aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/array/array_iterator.c361
-rw-r--r--contrib/array/array_iterator.h45
-rw-r--r--contrib/datetime/datetime_functions.c191
-rw-r--r--contrib/datetime/datetime_functions.h28
-rw-r--r--contrib/int8/int8.c70
-rw-r--r--contrib/ip_and_mac/ip.c293
-rw-r--r--contrib/ip_and_mac/mac.c291
-rw-r--r--contrib/ip_and_mac/mac.h241
-rw-r--r--contrib/miscutil/assert_test.c16
-rw-r--r--contrib/miscutil/assert_test.h4
-rw-r--r--contrib/miscutil/misc_utils.c14
-rw-r--r--contrib/miscutil/misc_utils.h10
-rw-r--r--contrib/pginterface/pginterface.c2
-rw-r--r--contrib/sequence/set_sequence.c18
-rw-r--r--contrib/sequence/set_sequence.h8
-rw-r--r--contrib/soundex/soundex.c4
-rw-r--r--contrib/spi/autoinc.c76
-rw-r--r--contrib/spi/insert_username.c60
-rw-r--r--contrib/spi/refint.c4
-rw-r--r--contrib/spi/timetravel.c303
-rw-r--r--contrib/string/string_io.c465
-rw-r--r--contrib/string/string_io.h21
-rw-r--r--contrib/userlock/user_locks.c71
-rw-r--r--contrib/userlock/user_locks.h14
-rw-r--r--src/backend/access/common/heaptuple.c89
-rw-r--r--src/backend/access/common/indextuple.c61
-rw-r--r--src/backend/access/common/printtup.c12
-rw-r--r--src/backend/access/common/tupdesc.c6
-rw-r--r--src/backend/access/hash/hash.c6
-rw-r--r--src/backend/access/heap/heapam.c19
-rw-r--r--src/backend/access/index/istrat.c8
-rw-r--r--src/backend/access/nbtree/nbtree.c6
-rw-r--r--src/backend/access/nbtree/nbtsearch.c11
-rw-r--r--src/backend/access/nbtree/nbtsort.c4
-rw-r--r--src/backend/access/rtree/rtproc.c4
-rw-r--r--src/backend/access/rtree/rtree.c4
-rw-r--r--src/backend/access/transam/transam.c10
-rw-r--r--src/backend/access/transam/xid.c4
-rw-r--r--src/backend/bootstrap/bootstrap.c20
-rw-r--r--src/backend/catalog/aclchk.c14
-rw-r--r--src/backend/catalog/catalog.c4
-rw-r--r--src/backend/catalog/heap.c25
-rw-r--r--src/backend/catalog/index.c10
-rw-r--r--src/backend/catalog/pg_aggregate.c4
-rw-r--r--src/backend/catalog/pg_operator.c6
-rw-r--r--src/backend/catalog/pg_proc.c4
-rw-r--r--src/backend/catalog/pg_type.c6
-rw-r--r--src/backend/commands/async.c8
-rw-r--r--src/backend/commands/cluster.c6
-rw-r--r--src/backend/commands/command.c28
-rw-r--r--src/backend/commands/copy.c15
-rw-r--r--src/backend/commands/creatinh.c9
-rw-r--r--src/backend/commands/dbcommands.c46
-rw-r--r--src/backend/commands/define.c51
-rw-r--r--src/backend/commands/explain.c30
-rw-r--r--src/backend/commands/proclang.c4
-rw-r--r--src/backend/commands/recipe.c14
-rw-r--r--src/backend/commands/trigger.c15
-rw-r--r--src/backend/commands/user.c803
-rw-r--r--src/backend/commands/vacuum.c64
-rw-r--r--src/backend/commands/variable.c60
-rw-r--r--src/backend/commands/view.c4
-rw-r--r--src/backend/executor/execAmi.c69
-rw-r--r--src/backend/executor/execMain.c47
-rw-r--r--src/backend/executor/execProcnode.c46
-rw-r--r--src/backend/executor/execQual.c74
-rw-r--r--src/backend/executor/execTuples.c10
-rw-r--r--src/backend/executor/execUtils.c26
-rw-r--r--src/backend/executor/nodeAgg.c63
-rw-r--r--src/backend/executor/nodeAppend.c6
-rw-r--r--src/backend/executor/nodeGroup.c47
-rw-r--r--src/backend/executor/nodeHash.c20
-rw-r--r--src/backend/executor/nodeHashjoin.c39
-rw-r--r--src/backend/executor/nodeIndexscan.c40
-rw-r--r--src/backend/executor/nodeMaterial.c16
-rw-r--r--src/backend/executor/nodeMergejoin.c11
-rw-r--r--src/backend/executor/nodeNestloop.c18
-rw-r--r--src/backend/executor/nodeResult.c26
-rw-r--r--src/backend/executor/nodeSort.c20
-rw-r--r--src/backend/executor/nodeSubplan.c276
-rw-r--r--src/backend/executor/nodeTee.c10
-rw-r--r--src/backend/executor/nodeUnique.c35
-rw-r--r--src/backend/executor/spi.c103
-rw-r--r--src/backend/lib/dllist.c22
-rw-r--r--src/backend/lib/lispsort.c4
-rw-r--r--src/backend/lib/qsort.c16
-rw-r--r--src/backend/libpq/auth.c250
-rw-r--r--src/backend/libpq/be-dumpdata.c6
-rw-r--r--src/backend/libpq/be-pqexec.c6
-rw-r--r--src/backend/libpq/crypt.c469
-rw-r--r--src/backend/libpq/hba.c396
-rw-r--r--src/backend/libpq/password.c11
-rw-r--r--src/backend/libpq/portal.c10
-rw-r--r--src/backend/libpq/portalbuf.c8
-rw-r--r--src/backend/libpq/pqcomm.c42
-rw-r--r--src/backend/libpq/pqcomprim.c28
-rw-r--r--src/backend/libpq/pqpacket.c51
-rw-r--r--src/backend/main/main.c26
-rw-r--r--src/backend/nodes/copyfuncs.c67
-rw-r--r--src/backend/nodes/equalfuncs.c4
-rw-r--r--src/backend/nodes/list.c42
-rw-r--r--src/backend/nodes/makefuncs.c10
-rw-r--r--src/backend/nodes/nodeFuncs.c4
-rw-r--r--src/backend/nodes/nodes.c4
-rw-r--r--src/backend/nodes/outfuncs.c38
-rw-r--r--src/backend/nodes/read.c14
-rw-r--r--src/backend/nodes/readfuncs.c62
-rw-r--r--src/backend/optimizer/geqo/geqo_erx.c4
-rw-r--r--src/backend/optimizer/geqo/geqo_eval.c4
-rw-r--r--src/backend/optimizer/geqo/geqo_main.c4
-rw-r--r--src/backend/optimizer/geqo/geqo_paths.c4
-rw-r--r--src/backend/optimizer/geqo/geqo_pool.c4
-rw-r--r--src/backend/optimizer/geqo/geqo_recombination.c4
-rw-r--r--src/backend/optimizer/path/allpaths.c55
-rw-r--r--src/backend/optimizer/path/clausesel.c13
-rw-r--r--src/backend/optimizer/path/hashutils.c4
-rw-r--r--src/backend/optimizer/path/indxpath.c4
-rw-r--r--src/backend/optimizer/path/joinrels.c6
-rw-r--r--src/backend/optimizer/path/joinutils.c10
-rw-r--r--src/backend/optimizer/path/mergeutils.c6
-rw-r--r--src/backend/optimizer/path/orindxpath.c4
-rw-r--r--src/backend/optimizer/path/predmig.c8
-rw-r--r--src/backend/optimizer/path/prune.c32
-rw-r--r--src/backend/optimizer/path/xfunc.c6
-rw-r--r--src/backend/optimizer/plan/createplan.c77
-rw-r--r--src/backend/optimizer/plan/planmain.c48
-rw-r--r--src/backend/optimizer/plan/planner.c67
-rw-r--r--src/backend/optimizer/plan/setrefs.c74
-rw-r--r--src/backend/optimizer/plan/subselect.c619
-rw-r--r--src/backend/optimizer/prep/prepqual.c4
-rw-r--r--src/backend/optimizer/prep/preptlist.c8
-rw-r--r--src/backend/optimizer/prep/prepunion.c135
-rw-r--r--src/backend/optimizer/util/clauseinfo.c6
-rw-r--r--src/backend/optimizer/util/clauses.c56
-rw-r--r--src/backend/optimizer/util/indexnode.c4
-rw-r--r--src/backend/optimizer/util/internal.c4
-rw-r--r--src/backend/optimizer/util/joininfo.c8
-rw-r--r--src/backend/optimizer/util/keys.c6
-rw-r--r--src/backend/optimizer/util/pathnode.c8
-rw-r--r--src/backend/optimizer/util/plancat.c6
-rw-r--r--src/backend/optimizer/util/relnode.c8
-rw-r--r--src/backend/optimizer/util/tlist.c26
-rw-r--r--src/backend/optimizer/util/var.c20
-rw-r--r--src/backend/parser/analyze.c188
-rw-r--r--src/backend/parser/parse.h431
-rw-r--r--src/backend/parser/parse_agg.c55
-rw-r--r--src/backend/parser/parse_clause.c57
-rw-r--r--src/backend/parser/parse_expr.c87
-rw-r--r--src/backend/parser/parse_func.c115
-rw-r--r--src/backend/parser/parse_node.c21
-rw-r--r--src/backend/parser/parse_oper.c19
-rw-r--r--src/backend/parser/parse_relation.c41
-rw-r--r--src/backend/parser/parse_target.c37
-rw-r--r--src/backend/parser/parse_type.c9
-rw-r--r--src/backend/parser/parser.c6
-rw-r--r--src/backend/parser/scansup.c4
-rw-r--r--src/backend/port/dynloader/aix.c28
-rw-r--r--src/backend/port/dynloader/bsd.c6
-rw-r--r--src/backend/port/dynloader/bsdi.c4
-rw-r--r--src/backend/port/dynloader/dgux.c3
-rw-r--r--src/backend/port/dynloader/dgux.h4
-rw-r--r--src/backend/port/dynloader/hpux.c6
-rw-r--r--src/backend/port/dynloader/linux.c7
-rw-r--r--src/backend/port/dynloader/linux.h4
-rw-r--r--src/backend/port/dynloader/univel.c8
-rw-r--r--src/backend/port/dynloader/univel.h44
-rw-r--r--src/backend/port/getrusage.c24
-rw-r--r--src/backend/port/inet_aton.c8
-rw-r--r--src/backend/port/inet_aton.h4
-rw-r--r--src/backend/port/isinf.c53
-rw-r--r--src/backend/port/nextstep/dynloader.c6
-rw-r--r--src/backend/port/nextstep/port.c2
-rw-r--r--src/backend/port/random.c5
-rw-r--r--src/backend/port/srandom.c5
-rw-r--r--src/backend/port/strtol.c6
-rw-r--r--src/backend/port/strtoul.c57
-rw-r--r--src/backend/port/ultrix4/dynloader.c4
-rw-r--r--src/backend/postmaster/postmaster.c224
-rw-r--r--src/backend/regex/engine.c114
-rw-r--r--src/backend/regex/regcomp.c222
-rw-r--r--src/backend/regex/regerror.c6
-rw-r--r--src/backend/rewrite/locks.c26
-rw-r--r--src/backend/rewrite/rewriteHandler.c94
-rw-r--r--src/backend/rewrite/rewriteManip.c79
-rw-r--r--src/backend/rewrite/rewriteRemove.c4
-rw-r--r--src/backend/rewrite/rewriteSupport.c16
-rw-r--r--src/backend/storage/buffer/bufmgr.c52
-rw-r--r--src/backend/storage/buffer/localbuf.c6
-rw-r--r--src/backend/storage/buffer/s_lock.c29
-rw-r--r--src/backend/storage/file/fd.c6
-rw-r--r--src/backend/storage/ipc/ipc.c7
-rw-r--r--src/backend/storage/ipc/shmem.c8
-rw-r--r--src/backend/storage/lmgr/lock.c103
-rw-r--r--src/backend/storage/lmgr/proc.c46
-rw-r--r--src/backend/storage/smgr/md.c30
-rw-r--r--src/backend/storage/smgr/smgrtype.c4
-rw-r--r--src/backend/tcop/dest.c4
-rw-r--r--src/backend/tcop/fastpath.c6
-rw-r--r--src/backend/tcop/postgres.c75
-rw-r--r--src/backend/tcop/pquery.c4
-rw-r--r--src/backend/tcop/utility.c53
-rw-r--r--src/backend/tioga/Varray.c2
-rw-r--r--src/backend/tioga/tgRecipe.c4
-rw-r--r--src/backend/tioga/tgRecipe.h3
-rw-r--r--src/backend/utils/adt/acl.c33
-rw-r--r--src/backend/utils/adt/arrayfuncs.c19
-rw-r--r--src/backend/utils/adt/bool.c23
-rw-r--r--src/backend/utils/adt/cash.c97
-rw-r--r--src/backend/utils/adt/char.c18
-rw-r--r--src/backend/utils/adt/chunk.c11
-rw-r--r--src/backend/utils/adt/date.c98
-rw-r--r--src/backend/utils/adt/datetime.c70
-rw-r--r--src/backend/utils/adt/dt.c681
-rw-r--r--src/backend/utils/adt/filename.c10
-rw-r--r--src/backend/utils/adt/float.c6
-rw-r--r--src/backend/utils/adt/geo_ops.c285
-rw-r--r--src/backend/utils/adt/int.c64
-rw-r--r--src/backend/utils/adt/like.c6
-rw-r--r--src/backend/utils/adt/nabstime.c22
-rw-r--r--src/backend/utils/adt/name.c4
-rw-r--r--src/backend/utils/adt/numutils.c16
-rw-r--r--src/backend/utils/adt/oid.c40
-rw-r--r--src/backend/utils/adt/oidint2.c4
-rw-r--r--src/backend/utils/adt/oidint4.c4
-rw-r--r--src/backend/utils/adt/oidname.c4
-rw-r--r--src/backend/utils/adt/oracle_compat.c24
-rw-r--r--src/backend/utils/adt/regexp.c4
-rw-r--r--src/backend/utils/adt/regproc.c28
-rw-r--r--src/backend/utils/adt/selfuncs.c4
-rw-r--r--src/backend/utils/adt/tid.c4
-rw-r--r--src/backend/utils/adt/timestamp.c26
-rw-r--r--src/backend/utils/adt/varchar.c23
-rw-r--r--src/backend/utils/adt/varlena.c40
-rw-r--r--src/backend/utils/cache/catcache.c16
-rw-r--r--src/backend/utils/cache/fcache.c9
-rw-r--r--src/backend/utils/cache/lsyscache.c10
-rw-r--r--src/backend/utils/cache/relcache.c21
-rw-r--r--src/backend/utils/cache/syscache.c18
-rw-r--r--src/backend/utils/error/elog.c17
-rw-r--r--src/backend/utils/error/exc.c4
-rw-r--r--src/backend/utils/error/format.c4
-rw-r--r--src/backend/utils/fmgr/fmgr.c76
-rw-r--r--src/backend/utils/hash/dynahash.c20
-rw-r--r--src/backend/utils/hash/hashfn.c12
-rw-r--r--src/backend/utils/init/globals.c4
-rw-r--r--src/backend/utils/init/miscinit.c156
-rw-r--r--src/backend/utils/init/postinit.c117
-rw-r--r--src/backend/utils/misc/database.c72
-rw-r--r--src/backend/utils/mmgr/mcxt.c4
-rw-r--r--src/backend/utils/mmgr/palloc.c8
-rw-r--r--src/backend/utils/mmgr/portalmem.c4
-rw-r--r--src/backend/utils/sort/lselect.c10
-rw-r--r--src/backend/utils/sort/psort.c342
-rw-r--r--src/backend/utils/time/tqual.c24
-rw-r--r--src/bin/pg_dump/common.c20
-rw-r--r--src/bin/pg_dump/pg_dump.c404
-rw-r--r--src/bin/pg_dump/pg_dump.h11
-rw-r--r--src/bin/pg_passwd/pg_passwd.c4
-rw-r--r--src/bin/psql/psql.c296
-rw-r--r--src/bin/psql/stringutils.c4
-rw-r--r--src/data/charset.conf40
-rw-r--r--src/data/charset.conf.orig40
-rw-r--r--src/data/koi-alt.tab85
-rw-r--r--src/data/koi-alt.tab.orig85
-rw-r--r--src/data/koi-iso.tab75
-rw-r--r--src/data/koi-iso.tab.orig75
-rw-r--r--src/data/koi-koi.tab2
-rw-r--r--src/data/koi-koi.tab.orig2
-rw-r--r--src/data/koi-mac.tab130
-rw-r--r--src/data/koi-mac.tab.orig130
-rw-r--r--src/data/koi-win.tab85
-rw-r--r--src/data/koi-win.tab.orig85
-rw-r--r--src/include/access/genam.h20
-rw-r--r--src/include/access/gist.h9
-rw-r--r--src/include/access/gistscan.h3
-rw-r--r--src/include/access/giststrat.h3
-rw-r--r--src/include/access/hash.h29
-rw-r--r--src/include/access/heapam.h29
-rw-r--r--src/include/access/hio.h5
-rw-r--r--src/include/access/htup.h26
-rw-r--r--src/include/access/iqual.h5
-rw-r--r--src/include/access/istrat.h17
-rw-r--r--src/include/access/itup.h17
-rw-r--r--src/include/access/nbtree.h35
-rw-r--r--src/include/access/rtree.h17
-rw-r--r--src/include/access/rtstrat.h5
-rw-r--r--src/include/access/skey.h5
-rw-r--r--src/include/access/strat.h3
-rw-r--r--src/include/access/transam.h27
-rw-r--r--src/include/access/tupdesc.h5
-rw-r--r--src/include/access/tupmacs.h4
-rw-r--r--src/include/access/xact.h4
-rw-r--r--src/include/bootstrap/bootstrap.h5
-rw-r--r--src/include/c.h9
-rw-r--r--src/include/catalog/heap.h4
-rw-r--r--src/include/catalog/index.h19
-rw-r--r--src/include/catalog/indexing.h14
-rw-r--r--src/include/catalog/pg_aggregate.h18
-rw-r--r--src/include/catalog/pg_amop.h24
-rw-r--r--src/include/catalog/pg_attribute.h75
-rw-r--r--src/include/catalog/pg_class.h5
-rw-r--r--src/include/catalog/pg_description.h8
-rw-r--r--src/include/catalog/pg_operator.h9
-rw-r--r--src/include/catalog/pg_proc.h557
-rw-r--r--src/include/catalog/pg_shadow.h8
-rw-r--r--src/include/catalog/pg_type.h5
-rw-r--r--src/include/commands/command.h8
-rw-r--r--src/include/commands/defrem.h11
-rw-r--r--src/include/commands/proclang.h4
-rw-r--r--src/include/commands/rename.h8
-rw-r--r--src/include/commands/trigger.h6
-rw-r--r--src/include/commands/user.h2
-rw-r--r--src/include/commands/vacuum.h4
-rw-r--r--src/include/commands/variable.h4
-rw-r--r--src/include/executor/execdesc.h5
-rw-r--r--src/include/executor/executor.h57
-rw-r--r--src/include/executor/functions.h8
-rw-r--r--src/include/executor/nodeHash.h13
-rw-r--r--src/include/executor/nodeHashjoin.h5
-rw-r--r--src/include/executor/nodeMaterial.h4
-rw-r--r--src/include/executor/nodeSubplan.h4
-rw-r--r--src/include/executor/spi.h19
-rw-r--r--src/include/lib/qsort.h5
-rw-r--r--src/include/libpq/auth.h6
-rw-r--r--src/include/libpq/crypt.h16
-rw-r--r--src/include/libpq/hba.h17
-rw-r--r--src/include/libpq/libpq-be.h84
-rw-r--r--src/include/libpq/libpq.h11
-rw-r--r--src/include/libpq/password.h2
-rw-r--r--src/include/libpq/pqcomm.h68
-rw-r--r--src/include/miscadmin.h6
-rw-r--r--src/include/nodes/execnodes.h54
-rw-r--r--src/include/nodes/makefuncs.h14
-rw-r--r--src/include/nodes/params.h7
-rw-r--r--src/include/nodes/parsenodes.h29
-rw-r--r--src/include/nodes/plannodes.h47
-rw-r--r--src/include/nodes/primnodes.h12
-rw-r--r--src/include/nodes/print.h5
-rw-r--r--src/include/optimizer/clauseinfo.h8
-rw-r--r--src/include/optimizer/clauses.h10
-rw-r--r--src/include/optimizer/cost.h17
-rw-r--r--src/include/optimizer/ordering.h11
-rw-r--r--src/include/optimizer/pathnode.h17
-rw-r--r--src/include/optimizer/paths.h26
-rw-r--r--src/include/optimizer/plancat.h17
-rw-r--r--src/include/optimizer/planmain.h20
-rw-r--r--src/include/optimizer/prep.h8
-rw-r--r--src/include/optimizer/subselect.h16
-rw-r--r--src/include/optimizer/tlist.h5
-rw-r--r--src/include/optimizer/xfunc.h8
-rw-r--r--src/include/parser/gramparse.h4
-rw-r--r--src/include/parser/parse_agg.h8
-rw-r--r--src/include/parser/parse_clause.h11
-rw-r--r--src/include/parser/parse_expr.h5
-rw-r--r--src/include/parser/parse_func.h13
-rw-r--r--src/include/parser/parse_node.h21
-rw-r--r--src/include/parser/parse_oper.h6
-rw-r--r--src/include/parser/parse_relation.h32
-rw-r--r--src/include/parser/parse_target.h5
-rw-r--r--src/include/parser/parse_type.h16
-rw-r--r--src/include/parser/parser.h3
-rw-r--r--src/include/port/bsd.h2
-rw-r--r--src/include/port/linux.h16
-rw-r--r--src/include/port/univel.h9
-rw-r--r--src/include/postgres.h7
-rw-r--r--src/include/rewrite/locks.h5
-rw-r--r--src/include/rewrite/rewriteManip.h7
-rw-r--r--src/include/rewrite/rewriteSupport.h5
-rw-r--r--src/include/rusagestub.h2
-rw-r--r--src/include/storage/buf_internals.h5
-rw-r--r--src/include/storage/bufmgr.h8
-rw-r--r--src/include/storage/bufpage.h7
-rw-r--r--src/include/storage/ipc.h8
-rw-r--r--src/include/storage/lmgr.h20
-rw-r--r--src/include/storage/lock.h9
-rw-r--r--src/include/storage/multilev.h4
-rw-r--r--src/include/storage/proc.h5
-rw-r--r--src/include/storage/s_lock.h99
-rw-r--r--src/include/storage/shmem.h11
-rw-r--r--src/include/storage/sinval.h5
-rw-r--r--src/include/storage/sinvaladt.h5
-rw-r--r--src/include/storage/smgr.h20
-rw-r--r--src/include/tcop/dest.h5
-rw-r--r--src/include/tcop/pquery.h8
-rw-r--r--src/include/tcop/tcopprot.h12
-rw-r--r--src/include/utils/acl.h11
-rw-r--r--src/include/utils/array.h26
-rw-r--r--src/include/utils/builtins.h6
-rw-r--r--src/include/utils/catcache.h14
-rw-r--r--src/include/utils/datum.h5
-rw-r--r--src/include/utils/dt.h40
-rw-r--r--src/include/utils/exc.h8
-rw-r--r--src/include/utils/geo_decls.h8
-rw-r--r--src/include/utils/hsearch.h5
-rw-r--r--src/include/utils/lselect.h11
-rw-r--r--src/include/utils/lsyscache.h5
-rw-r--r--src/include/utils/mcxt.h5
-rw-r--r--src/include/utils/memutils.h7
-rw-r--r--src/include/utils/portal.h5
-rw-r--r--src/include/utils/rel.h5
-rw-r--r--src/include/utils/rel2.h5
-rw-r--r--src/include/utils/syscache.h11
-rw-r--r--src/interfaces/ecpg/include/ecpglib.h32
-rw-r--r--src/interfaces/ecpg/include/ecpgtype.h21
-rw-r--r--src/interfaces/ecpg/include/sqlca.h17
-rw-r--r--src/interfaces/ecpg/lib/ecpglib.c66
-rw-r--r--src/interfaces/ecpg/lib/typename.c42
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c26
-rw-r--r--src/interfaces/ecpg/preproc/extern.h15
-rw-r--r--src/interfaces/ecpg/preproc/type.c546
-rw-r--r--src/interfaces/ecpg/preproc/type.h85
-rw-r--r--src/interfaces/ecpg/test/Ptest1.c69
-rw-r--r--src/interfaces/ecpg/test/test1.c70
-rw-r--r--src/interfaces/libpgtcl/pgtclCmds.c29
-rw-r--r--src/interfaces/libpgtcl/pgtclId.c4
-rw-r--r--src/interfaces/libpq/fe-auth.c54
-rw-r--r--src/interfaces/libpq/fe-connect.c108
-rw-r--r--src/interfaces/libpq/fe-connect.h4
-rw-r--r--src/interfaces/libpq/fe-exec.c17
-rw-r--r--src/interfaces/libpq/fe-misc.c6
-rw-r--r--src/interfaces/libpq/libpq-fe.h12
-rw-r--r--src/interfaces/python/pgmodule.c486
-rw-r--r--src/pl/tcl/pltcl.c3915
-rw-r--r--src/test/examples/testlibpq2.c9
-rw-r--r--src/test/examples/testlibpq3.c11
-rw-r--r--src/test/examples/testlibpq4.c20
-rw-r--r--src/test/regress/regress.c191
-rw-r--r--src/tutorial/C-code/complex.c2
-rw-r--r--src/tutorial/C-code/funcs.c4
-rw-r--r--src/utils/strdup.c4
430 files changed, 12555 insertions, 10457 deletions
diff --git a/contrib/array/array_iterator.c b/contrib/array/array_iterator.c
index 53130bf7a96..7c301c8e236 100644
--- a/contrib/array/array_iterator.c
+++ b/contrib/array/array_iterator.c
@@ -29,90 +29,113 @@
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;
-
- /* Sanity checks */
- if ((array == (ArrayType *) NULL)
- || (ARR_IS_LO(array) == true)) {
- /* elog(NOTICE, "array_iterator: array is null"); */
- return (0);
- }
- ndim = ARR_NDIM(array);
- dim = ARR_DIMS(array);
- nitems = getNitems(ndim, dim);
- if (nitems == 0) {
- /* elog(NOTICE, "array_iterator: nitems = 0"); */
- return (0);
- }
-
- /* Lookup element type information */
- typ_tuple = SearchSysCacheTuple(TYPOID, ObjectIdGetDatum(elemtype),0,0,0);
- if (!HeapTupleIsValid(typ_tuple)) {
- elog(ERROR,"array_iterator: cache lookup failed for type %d", elemtype);
- return 0;
- }
- typ_struct = (TypeTupleForm) GETSTRUCT(typ_tuple);
- typlen = typ_struct->typlen;
- typbyval = typ_struct->typbyval;
-
- /* Lookup the function entry point */
- proc_fn = (func_ptr) NULL;
- fmgr_info(proc, &proc_fn, &pronargs);
- if ((proc_fn == NULL) || (pronargs != 2)) {
- elog(ERROR, "array_iterator: fmgr_info lookup failed for oid %d", proc);
- return (0);
- }
-
- /* Scan the array and apply the operator to each element */
- result = 0;
- p = ARR_DATA_PTR(array);
- for (i = 0; i < nitems; i++) {
- if (typbyval) {
- 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;
- }
- p += typlen;
- } else {
- result = (int) (*proc_fn)(p, value);
- if (typlen > 0) {
- p += typlen;
- } else {
- p += INTALIGN(* (int32 *) p);
- }
- }
- if (result) {
- if (!and) {
- return (1);
- }
- } else {
- if (and) {
+ 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)
+ || (ARR_IS_LO(array) == true))
+ {
+ /* elog(NOTICE, "array_iterator: array is null"); */
+ return (0);
+ }
+ ndim = ARR_NDIM(array);
+ dim = ARR_DIMS(array);
+ nitems = getNitems(ndim, dim);
+ if (nitems == 0)
+ {
+ /* elog(NOTICE, "array_iterator: nitems = 0"); */
+ return (0);
+ }
+
+ /* Lookup element type information */
+ typ_tuple = SearchSysCacheTuple(TYPOID, ObjectIdGetDatum(elemtype), 0, 0, 0);
+ if (!HeapTupleIsValid(typ_tuple))
+ {
+ elog(ERROR, "array_iterator: cache lookup failed for type %d", elemtype);
+ return 0;
+ }
+ typ_struct = (TypeTupleForm) GETSTRUCT(typ_tuple);
+ typlen = typ_struct->typlen;
+ typbyval = typ_struct->typbyval;
+
+ /* Lookup the function entry point */
+ proc_fn = (func_ptr) NULL;
+ fmgr_info(proc, &proc_fn, &pronargs);
+ if ((proc_fn == NULL) || (pronargs != 2))
+ {
+ elog(ERROR, "array_iterator: fmgr_info lookup failed for oid %d", proc);
return (0);
- }
}
- }
- if (and && result) {
- return (1);
- } else {
- return (0);
- }
+ /* Scan the array and apply the operator to each element */
+ result = 0;
+ p = ARR_DATA_PTR(array);
+ for (i = 0; i < nitems; i++)
+ {
+ if (typbyval)
+ {
+ 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;
+ }
+ p += typlen;
+ }
+ else
+ {
+ result = (int) (*proc_fn) (p, value);
+ if (typlen > 0)
+ {
+ p += typlen;
+ }
+ else
+ {
+ p += INTALIGN(*(int32 *) p);
+ }
+ }
+ if (result)
+ {
+ if (!and)
+ {
+ return (1);
+ }
+ }
+ else
+ {
+ if (and)
+ {
+ return (0);
+ }
+ }
+ }
+
+ if (and && result)
+ {
+ return (1);
+ }
+ else
+ {
+ return (0);
+ }
}
/*
@@ -120,39 +143,39 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType *array, Datum value)
*/
int32
-array_texteq(ArrayType *array, char* value)
+array_texteq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 25, /* text */
- (Oid) 67, /* texteq */
- 0, /* logical or */
- array, (Datum)value);
+ return array_iterator((Oid) 25, /* text */
+ (Oid) 67, /* texteq */
+ 0, /* logical or */
+ array, (Datum) value);
}
int32
-array_all_texteq(ArrayType *array, char* value)
+array_all_texteq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 25, /* text */
- (Oid) 67, /* texteq */
- 1, /* logical and */
- array, (Datum)value);
+ return array_iterator((Oid) 25, /* text */
+ (Oid) 67, /* texteq */
+ 1, /* logical and */
+ array, (Datum) value);
}
int32
-array_textregexeq(ArrayType *array, char* value)
+array_textregexeq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 25, /* text */
- (Oid) 1254, /* textregexeq */
- 0, /* logical or */
- array, (Datum)value);
+ return array_iterator((Oid) 25, /* text */
+ (Oid) 1254, /* textregexeq */
+ 0, /* logical or */
+ array, (Datum) value);
}
int32
-array_all_textregexeq(ArrayType *array, char* value)
+array_all_textregexeq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 25, /* text */
- (Oid) 1254, /* textregexeq */
- 1, /* logical and */
- array, (Datum)value);
+ return array_iterator((Oid) 25, /* text */
+ (Oid) 1254, /* textregexeq */
+ 1, /* logical and */
+ array, (Datum) value);
}
/*
@@ -161,39 +184,39 @@ array_all_textregexeq(ArrayType *array, char* value)
*/
int32
-array_char16eq(ArrayType *array, char* value)
+array_char16eq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* char16 */
- (Oid) 1275, /* char16eq */
- 0, /* logical or */
- array, (Datum)value);
+ return array_iterator((Oid) 20, /* char16 */
+ (Oid) 1275, /* char16eq */
+ 0, /* logical or */
+ array, (Datum) value);
}
int32
-array_all_char16eq(ArrayType *array, char* value)
+array_all_char16eq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* char16 */
- (Oid) 1275, /* char16eq */
- 1, /* logical and */
- array, (Datum)value);
+ return array_iterator((Oid) 20, /* char16 */
+ (Oid) 1275, /* char16eq */
+ 1, /* logical and */
+ array, (Datum) value);
}
int32
-array_char16regexeq(ArrayType *array, char* value)
+array_char16regexeq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* char16 */
- (Oid) 1288, /* char16regexeq */
- 0, /* logical or */
- array, (Datum)value);
+ return array_iterator((Oid) 20, /* char16 */
+ (Oid) 1288, /* char16regexeq */
+ 0, /* logical or */
+ array, (Datum) value);
}
int32
-array_all_char16regexeq(ArrayType *array, char* value)
+array_all_char16regexeq(ArrayType *array, char *value)
{
- return array_iterator((Oid) 20, /* char16 */
- (Oid) 1288, /* char16regexeq */
- 1, /* logical and */
- array, (Datum)value);
+ return array_iterator((Oid) 20, /* char16 */
+ (Oid) 1288, /* char16regexeq */
+ 1, /* logical and */
+ array, (Datum) value);
}
/*
@@ -203,109 +226,109 @@ array_all_char16regexeq(ArrayType *array, char* value)
int32
array_int4eq(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 65, /* int4eq */
- 0, /* logical or */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 65, /* int4eq */
+ 0, /* logical or */
+ array, (Datum) value);
}
int32
array_all_int4eq(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 65, /* int4eq */
- 1, /* logical and */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 65, /* int4eq */
+ 1, /* logical and */
+ array, (Datum) value);
}
int32
array_int4ne(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 144, /* int4ne */
- 0, /* logical or */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 144, /* int4ne */
+ 0, /* logical or */
+ array, (Datum) value);
}
int32
array_all_int4ne(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 144, /* int4ne */
- 1, /* logical and */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 144, /* int4ne */
+ 1, /* logical and */
+ array, (Datum) value);
}
int32
array_int4gt(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 147, /* int4gt */
- 0, /* logical or */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 147, /* int4gt */
+ 0, /* logical or */
+ array, (Datum) value);
}
int32
array_all_int4gt(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 147, /* int4gt */
- 1, /* logical and */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 147, /* int4gt */
+ 1, /* logical and */
+ array, (Datum) value);
}
int32
array_int4ge(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 150, /* int4ge */
- 0, /* logical or */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 150, /* int4ge */
+ 0, /* logical or */
+ array, (Datum) value);
}
int32
array_all_int4ge(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 150, /* int4ge */
- 1, /* logical and */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 150, /* int4ge */
+ 1, /* logical and */
+ array, (Datum) value);
}
int32
array_int4lt(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 66, /* int4lt */
- 0, /* logical or */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 66, /* int4lt */
+ 0, /* logical or */
+ array, (Datum) value);
}
int32
array_all_int4lt(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 66, /* int4lt */
- 1, /* logical and */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 66, /* int4lt */
+ 1, /* logical and */
+ array, (Datum) value);
}
int32
array_int4le(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 149, /* int4le */
- 0, /* logical or */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 149, /* int4le */
+ 0, /* logical or */
+ array, (Datum) value);
}
int32
array_all_int4le(ArrayType *array, int4 value)
{
- return array_iterator((Oid) 23, /* int4 */
- (Oid) 149, /* int4le */
- 1, /* logical and */
- array, (Datum)value);
+ return array_iterator((Oid) 23, /* int4 */
+ (Oid) 149, /* int4le */
+ 1, /* logical and */
+ array, (Datum) value);
}
/* end of file */
diff --git a/contrib/array/array_iterator.h b/contrib/array/array_iterator.h
index 0d9c58ed00b..458ec5916d8 100644
--- a/contrib/array/array_iterator.h
+++ b/contrib/array/array_iterator.h
@@ -1,27 +1,28 @@
#ifndef ARRAY_ITERATOR_H
#define ARRAY_ITERATOR_H
-static int32 array_iterator(Oid elemtype, Oid proc, int and,
- ArrayType *array, Datum value);
-int32 array_texteq(ArrayType *array, char* value);
-int32 array_all_texteq(ArrayType *array, char* value);
-int32 array_textregexeq(ArrayType *array, char* value);
-int32 array_all_textregexeq(ArrayType *array, char* value);
-int32 array_char16eq(ArrayType *array, char* value);
-int32 array_all_char16eq(ArrayType *array, char* value);
-int32 array_char16regexeq(ArrayType *array, char* value);
-int32 array_all_char16regexeq(ArrayType *array, char* value);
-int32 array_int4eq(ArrayType *array, int4 value);
-int32 array_all_int4eq(ArrayType *array, int4 value);
-int32 array_int4ne(ArrayType *array, int4 value);
-int32 array_all_int4ne(ArrayType *array, int4 value);
-int32 array_int4gt(ArrayType *array, int4 value);
-int32 array_all_int4gt(ArrayType *array, int4 value);
-int32 array_int4ge(ArrayType *array, int4 value);
-int32 array_all_int4ge(ArrayType *array, int4 value);
-int32 array_int4lt(ArrayType *array, int4 value);
-int32 array_all_int4lt(ArrayType *array, int4 value);
-int32 array_int4le(ArrayType *array, int4 value);
-int32 array_all_int4le(ArrayType *array, int4 value);
+static int32
+array_iterator(Oid elemtype, Oid proc, int and,
+ ArrayType *array, Datum value);
+int32 array_texteq(ArrayType *array, char *value);
+int32 array_all_texteq(ArrayType *array, char *value);
+int32 array_textregexeq(ArrayType *array, char *value);
+int32 array_all_textregexeq(ArrayType *array, char *value);
+int32 array_char16eq(ArrayType *array, char *value);
+int32 array_all_char16eq(ArrayType *array, char *value);
+int32 array_char16regexeq(ArrayType *array, char *value);
+int32 array_all_char16regexeq(ArrayType *array, char *value);
+int32 array_int4eq(ArrayType *array, int4 value);
+int32 array_all_int4eq(ArrayType *array, int4 value);
+int32 array_int4ne(ArrayType *array, int4 value);
+int32 array_all_int4ne(ArrayType *array, int4 value);
+int32 array_int4gt(ArrayType *array, int4 value);
+int32 array_all_int4gt(ArrayType *array, int4 value);
+int32 array_int4ge(ArrayType *array, int4 value);
+int32 array_all_int4ge(ArrayType *array, int4 value);
+int32 array_int4lt(ArrayType *array, int4 value);
+int32 array_all_int4lt(ArrayType *array, int4 value);
+int32 array_int4le(ArrayType *array, int4 value);
+int32 array_all_int4le(ArrayType *array, int4 value);
#endif
diff --git a/contrib/datetime/datetime_functions.c b/contrib/datetime/datetime_functions.c
index 4c8d11794cb..29a2a55400a 100644
--- a/contrib/datetime/datetime_functions.c
+++ b/contrib/datetime/datetime_functions.c
@@ -6,7 +6,7 @@
* Copyright (c) 1996, Massimo Dal Zotto <dz@cs.unitn.it>
*/
-#include <stdio.h> /* for sprintf() */
+#include <stdio.h> /* for sprintf() */
#include <string.h>
#include <limits.h>
#ifdef HAVE_FLOAT_H
@@ -32,45 +32,47 @@
* to hh:mm like in timetables.
*/
-TimeADT *
+TimeADT *
hhmm_in(char *str)
{
- TimeADT *time;
-
- double fsec;
- struct tm tt, *tm = &tt;
-
- int nf;
- char lowstr[MAXDATELEN+1];
- char *field[MAXDATEFIELDS];
- int dtype;
- int ftype[MAXDATEFIELDS];
-
- if (!PointerIsValid(str))
- elog(ERROR,"Bad (null) time external representation",NULL);
-
- if ((ParseDateTime( str, lowstr, field, ftype, MAXDATEFIELDS, &nf) != 0)
- || (DecodeTimeOnly( field, ftype, nf, &dtype, tm, &fsec) != 0))
- elog(ERROR,"Bad time external representation '%s'",str);
-
- if (tm->tm_hour<0 || tm->tm_hour>24 ||
- (tm->tm_hour==24 && (tm->tm_min!=0 || tm->tm_sec!=0 || fsec!= 0))) {
- elog(ERROR,
- "time_in: hour must be limited to values 0 through 24:00 "
- "in \"%s\"",
- str);
- }
- if ((tm->tm_min < 0) || (tm->tm_min > 59))
- elog(ERROR,"Minute must be limited to values 0 through 59 in '%s'",str);
- if ((tm->tm_sec < 0) || ((tm->tm_sec + fsec) >= 60))
- elog(ERROR,"Second must be limited to values 0 through < 60 in '%s'",
- str);
-
- time = palloc(sizeof(TimeADT));
-
- *time = ((((tm->tm_hour*60)+tm->tm_min)*60));
-
- return(time);
+ TimeADT *time;
+
+ double fsec;
+ struct tm tt,
+ *tm = &tt;
+
+ int nf;
+ char lowstr[MAXDATELEN + 1];
+ char *field[MAXDATEFIELDS];
+ int dtype;
+ int ftype[MAXDATEFIELDS];
+
+ if (!PointerIsValid(str))
+ elog(ERROR, "Bad (null) time external representation", NULL);
+
+ if ((ParseDateTime(str, lowstr, field, ftype, MAXDATEFIELDS, &nf) != 0)
+ || (DecodeTimeOnly(field, ftype, nf, &dtype, tm, &fsec) != 0))
+ elog(ERROR, "Bad time external representation '%s'", str);
+
+ if (tm->tm_hour < 0 || tm->tm_hour > 24 ||
+ (tm->tm_hour == 24 && (tm->tm_min != 0 || tm->tm_sec != 0 || fsec != 0)))
+ {
+ elog(ERROR,
+ "time_in: hour must be limited to values 0 through 24:00 "
+ "in \"%s\"",
+ str);
+ }
+ if ((tm->tm_min < 0) || (tm->tm_min > 59))
+ elog(ERROR, "Minute must be limited to values 0 through 59 in '%s'", str);
+ if ((tm->tm_sec < 0) || ((tm->tm_sec + fsec) >= 60))
+ elog(ERROR, "Second must be limited to values 0 through < 60 in '%s'",
+ str);
+
+ time = palloc(sizeof(TimeADT));
+
+ *time = ((((tm->tm_hour * 60) + tm->tm_min) * 60));
+
+ return (time);
}
/*
@@ -82,132 +84,143 @@ hhmm_in(char *str)
char *
hhmm_out(TimeADT *time)
{
- char *result;
- struct tm tt, *tm = &tt;
- char buf[MAXDATELEN+1];
+ char *result;
+ struct tm tt,
+ *tm = &tt;
+ char buf[MAXDATELEN + 1];
- if (!PointerIsValid(time))
- return NULL;
+ if (!PointerIsValid(time))
+ return NULL;
- tm->tm_hour = (*time / (60*60));
- tm->tm_min = (((int) (*time / 60)) % 60);
- tm->tm_sec = (((int) *time) % 60);
+ tm->tm_hour = (*time / (60 * 60));
+ tm->tm_min = (((int) (*time / 60)) % 60);
+ tm->tm_sec = (((int) *time) % 60);
- if (tm->tm_sec == 0) {
- sprintf(buf, "%02d:%02d", tm->tm_hour, tm->tm_min);
- } else {
- sprintf(buf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
- }
+ if (tm->tm_sec == 0)
+ {
+ sprintf(buf, "%02d:%02d", tm->tm_hour, tm->tm_min);
+ }
+ else
+ {
+ sprintf(buf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
+ }
- result = palloc(strlen(buf)+1);
+ result = palloc(strlen(buf) + 1);
- strcpy( result, buf);
+ strcpy(result, buf);
- return(result);
+ return (result);
}
-TimeADT *
+TimeADT *
hhmm(TimeADT *time)
{
- TimeADT *result = palloc(sizeof(TimeADT));
+ TimeADT *result = palloc(sizeof(TimeADT));
- *result = (((int) *time) / 60 * 60);
+ *result = (((int) *time) / 60 * 60);
- return(result);
+ return (result);
}
-TimeADT *
+TimeADT *
time_difference(TimeADT *time1, TimeADT *time2)
{
- TimeADT *time = palloc(sizeof(TimeADT));
+ TimeADT *time = palloc(sizeof(TimeADT));
- *time = (*time1 - *time2);
- return(time);
+ *time = (*time1 - *time2);
+ return (time);
}
int4
time_hours(TimeADT *time)
{
- return (((int) *time) / 3600);
+ return (((int) *time) / 3600);
}
int4
time_minutes(TimeADT *time)
{
- return ((((int) *time) / 60) % 60);
+ return ((((int) *time) / 60) % 60);
}
int4
time_seconds(TimeADT *time)
{
- return (((int) *time) % 60);
+ return (((int) *time) % 60);
}
int4
as_minutes(TimeADT *time)
{
- return (((int) *time) / 60);
+ return (((int) *time) / 60);
}
int4
as_seconds(TimeADT *time)
{
- return ((int) *time);
+ return ((int) *time);
}
int4
date_day(DateADT val)
{
- int year, month, day;
+ int year,
+ month,
+ day;
- j2date(val + JDATE_2000, &year, &month, &day);
+ j2date(val + JDATE_2000, &year, &month, &day);
- return (day);
+ return (day);
}
int4
date_month(DateADT val)
{
- int year, month, day;
+ int year,
+ month,
+ day;
- j2date(val + JDATE_2000, &year, &month, &day);
+ j2date(val + JDATE_2000, &year, &month, &day);
- return (month);
+ return (month);
}
int4
date_year(DateADT val)
{
- int year, month, day;
+ int year,
+ month,
+ day;
- j2date(val + JDATE_2000, &year, &month, &day);
+ j2date(val + JDATE_2000, &year, &month, &day);
- return (year);
+ return (year);
}
-TimeADT *
+TimeADT *
currenttime()
{
- TimeADT *result = palloc(sizeof(TimeADT));
- struct tm *tm;
- time_t current_time;
+ TimeADT *result = palloc(sizeof(TimeADT));
+ struct tm *tm;
+ time_t current_time;
- current_time = time(NULL);
- tm = localtime(&current_time);
- *result = ((((tm->tm_hour*60)+tm->tm_min)*60)+tm->tm_sec);
+ current_time = time(NULL);
+ tm = localtime(&current_time);
+ *result = ((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec);
- return (result);
+ return (result);
}
DateADT
currentdate()
{
- DateADT date;
- struct tm tt, *tm = &tt;
+ DateADT date;
+ struct tm tt,
+ *tm = &tt;
- GetCurrentTime(tm);
- date = (date2j( tm->tm_year, tm->tm_mon, tm->tm_mday) - JDATE_2000);
- return (date);
+ GetCurrentTime(tm);
+ date = (date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - JDATE_2000);
+ return (date);
}
/* end of file */
diff --git a/contrib/datetime/datetime_functions.h b/contrib/datetime/datetime_functions.h
index 68474984059..3a3de8ec52a 100644
--- a/contrib/datetime/datetime_functions.h
+++ b/contrib/datetime/datetime_functions.h
@@ -1,19 +1,19 @@
#ifndef DATETIME_FUNCTIONS_H
#define DATETIME_FUNCTIONS_H
-TimeADT *hhmm_in(char *str);
-char *hhmm_out(TimeADT *time);
-TimeADT *hhmm(TimeADT *time);
-TimeADT *time_difference(TimeADT *time1, TimeADT *time2);
-int4 time_hours(TimeADT *time);
-int4 time_minutes(TimeADT *time);
-int4 time_seconds(TimeADT *time);
-int4 as_minutes(TimeADT *time);
-int4 as_seconds(TimeADT *time);
-int4 date_day(DateADT val);
-int4 date_month(DateADT val);
-int4 date_year(DateADT val);
-TimeADT *currenttime(void);
-DateADT currentdate(void);
+TimeADT *hhmm_in(char *str);
+char *hhmm_out(TimeADT *time);
+TimeADT *hhmm(TimeADT *time);
+TimeADT *time_difference(TimeADT *time1, TimeADT *time2);
+int4 time_hours(TimeADT *time);
+int4 time_minutes(TimeADT *time);
+int4 time_seconds(TimeADT *time);
+int4 as_minutes(TimeADT *time);
+int4 as_seconds(TimeADT *time);
+int4 date_day(DateADT val);
+int4 date_month(DateADT val);
+int4 date_year(DateADT val);
+TimeADT *currenttime(void);
+DateADT currentdate(void);
#endif
diff --git a/contrib/int8/int8.c b/contrib/int8/int8.c
index f8945ccd5d3..4e04c993526 100644
--- a/contrib/int8/int8.c
+++ b/contrib/int8/int8.c
@@ -89,7 +89,7 @@ int64 *dtoi8(float64 val);
/* int8in()
*/
-int64 *
+int64 *
int8in(char *str)
{
int64 *result = palloc(sizeof(int64));
@@ -107,12 +107,12 @@ int8in(char *str)
#endif
return (result);
-} /* int8in() */
+} /* int8in() */
/* int8out()
*/
-char *
+char *
int8out(int64 * val)
{
char *result;
@@ -137,7 +137,7 @@ int8out(int64 * val)
#endif
return (result);
-} /* int8out() */
+} /* int8out() */
/*----------------------------------------------------------
@@ -151,37 +151,37 @@ bool
int8eq(int64 * val1, int64 * val2)
{
return (*val1 == *val2);
-} /* int8eq() */
+} /* int8eq() */
bool
int8ne(int64 * val1, int64 * val2)
{
return (*val1 != *val2);
-} /* int8ne() */
+} /* int8ne() */
bool
int8lt(int64 * val1, int64 * val2)
{
return (*val1 < *val2);
-} /* int8lt() */
+} /* int8lt() */
bool
int8gt(int64 * val1, int64 * val2)
{
return (*val1 > *val2);
-} /* int8gt() */
+} /* int8gt() */
bool
int8le(int64 * val1, int64 * val2)
{
return (*val1 <= *val2);
-} /* int8le() */
+} /* int8le() */
bool
int8ge(int64 * val1, int64 * val2)
{
return (*val1 >= *val2);
-} /* int8ge() */
+} /* int8ge() */
/* int84relop()
@@ -191,44 +191,44 @@ bool
int84eq(int64 * val1, int32 val2)
{
return (*val1 == val2);
-} /* int84eq() */
+} /* int84eq() */
bool
int84ne(int64 * val1, int32 val2)
{
return (*val1 != val2);
-} /* int84ne() */
+} /* int84ne() */
bool
int84lt(int64 * val1, int32 val2)
{
return (*val1 < val2);
-} /* int84lt() */
+} /* int84lt() */
bool
int84gt(int64 * val1, int32 val2)
{
return (*val1 > val2);
-} /* int84gt() */
+} /* int84gt() */
bool
int84le(int64 * val1, int32 val2)
{
return (*val1 <= val2);
-} /* int84le() */
+} /* int84le() */
bool
int84ge(int64 * val1, int32 val2)
{
return (*val1 >= val2);
-} /* int84ge() */
+} /* int84ge() */
/*----------------------------------------------------------
* Arithmetic operators on 64-bit integers.
*---------------------------------------------------------*/
-int64 *
+int64 *
int8um(int64 * val)
{
int64 *result = palloc(sizeof(int64));
@@ -239,9 +239,9 @@ int8um(int64 * val)
*result = (-*val);
return (result);
-} /* int8um() */
+} /* int8um() */
-int64 *
+int64 *
int8pl(int64 * val1, int64 * val2)
{
int64 *result = palloc(sizeof(int64));
@@ -252,9 +252,9 @@ int8pl(int64 * val1, int64 * val2)
*result = *val1 + *val2;
return (result);
-} /* int8pl() */
+} /* int8pl() */
-int64 *
+int64 *
int8mi(int64 * val1, int64 * val2)
{
int64 *result = palloc(sizeof(int64));
@@ -265,9 +265,9 @@ int8mi(int64 * val1, int64 * val2)
*result = *val1 - *val2;
return (result);
-} /* int8mi() */
+} /* int8mi() */
-int64 *
+int64 *
int8mul(int64 * val1, int64 * val2)
{
int64 *result = palloc(sizeof(int64));
@@ -278,9 +278,9 @@ int8mul(int64 * val1, int64 * val2)
*result = *val1 * *val2;
return (result);
-} /* int8mul() */
+} /* int8mul() */
-int64 *
+int64 *
int8div(int64 * val1, int64 * val2)
{
int64 *result = palloc(sizeof(int64));
@@ -291,14 +291,14 @@ int8div(int64 * val1, int64 * val2)
*result = *val1 / *val2;
return (result);
-} /* int8div() */
+} /* int8div() */
/*----------------------------------------------------------
* Conversion operators.
*---------------------------------------------------------*/
-int64 *
+int64 *
int48(int32 val)
{
int64 *result = palloc(sizeof(int64));
@@ -306,7 +306,7 @@ int48(int32 val)
*result = val;
return (result);
-} /* int48() */
+} /* int48() */
int32
int84(int64 * val)
@@ -322,10 +322,10 @@ int84(int64 * val)
result = *val;
return (result);
-} /* int84() */
+} /* int84() */
#if FALSE
-int64 *
+int64 *
int28 (int16 val)
{
int64 *result;
@@ -336,7 +336,7 @@ int28 (int16 val)
*result = val;
return (result);
-} /* int28() */
+} /* int28() */
int16
int82(int64 * val)
@@ -349,7 +349,7 @@ int82(int64 * val)
result = *val;
return (result);
-} /* int82() */
+} /* int82() */
#endif
@@ -361,9 +361,9 @@ i8tod(int64 * val)
*result = *val;
return (result);
-} /* i8tod() */
+} /* i8tod() */
-int64 *
+int64 *
dtoi8(float64 val)
{
int64 *result = palloc(sizeof(int64));
@@ -374,4 +374,4 @@ dtoi8(float64 val)
*result = *val;
return (result);
-} /* dtoi8() */
+} /* dtoi8() */
diff --git a/contrib/ip_and_mac/ip.c b/contrib/ip_and_mac/ip.c
index d941c26742f..b0320bae38d 100644
--- a/contrib/ip_and_mac/ip.c
+++ b/contrib/ip_and_mac/ip.c
@@ -1,7 +1,7 @@
/*
* PostgreSQL type definitions for IP addresses.
*
- * $Id: ip.c,v 1.2 1998/02/14 17:58:03 scrappy Exp $
+ * $Id: ip.c,v 1.3 1998/02/26 04:27:37 momjian Exp $
*/
#include <stdio.h>
@@ -13,83 +13,98 @@
* This is the internal storage format for IP addresses:
*/
-typedef struct ipaddr {
- uint32 address;
- int16 width;
-} ipaddr;
+typedef struct ipaddr
+{
+ uint32 address;
+ int16 width;
+} ipaddr;
/*
* Various forward declarations:
*/
-ipaddr *ipaddr_in(char *str);
-char *ipaddr_out(ipaddr *addr);
+ipaddr *ipaddr_in(char *str);
+char *ipaddr_out(ipaddr * addr);
-bool ipaddr_lt(ipaddr *a1, ipaddr *a2);
-bool ipaddr_le(ipaddr *a1, ipaddr *a2);
-bool ipaddr_eq(ipaddr *a1, ipaddr *a2);
-bool ipaddr_ge(ipaddr *a1, ipaddr *a2);
-bool ipaddr_gt(ipaddr *a1, ipaddr *a2);
+bool ipaddr_lt(ipaddr * a1, ipaddr * a2);
+bool ipaddr_le(ipaddr * a1, ipaddr * a2);
+bool ipaddr_eq(ipaddr * a1, ipaddr * a2);
+bool ipaddr_ge(ipaddr * a1, ipaddr * a2);
+bool ipaddr_gt(ipaddr * a1, ipaddr * a2);
-bool ipaddr_ne(ipaddr *a1, ipaddr *a2);
+bool ipaddr_ne(ipaddr * a1, ipaddr * a2);
-int4 ipaddr_cmp(ipaddr *a1, ipaddr *a2);
+int4 ipaddr_cmp(ipaddr * a1, ipaddr * a2);
-bool ipaddr_in_net(ipaddr *a1, ipaddr *a2);
-ipaddr *ipaddr_mask(ipaddr *a);
-ipaddr *ipaddr_bcast(ipaddr *a);
+bool ipaddr_in_net(ipaddr * a1, ipaddr * a2);
+ipaddr *ipaddr_mask(ipaddr * a);
+ipaddr *ipaddr_bcast(ipaddr * a);
/*
* Build a mask of a given width:
*/
-unsigned long build_mask(unsigned char bits) {
- unsigned long mask = 0;
- int i;
- for (i = 0; i < bits; i++)
- mask = (mask >> 1) | 0x80000000;
- return mask;
+unsigned long
+build_mask(unsigned char bits)
+{
+ unsigned long mask = 0;
+ int i;
+
+ for (i = 0; i < bits; i++)
+ mask = (mask >> 1) | 0x80000000;
+ return mask;
}
/*
- * IP address reader. Note how the count returned by sscanf()
+ * IP address reader. Note how the count returned by sscanf()
* is used to determine whether the mask size was specified.
*/
-ipaddr *ipaddr_in(char *str) {
- int a, b, c, d, w;
- ipaddr *result;
- int count;
-
- if (strlen(str) > 0) {
-
- count = sscanf(str, "%d.%d.%d.%d/%d", &a, &b, &c, &d, &w);
-
- if (count < 4) {
- elog(ERROR, "ipaddr_in: error in parsing \"%s\"", str);
- return(NULL);
- }
-
- if (count == 4)
- w = 32;
-
- if ((a < 0) || (a > 255) || (b < 0) || (b > 255) ||
- (c < 0) || (c > 255) || (d < 0) || (d > 255) ||
- (w < 0) || (w > 32)) {
- elog(ERROR, "ipaddr_in: illegal address \"%s\"", str);
- return(NULL);
- }
- } else {
- a = b = c = d = w = 0; /* special case for missing address */
- }
-
- result = (ipaddr *)palloc(sizeof(ipaddr));
-
- result->address = (uint32) ((a<<24)|(b<<16)|(c<<8)|d);
- result->address &= build_mask(w);
- result->width = w;
-
- return(result);
+ipaddr *
+ipaddr_in(char *str)
+{
+ int a,
+ b,
+ c,
+ d,
+ w;
+ ipaddr *result;
+ int count;
+
+ if (strlen(str) > 0)
+ {
+
+ count = sscanf(str, "%d.%d.%d.%d/%d", &a, &b, &c, &d, &w);
+
+ if (count < 4)
+ {
+ elog(ERROR, "ipaddr_in: error in parsing \"%s\"", str);
+ return (NULL);
+ }
+
+ if (count == 4)
+ w = 32;
+
+ if ((a < 0) || (a > 255) || (b < 0) || (b > 255) ||
+ (c < 0) || (c > 255) || (d < 0) || (d > 255) ||
+ (w < 0) || (w > 32))
+ {
+ elog(ERROR, "ipaddr_in: illegal address \"%s\"", str);
+ return (NULL);
+ }
+ }
+ else
+ {
+ a = b = c = d = w = 0; /* special case for missing address */
+ }
+
+ result = (ipaddr *) palloc(sizeof(ipaddr));
+
+ result->address = (uint32) ((a << 24) | (b << 16) | (c << 8) | d);
+ result->address &= build_mask(w);
+ result->width = w;
+
+ return (result);
}
/*
@@ -97,118 +112,144 @@ ipaddr *ipaddr_in(char *str) {
* generated only for subnets, not for plain host addresses.
*/
-char *ipaddr_out(ipaddr *addr) {
- char *result;
-
- if (addr == NULL)
- return(NULL);
-
- result = (char *)palloc(32);
-
- if (addr->address > 0) {
- if (addr->width == 32)
- sprintf(result, "%d.%d.%d.%d",
- (addr->address >> 24) & 0xff,
- (addr->address >> 16) & 0xff,
- (addr->address >> 8) & 0xff,
- addr->address & 0xff);
- else
- sprintf(result, "%d.%d.%d.%d/%d",
- (addr->address >> 24) & 0xff,
- (addr->address >> 16) & 0xff,
- (addr->address >> 8) & 0xff,
- addr->address & 0xff,
- addr->width);
- } else {
- result[0] = 0; /* special case for missing address */
- }
- return(result);
+char *
+ipaddr_out(ipaddr * addr)
+{
+ char *result;
+
+ if (addr == NULL)
+ return (NULL);
+
+ result = (char *) palloc(32);
+
+ if (addr->address > 0)
+ {
+ if (addr->width == 32)
+ sprintf(result, "%d.%d.%d.%d",
+ (addr->address >> 24) & 0xff,
+ (addr->address >> 16) & 0xff,
+ (addr->address >> 8) & 0xff,
+ addr->address & 0xff);
+ else
+ sprintf(result, "%d.%d.%d.%d/%d",
+ (addr->address >> 24) & 0xff,
+ (addr->address >> 16) & 0xff,
+ (addr->address >> 8) & 0xff,
+ addr->address & 0xff,
+ addr->width);
+ }
+ else
+ {
+ result[0] = 0; /* special case for missing address */
+ }
+ return (result);
}
/*
* Boolean tests for magnitude.
*/
-bool ipaddr_lt(ipaddr *a1, ipaddr *a2) {
- return (a1->address < a2->address);
+bool
+ipaddr_lt(ipaddr * a1, ipaddr * a2)
+{
+ return (a1->address < a2->address);
};
-bool ipaddr_le(ipaddr *a1, ipaddr *a2) {
- return (a1->address <= a2->address);
+bool
+ipaddr_le(ipaddr * a1, ipaddr * a2)
+{
+ return (a1->address <= a2->address);
};
-bool ipaddr_eq(ipaddr *a1, ipaddr *a2) {
- return (a1->address == a2->address);
+bool
+ipaddr_eq(ipaddr * a1, ipaddr * a2)
+{
+ return (a1->address == a2->address);
};
-bool ipaddr_ge(ipaddr *a1, ipaddr *a2) {
- return (a1->address >= a2->address);
+bool
+ipaddr_ge(ipaddr * a1, ipaddr * a2)
+{
+ return (a1->address >= a2->address);
};
-bool ipaddr_gt(ipaddr *a1, ipaddr *a2) {
- return (a1->address > a2->address);
+bool
+ipaddr_gt(ipaddr * a1, ipaddr * a2)
+{
+ return (a1->address > a2->address);
};
-bool ipaddr_ne(ipaddr *a1, ipaddr *a2) {
- return (a1->address != a2->address);
+bool
+ipaddr_ne(ipaddr * a1, ipaddr * a2)
+{
+ return (a1->address != a2->address);
};
/*
* Comparison function for sorting:
*/
-int4 ipaddr_cmp(ipaddr *a1, ipaddr *a2) {
- if (a1->address < a2->address)
- return -1;
- else if (a1->address > a2->address)
- return 1;
- else
- return 0;
+int4
+ipaddr_cmp(ipaddr * a1, ipaddr * a2)
+{
+ if (a1->address < a2->address)
+ return -1;
+ else if (a1->address > a2->address)
+ return 1;
+ else
+ return 0;
}
/*
* Test whether an address is within a given subnet:
*/
-bool ipaddr_in_net(ipaddr *a1, ipaddr *a2) {
- uint32 maskbits;
- if (a1->width < a2->width)
- return FALSE;
- if ((a1->width == 32) && (a2->width == 32))
- return ipaddr_eq(a1, a2);
- maskbits = build_mask(a2->width);
- if ((a1->address & maskbits) == (a2->address & maskbits))
- return TRUE;
- return FALSE;
+bool
+ipaddr_in_net(ipaddr * a1, ipaddr * a2)
+{
+ uint32 maskbits;
+
+ if (a1->width < a2->width)
+ return FALSE;
+ if ((a1->width == 32) && (a2->width == 32))
+ return ipaddr_eq(a1, a2);
+ maskbits = build_mask(a2->width);
+ if ((a1->address & maskbits) == (a2->address & maskbits))
+ return TRUE;
+ return FALSE;
}
/*
* Pick out just the mask of a network:
*/
-ipaddr *ipaddr_mask(ipaddr *a) {
- ipaddr *result;
+ipaddr *
+ipaddr_mask(ipaddr * a)
+{
+ ipaddr *result;
- result = (ipaddr *)palloc(sizeof(ipaddr));
- result->address = build_mask(a->width);
- result->width = 32;
+ result = (ipaddr *) palloc(sizeof(ipaddr));
+ result->address = build_mask(a->width);
+ result->width = 32;
- return result;
+ return result;
}
/*
* Return the broadcast address of a network:
*/
-ipaddr *ipaddr_bcast(ipaddr *a) {
- ipaddr *result;
+ipaddr *
+ipaddr_bcast(ipaddr * a)
+{
+ ipaddr *result;
- result = (ipaddr *)palloc(sizeof(ipaddr));
- result->address = a->address;
- result->address |= (build_mask(32 - a->width) >> a->width);
- result->width = 32;
+ result = (ipaddr *) palloc(sizeof(ipaddr));
+ result->address = a->address;
+ result->address |= (build_mask(32 - a->width) >> a->width);
+ result->width = 32;
- return result;
+ return result;
}
/*
diff --git a/contrib/ip_and_mac/mac.c b/contrib/ip_and_mac/mac.c
index 34aed592674..f4f5fff7df8 100644
--- a/contrib/ip_and_mac/mac.c
+++ b/contrib/ip_and_mac/mac.c
@@ -1,7 +1,7 @@
/*
* PostgreSQL type definitions for MAC addresses.
*
- * $Id: mac.c,v 1.2 1998/02/14 17:58:05 scrappy Exp $
+ * $Id: mac.c,v 1.3 1998/02/26 04:27:44 momjian Exp $
*/
#include <stdio.h>
@@ -15,33 +15,34 @@
* This is the internal storage format for MAC addresses:
*/
-typedef struct macaddr {
- unsigned char a;
- unsigned char b;
- unsigned char c;
- unsigned char d;
- unsigned char e;
- unsigned char f;
-} macaddr;
+typedef struct macaddr
+{
+ unsigned char a;
+ unsigned char b;
+ unsigned char c;
+ unsigned char d;
+ unsigned char e;
+ unsigned char f;
+} macaddr;
/*
* Various forward declarations:
*/
-macaddr *macaddr_in(char *str);
-char *macaddr_out(macaddr *addr);
+macaddr *macaddr_in(char *str);
+char *macaddr_out(macaddr * addr);
-bool macaddr_lt(macaddr *a1, macaddr *a2);
-bool macaddr_le(macaddr *a1, macaddr *a2);
-bool macaddr_eq(macaddr *a1, macaddr *a2);
-bool macaddr_ge(macaddr *a1, macaddr *a2);
-bool macaddr_gt(macaddr *a1, macaddr *a2);
+bool macaddr_lt(macaddr * a1, macaddr * a2);
+bool macaddr_le(macaddr * a1, macaddr * a2);
+bool macaddr_eq(macaddr * a1, macaddr * a2);
+bool macaddr_ge(macaddr * a1, macaddr * a2);
+bool macaddr_gt(macaddr * a1, macaddr * a2);
-bool macaddr_ne(macaddr *a1, macaddr *a2);
+bool macaddr_ne(macaddr * a1, macaddr * a2);
-int4 macaddr_cmp(macaddr *a1, macaddr *a2);
+int4 macaddr_cmp(macaddr * a1, macaddr * a2);
-text *macaddr_manuf(macaddr *addr);
+text *macaddr_manuf(macaddr * addr);
/*
* Utility macros used for sorting and comparing:
@@ -57,147 +58,185 @@ text *macaddr_manuf(macaddr *addr);
* MAC address reader. Accepts several common notations.
*/
-macaddr *macaddr_in(char *str) {
- int a, b, c, d, e, f;
- macaddr *result;
- int count;
-
- if (strlen(str) > 0) {
-
- count = sscanf(str, "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e, &f);
- if (count != 6)
- count = sscanf(str, "%x-%x-%x-%x-%x-%x", &a, &b, &c, &d, &e, &f);
- if (count != 6)
- count = sscanf(str, "%2x%2x%2x:%2x%2x%2x", &a, &b, &c, &d, &e, &f);
- if (count != 6)
- count = sscanf(str, "%2x%2x%2x-%2x%2x%2x", &a, &b, &c, &d, &e, &f);
- if (count != 6)
- count = sscanf(str, "%2x%2x.%2x%2x.%2x%2x", &a, &b, &c, &d, &e, &f);
-
- if (count != 6) {
- elog(ERROR, "macaddr_in: error in parsing \"%s\"", str);
- return(NULL);
- }
-
- if ((a < 0) || (a > 255) || (b < 0) || (b > 255) ||
- (c < 0) || (c > 255) || (d < 0) || (d > 255) ||
- (e < 0) || (e > 255) || (f < 0) || (f > 255)) {
- elog(ERROR, "macaddr_in: illegal address \"%s\"", str);
- return(NULL);
- }
- } else {
- a = b = c = d = e = f = 0; /* special case for missing address */
- }
-
- result = (macaddr *)palloc(sizeof(macaddr));
-
- result->a = a;
- result->b = b;
- result->c = c;
- result->d = d;
- result->e = e;
- result->f = f;
-
- return(result);
+macaddr *
+macaddr_in(char *str)
+{
+ int a,
+ b,
+ c,
+ d,
+ e,
+ f;
+ macaddr *result;
+ int count;
+
+ if (strlen(str) > 0)
+ {
+
+ count = sscanf(str, "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e, &f);
+ if (count != 6)
+ count = sscanf(str, "%x-%x-%x-%x-%x-%x", &a, &b, &c, &d, &e, &f);
+ if (count != 6)
+ count = sscanf(str, "%2x%2x%2x:%2x%2x%2x", &a, &b, &c, &d, &e, &f);
+ if (count != 6)
+ count = sscanf(str, "%2x%2x%2x-%2x%2x%2x", &a, &b, &c, &d, &e, &f);
+ if (count != 6)
+ count = sscanf(str, "%2x%2x.%2x%2x.%2x%2x", &a, &b, &c, &d, &e, &f);
+
+ if (count != 6)
+ {
+ elog(ERROR, "macaddr_in: error in parsing \"%s\"", str);
+ return (NULL);
+ }
+
+ if ((a < 0) || (a > 255) || (b < 0) || (b > 255) ||
+ (c < 0) || (c > 255) || (d < 0) || (d > 255) ||
+ (e < 0) || (e > 255) || (f < 0) || (f > 255))
+ {
+ elog(ERROR, "macaddr_in: illegal address \"%s\"", str);
+ return (NULL);
+ }
+ }
+ else
+ {
+ a = b = c = d = e = f = 0; /* special case for missing
+ * address */
+ }
+
+ result = (macaddr *) palloc(sizeof(macaddr));
+
+ result->a = a;
+ result->b = b;
+ result->c = c;
+ result->d = d;
+ result->e = e;
+ result->f = f;
+
+ return (result);
}
/*
* MAC address output function. Fixed format.
*/
-char *macaddr_out(macaddr *addr) {
- char *result;
-
- if (addr == NULL)
- return(NULL);
-
- result = (char *)palloc(32);
-
- if ((hibits(addr) > 0) || (lobits(addr) > 0)) {
- sprintf(result, "%02x:%02x:%02x:%02x:%02x:%02x",
- addr->a, addr->b, addr->c, addr->d, addr->e, addr->f);
- } else {
- result[0] = 0; /* special case for missing address */
- }
- return(result);
+char *
+macaddr_out(macaddr * addr)
+{
+ char *result;
+
+ if (addr == NULL)
+ return (NULL);
+
+ result = (char *) palloc(32);
+
+ if ((hibits(addr) > 0) || (lobits(addr) > 0))
+ {
+ sprintf(result, "%02x:%02x:%02x:%02x:%02x:%02x",
+ addr->a, addr->b, addr->c, addr->d, addr->e, addr->f);
+ }
+ else
+ {
+ result[0] = 0; /* special case for missing address */
+ }
+ return (result);
}
/*
* Boolean tests.
*/
-bool macaddr_lt(macaddr *a1, macaddr *a2) {
- return((hibits(a1) < hibits(a2)) ||
- ((hibits(a1) == hibits(a2)) && lobits(a1) < lobits(a2)));
+bool
+macaddr_lt(macaddr * a1, macaddr * a2)
+{
+ return ((hibits(a1) < hibits(a2)) ||
+ ((hibits(a1) == hibits(a2)) && lobits(a1) < lobits(a2)));
};
-bool macaddr_le(macaddr *a1, macaddr *a2) {
- return((hibits(a1) < hibits(a2)) ||
- ((hibits(a1) == hibits(a2)) && lobits(a1) <= lobits(a2)));
+bool
+macaddr_le(macaddr * a1, macaddr * a2)
+{
+ return ((hibits(a1) < hibits(a2)) ||
+ ((hibits(a1) == hibits(a2)) && lobits(a1) <= lobits(a2)));
};
-bool macaddr_eq(macaddr *a1, macaddr *a2) {
- return ((hibits(a1) == hibits(a2)) && (lobits(a1) == lobits(a2)));
+bool
+macaddr_eq(macaddr * a1, macaddr * a2)
+{
+ return ((hibits(a1) == hibits(a2)) && (lobits(a1) == lobits(a2)));
};
-bool macaddr_ge(macaddr *a1, macaddr *a2) {
- return((hibits(a1) > hibits(a2)) ||
- ((hibits(a1) == hibits(a2)) && lobits(a1) >= lobits(a2)));
+bool
+macaddr_ge(macaddr * a1, macaddr * a2)
+{
+ return ((hibits(a1) > hibits(a2)) ||
+ ((hibits(a1) == hibits(a2)) && lobits(a1) >= lobits(a2)));
};
-bool macaddr_gt(macaddr *a1, macaddr *a2) {
- return((hibits(a1) > hibits(a2)) ||
- ((hibits(a1) == hibits(a2)) && lobits(a1) > lobits(a2)));
+bool
+macaddr_gt(macaddr * a1, macaddr * a2)
+{
+ return ((hibits(a1) > hibits(a2)) ||
+ ((hibits(a1) == hibits(a2)) && lobits(a1) > lobits(a2)));
};
-bool macaddr_ne(macaddr *a1, macaddr *a2) {
- return ((hibits(a1) != hibits(a2)) || (lobits(a1) != lobits(a2)));
+bool
+macaddr_ne(macaddr * a1, macaddr * a2)
+{
+ return ((hibits(a1) != hibits(a2)) || (lobits(a1) != lobits(a2)));
};
/*
* Comparison function for sorting:
*/
-int4 macaddr_cmp(macaddr *a1, macaddr *a2) {
- if (hibits(a1) < hibits(a2))
- return -1;
- else if (hibits(a1) > hibits(a2))
- return 1;
- else if (lobits(a1) < lobits(a2))
- return -1;
- else if (lobits(a1) > lobits(a2))
- return 1;
- else
- return 0;
+int4
+macaddr_cmp(macaddr * a1, macaddr * a2)
+{
+ if (hibits(a1) < hibits(a2))
+ return -1;
+ else if (hibits(a1) > hibits(a2))
+ return 1;
+ else if (lobits(a1) < lobits(a2))
+ return -1;
+ else if (lobits(a1) > lobits(a2))
+ return 1;
+ else
+ return 0;
}
/*
* The special manufacturer fetching function. See "mac.h".
*/
-text *macaddr_manuf(macaddr *addr) {
- manufacturer *manuf;
- int length;
- text *result;
-
- for (manuf = manufacturers; manuf->name != NULL; manuf++) {
- if ((manuf->a == addr->a) &&
- (manuf->b == addr->b) &&
- (manuf->c == addr->c))
- break;
- }
- if (manuf->name == NULL) {
- result = palloc(VARHDRSZ + 1);
- memset(result, 0, VARHDRSZ + 1);
- VARSIZE(result) = VARHDRSZ + 1;
- } else {
- length = strlen(manuf->name) + 1;
- result = palloc(length + VARHDRSZ);
- memset(result, 0, length + VARHDRSZ);
- VARSIZE(result) = length + VARHDRSZ;
- memcpy(VARDATA(result), manuf->name, length);
- }
- return result;
+text *
+macaddr_manuf(macaddr * addr)
+{
+ manufacturer *manuf;
+ int length;
+ text *result;
+
+ for (manuf = manufacturers; manuf->name != NULL; manuf++)
+ {
+ if ((manuf->a == addr->a) &&
+ (manuf->b == addr->b) &&
+ (manuf->c == addr->c))
+ break;
+ }
+ if (manuf->name == NULL)
+ {
+ result = palloc(VARHDRSZ + 1);
+ memset(result, 0, VARHDRSZ + 1);
+ VARSIZE(result) = VARHDRSZ + 1;
+ }
+ else
+ {
+ length = strlen(manuf->name) + 1;
+ result = palloc(length + VARHDRSZ);
+ memset(result, 0, length + VARHDRSZ);
+ VARSIZE(result) = length + VARHDRSZ;
+ memcpy(VARDATA(result), manuf->name, length);
+ }
+ return result;
}
/*
diff --git a/contrib/ip_and_mac/mac.h b/contrib/ip_and_mac/mac.h
index 27c4c1ec278..954dc059257 100644
--- a/contrib/ip_and_mac/mac.h
+++ b/contrib/ip_and_mac/mac.h
@@ -1,130 +1,131 @@
/*
* PostgreSQL type definitions for MAC addresses.
*
- * $Id: mac.h,v 1.2 1998/02/14 17:58:07 scrappy Exp $
+ * $Id: mac.h,v 1.3 1998/02/26 04:27:50 momjian Exp $
*/
-typedef struct manufacturer {
- unsigned char a;
- unsigned char b;
- unsigned char c;
- char *name;
-} manufacturer;
+typedef struct manufacturer
+{
+ unsigned char a;
+ unsigned char b;
+ unsigned char c;
+ char *name;
+} manufacturer;
manufacturer manufacturers[] = {
- {0x00, 0x00, 0x0C, "Cisco"},
- {0x00, 0x00, 0x0E, "Fujitsu"},
- {0x00, 0x00, 0x0F, "NeXT"},
- {0x00, 0x00, 0x10, "Sytek"},
- {0x00, 0x00, 0x1D, "Cabletron"},
- {0x00, 0x00, 0x20, "DIAB"},
- {0x00, 0x00, 0x22, "Visual Technology"},
- {0x00, 0x00, 0x2A, "TRW"},
- {0x00, 0x00, 0x32, "GPT Limited"},
- {0x00, 0x00, 0x5A, "S & Koch"},
- {0x00, 0x00, 0x5E, "IANA"},
- {0x00, 0x00, 0x65, "Network General"},
- {0x00, 0x00, 0x6B, "MIPS"},
- {0x00, 0x00, 0x77, "MIPS"},
- {0x00, 0x00, 0x7A, "Ardent"},
- {0x00, 0x00, 0x89, "Cayman Systems"},
- {0x00, 0x00, 0x93, "Proteon"},
- {0x00, 0x00, 0x9F, "Ameristar Technology"},
- {0x00, 0x00, 0xA2, "Wellfleet"},
- {0x00, 0x00, 0xA3, "Network Application Technology"},
- {0x00, 0x00, 0xA6, "Network General"},
- {0x00, 0x00, 0xA7, "NCD"},
- {0x00, 0x00, 0xA9, "Network Systems"},
- {0x00, 0x00, 0xAA, "Xerox"},
- {0x00, 0x00, 0xB3, "CIMLinc"},
- {0x00, 0x00, 0xB7, "Dove Fastnet"},
- {0x00, 0x00, 0xBC, "Allen-Bradley"},
- {0x00, 0x00, 0xC0, "Western Digital"},
- {0x00, 0x00, 0xC5, "Farallon"},
- {0x00, 0x00, 0xC6, "Hewlett-Packard"},
- {0x00, 0x00, 0xC8, "Altos"},
- {0x00, 0x00, 0xC9, "Emulex"},
- {0x00, 0x00, 0xD7, "Dartmouth College"},
- {0x00, 0x00, 0xD8, "3Com (?)"},
- {0x00, 0x00, 0xDD, "Gould"},
- {0x00, 0x00, 0xDE, "Unigraph"},
- {0x00, 0x00, 0xE2, "Acer Counterpoint"},
- {0x00, 0x00, 0xEF, "Alantec"},
- {0x00, 0x00, 0xFD, "High Level Hardware"},
- {0x00, 0x01, 0x02, "BBN internal usage"},
- {0x00, 0x20, 0xAF, "3Com"},
- {0x00, 0x17, 0x00, "Kabel"},
- {0x00, 0x80, 0x64, "Wyse Technology"},
- {0x00, 0x80, 0x2B, "IMAC (?)"},
- {0x00, 0x80, 0x2D, "Xylogics, Inc."},
- {0x00, 0x80, 0x8C, "Frontier Software Development"},
- {0x00, 0x80, 0xC2, "IEEE 802.1 Committee"},
- {0x00, 0x80, 0xD3, "Shiva"},
- {0x00, 0xAA, 0x00, "Intel"},
- {0x00, 0xDD, 0x00, "Ungermann-Bass"},
- {0x00, 0xDD, 0x01, "Ungermann-Bass"},
- {0x02, 0x07, 0x01, "Racal InterLan"},
- {0x02, 0x04, 0x06, "BBN internal usage"},
- {0x02, 0x60, 0x86, "Satelcom MegaPac"},
- {0x02, 0x60, 0x8C, "3Com"},
- {0x02, 0xCF, 0x1F, "CMC"},
- {0x08, 0x00, 0x02, "3Com"},
- {0x08, 0x00, 0x03, "ACC"},
- {0x08, 0x00, 0x05, "Symbolics"},
- {0x08, 0x00, 0x08, "BBN"},
- {0x08, 0x00, 0x09, "Hewlett-Packard"},
- {0x08, 0x00, 0x0A, "Nestar Systems"},
- {0x08, 0x00, 0x0B, "Unisys"},
- {0x08, 0x00, 0x11, "Tektronix"},
- {0x08, 0x00, 0x14, "Excelan"},
- {0x08, 0x00, 0x17, "NSC"},
- {0x08, 0x00, 0x1A, "Data General"},
- {0x08, 0x00, 0x1B, "Data General"},
- {0x08, 0x00, 0x1E, "Apollo"},
- {0x08, 0x00, 0x20, "Sun"},
- {0x08, 0x00, 0x22, "NBI"},
- {0x08, 0x00, 0x25, "CDC"},
- {0x08, 0x00, 0x26, "Norsk Data"},
- {0x08, 0x00, 0x27, "PCS Computer Systems GmbH"},
- {0x08, 0x00, 0x28, "Texas Instruments"},
- {0x08, 0x00, 0x2B, "DEC"},
- {0x08, 0x00, 0x2E, "Metaphor"},
- {0x08, 0x00, 0x2F, "Prime Computer"},
- {0x08, 0x00, 0x36, "Intergraph"},
- {0x08, 0x00, 0x37, "Fujitsu-Xerox"},
- {0x08, 0x00, 0x38, "Bull"},
- {0x08, 0x00, 0x39, "Spider Systems"},
- {0x08, 0x00, 0x41, "DCA Digital Comm. Assoc."},
- {0x08, 0x00, 0x45, "Xylogics (?)"},
- {0x08, 0x00, 0x46, "Sony"},
- {0x08, 0x00, 0x47, "Sequent"},
- {0x08, 0x00, 0x49, "Univation"},
- {0x08, 0x00, 0x4C, "Encore"},
- {0x08, 0x00, 0x4E, "BICC"},
- {0x08, 0x00, 0x56, "Stanford University"},
- {0x08, 0x00, 0x58, "DECsystem 20 (?)"},
- {0x08, 0x00, 0x5A, "IBM"},
- {0x08, 0x00, 0x67, "Comdesign"},
- {0x08, 0x00, 0x68, "Ridge"},
- {0x08, 0x00, 0x69, "Silicon Graphics"},
- {0x08, 0x00, 0x6E, "Concurrent"},
- {0x08, 0x00, 0x75, "DDE"},
- {0x08, 0x00, 0x7C, "Vitalink"},
- {0x08, 0x00, 0x80, "XIOS"},
- {0x08, 0x00, 0x86, "Imagen/QMS"},
- {0x08, 0x00, 0x87, "Xyplex"},
- {0x08, 0x00, 0x89, "Kinetics"},
- {0x08, 0x00, 0x8B, "Pyramid"},
- {0x08, 0x00, 0x8D, "XyVision"},
- {0x08, 0x00, 0x90, "Retix Inc"},
- {0x48, 0x44, 0x53, "HDS (?)"},
- {0x80, 0x00, 0x10, "AT&T"},
- {0xAA, 0x00, 0x00, "DEC"},
- {0xAA, 0x00, 0x01, "DEC"},
- {0xAA, 0x00, 0x02, "DEC"},
- {0xAA, 0x00, 0x03, "DEC"},
- {0xAA, 0x00, 0x04, "DEC"},
- {0x00, 0x00, 0x00, NULL}
+ {0x00, 0x00, 0x0C, "Cisco"},
+ {0x00, 0x00, 0x0E, "Fujitsu"},
+ {0x00, 0x00, 0x0F, "NeXT"},
+ {0x00, 0x00, 0x10, "Sytek"},
+ {0x00, 0x00, 0x1D, "Cabletron"},
+ {0x00, 0x00, 0x20, "DIAB"},
+ {0x00, 0x00, 0x22, "Visual Technology"},
+ {0x00, 0x00, 0x2A, "TRW"},
+ {0x00, 0x00, 0x32, "GPT Limited"},
+ {0x00, 0x00, 0x5A, "S & Koch"},
+ {0x00, 0x00, 0x5E, "IANA"},
+ {0x00, 0x00, 0x65, "Network General"},
+ {0x00, 0x00, 0x6B, "MIPS"},
+ {0x00, 0x00, 0x77, "MIPS"},
+ {0x00, 0x00, 0x7A, "Ardent"},
+ {0x00, 0x00, 0x89, "Cayman Systems"},
+ {0x00, 0x00, 0x93, "Proteon"},
+ {0x00, 0x00, 0x9F, "Ameristar Technology"},
+ {0x00, 0x00, 0xA2, "Wellfleet"},
+ {0x00, 0x00, 0xA3, "Network Application Technology"},
+ {0x00, 0x00, 0xA6, "Network General"},
+ {0x00, 0x00, 0xA7, "NCD"},
+ {0x00, 0x00, 0xA9, "Network Systems"},
+ {0x00, 0x00, 0xAA, "Xerox"},
+ {0x00, 0x00, 0xB3, "CIMLinc"},
+ {0x00, 0x00, 0xB7, "Dove Fastnet"},
+ {0x00, 0x00, 0xBC, "Allen-Bradley"},
+ {0x00, 0x00, 0xC0, "Western Digital"},
+ {0x00, 0x00, 0xC5, "Farallon"},
+ {0x00, 0x00, 0xC6, "Hewlett-Packard"},
+ {0x00, 0x00, 0xC8, "Altos"},
+ {0x00, 0x00, 0xC9, "Emulex"},
+ {0x00, 0x00, 0xD7, "Dartmouth College"},
+ {0x00, 0x00, 0xD8, "3Com (?)"},
+ {0x00, 0x00, 0xDD, "Gould"},
+ {0x00, 0x00, 0xDE, "Unigraph"},
+ {0x00, 0x00, 0xE2, "Acer Counterpoint"},
+ {0x00, 0x00, 0xEF, "Alantec"},
+ {0x00, 0x00, 0xFD, "High Level Hardware"},
+ {0x00, 0x01, 0x02, "BBN internal usage"},
+ {0x00, 0x20, 0xAF, "3Com"},
+ {0x00, 0x17, 0x00, "Kabel"},
+ {0x00, 0x80, 0x64, "Wyse Technology"},
+ {0x00, 0x80, 0x2B, "IMAC (?)"},
+ {0x00, 0x80, 0x2D, "Xylogics, Inc."},
+ {0x00, 0x80, 0x8C, "Frontier Software Development"},
+ {0x00, 0x80, 0xC2, "IEEE 802.1 Committee"},
+ {0x00, 0x80, 0xD3, "Shiva"},
+ {0x00, 0xAA, 0x00, "Intel"},
+ {0x00, 0xDD, 0x00, "Ungermann-Bass"},
+ {0x00, 0xDD, 0x01, "Ungermann-Bass"},
+ {0x02, 0x07, 0x01, "Racal InterLan"},
+ {0x02, 0x04, 0x06, "BBN internal usage"},
+ {0x02, 0x60, 0x86, "Satelcom MegaPac"},
+ {0x02, 0x60, 0x8C, "3Com"},
+ {0x02, 0xCF, 0x1F, "CMC"},
+ {0x08, 0x00, 0x02, "3Com"},
+ {0x08, 0x00, 0x03, "ACC"},
+ {0x08, 0x00, 0x05, "Symbolics"},
+ {0x08, 0x00, 0x08, "BBN"},
+ {0x08, 0x00, 0x09, "Hewlett-Packard"},
+ {0x08, 0x00, 0x0A, "Nestar Systems"},
+ {0x08, 0x00, 0x0B, "Unisys"},
+ {0x08, 0x00, 0x11, "Tektronix"},
+ {0x08, 0x00, 0x14, "Excelan"},
+ {0x08, 0x00, 0x17, "NSC"},
+ {0x08, 0x00, 0x1A, "Data General"},
+ {0x08, 0x00, 0x1B, "Data General"},
+ {0x08, 0x00, 0x1E, "Apollo"},
+ {0x08, 0x00, 0x20, "Sun"},
+ {0x08, 0x00, 0x22, "NBI"},
+ {0x08, 0x00, 0x25, "CDC"},
+ {0x08, 0x00, 0x26, "Norsk Data"},
+ {0x08, 0x00, 0x27, "PCS Computer Systems GmbH"},
+ {0x08, 0x00, 0x28, "Texas Instruments"},
+ {0x08, 0x00, 0x2B, "DEC"},
+ {0x08, 0x00, 0x2E, "Metaphor"},
+ {0x08, 0x00, 0x2F, "Prime Computer"},
+ {0x08, 0x00, 0x36, "Intergraph"},
+ {0x08, 0x00, 0x37, "Fujitsu-Xerox"},
+ {0x08, 0x00, 0x38, "Bull"},
+ {0x08, 0x00, 0x39, "Spider Systems"},
+ {0x08, 0x00, 0x41, "DCA Digital Comm. Assoc."},
+ {0x08, 0x00, 0x45, "Xylogics (?)"},
+ {0x08, 0x00, 0x46, "Sony"},
+ {0x08, 0x00, 0x47, "Sequent"},
+ {0x08, 0x00, 0x49, "Univation"},
+ {0x08, 0x00, 0x4C, "Encore"},
+ {0x08, 0x00, 0x4E, "BICC"},
+ {0x08, 0x00, 0x56, "Stanford University"},
+ {0x08, 0x00, 0x58, "DECsystem 20 (?)"},
+ {0x08, 0x00, 0x5A, "IBM"},
+ {0x08, 0x00, 0x67, "Comdesign"},
+ {0x08, 0x00, 0x68, "Ridge"},
+ {0x08, 0x00, 0x69, "Silicon Graphics"},
+ {0x08, 0x00, 0x6E, "Concurrent"},
+ {0x08, 0x00, 0x75, "DDE"},
+ {0x08, 0x00, 0x7C, "Vitalink"},
+ {0x08, 0x00, 0x80, "XIOS"},
+ {0x08, 0x00, 0x86, "Imagen/QMS"},
+ {0x08, 0x00, 0x87, "Xyplex"},
+ {0x08, 0x00, 0x89, "Kinetics"},
+ {0x08, 0x00, 0x8B, "Pyramid"},
+ {0x08, 0x00, 0x8D, "XyVision"},
+ {0x08, 0x00, 0x90, "Retix Inc"},
+ {0x48, 0x44, 0x53, "HDS (?)"},
+ {0x80, 0x00, 0x10, "AT&T"},
+ {0xAA, 0x00, 0x00, "DEC"},
+ {0xAA, 0x00, 0x01, "DEC"},
+ {0xAA, 0x00, 0x02, "DEC"},
+ {0xAA, 0x00, 0x03, "DEC"},
+ {0xAA, 0x00, 0x04, "DEC"},
+ {0x00, 0x00, 0x00, NULL}
};
/*
diff --git a/contrib/miscutil/assert_test.c b/contrib/miscutil/assert_test.c
index fa2ec1fcaad..793f585e510 100644
--- a/contrib/miscutil/assert_test.c
+++ b/contrib/miscutil/assert_test.c
@@ -9,19 +9,19 @@
#include "postgres.h"
#include "assert_test.h"
-extern int assertTest(int val);
-extern int assertEnable(int val);
+extern int assertTest(int val);
+extern int assertEnable(int val);
int
assert_enable(int val)
{
- return assertEnable(val);
+ return assertEnable(val);
}
int
assert_test(int val)
{
- return assertTest(val);
+ return assertTest(val);
}
/*
@@ -29,14 +29,14 @@ assert_test(int val)
-- Enable/disable Postgres assert checking.
--
create function assert_enable(int4) returns int4
- as '/usr/local/pgsql/lib/assert_test.so'
- language 'C';
+ as '/usr/local/pgsql/lib/assert_test.so'
+ language 'C';
-- Test Postgres assert checking.
--
create function assert_test(int4) returns int4
- as '/usr/local/pgsql/lib/assert_test.so'
- language 'C';
+ as '/usr/local/pgsql/lib/assert_test.so'
+ language 'C';
*/
diff --git a/contrib/miscutil/assert_test.h b/contrib/miscutil/assert_test.h
index 2af288729aa..73b3938e065 100644
--- a/contrib/miscutil/assert_test.h
+++ b/contrib/miscutil/assert_test.h
@@ -1,7 +1,7 @@
#ifndef ASSERT_TEST_H
#define ASSERT_TEST_H
-int assert_enable(int val);
-int assert_test(int val);
+int assert_enable(int val);
+int assert_test(int val);
#endif
diff --git a/contrib/miscutil/misc_utils.c b/contrib/miscutil/misc_utils.c
index 3b8f379d21f..b787457e3f9 100644
--- a/contrib/miscutil/misc_utils.c
+++ b/contrib/miscutil/misc_utils.c
@@ -13,38 +13,38 @@
#include "misc_utils.h"
-extern int ExecutorLimit(int limit);
+extern int ExecutorLimit(int limit);
extern void Async_Unlisten(char *relname, int pid);
int
query_limit(int limit)
{
- return ExecutorLimit(limit);
+ return ExecutorLimit(limit);
}
int
backend_pid()
{
- return getpid();
+ return getpid();
}
int
unlisten(char *relname)
{
- Async_Unlisten(relname, getpid());
- return 0;
+ Async_Unlisten(relname, getpid());
+ return 0;
}
int
max(int x, int y)
{
- return ((x > y) ? x : y);
+ return ((x > y) ? x : y);
}
int
min(int x, int y)
{
- return ((x < y) ? x : y);
+ return ((x < y) ? x : y);
}
/* end of file */
diff --git a/contrib/miscutil/misc_utils.h b/contrib/miscutil/misc_utils.h
index 7dd583c2646..a87c71b244b 100644
--- a/contrib/miscutil/misc_utils.h
+++ b/contrib/miscutil/misc_utils.h
@@ -1,10 +1,10 @@
#ifndef MISC_UTILS_H
#define MISC_UTILS_H
-int query_limit(int limit);
-int backend_pid(void);
-int unlisten(char *relname);
-int max(int x, int y);
-int min(int x, int y);
+int query_limit(int limit);
+int backend_pid(void);
+int unlisten(char *relname);
+int max(int x, int y);
+int min(int x, int y);
#endif
diff --git a/contrib/pginterface/pginterface.c b/contrib/pginterface/pginterface.c
index 1335baa1928..3c19943c263 100644
--- a/contrib/pginterface/pginterface.c
+++ b/contrib/pginterface/pginterface.c
@@ -30,7 +30,7 @@ static int tuple;
** connectdb - returns PGconn structure
**
*/
-PGconn *
+PGconn *
connectdb(char *dbName,
char *pghost,
char *pgport,
diff --git a/contrib/sequence/set_sequence.c b/contrib/sequence/set_sequence.c
index 7468efb5fd7..713421f8226 100644
--- a/contrib/sequence/set_sequence.c
+++ b/contrib/sequence/set_sequence.c
@@ -12,30 +12,30 @@
#include "set_sequence.h"
-extern int setval(struct varlena *seqin, int4 val);
+extern int setval(struct varlena * seqin, int4 val);
int
-set_currval(struct varlena *sequence, int4 nextval)
+set_currval(struct varlena * sequence, int4 nextval)
{
- return setval(sequence, nextval);
+ return setval(sequence, nextval);
}
int
-next_id(struct varlena *sequence)
+next_id(struct varlena * sequence)
{
- return nextval(sequence);
+ return nextval(sequence);
}
int
-last_id(struct varlena *sequence)
+last_id(struct varlena * sequence)
{
- return currval(sequence);
+ return currval(sequence);
}
int
-set_last_id(struct varlena *sequence, int4 nextval)
+set_last_id(struct varlena * sequence, int4 nextval)
{
- return setval(sequence, nextval);
+ return setval(sequence, nextval);
}
/* end of file */
diff --git a/contrib/sequence/set_sequence.h b/contrib/sequence/set_sequence.h
index f5c62949663..992adcc02bc 100644
--- a/contrib/sequence/set_sequence.h
+++ b/contrib/sequence/set_sequence.h
@@ -1,9 +1,9 @@
#ifndef SET_SEQUENCE_H
#define SET_SEQUENCE_H
-int set_currval(struct varlena *sequence, int4 nextval);
-int next_id(struct varlena *sequence);
-int last_id(struct varlena *sequence);
-int set_last_id(struct varlena *sequence, int4 nextval);
+int set_currval(struct varlena * sequence, int4 nextval);
+int next_id(struct varlena * sequence);
+int last_id(struct varlena * sequence);
+int set_last_id(struct varlena * sequence, int4 nextval);
#endif
diff --git a/contrib/soundex/soundex.c b/contrib/soundex/soundex.c
index 20b99759a16..df0c8366b95 100644
--- a/contrib/soundex/soundex.c
+++ b/contrib/soundex/soundex.c
@@ -13,7 +13,7 @@
/* prototype for soundex function */
char *soundex(char *instr, char *outstr);
-text *
+text *
text_soundex(text *t)
{
/* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
@@ -47,7 +47,7 @@ text_soundex(text *t)
return (new_t);
}
-char *
+char *
soundex(char *instr, char *outstr)
{ /* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
char *table = "01230120022455012623010202";
diff --git a/contrib/spi/autoinc.c b/contrib/spi/autoinc.c
index 57ad37dbf45..c7caf3c842c 100644
--- a/contrib/spi/autoinc.c
+++ b/contrib/spi/autoinc.c
@@ -2,9 +2,9 @@
#include "executor/spi.h" /* this is what you need to work with SPI */
#include "commands/trigger.h" /* -"- and triggers */
-HeapTuple autoinc(void);
+HeapTuple autoinc(void);
-extern int4 nextval(struct varlena * seqin);
+extern int4 nextval(struct varlena * seqin);
HeapTuple
autoinc()
@@ -28,73 +28,73 @@ autoinc()
elog(ERROR, "autoinc: can't process STATEMENT events");
if (TRIGGER_FIRED_AFTER(CurrentTriggerData->tg_event))
elog(ERROR, "autoinc: must be fired before event");
-
+
if (TRIGGER_FIRED_BY_INSERT(CurrentTriggerData->tg_event))
rettuple = CurrentTriggerData->tg_trigtuple;
else if (TRIGGER_FIRED_BY_UPDATE(CurrentTriggerData->tg_event))
rettuple = CurrentTriggerData->tg_newtuple;
else
elog(ERROR, "autoinc: can't process DELETE events");
-
+
rel = CurrentTriggerData->tg_relation;
relname = SPI_getrelname(rel);
-
+
trigger = CurrentTriggerData->tg_trigger;
nargs = trigger->tgnargs;
if (nargs <= 0 || nargs % 2 != 0)
elog(ERROR, "autoinc (%s): even number gt 0 of arguments was expected", relname);
-
+
args = trigger->tgargs;
tupdesc = rel->rd_att;
-
+
CurrentTriggerData = NULL;
-
- chattrs = (int *) palloc (nargs/2 * sizeof (int));
- newvals = (Datum *) palloc (nargs/2 * sizeof (Datum));
-
- for (i = 0; i < nargs; )
+
+ chattrs = (int *) palloc(nargs / 2 * sizeof(int));
+ newvals = (Datum *) palloc(nargs / 2 * sizeof(Datum));
+
+ for (i = 0; i < nargs;)
{
- struct varlena *seqname;
- int attnum = SPI_fnumber (tupdesc, args[i]);
- int32 val;
-
- if ( attnum < 0 )
+ struct varlena *seqname;
+ int attnum = SPI_fnumber(tupdesc, args[i]);
+ int32 val;
+
+ if (attnum < 0)
elog(ERROR, "autoinc (%s): there is no attribute %s", relname, args[i]);
- if (SPI_gettypeid (tupdesc, attnum) != INT4OID)
- elog(ERROR, "autoinc (%s): attribute %s must be of INT4 type",
- relname, args[i]);
-
- val = DatumGetInt32 (SPI_getbinval (rettuple, tupdesc, attnum, &isnull));
-
+ if (SPI_gettypeid(tupdesc, attnum) != INT4OID)
+ elog(ERROR, "autoinc (%s): attribute %s must be of INT4 type",
+ relname, args[i]);
+
+ val = DatumGetInt32(SPI_getbinval(rettuple, tupdesc, attnum, &isnull));
+
if (!isnull && val != 0)
{
i += 2;
continue;
}
-
+
i++;
chattrs[chnattrs] = attnum;
- seqname = textin (args[i]);
- newvals[chnattrs] = Int32GetDatum (nextval (seqname));
- if ( DatumGetInt32 (newvals[chnattrs]) == 0 )
- newvals[chnattrs] = Int32GetDatum (nextval (seqname));
- pfree (seqname);
+ seqname = textin(args[i]);
+ newvals[chnattrs] = Int32GetDatum(nextval(seqname));
+ if (DatumGetInt32(newvals[chnattrs]) == 0)
+ newvals[chnattrs] = Int32GetDatum(nextval(seqname));
+ pfree(seqname);
chnattrs++;
i++;
}
-
+
if (chnattrs > 0)
{
- rettuple = SPI_modifytuple (rel, rettuple, chnattrs, chattrs, newvals, NULL);
- if ( rettuple == NULL )
- elog (ERROR, "autoinc (%s): %d returned by SPI_modifytuple",
- relname, SPI_result);
+ rettuple = SPI_modifytuple(rel, rettuple, chnattrs, chattrs, newvals, NULL);
+ if (rettuple == NULL)
+ elog(ERROR, "autoinc (%s): %d returned by SPI_modifytuple",
+ relname, SPI_result);
}
-
- pfree (relname);
- pfree (chattrs);
- pfree (newvals);
+
+ pfree(relname);
+ pfree(chattrs);
+ pfree(newvals);
return (rettuple);
}
diff --git a/contrib/spi/insert_username.c b/contrib/spi/insert_username.c
index cd0fdfc0bba..b53d5e40884 100644
--- a/contrib/spi/insert_username.c
+++ b/contrib/spi/insert_username.c
@@ -7,71 +7,71 @@
*/
#include "executor/spi.h" /* this is what you need to work with SPI */
-#include "commands/trigger.h" /* -"- and triggers */
+#include "commands/trigger.h" /* -"- and triggers */
#include "miscadmin.h" /* for GetPgUserName() */
-HeapTuple insert_username (void);
+HeapTuple insert_username(void);
HeapTuple
-insert_username ()
+insert_username()
{
- Trigger *trigger; /* to get trigger name */
+ Trigger *trigger; /* to get trigger name */
int nargs; /* # of arguments */
Datum newval; /* new value of column */
- char **args; /* arguments */
- char *relname; /* triggered relation name */
+ char **args; /* arguments */
+ char *relname; /* triggered relation name */
Relation rel; /* triggered relation */
HeapTuple rettuple = NULL;
TupleDesc tupdesc; /* tuple description */
int attnum;
- /* sanity checks from autoinc.c */
+ /* sanity checks from autoinc.c */
if (!CurrentTriggerData)
elog(ERROR, "insert_username: triggers are not initialized");
if (TRIGGER_FIRED_FOR_STATEMENT(CurrentTriggerData->tg_event))
elog(ERROR, "insert_username: can't process STATEMENT events");
if (TRIGGER_FIRED_AFTER(CurrentTriggerData->tg_event))
elog(ERROR, "insert_username: must be fired before event");
-
+
if (TRIGGER_FIRED_BY_INSERT(CurrentTriggerData->tg_event))
rettuple = CurrentTriggerData->tg_trigtuple;
else if (TRIGGER_FIRED_BY_UPDATE(CurrentTriggerData->tg_event))
rettuple = CurrentTriggerData->tg_newtuple;
else
elog(ERROR, "insert_username: can't process DELETE events");
-
+
rel = CurrentTriggerData->tg_relation;
relname = SPI_getrelname(rel);
-
+
trigger = CurrentTriggerData->tg_trigger;
nargs = trigger->tgnargs;
if (nargs != 1)
elog(ERROR, "insert_username (%s): one argument was expected", relname);
-
+
args = trigger->tgargs;
tupdesc = rel->rd_att;
-
+
CurrentTriggerData = NULL;
-
- attnum = SPI_fnumber (tupdesc, args[0]);
-
- if ( attnum < 0 )
+
+ attnum = SPI_fnumber(tupdesc, args[0]);
+
+ if (attnum < 0)
elog(ERROR, "insert_username (%s): there is no attribute %s", relname, args[0]);
- if (SPI_gettypeid (tupdesc, attnum) != TEXTOID)
- elog(ERROR, "insert_username (%s): attribute %s must be of TEXT type",
- relname, args[0]);
-
- /* create fields containing name */
- newval = PointerGetDatum (textin (GetPgUserName ()));
-
- /* construct new tuple */
- rettuple = SPI_modifytuple (rel, rettuple, 1, &attnum, &newval, NULL);
- if ( rettuple == NULL )
- elog (ERROR, "insert_username (%s): %d returned by SPI_modifytuple",
- relname, SPI_result);
-
- pfree (relname);
+ if (SPI_gettypeid(tupdesc, attnum) != TEXTOID)
+ elog(ERROR, "insert_username (%s): attribute %s must be of TEXT type",
+ relname, args[0]);
+
+ /* create fields containing name */
+ newval = PointerGetDatum(textin(GetPgUserName()));
+
+ /* construct new tuple */
+ rettuple = SPI_modifytuple(rel, rettuple, 1, &attnum, &newval, NULL);
+ if (rettuple == NULL)
+ elog(ERROR, "insert_username (%s): %d returned by SPI_modifytuple",
+ relname, SPI_result);
+
+ pfree(relname);
return (rettuple);
}
diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c
index 5fc9bfa4ce6..954e12c5905 100644
--- a/contrib/spi/refint.c
+++ b/contrib/spi/refint.c
@@ -190,7 +190,7 @@ check_primary_key()
* Ok, execute prepared plan.
*/
ret = SPI_execp(*(plan->splan), kvals, NULL, 1);
- /* we have no NULLs - so we pass ^^^^ here */
+ /* we have no NULLs - so we pass ^^^^ here */
if (ret < 0)
elog(ERROR, "check_primary_key: SPI_execp returned %d", ret);
@@ -481,7 +481,7 @@ check_foreign_key()
relname = args[0];
ret = SPI_execp(plan->splan[r], kvals, NULL, tcount);
- /* we have no NULLs - so we pass ^^^^ here */
+ /* we have no NULLs - so we pass ^^^^ here */
if (ret < 0)
elog(ERROR, "check_foreign_key: SPI_execp returned %d", ret);
diff --git a/contrib/spi/timetravel.c b/contrib/spi/timetravel.c
index 270095acbff..89d3f13e41f 100644
--- a/contrib/spi/timetravel.c
+++ b/contrib/spi/timetravel.c
@@ -9,38 +9,38 @@
#define ABSTIMEOID 702 /* it should be in pg_type.h */
-AbsoluteTime currabstime(void);
-HeapTuple timetravel(void);
-int32 set_timetravel(Name relname, int32 on);
+AbsoluteTime currabstime(void);
+HeapTuple timetravel(void);
+int32 set_timetravel(Name relname, int32 on);
typedef struct
{
- char *ident;
- void *splan;
-} EPlan;
+ char *ident;
+ void *splan;
+} EPlan;
static EPlan *Plans = NULL; /* for UPDATE/DELETE */
static int nPlans = 0;
-static char **TTOff = NULL;
-static int nTTOff = 0;
+static char **TTOff = NULL;
+static int nTTOff = 0;
static EPlan *find_plan(char *ident, EPlan ** eplan, int *nplans);
/*
- * timetravel () --
- * 1. IF an update affects tuple with stop_date eq INFINITY
- * then form (and return) new tuple with stop_date eq current date
- * and all other column values as in old tuple, and insert tuple
- * with new data and start_date eq current date and
- * stop_date eq INFINITY
- * ELSE - skip updation of tuple.
- * 2. IF an delete affects tuple with stop_date eq INFINITY
- * then insert the same tuple with stop_date eq current date
- * ELSE - skip deletion of tuple.
- * 3. On INSERT, if start_date is NULL then current date will be
- * inserted, if stop_date is NULL then INFINITY will be inserted.
- *
+ * timetravel () --
+ * 1. IF an update affects tuple with stop_date eq INFINITY
+ * then form (and return) new tuple with stop_date eq current date
+ * and all other column values as in old tuple, and insert tuple
+ * with new data and start_date eq current date and
+ * stop_date eq INFINITY
+ * ELSE - skip updation of tuple.
+ * 2. IF an delete affects tuple with stop_date eq INFINITY
+ * then insert the same tuple with stop_date eq current date
+ * ELSE - skip deletion of tuple.
+ * 3. On INSERT, if start_date is NULL then current date will be
+ * inserted, if stop_date is NULL then INFINITY will be inserted.
+ *
* In CREATE TRIGGER you are to specify start_date and stop_date column
* names:
* EXECUTE PROCEDURE
@@ -53,8 +53,10 @@ timetravel()
Trigger *trigger; /* to get trigger name */
char **args; /* arguments */
int attnum[2]; /* fnumbers of start/stop columns */
- Datum oldon, oldoff;
- Datum newon, newoff;
+ Datum oldon,
+ oldoff;
+ Datum newon,
+ newoff;
Datum *cvals; /* column values */
char *cnulls; /* column nulls */
char *relname; /* triggered relation name */
@@ -78,11 +80,11 @@ timetravel()
/* Called by trigger manager ? */
if (!CurrentTriggerData)
elog(ERROR, "timetravel: triggers are not initialized");
-
+
/* Should be called for ROW trigger */
if (TRIGGER_FIRED_FOR_STATEMENT(CurrentTriggerData->tg_event))
elog(ERROR, "timetravel: can't process STATEMENT events");
-
+
/* Should be called BEFORE */
if (TRIGGER_FIRED_AFTER(CurrentTriggerData->tg_event))
elog(ERROR, "timetravel: must be fired before event");
@@ -90,196 +92,197 @@ timetravel()
/* INSERT ? */
if (TRIGGER_FIRED_BY_INSERT(CurrentTriggerData->tg_event))
isinsert = true;
-
+
if (TRIGGER_FIRED_BY_UPDATE(CurrentTriggerData->tg_event))
newtuple = CurrentTriggerData->tg_newtuple;
-
+
trigtuple = CurrentTriggerData->tg_trigtuple;
-
+
rel = CurrentTriggerData->tg_relation;
relname = SPI_getrelname(rel);
-
+
/* check if TT is OFF for this relation */
for (i = 0; i < nTTOff; i++)
- if (strcasecmp (TTOff[i], relname) == 0)
+ if (strcasecmp(TTOff[i], relname) == 0)
break;
if (i < nTTOff) /* OFF - nothing to do */
{
- pfree (relname);
+ pfree(relname);
return ((newtuple != NULL) ? newtuple : trigtuple);
}
-
+
trigger = CurrentTriggerData->tg_trigger;
if (trigger->tgnargs != 2)
- elog(ERROR, "timetravel (%s): invalid (!= 2) number of arguments %d",
- relname, trigger->tgnargs);
-
+ elog(ERROR, "timetravel (%s): invalid (!= 2) number of arguments %d",
+ relname, trigger->tgnargs);
+
args = trigger->tgargs;
tupdesc = rel->rd_att;
natts = tupdesc->natts;
-
+
/*
* Setting CurrentTriggerData to NULL prevents direct calls to trigger
* functions in queries. Normally, trigger functions have to be called
* by trigger manager code only.
*/
CurrentTriggerData = NULL;
-
- for (i = 0; i < 2; i++ )
+
+ for (i = 0; i < 2; i++)
{
- attnum[i] = SPI_fnumber (tupdesc, args[i]);
- if ( attnum[i] < 0 )
+ attnum[i] = SPI_fnumber(tupdesc, args[i]);
+ if (attnum[i] < 0)
elog(ERROR, "timetravel (%s): there is no attribute %s", relname, args[i]);
- if (SPI_gettypeid (tupdesc, attnum[i]) != ABSTIMEOID)
- elog(ERROR, "timetravel (%s): attributes %s and %s must be of abstime type",
- relname, args[0], args[1]);
+ if (SPI_gettypeid(tupdesc, attnum[i]) != ABSTIMEOID)
+ elog(ERROR, "timetravel (%s): attributes %s and %s must be of abstime type",
+ relname, args[0], args[1]);
}
-
- if (isinsert) /* INSERT */
+
+ if (isinsert) /* INSERT */
{
- int chnattrs = 0;
- int chattrs[2];
- Datum newvals[2];
-
- oldon = SPI_getbinval (trigtuple, tupdesc, attnum[0], &isnull);
+ int chnattrs = 0;
+ int chattrs[2];
+ Datum newvals[2];
+
+ oldon = SPI_getbinval(trigtuple, tupdesc, attnum[0], &isnull);
if (isnull)
{
- newvals[chnattrs] = GetCurrentAbsoluteTime ();
+ newvals[chnattrs] = GetCurrentAbsoluteTime();
chattrs[chnattrs] = attnum[0];
chnattrs++;
}
-
- oldoff = SPI_getbinval (trigtuple, tupdesc, attnum[1], &isnull);
+
+ oldoff = SPI_getbinval(trigtuple, tupdesc, attnum[1], &isnull);
if (isnull)
{
- if ((chnattrs == 0 && DatumGetInt32 (oldon) >= NOEND_ABSTIME) ||
- (chnattrs > 0 && DatumGetInt32 (newvals[0]) >= NOEND_ABSTIME))
- elog (ERROR, "timetravel (%s): %s ge %s",
- relname, args[0], args[1]);
+ if ((chnattrs == 0 && DatumGetInt32(oldon) >= NOEND_ABSTIME) ||
+ (chnattrs > 0 && DatumGetInt32(newvals[0]) >= NOEND_ABSTIME))
+ elog(ERROR, "timetravel (%s): %s ge %s",
+ relname, args[0], args[1]);
newvals[chnattrs] = NOEND_ABSTIME;
chattrs[chnattrs] = attnum[1];
chnattrs++;
}
else
{
- if ((chnattrs == 0 && DatumGetInt32 (oldon) >=
- DatumGetInt32 (oldoff)) ||
- (chnattrs > 0 && DatumGetInt32 (newvals[0]) >=
- DatumGetInt32 (oldoff)))
- elog (ERROR, "timetravel (%s): %s ge %s",
- relname, args[0], args[1]);
+ if ((chnattrs == 0 && DatumGetInt32(oldon) >=
+ DatumGetInt32(oldoff)) ||
+ (chnattrs > 0 && DatumGetInt32(newvals[0]) >=
+ DatumGetInt32(oldoff)))
+ elog(ERROR, "timetravel (%s): %s ge %s",
+ relname, args[0], args[1]);
}
-
- pfree (relname);
- if ( chnattrs <= 0 )
+
+ pfree(relname);
+ if (chnattrs <= 0)
return (trigtuple);
-
- rettuple = SPI_modifytuple (rel, trigtuple, chnattrs,
- chattrs, newvals, NULL);
+
+ rettuple = SPI_modifytuple(rel, trigtuple, chnattrs,
+ chattrs, newvals, NULL);
return (rettuple);
}
-
- oldon = SPI_getbinval (trigtuple, tupdesc, attnum[0], &isnull);
+
+ oldon = SPI_getbinval(trigtuple, tupdesc, attnum[0], &isnull);
if (isnull)
elog(ERROR, "timetravel (%s): %s must be NOT NULL", relname, args[0]);
-
- oldoff = SPI_getbinval (trigtuple, tupdesc, attnum[1], &isnull);
+
+ oldoff = SPI_getbinval(trigtuple, tupdesc, attnum[1], &isnull);
if (isnull)
elog(ERROR, "timetravel (%s): %s must be NOT NULL", relname, args[1]);
+
/*
- * If DELETE/UPDATE of tuple with stop_date neq INFINITY
- * then say upper Executor to skip operation for this tuple
+ * If DELETE/UPDATE of tuple with stop_date neq INFINITY then say
+ * upper Executor to skip operation for this tuple
*/
- if (newtuple != NULL) /* UPDATE */
+ if (newtuple != NULL) /* UPDATE */
{
- newon = SPI_getbinval (newtuple, tupdesc, attnum[0], &isnull);
+ newon = SPI_getbinval(newtuple, tupdesc, attnum[0], &isnull);
if (isnull)
elog(ERROR, "timetravel (%s): %s must be NOT NULL", relname, args[0]);
- newoff = SPI_getbinval (newtuple, tupdesc, attnum[1], &isnull);
+ newoff = SPI_getbinval(newtuple, tupdesc, attnum[1], &isnull);
if (isnull)
elog(ERROR, "timetravel (%s): %s must be NOT NULL", relname, args[1]);
-
- if ( oldon != newon || oldoff != newoff )
- elog (ERROR, "timetravel (%s): you can't change %s and/or %s columns (use set_timetravel)",
- relname, args[0], args[1]);
-
- if ( newoff != NOEND_ABSTIME )
+
+ if (oldon != newon || oldoff != newoff)
+ elog(ERROR, "timetravel (%s): you can't change %s and/or %s columns (use set_timetravel)",
+ relname, args[0], args[1]);
+
+ if (newoff != NOEND_ABSTIME)
{
- pfree (relname); /* allocated in upper executor context */
+ pfree(relname); /* allocated in upper executor context */
return (NULL);
}
}
- else if (oldoff != NOEND_ABSTIME) /* DELETE */
+ else if (oldoff != NOEND_ABSTIME) /* DELETE */
{
- pfree (relname);
+ pfree(relname);
return (NULL);
}
-
- newoff = GetCurrentAbsoluteTime ();
-
+
+ newoff = GetCurrentAbsoluteTime();
+
/* Connect to SPI manager */
if ((ret = SPI_connect()) < 0)
elog(ERROR, "timetravel (%s): SPI_connect returned %d", relname, ret);
-
+
/* Fetch tuple values and nulls */
- cvals = (Datum *) palloc (natts * sizeof (Datum));
- cnulls = (char *) palloc (natts * sizeof (char));
+ cvals = (Datum *) palloc(natts * sizeof(Datum));
+ cnulls = (char *) palloc(natts * sizeof(char));
for (i = 0; i < natts; i++)
{
- cvals[i] = SPI_getbinval ((newtuple != NULL) ? newtuple : trigtuple,
- tupdesc, i + 1, &isnull);
+ cvals[i] = SPI_getbinval((newtuple != NULL) ? newtuple : trigtuple,
+ tupdesc, i + 1, &isnull);
cnulls[i] = (isnull) ? 'n' : ' ';
}
-
+
/* change date column(s) */
- if (newtuple) /* UPDATE */
+ if (newtuple) /* UPDATE */
{
- cvals[attnum[0] - 1] = newoff; /* start_date eq current date */
+ cvals[attnum[0] - 1] = newoff; /* start_date eq current date */
cnulls[attnum[0] - 1] = ' ';
cvals[attnum[1] - 1] = NOEND_ABSTIME; /* stop_date eq INFINITY */
cnulls[attnum[1] - 1] = ' ';
}
- else /* DELETE */
+ else
+/* DELETE */
{
- cvals[attnum[1] - 1] = newoff; /* stop_date eq current date */
+ cvals[attnum[1] - 1] = newoff; /* stop_date eq current date */
cnulls[attnum[1] - 1] = ' ';
}
-
+
/*
- * Construct ident string as TriggerName $ TriggeredRelationId
- * and try to find prepared execution plan.
+ * Construct ident string as TriggerName $ TriggeredRelationId and try
+ * to find prepared execution plan.
*/
sprintf(ident, "%s$%u", trigger->tgname, rel->rd_id);
plan = find_plan(ident, &Plans, &nPlans);
-
+
/* if there is no plan ... */
if (plan->splan == NULL)
{
void *pplan;
Oid *ctypes;
char sql[8192];
-
+
/* allocate ctypes for preparation */
ctypes = (Oid *) palloc(natts * sizeof(Oid));
-
+
/*
- * Construct query:
- * INSERT INTO _relation_ VALUES ($1, ...)
+ * Construct query: INSERT INTO _relation_ VALUES ($1, ...)
*/
sprintf(sql, "INSERT INTO %s VALUES (", relname);
for (i = 1; i <= natts; i++)
{
sprintf(sql + strlen(sql), "$%d%s",
- i, (i < natts) ? ", " : ")");
+ i, (i < natts) ? ", " : ")");
ctypes[i - 1] = SPI_gettypeid(tupdesc, i);
}
-
+
/* Prepare plan for query */
pplan = SPI_prepare(sql, natts, ctypes);
if (pplan == NULL)
elog(ERROR, "timetravel (%s): SPI_prepare returned %d", relname, SPI_result);
-
+
/*
* Remember that SPI_prepare places plan in current memory context
* - so, we have to save plan in Top memory context for latter
@@ -288,101 +291,103 @@ timetravel()
pplan = SPI_saveplan(pplan);
if (pplan == NULL)
elog(ERROR, "timetravel (%s): SPI_saveplan returned %d", relname, SPI_result);
-
+
plan->splan = pplan;
}
-
+
/*
* Ok, execute prepared plan.
*/
ret = SPI_execp(plan->splan, cvals, cnulls, 0);
-
+
if (ret < 0)
elog(ERROR, "timetravel (%s): SPI_execp returned %d", relname, ret);
-
+
/* Tuple to return to upper Executor ... */
- if (newtuple) /* UPDATE */
+ if (newtuple) /* UPDATE */
{
HeapTuple tmptuple;
-
- tmptuple = SPI_copytuple (trigtuple);
- rettuple = SPI_modifytuple (rel, tmptuple, 1, &(attnum[1]), &newoff, NULL);
+
+ tmptuple = SPI_copytuple(trigtuple);
+ rettuple = SPI_modifytuple(rel, tmptuple, 1, &(attnum[1]), &newoff, NULL);
+
/*
* SPI_copytuple allocates tmptuple in upper executor context -
* have to free allocation using SPI_pfree
*/
- SPI_pfree (tmptuple);
+ SPI_pfree(tmptuple);
}
- else /* DELETE */
+ else
+/* DELETE */
rettuple = trigtuple;
-
- SPI_finish(); /* don't forget say Bye to SPI mgr */
-
- pfree (relname);
+
+ SPI_finish(); /* don't forget say Bye to SPI mgr */
+
+ pfree(relname);
return (rettuple);
}
/*
* set_timetravel () --
- * turn timetravel for specified relation ON/OFF
+ * turn timetravel for specified relation ON/OFF
*/
int32
set_timetravel(Name relname, int32 on)
{
- char *rname;
- char *d;
- char *s;
- int i;
-
+ char *rname;
+ char *d;
+ char *s;
+ int i;
+
for (i = 0; i < nTTOff; i++)
- if (namestrcmp (relname, TTOff[i]) == 0)
+ if (namestrcmp(relname, TTOff[i]) == 0)
break;
-
+
if (i < nTTOff) /* OFF currently */
{
if (on == 0)
return (0);
-
+
/* turn ON */
- free (TTOff[i]);
+ free(TTOff[i]);
if (nTTOff == 1)
- free (TTOff);
+ free(TTOff);
else
{
if (i < nTTOff - 1)
- memcpy (&(TTOff[i]), &(TTOff[i + 1]), (nTTOff - i) * sizeof (char*));
- TTOff = realloc (TTOff, (nTTOff - 1) * sizeof (char*));
+ memcpy(&(TTOff[i]), &(TTOff[i + 1]), (nTTOff - i) * sizeof(char *));
+ TTOff = realloc(TTOff, (nTTOff - 1) * sizeof(char *));
}
nTTOff--;
return (0);
}
-
+
/* ON currently */
if (on != 0)
return (1);
-
+
/* turn OFF */
if (nTTOff == 0)
- TTOff = malloc (sizeof (char*));
+ TTOff = malloc(sizeof(char *));
else
- TTOff = realloc (TTOff, (nTTOff + 1) * sizeof (char*));
- s = rname = nameout (relname);
- d = TTOff[nTTOff] = malloc (strlen (rname) + 1);
+ TTOff = realloc(TTOff, (nTTOff + 1) * sizeof(char *));
+ s = rname = nameout(relname);
+ d = TTOff[nTTOff] = malloc(strlen(rname) + 1);
while (*s)
- *d++ = tolower (*s++);
+ *d++ = tolower(*s++);
*d = 0;
- pfree (rname);
+ pfree(rname);
nTTOff++;
-
+
return (1);
}
AbsoluteTime
-currabstime ()
+currabstime()
{
- return (GetCurrentAbsoluteTime ());
+ return (GetCurrentAbsoluteTime());
}
static EPlan *
diff --git a/contrib/string/string_io.c b/contrib/string/string_io.c
index 5dd6346b56f..48deefd653b 100644
--- a/contrib/string/string_io.c
+++ b/contrib/string/string_io.c
@@ -20,13 +20,13 @@
#define ISO8859
#define MIN(x, y) ((x) < (y) ? (x) : (y))
-#define VALUE(char) ((char) - '0')
-#define DIGIT(val) ((val) + '0')
-#define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
+#define VALUE(char) ((char) - '0')
+#define DIGIT(val) ((val) + '0')
+#define ISOCTAL(c) (((c) >= '0') && ((c) <= '7'))
#ifndef ISO8859
-#define NOTPRINTABLE(c) (!isprint(c))
+#define NOTPRINTABLE(c) (!isprint(c))
#else
-#define NOTPRINTABLE(c) (!isprint(c) && ((c) < 0xa0))
+#define NOTPRINTABLE(c) (!isprint(c) && ((c) < 0xa0))
#endif
/*
@@ -50,103 +50,117 @@
char *
string_output(char *data, int size)
{
- register unsigned char c, *p, *r, *result;
- register int l, len;
+ register unsigned char c,
+ *p,
+ *r,
+ *result;
+ register int l,
+ len;
+
+ if (data == NULL)
+ {
+ result = (char *) palloc(2);
+ result[0] = '-';
+ result[1] = '\0';
+ return (result);
+ }
- if (data == NULL) {
- result = (char *) palloc(2);
- result[0] = '-';
- result[1] = '\0';
- return (result);
- }
-
- if (size < 0) {
- size = strlen(data);
- }
-
- /* adjust string length for escapes */
- len = size;
- for (p=data,l=size; l>0; p++,l--) {
- 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;
- }
+ if (size < 0)
+ {
+ size = strlen(data);
+ }
+
+ /* adjust string length for escapes */
+ len = size;
+ for (p = data, l = size; l > 0; p++, l--)
+ {
+ 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;
+ }
+ }
}
- }
- len++;
-
- result = (char *) palloc(len);
-
- for (p=data,r=result,l=size; (l > 0) && (c = *p); p++,l--) {
- 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 {
- *r++ = c;
- }
+ len++;
+
+ result = (char *) palloc(len);
+
+ for (p = data, r = result, l = size; (l > 0) && (c = *p); p++, l--)
+ {
+ 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
+ {
+ *r++ = c;
+ }
+ }
}
- }
- *r = '\0';
+ *r = '\0';
- return((char *) result);
+ return ((char *) result);
}
/*
* string_input() --
*
- * This function accepts a C string in input and copies it into a new
+ * This function accepts a C string in input and copies it into a new
* object allocated with palloc() translating all escape sequences.
* An optional header can be allocatd before the string, for example
* to hold the length of a varlena object.
@@ -172,136 +186,155 @@ string_output(char *data, int size)
char *
string_input(char *str, int size, int hdrsize, int *rtn_size)
{
- register unsigned char *p, *r;
- unsigned char *result;
- int len;
-
- if ((str == NULL) || (hdrsize < 0)) {
- return (char *) NULL;
- }
-
- /* Compute result size */
- len = strlen(str);
- for (p=str; *p; ) {
- if (*p++ == '\\') {
- if (ISOCTAL(*p)) {
- if (ISOCTAL(*(p+1))) {
- p++;
- len--;
- }
- if (ISOCTAL(*(p+1))) {
- p++;
- len--;
+ register unsigned char *p,
+ *r;
+ unsigned char *result;
+ int len;
+
+ if ((str == NULL) || (hdrsize < 0))
+ {
+ return (char *) NULL;
+ }
+
+ /* Compute result size */
+ len = strlen(str);
+ for (p = str; *p;)
+ {
+ if (*p++ == '\\')
+ {
+ if (ISOCTAL(*p))
+ {
+ if (ISOCTAL(*(p + 1)))
+ {
+ p++;
+ len--;
+ }
+ if (ISOCTAL(*(p + 1)))
+ {
+ p++;
+ len--;
+ }
+ }
+ if (*p)
+ p++;
+ len--;
}
- }
- if (*p) p++;
- len--;
}
- }
-
- /* result has variable length */
- if (size == 0) {
- size = len+1;
- } else
-
- /* result has variable length with maximum size */
- if (size < 0) {
- size = MIN(len, - size)+1;
- }
-
- result = (char *) palloc(hdrsize+size);
- memset(result, 0, hdrsize+size);
- if (rtn_size) {
- *rtn_size = size;
- }
-
- r = result + hdrsize;
- for (p=str; *p; ) {
- register unsigned char c;
- if ((c = *p++) == '\\') {
- 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++);
+
+ /* result has variable length */
+ if (size == 0)
+ {
+ size = len + 1;
+ }
+ else
+ /* result has variable length with maximum size */
+ if (size < 0)
+ {
+ size = MIN(len, -size) + 1;
+ }
+
+ result = (char *) palloc(hdrsize + size);
+ memset(result, 0, hdrsize + size);
+ if (rtn_size)
+ {
+ *rtn_size = size;
+ }
+
+ r = result + hdrsize;
+ for (p = str; *p;)
+ {
+ register unsigned char c;
+
+ if ((c = *p++) == '\\')
+ {
+ 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;
+ }
}
- if (isdigit(*p)) {
- c = (c<<3) + VALUE(*p++);
+ else
+ {
+ *r++ = c;
}
- *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 {
- *r++ = c;
}
- }
- return((char *) result);
+ return ((char *) result);
}
char *
c_charout(int32 c)
{
- char str[2];
+ char str[2];
- str[0] = (char) c;
- str[1] = '\0';
+ str[0] = (char) c;
+ str[1] = '\0';
- return (string_output(str, 1));
+ return (string_output(str, 1));
}
char *
c_char2out(uint16 s)
{
- return (string_output((char *) &s, 2));
+ return (string_output((char *) &s, 2));
}
char *
c_char4out(uint32 s)
{
- return (string_output((char *) &s, 4));
+ return (string_output((char *) &s, 4));
}
char *
c_char8out(char *s)
{
- return (string_output(s, 8));
+ return (string_output(s, 8));
}
char *
c_char16out(char *s)
{
- return (string_output(s, 16));
+ return (string_output(s, 16));
}
/*
@@ -309,16 +342,17 @@ c_char16out(char *s)
*/
char *
-c_textout(struct varlena *vlena)
+c_textout(struct varlena * vlena)
{
- int len = 0;
- char *s = NULL;
-
- if (vlena) {
- len = VARSIZE(vlena) - VARHDRSZ;
- s = VARDATA(vlena);
- }
- return (string_output(s, len));
+ int len = 0;
+ char *s = NULL;
+
+ if (vlena)
+ {
+ len = VARSIZE(vlena) - VARHDRSZ;
+ s = VARDATA(vlena);
+ }
+ return (string_output(s, len));
}
/*
@@ -328,37 +362,40 @@ c_textout(struct varlena *vlena)
char *
c_varcharout(char *s)
{
- int len = 0;
+ int len = 0;
- if (s) {
- len = *(int32*)s - 4;
- s += 4;
- }
- return (string_output(s, len));
+ if (s)
+ {
+ len = *(int32 *) s - 4;
+ s += 4;
+ }
+ return (string_output(s, len));
}
#if 0
struct varlena *
c_textin(char *str)
{
- struct varlena *result;
- int len;
+ struct varlena *result;
+ int len;
- if (str == NULL) {
- return ((struct varlena *) NULL);
- }
+ if (str == NULL)
+ {
+ return ((struct varlena *) NULL);
+ }
- result = (struct varlena *) string_input(str, 0, VARHDRSZ, &len);
- VARSIZE(result) = len;
+ result = (struct varlena *) string_input(str, 0, VARHDRSZ, &len);
+ VARSIZE(result) = len;
- return (result);
+ return (result);
}
char *
c_char16in(char *str)
{
- return (string_input(str, 16, 0, NULL));
+ return (string_input(str, 16, 0, NULL));
}
+
#endif
diff --git a/contrib/string/string_io.h b/contrib/string/string_io.h
index 974f1f42623..b2af60f62c0 100644
--- a/contrib/string/string_io.h
+++ b/contrib/string/string_io.h
@@ -1,19 +1,20 @@
#ifndef STRING_IO_H
#define STRING_IO_H
-char *string_output(char *data, int size);
-char *string_input(char *str, int size, int hdrsize, int *rtn_size);
-char *c_charout(int32 c);
-char *c_char2out(uint16 s);
-char *c_char4out(uint32 s);
-char *c_char8out(char *s);
-char *c_char16out(char *s);
-char *c_textout(struct varlena *vlena);
-char *c_varcharout(char *s);
+char *string_output(char *data, int size);
+char *string_input(char *str, int size, int hdrsize, int *rtn_size);
+char *c_charout(int32 c);
+char *c_char2out(uint16 s);
+char *c_char4out(uint32 s);
+char *c_char8out(char *s);
+char *c_char16out(char *s);
+char *c_textout(struct varlena * vlena);
+char *c_varcharout(char *s);
#if 0
struct varlena *c_textin(char *str);
-char *c_char16in(char *str);
+char *c_char16in(char *str);
+
#endif
#endif
diff --git a/contrib/userlock/user_locks.c b/contrib/userlock/user_locks.c
index efc9b0a4644..fe8abcac0cf 100644
--- a/contrib/userlock/user_locks.c
+++ b/contrib/userlock/user_locks.c
@@ -22,79 +22,80 @@
#include "user_locks.h"
-#define USER_LOCKS_TABLE_ID 0
+#define USER_LOCKS_TABLE_ID 0
-extern Oid MyDatabaseId;
+extern Oid MyDatabaseId;
int
user_lock(unsigned int id1, unsigned int id2, LOCKT lockt)
{
- LOCKTAG tag;
+ LOCKTAG tag;
- memset(&tag,0,sizeof(LOCKTAG));
- tag.relId = 0;
- tag.dbId = MyDatabaseId;
- tag.tupleId.ip_blkid.bi_hi = id2 >> 16;
- tag.tupleId.ip_blkid.bi_lo = id2 & 0xffff;
- tag.tupleId.ip_posid = (unsigned short) (id1 & 0xffff);
+ memset(&tag, 0, sizeof(LOCKTAG));
+ tag.relId = 0;
+ tag.dbId = MyDatabaseId;
+ tag.tupleId.ip_blkid.bi_hi = id2 >> 16;
+ tag.tupleId.ip_blkid.bi_lo = id2 & 0xffff;
+ tag.tupleId.ip_posid = (unsigned short) (id1 & 0xffff);
- return LockAcquire(USER_LOCKS_TABLE_ID, &tag, lockt);
+ return LockAcquire(USER_LOCKS_TABLE_ID, &tag, lockt);
}
int
user_unlock(unsigned int id1, unsigned int id2, LOCKT lockt)
{
- LOCKTAG tag;
-
- memset(&tag, 0,sizeof(LOCKTAG));
- tag.relId = 0;
- tag.dbId = MyDatabaseId;
- tag.tupleId.ip_blkid.bi_hi = id2 >> 16;
- tag.tupleId.ip_blkid.bi_lo = id2 & 0xffff;
- tag.tupleId.ip_posid = (unsigned short) (id1 & 0xffff);
-
- return LockRelease(USER_LOCKS_TABLE_ID, &tag, lockt);
+ LOCKTAG tag;
+
+ memset(&tag, 0, sizeof(LOCKTAG));
+ tag.relId = 0;
+ tag.dbId = MyDatabaseId;
+ tag.tupleId.ip_blkid.bi_hi = id2 >> 16;
+ tag.tupleId.ip_blkid.bi_lo = id2 & 0xffff;
+ tag.tupleId.ip_posid = (unsigned short) (id1 & 0xffff);
+
+ return LockRelease(USER_LOCKS_TABLE_ID, &tag, lockt);
}
int
user_write_lock(unsigned int id1, unsigned int id2)
{
- return user_lock(id1, id2, WRITE_LOCK);
+ return user_lock(id1, id2, WRITE_LOCK);
}
int
user_write_unlock(unsigned int id1, unsigned int id2)
{
- return user_unlock(id1, id2, WRITE_LOCK);
+ return user_unlock(id1, id2, WRITE_LOCK);
}
int
user_write_lock_oid(Oid oid)
{
- return user_lock(0, oid, WRITE_LOCK);
+ return user_lock(0, oid, WRITE_LOCK);
}
int
user_write_unlock_oid(Oid oid)
{
- return user_unlock(0, oid, WRITE_LOCK);
+ return user_unlock(0, oid, WRITE_LOCK);
}
int
user_unlock_all()
{
- PROC *proc;
- SHMEM_OFFSET location;
-
- ShmemPIDLookup(getpid(),&location);
- if (location == INVALID_OFFSET) {
- elog(NOTICE, "UserUnlockAll: unable to get proc ptr");
- return -1;
- }
-
- proc = (PROC *) MAKE_PTR(location);
- return LockReleaseAll(USER_LOCKS_TABLE_ID, &proc->lockQueue);
+ PROC *proc;
+ SHMEM_OFFSET location;
+
+ ShmemPIDLookup(getpid(), &location);
+ if (location == INVALID_OFFSET)
+ {
+ elog(NOTICE, "UserUnlockAll: unable to get proc ptr");
+ return -1;
+ }
+
+ proc = (PROC *) MAKE_PTR(location);
+ return LockReleaseAll(USER_LOCKS_TABLE_ID, &proc->lockQueue);
}
/* end of file */
diff --git a/contrib/userlock/user_locks.h b/contrib/userlock/user_locks.h
index ab890483fa4..7f315564031 100644
--- a/contrib/userlock/user_locks.h
+++ b/contrib/userlock/user_locks.h
@@ -1,12 +1,12 @@
#ifndef USER_LOCKS_H
#define USER_LOCKS_H
-int user_lock(unsigned int id1, unsigned int id2, LOCKT lockt);
-int user_unlock(unsigned int id1, unsigned int id2, LOCKT lockt);
-int user_write_lock(unsigned int id1, unsigned int id2);
-int user_write_unlock(unsigned int id1, unsigned int id2);
-int user_write_lock_oid(Oid oid);
-int user_write_unlock_oid(Oid oid);
-int user_unlock_all(void);
+int user_lock(unsigned int id1, unsigned int id2, LOCKT lockt);
+int user_unlock(unsigned int id1, unsigned int id2, LOCKT lockt);
+int user_write_lock(unsigned int id1, unsigned int id2);
+int user_write_unlock(unsigned int id1, unsigned int id2);
+int user_write_lock_oid(Oid oid);
+int user_write_unlock_oid(Oid oid);
+int user_unlock_all(void);
#endif
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index 37c9b62874c..ded94d0d8a3 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.36 1998/02/11 19:09:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.37 1998/02/26 04:29:15 momjian Exp $
*
* NOTES
* The old interface functions have been converted to macros
@@ -34,14 +34,14 @@
#endif
/* Used by heap_getattr() macro, for speed */
-long heap_sysoffset[] = {
+long heap_sysoffset[] = {
/* Only the first one is pass-by-ref, and is handled specially in the macro */
- offsetof(HeapTupleData, t_ctid),
- offsetof(HeapTupleData, t_oid),
- offsetof(HeapTupleData, t_xmin),
- offsetof(HeapTupleData, t_cmin),
- offsetof(HeapTupleData, t_xmax),
- offsetof(HeapTupleData, t_cmax)
+ offsetof(HeapTupleData, t_ctid),
+ offsetof(HeapTupleData, t_oid),
+ offsetof(HeapTupleData, t_xmin),
+ offsetof(HeapTupleData, t_cmin),
+ offsetof(HeapTupleData, t_xmax),
+ offsetof(HeapTupleData, t_cmax)
};
/* ----------------------------------------------------------------
@@ -350,7 +350,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
{
switch (attnum)
{
- case SelfItemPointerAttributeNumber:
+ case SelfItemPointerAttributeNumber:
return ((Datum) &tup->t_ctid);
case ObjectIdAttributeNumber:
return ((Datum) (long) tup->t_oid);
@@ -389,16 +389,16 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
*/
Datum
nocachegetattr(HeapTuple tup,
- int attnum,
- TupleDesc tupleDesc,
- bool *isnull)
+ int attnum,
+ TupleDesc tupleDesc,
+ bool *isnull)
{
char *tp; /* ptr to att in tuple */
- bits8 *bp = tup->t_bits; /* ptr to att in tuple */
+ bits8 *bp = tup->t_bits; /* ptr to att in tuple */
int slow; /* do we have to walk nulls? */
AttributeTupleForm *att = tupleDesc->attrs;
-
+
#if IN_MACRO
/* This is handled in the macro */
Assert(attnum > 0);
@@ -430,6 +430,7 @@ nocachegetattr(HeapTuple tup,
}
else if (attnum == 0)
{
+
/*
* first attribute is always at position zero
*/
@@ -470,11 +471,11 @@ nocachegetattr(HeapTuple tup,
* ----------------
*/
{
- int i = 0; /* current offset in bp */
- int mask; /* bit in byte we're looking at */
- char n; /* current byte in bp */
- int byte,
- finalbit;
+ int i = 0; /* current offset in bp */
+ int mask; /* bit in byte we're looking at */
+ char n; /* current byte in bp */
+ int byte,
+ finalbit;
byte = attnum >> 3;
finalbit = attnum & 0x07;
@@ -486,14 +487,14 @@ nocachegetattr(HeapTuple tup,
{
/* check for nulls in any "earlier" bytes */
if ((~n) != 0)
- slow=1;
+ slow = 1;
}
else
{
/* check for nulls "before" final bit of last byte */
mask = (1 << finalbit) - 1;
if ((~n) & mask)
- slow=1;
+ slow = 1;
}
}
}
@@ -508,8 +509,8 @@ nocachegetattr(HeapTuple tup,
{
if (att[attnum]->attcacheoff != -1)
{
- return (Datum)fetchatt(&(att[attnum]),
- tp + att[attnum]->attcacheoff);
+ return (Datum) fetchatt(&(att[attnum]),
+ tp + att[attnum]->attcacheoff);
}
else if (attnum == 0)
{
@@ -517,11 +518,11 @@ nocachegetattr(HeapTuple tup,
}
else if (!HeapTupleAllFixed(tup))
{
- int j = 0;
+ int j = 0;
/*
- * In for(), we make this <= and not < because we want to
- * test if we can go past it in initializing offsets.
+ * In for(), we make this <= and not < because we want to test
+ * if we can go past it in initializing offsets.
*/
for (j = 0; j <= attnum && !slow; j++)
if (att[j]->attlen < 1 && !VARLENA_FIXED_SIZE(att[j]))
@@ -536,8 +537,8 @@ nocachegetattr(HeapTuple tup,
*/
if (!slow)
{
- int j = 1;
- long off;
+ int j = 1;
+ long off;
/*
* need to set cache for some atts
@@ -554,13 +555,14 @@ nocachegetattr(HeapTuple tup,
off = att[j - 1]->attcacheoff + att[j - 1]->atttypmod;
for (; j <= attnum ||
- /* Can we compute more? We will probably need them */
- (j < tup->t_natts &&
- att[j]->attcacheoff == -1 &&
- (HeapTupleNoNulls(tup) || !att_isnull(j, bp)) &&
- (HeapTupleAllFixed(tup)||
- att[j]->attlen > 0 || VARLENA_FIXED_SIZE(att[j]))); j++)
+ /* Can we compute more? We will probably need them */
+ (j < tup->t_natts &&
+ att[j]->attcacheoff == -1 &&
+ (HeapTupleNoNulls(tup) || !att_isnull(j, bp)) &&
+ (HeapTupleAllFixed(tup) ||
+ att[j]->attlen > 0 || VARLENA_FIXED_SIZE(att[j]))); j++)
{
+
/*
* Fix me when going to a machine with more than a four-byte
* word!
@@ -605,7 +607,7 @@ nocachegetattr(HeapTuple tup,
break;
case -1:
Assert(!VARLENA_FIXED_SIZE(att[j]) ||
- att[j]->atttypmod == VARSIZE(tp + off));
+ att[j]->atttypmod == VARSIZE(tp + off));
off += VARSIZE(tp + off);
break;
default:
@@ -618,9 +620,9 @@ nocachegetattr(HeapTuple tup,
}
else
{
- bool usecache = true;
- int off = 0;
- int i;
+ bool usecache = true;
+ int off = 0;
+ int i;
/*
* Now we know that we have to walk the tuple CAREFULLY.
@@ -665,7 +667,7 @@ nocachegetattr(HeapTuple tup,
default:
if (att[i]->attlen < sizeof(int32))
elog(ERROR,
- "nocachegetattr2: attribute %d has len %d",
+ "nocachegetattr2: attribute %d has len %d",
i, att[i]->attlen);
if (att[i]->attalign == 'd')
off = DOUBLEALIGN(off);
@@ -690,7 +692,7 @@ nocachegetattr(HeapTuple tup,
break;
case -1:
Assert(!VARLENA_FIXED_SIZE(att[i]) ||
- att[i]->atttypmod == VARSIZE(tp + off));
+ att[i]->atttypmod == VARSIZE(tp + off));
off += VARSIZE(tp + off);
if (!VARLENA_FIXED_SIZE(att[i]))
usecache = false;
@@ -965,9 +967,9 @@ heap_modifytuple(HeapTuple tuple,
* ----------------
*/
infomask = newTuple->t_infomask;
- memmove((char *) &newTuple->t_oid, /* XXX */
+ memmove((char *) &newTuple->t_oid, /* XXX */
(char *) &tuple->t_oid,
- ((char *) &tuple->t_hoff - (char *) &tuple->t_oid)); /* XXX */
+ ((char *) &tuple->t_hoff - (char *) &tuple->t_oid)); /* XXX */
newTuple->t_infomask = infomask;
newTuple->t_natts = numberOfAttributes; /* fix t_natts just in
* case */
@@ -993,7 +995,7 @@ heap_addheader(uint32 natts, /* max domain index */
int structlen, /* its length */
char *structure) /* pointer to the struct */
{
- char *tp; /* tuple data pointer */
+ char *tp; /* tuple data pointer */
HeapTuple tup;
long len;
int hoff;
@@ -1018,4 +1020,3 @@ heap_addheader(uint32 natts, /* max domain index */
return (tup);
}
-
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c
index 1ba64a251bc..521dda8d81b 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.27 1998/02/11 19:09:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.28 1998/02/26 04:29:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,7 +41,7 @@ index_formtuple(TupleDesc tupleDescriptor,
Datum value[],
char null[])
{
- char *tp; /* tuple pointer */
+ char *tp; /* tuple pointer */
IndexTuple tuple; /* return tuple */
Size size,
hoff;
@@ -133,14 +133,14 @@ index_formtuple(TupleDesc tupleDescriptor,
*/
Datum
nocache_index_getattr(IndexTuple tup,
- int attnum,
- TupleDesc tupleDesc,
- bool *isnull)
+ int attnum,
+ TupleDesc tupleDesc,
+ bool *isnull)
{
- char *tp; /* ptr to att in tuple */
- char *bp = NULL; /* ptr to att in tuple */
+ char *tp; /* ptr to att in tuple */
+ char *bp = NULL; /* ptr to att in tuple */
int slow; /* do we have to walk nulls? */
- int data_off; /* tuple data offset */
+ int data_off; /* tuple data offset */
AttributeTupleForm *att = tupleDesc->attrs;
/* ----------------
@@ -174,7 +174,7 @@ nocache_index_getattr(IndexTuple tup,
#ifdef IN_MACRO
/* This is handled in the macro */
-
+
/* first attribute is always at position zero */
if (attnum == 1)
@@ -184,8 +184,8 @@ nocache_index_getattr(IndexTuple tup,
if (att[attnum]->attcacheoff != -1)
{
return (Datum) fetchatt(&(att[attnum]),
- (char *) tup + data_off +
- att[attnum]->attcacheoff);
+ (char *) tup + data_off +
+ att[attnum]->attcacheoff);
}
#endif
@@ -206,11 +206,11 @@ nocache_index_getattr(IndexTuple tup,
* here! */
#ifdef IN_MACRO
/* This is handled in the macro */
-
+
if (att_isnull(attnum, bp))
{
*isnull = true;
- return (Datum)NULL;
+ return (Datum) NULL;
}
#endif
@@ -219,11 +219,11 @@ nocache_index_getattr(IndexTuple tup,
* ----------------
*/
{
- int i = 0; /* current offset in bp */
- int mask; /* bit in byte we're looking at */
- char n; /* current byte in bp */
- int byte,
- finalbit;
+ int i = 0; /* current offset in bp */
+ int mask; /* bit in byte we're looking at */
+ char n; /* current byte in bp */
+ int byte,
+ finalbit;
byte = attnum >> 3;
finalbit = attnum & 0x07;
@@ -235,14 +235,14 @@ nocache_index_getattr(IndexTuple tup,
{
/* check for nulls in any "earlier" bytes */
if ((~n) != 0)
- slow=1;
+ slow = 1;
}
else
{
/* check for nulls "before" final bit of last byte */
mask = (1 << finalbit) - 1;
if ((~n) & mask)
- slow=1;
+ slow = 1;
}
}
}
@@ -257,7 +257,7 @@ nocache_index_getattr(IndexTuple tup,
if (att[attnum]->attcacheoff != -1)
{
return (Datum) fetchatt(&(att[attnum]),
- tp + att[attnum]->attcacheoff);
+ tp + att[attnum]->attcacheoff);
}
else if (attnum == 0)
{
@@ -265,7 +265,7 @@ nocache_index_getattr(IndexTuple tup,
}
else if (!IndexTupleAllFixed(tup))
{
- int j = 0;
+ int j = 0;
for (j = 0; j < attnum && !slow; j++)
if (att[j]->attlen < 1 && !VARLENA_FIXED_SIZE(att[j]))
@@ -281,8 +281,8 @@ nocache_index_getattr(IndexTuple tup,
if (!slow)
{
- int j = 1;
- long off;
+ int j = 1;
+ long off;
/*
* need to set cache for some atts
@@ -293,13 +293,14 @@ nocache_index_getattr(IndexTuple tup,
while (att[j]->attcacheoff != -1)
j++;
- if (!VARLENA_FIXED_SIZE(att[j-1]))
+ if (!VARLENA_FIXED_SIZE(att[j - 1]))
off = att[j - 1]->attcacheoff + att[j - 1]->attlen;
else
off = att[j - 1]->attcacheoff + att[j - 1]->atttypmod;
for (; j < attnum + 1; j++)
{
+
/*
* Fix me when going to a machine with more than a four-byte
* word!
@@ -346,9 +347,9 @@ nocache_index_getattr(IndexTuple tup,
}
else
{
- bool usecache = true;
- int off = 0;
- int i;
+ bool usecache = true;
+ int off = 0;
+ int i;
/*
* Now we know that we have to walk the tuple CAREFULLY.
@@ -387,7 +388,7 @@ nocache_index_getattr(IndexTuple tup,
default:
if (att[i]->attlen < sizeof(int32))
elog(ERROR,
- "nocachegetiattr2: attribute %d has len %d",
+ "nocachegetiattr2: attribute %d has len %d",
i, att[i]->attlen);
if (att[i]->attalign == 'd')
off = DOUBLEALIGN(off);
@@ -412,7 +413,7 @@ nocache_index_getattr(IndexTuple tup,
break;
case -1:
Assert(!VARLENA_FIXED_SIZE(att[i]) ||
- att[i]->atttypmod == VARSIZE(tp + off));
+ att[i]->atttypmod == VARSIZE(tp + off));
off += VARSIZE(tp + off);
if (!VARLENA_FIXED_SIZE(att[i]))
usecache = false;
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c
index 35c812cd733..02e60c899ae 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.26 1998/02/11 19:09:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.27 1998/02/26 04:29:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -124,7 +124,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
{
outputstr = fmgr(typoutput, attr,
gettypelem(typeinfo->attrs[i]->atttypid),
- typeinfo->attrs[i]->atttypmod);
+ typeinfo->attrs[i]->atttypmod);
pq_putint(strlen(outputstr) + VARHDRSZ, VARHDRSZ);
pq_putnchar(outputstr, strlen(outputstr));
pfree(outputstr);
@@ -176,8 +176,8 @@ showatts(char *name, TupleDesc tupleDesc)
void
debugtup(HeapTuple tuple, TupleDesc typeinfo)
{
- int i;
- Datum attr;
+ int i;
+ Datum attr;
char *value;
bool isnull;
Oid typoutput;
@@ -191,7 +191,7 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo)
{
value = fmgr(typoutput, attr,
gettypelem(typeinfo->attrs[i]->atttypid),
- typeinfo->attrs[i]->atttypmod);
+ typeinfo->attrs[i]->atttypmod);
printatt((unsigned) i + 1, typeinfo->attrs[i], value);
pfree(value);
}
@@ -313,7 +313,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
pq_putnchar(DatumGetPointer(attr), len);
#ifdef IPORTAL_DEBUG
fprintf(stderr, "byref length %d data %x\n", len,
- DatumGetPointer(attr));
+ DatumGetPointer(attr));
#endif
}
}
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index be1418e701f..62d27d8cd70 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.35 1998/02/10 16:02:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.36 1998/02/26 04:29:22 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -306,7 +306,7 @@ TupleDescInitEntry(TupleDesc desc,
att->attnum = attributeNumber;
att->attnelems = attdim;
att->attisset = attisset;
-
+
att->attnotnull = false;
att->atthasdef = false;
@@ -487,7 +487,7 @@ BuildDescForRelation(List *schema, char *relname)
if (arry != NIL)
{
/* array of XXX is _XXX */
- sprintf(typename, "_%.*s", NAMEDATALEN-2,entry->typename->name);
+ sprintf(typename, "_%.*s", NAMEDATALEN - 2, entry->typename->name);
attdim = length(arry);
}
else
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index bcfe5fdfc8a..e443f393ba0 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.17 1997/11/20 23:19:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.18 1998/02/26 04:29:28 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
@@ -306,7 +306,7 @@ hashinsert(Relation rel, Datum *datum, char *nulls, ItemPointer ht_ctid, Relatio
/*
* hashgettuple() -- Get the next tuple in the scan.
*/
-char *
+char *
hashgettuple(IndexScanDesc scan, ScanDirection dir)
{
RetrieveIndexResult res;
@@ -329,7 +329,7 @@ hashgettuple(IndexScanDesc scan, ScanDirection dir)
/*
* hashbeginscan() -- start a scan on a hash index
*/
-char *
+char *
hashbeginscan(Relation rel,
bool fromEnd,
uint16 keysz,
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index eaded2cdb8f..6bb6f387181 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.26 1998/02/11 19:09:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.27 1998/02/26 04:29:31 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -654,6 +654,7 @@ heap_beginscan(Relation relation,
sdesc->rs_rd = relation;
if (nkeys)
+
/*
* we do this here instead of in initsdesc() because heap_rescan
* also calls initsdesc() and we don't want to allocate memory
@@ -1303,7 +1304,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
Page dp;
Buffer buffer;
HeapTuple tuple;
-
+
/* ----------------
* increment access statistics
* ----------------
@@ -1375,13 +1376,13 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
* ----------------
*/
HeapTupleSatisfies(lp,
- relation,
- buffer,
- (PageHeader) dp,
- false,
- 0,
- (ScanKey) NULL,
- tuple);
+ relation,
+ buffer,
+ (PageHeader) dp,
+ false,
+ 0,
+ (ScanKey) NULL,
+ tuple);
if (!tuple)
{
ReleaseBuffer(buffer);
diff --git a/src/backend/access/index/istrat.c b/src/backend/access/index/istrat.c
index 01825cc6848..b46037e7e40 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.16 1998/01/15 19:42:02 pgsql Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.17 1998/02/26 04:29:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -242,17 +242,17 @@ StrategyTermEvaluate(StrategyTerm term,
switch (operator->flags ^ entry->sk_flags)
{
case 0x0:
- tmpres = (long) FMGR_PTR2(&entry->sk_func,
+ tmpres = (long) FMGR_PTR2(&entry->sk_func,
left, right);
break;
case SK_NEGATE:
- tmpres = (long) !FMGR_PTR2(&entry->sk_func,
+ tmpres = (long) !FMGR_PTR2(&entry->sk_func,
left, right);
break;
case SK_COMMUTE:
- tmpres = (long) FMGR_PTR2(&entry->sk_func,
+ tmpres = (long) FMGR_PTR2(&entry->sk_func,
right, left);
break;
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index bf4c1bfae9d..72e0731edd3 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.24 1997/11/20 23:20:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.25 1998/02/26 04:29:44 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
@@ -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,7 +411,7 @@ 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;
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index 32bd77d8570..5729cafe71f 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.30 1998/01/15 19:42:13 pgsql Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.31 1998/02/26 04:29:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -197,12 +197,11 @@ _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
+ *
* Also, if this page is not LEAF one (and # of attrs > keysize)
- * then we can't move too.
- * - vadim 10/22/97
+ * then we can't move too. - vadim 10/22/97
*/
if (_bt_skeycmp(rel, keysz, scankey, page, hikey,
diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c
index d52d79ce52d..b6f7b337a95 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.28 1998/02/21 19:23:14 scrappy Exp $
+ * $Id: nbtsort.c,v 1.29 1998/02/26 04:29:54 momjian Exp $
*
* NOTES
*
@@ -553,7 +553,7 @@ _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));
diff --git a/src/backend/access/rtree/rtproc.c b/src/backend/access/rtree/rtproc.c
index af46780446b..e9b52ead239 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.15 1998/01/07 21:02:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.16 1998/02/26 04:30:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,7 +39,7 @@ rt_box_union(BOX *a, BOX *b)
return (n);
}
-BOX *
+BOX *
rt_box_inter(BOX *a, BOX *b)
{
BOX *n;
diff --git a/src/backend/access/rtree/rtree.c b/src/backend/access/rtree/rtree.c
index af401accd68..4968162f761 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.22 1998/01/15 19:42:19 pgsql Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.23 1998/02/26 04:30:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -956,7 +956,7 @@ freestack(RTSTACK *s)
}
}
-char *
+char *
rtdelete(Relation r, ItemPointer tid)
{
BlockNumber blkno;
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index e864a2ead33..5beaa125be4 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.16 1998/01/07 21:02:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.17 1998/02/26 04:30:18 momjian Exp $
*
* NOTES
* This file contains the high level access-method interface to the
@@ -47,8 +47,8 @@ Relation VariableRelation = (Relation) NULL;
* global variables holding cached transaction id's and statuses.
* ----------------
*/
-TransactionId cachedTestXid;
-XidStatus cachedTestXidStatus;
+TransactionId cachedTestXid;
+XidStatus cachedTestXidStatus;
/* ----------------
* transaction system constants
@@ -416,14 +416,14 @@ InitializeTransactionLog(void)
VariableRelation = heap_openr(VariableRelationName);
/* ----------------
* XXX TransactionLogUpdate requires that LogRelation
- * is valid so we temporarily set it so we can initialize
+ * is valid so we temporarily set it so we can initialize
* things properly. This could be done cleaner.
* ----------------
*/
LogRelation = logRelation;
/* ----------------
- * if we have a virgin database, we initialize the log
+ * if we have a virgin database, we initialize the log
* relation by committing the AmiTransactionId (id 512) and we
* initialize the variable relation by setting the next available
* transaction id to FirstTransactionId (id 514). OID initialization
diff --git a/src/backend/access/transam/xid.c b/src/backend/access/transam/xid.c
index 4a0799ac2ca..64ae130dd34 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.11 1997/11/02 15:24:47 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.12 1998/02/26 04:30:19 momjian Exp $
*
* OLD COMMENTS
* XXX WARNING
@@ -38,7 +38,7 @@ xidin(char *representation)
}
/* XXX char16 name for catalogs */
-char *
+char *
xidout(TransactionId transactionId)
{
/* return(TransactionIdFormString(transactionId)); */
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 948248a0f39..b23eb3c4e98 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.36 1998/02/11 19:09:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.37 1998/02/26 04:30:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -200,19 +200,21 @@ int numattr; /* number of attributes for cur. rel */
extern int fsyncOff; /* do not fsync the database */
/* The test for HAVE_SIGSETJMP fails on Linux 2.0.x because the test
- * explicitly disallows sigsetjmp being a #define, which is how it
- * is declared in Linux. So, to avoid compiler warnings about
- * sigsetjmp() being redefined, let's not redefine unless necessary.
+ * explicitly disallows sigsetjmp being a #define, which is how it
+ * is declared in Linux. So, to avoid compiler warnings about
+ * sigsetjmp() being redefined, let's not redefine unless necessary.
* - thomas 1997-12-27
*/
#if !defined(HAVE_SIGSETJMP) && !defined(sigsetjmp)
static jmp_buf Warn_restart;
+
#define sigsetjmp(x,y) setjmp(x)
#define siglongjmp longjmp
#else
static sigjmp_buf Warn_restart;
+
#endif
int DebugMode;
@@ -472,8 +474,8 @@ boot_openrel(char *relname)
HeapScanDesc sdesc;
HeapTuple tup;
- if (strlen(relname) >= NAMEDATALEN-1)
- relname[NAMEDATALEN-1] = '\0';
+ if (strlen(relname) >= NAMEDATALEN - 1)
+ relname[NAMEDATALEN - 1] = '\0';
if (Typ == (struct typmap **) NULL)
{
@@ -907,7 +909,7 @@ AllocateAttribute()
* be freed by the CALLER.
* ----------------
*/
-char *
+char *
MapArrayTypeName(char *s)
{
int i,
@@ -960,7 +962,7 @@ EnterString(char *str)
* associated with the idnum
* ----------------
*/
-char *
+char *
LexIDStr(int ident_num)
{
return (strtable[ident_num]);
@@ -979,7 +981,7 @@ LexIDStr(int ident_num)
static int
CompHash(char *str, int len)
{
- int result;
+ int result;
result = (NUM * str[0] + NUMSQR * str[len - 1] + NUMCUBE * str[(len - 1) / 2]);
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 17d87dd744b..afbf47b29b4 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.7 1998/02/25 13:05:57 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.8 1998/02/26 04:30:26 momjian Exp $
*
* NOTES
* See acl.h.
@@ -74,7 +74,7 @@ char *aclcheck_error_strings[] = {
static
dumpacl(Acl *acl)
{
- unsigned i;
+ unsigned i;
AclItem *aip;
elog(DEBUG, "acl size = %d, # acls = %d",
@@ -94,7 +94,7 @@ ChangeAcl(char *relname,
AclItem *mod_aip,
unsigned modechg)
{
- unsigned i;
+ unsigned i;
Acl *old_acl = (Acl *) NULL,
*new_acl;
Relation relation;
@@ -211,7 +211,7 @@ get_grosysid(char *groname)
return (id);
}
-char *
+char *
get_groname(AclId grosysid)
{
HeapTuple htp;
@@ -283,8 +283,8 @@ in_group(AclId uid, AclId gid)
static int32
aclcheck(char *relname, Acl *acl, AclId id, AclIdType idtype, AclMode mode)
{
- unsigned i;
- AclItem *aip,
+ unsigned i;
+ AclItem *aip,
*aidat;
unsigned num,
found_group;
@@ -417,7 +417,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
/*
* Deny anyone permission to update a system catalog unless
- * pg_shadow.usecatupd is set. (This is to let superusers protect
+ * pg_shadow.usecatupd is set. (This is to let superusers protect
* themselves from themselves.)
*/
if (((mode & ACL_WR) || (mode & ACL_AP)) &&
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c
index 95241e9dd65..844c1502f67 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.14 1998/02/11 19:09:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.15 1998/02/26 04:30:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
* relpath - path to the relation
* Perhaps this should be in-line code in relopen().
*/
-char *
+char *
relpath(char relname[])
{
char *path;
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index c48779d700c..7bab4d18428 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.46 1998/02/11 19:09:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.47 1998/02/26 04:30:35 momjian Exp $
*
* INTERFACE ROUTINES
* heap_create() - Create an uncataloged heap relation
@@ -63,8 +63,9 @@
#include <string.h>
#endif
-static void AddPgRelationTuple(Relation pg_class_desc,
- Relation new_rel_desc, Oid new_rel_oid, unsigned natts);
+static void
+AddPgRelationTuple(Relation pg_class_desc,
+ Relation new_rel_desc, Oid new_rel_oid, unsigned natts);
static void AddToTempRelList(Relation r);
static void DeletePgAttributeTuples(Relation rdesc);
static void DeletePgRelationTuple(Relation rdesc);
@@ -164,14 +165,14 @@ static TempRelList *tempRels = NULL;
*
*
* if heap_create is called with "" as the name, then heap_create will create
- * a temporary name "temp_$RELOID" for the relation
+ * a temporary name "temp_$RELOID" for the relation
* ----------------------------------------------------------------
*/
Relation
heap_create(char *name,
TupleDesc tupDesc)
{
- unsigned i;
+ unsigned i;
Oid relid;
Relation rdesc;
int len;
@@ -378,7 +379,7 @@ heap_create(char *name,
* create new relation
* insert new relation into attribute catalog
*
- * Should coordinate with heap_create_with_catalogr(). Either
+ * Should coordinate with heap_create_with_catalogr(). Either
* it should not be called or there should be a way to prevent
* the relation from being removed at the end of the
* transaction if it is successful ('u'/'r' may be enough).
@@ -726,14 +727,14 @@ addNewRelationType(char *typeName, Oid new_rel_oid)
*/
new_type_oid = TypeCreate(typeName, /* type name */
new_rel_oid, /* relation oid */
- typeLen(typeidType(OIDOID)), /* internal size */
- typeLen(typeidType(OIDOID)), /* external size */
+ typeLen(typeidType(OIDOID)), /* internal size */
+ typeLen(typeidType(OIDOID)), /* external size */
'c', /* type-type (catalog) */
',', /* default array delimiter */
"int4in", /* input procedure */
- "int4out",/* output procedure */
- "int4in", /* receive procedure */
- "int4out",/* send procedure */
+ "int4out", /* output procedure */
+ "int4in", /* receive procedure */
+ "int4out", /* send procedure */
NULL, /* array element type - irrelevent */
"-", /* default type value */
(bool) 1, /* passed by value */
@@ -748,7 +749,7 @@ addNewRelationType(char *typeName, Oid new_rel_oid)
*/
Oid
heap_create_with_catalog(char relname[],
- TupleDesc tupdesc)
+ TupleDesc tupdesc)
{
Relation pg_class_desc;
Relation new_rel_desc;
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 3f66216a4c5..1f78612fc19 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.38 1998/02/07 21:41:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.39 1998/02/26 04:30:38 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -119,7 +119,7 @@ DefaultBuild(Relation heapRelation, Relation indexRelation,
*/
static FormData_pg_attribute sysatts[] = {
{0l, {"ctid"}, 27l, 0l, 6, -1, 0, -1, -1, '\0', '\0', 'i', '\0', '\0'},
- {0l, {"oid"}, 26l, 0l, 4, -2, 0, -1, -1, '\001', '\0', 'i', '\0', '\0'},
+ {0l, {"oid"}, 26l, 0l, 4, -2, 0, -1, -1, '\001', '\0', 'i', '\0', '\0'},
{0l, {"xmin"}, 28l, 0l, 4, -3, 0, -1, -1, '\0', '\0', 'i', '\0', '\0'},
{0l, {"cmin"}, 29l, 0l, 4, -4, 0, -1, -1, '\001', '\0', 'i', '\0', '\0'},
{0l, {"xmax"}, 28l, 0l, 4, -5, 0, -1, -1, '\0', '\0', 'i', '\0', '\0'},
@@ -460,7 +460,7 @@ ConstructTupleDescriptor(Oid heapoid,
((TypeTupleForm) ((char *) tup + tup->t_hoff))->typbyval;
((AttributeTupleForm) to)->attlen =
- ((TypeTupleForm) ((char *) tup + tup->t_hoff))->typlen;
+ ((TypeTupleForm) ((char *) tup + tup->t_hoff))->typlen;
((AttributeTupleForm) to)->atttypmod = IndexKeyType->typmod;
}
@@ -1100,7 +1100,7 @@ index_create(char *heapRelationName,
* write lock heap to guarantee exclusive access
* ----------------
RelationSetLockForWrite(heapRelation);
- * ^^^^^
+ * ^^^^^
* Does it have any sense ? - vadim 10/27/97
*/
@@ -1611,7 +1611,7 @@ DefaultBuild(Relation heapRelation,
*/
scan = heap_beginscan(heapRelation, /* relation */
0, /* start at end */
- false, /* seeself */
+ false,/* seeself */
0, /* number of keys */
(ScanKey) NULL); /* scan key */
diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c
index c7543454034..84515e70edb 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.12 1998/02/11 19:10:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.13 1998/02/26 04:30:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -267,7 +267,7 @@ AggregateCreate(char *aggName,
}
-char *
+char *
AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool *isNull)
{
HeapTuple tup;
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index 235314e5307..fc251274277 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.21 1998/02/11 19:10:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.22 1998/02/26 04:30:41 momjian Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -224,7 +224,7 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
Oid leftObjectId,
Oid rightObjectId)
{
- int i;
+ int i;
HeapTuple tup;
Datum values[Natts_pg_operator];
char nulls[Natts_pg_operator];
@@ -782,7 +782,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
};
fmgr_info(ObjectIdEqualRegProcedure, &opKey[0].sk_func);
- opKey[0].sk_nargs = opKey[0].sk_func.fn_nargs;
+ opKey[0].sk_nargs = opKey[0].sk_func.fn_nargs;
for (i = 0; i < Natts_pg_operator; ++i)
{
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index 855999935ff..f300b97965d 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.14 1998/02/11 19:10:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.15 1998/02/26 04:30:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -216,7 +216,7 @@ ProcedureCreate(char *procedureName,
if (strcmp(languageName, "sql") == 0)
{
plan_list = pg_parse_and_plan(prosrc, typev, parameterCount,
- &querytree_list, dest);
+ &querytree_list, dest);
/* typecheck return value */
pg_checkretval(typeObjectId, querytree_list);
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index 7a137c254fb..9fef898f2b3 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.19 1998/02/11 19:10:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.20 1998/02/26 04:30:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -155,7 +155,7 @@ TypeGet(char *typeName, /* name of type to be fetched */
static Oid
TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
{
- int i;
+ int i;
HeapTuple tup;
Datum values[Natts_pg_type];
char nulls[Natts_pg_type];
@@ -605,7 +605,7 @@ TypeRename(char *oldTypeName, char *newTypeName)
* the CALLER is responsible for pfreeing the
*/
-char *
+char *
makeArrayTypeName(char *typeName)
{
char *arr;
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c
index ea3058e9e04..58cc6b467c0 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.28 1998/01/31 04:38:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.29 1998/02/26 04:30:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -84,7 +84,7 @@
#include <libpq/libpq.h>
#ifndef HAVE_STRDUP
-# include <port-protos.h> /* for strdup() */
+#include <port-protos.h> /* for strdup() */
#endif
#include <storage/lmgr.h>
@@ -97,7 +97,7 @@ static Dllist *pendingNotifies = NULL;
static int AsyncExistsPendingNotify(char *);
static void ClearPendingNotify(void);
static void Async_NotifyFrontEnd(void);
-void Async_Unlisten(char *relname, int pid);
+void Async_Unlisten(char *relname, int pid);
static void Async_UnlistenOnExit(int code, char *relname);
/*
@@ -617,7 +617,7 @@ Async_NotifyFrontEnd()
if (whereToSendOutput == Remote)
{
pq_putnchar("A", 1);
- pq_putint((int32)MyProcPid, sizeof(int32));
+ pq_putint((int32) MyProcPid, sizeof(int32));
pq_putstr(DatumGetName(d)->data);
pq_flush();
}
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 9b2df76761e..377f8f166ce 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.22 1998/01/10 05:19:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.23 1998/02/26 04:30:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -212,8 +212,8 @@ copy_heap(Oid OIDOldHeap)
OldHeapDesc = RelationGetTupleDescriptor(OldHeap);
/*
- * Need to make a copy of the tuple descriptor, heap_create_with_catalog
- * modifies it.
+ * Need to make a copy of the tuple descriptor,
+ * heap_create_with_catalog modifies it.
*/
tupdesc = CreateTupleDescCopy(OldHeapDesc);
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c
index 4e66b1fe3e8..0bf94de2200 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.25 1998/02/07 21:41:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.26 1998/02/26 04:30:49 momjian Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
@@ -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
@@ -148,16 +148,16 @@ PerformPortalFetch(char *name,
* ----------------
*/
queryDesc = PortalGetQueryDesc(portal);
-
- if ( dest == None ) /* MOVE */
+
+ if (dest == None) /* MOVE */
{
- QueryDesc *qdesc = (QueryDesc *) palloc (sizeof (QueryDesc));
-
- memcpy (qdesc, queryDesc, sizeof (QueryDesc));
+ QueryDesc *qdesc = (QueryDesc *) palloc(sizeof(QueryDesc));
+
+ memcpy(qdesc, queryDesc, sizeof(QueryDesc));
qdesc->dest = dest;
queryDesc = qdesc;
}
-
+
BeginCommand(name,
queryDesc->operation,
portal->attinfo, /* QueryDescGetTypeInfo(queryDesc),
@@ -178,9 +178,9 @@ PerformPortalFetch(char *name,
ExecutorRun(queryDesc, PortalGetState(portal), feature, count);
- if ( dest == None ) /* MOVE */
- pfree (queryDesc);
-
+ if (dest == None) /* MOVE */
+ pfree(queryDesc);
+
/* ----------------
* Note: the "end-of-command" tag is returned by higher-level
* utility code
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 7807ddb91f9..bf8a974401e 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.43 1998/02/25 13:06:08 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.44 1998/02/26 04:30:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,7 +48,8 @@ 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,
+static void
+GetIndexRelations(Oid main_relation_oid,
int *n_indices,
Relation **index_rels);
@@ -64,7 +65,7 @@ static void CopyAttributeOut(FILE *fp, char *string, char *delim);
static int CountTuples(Relation relation);
extern FILE *Pfout,
- *Pfin;
+ *Pfin;
static int lineno;
@@ -275,7 +276,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
if (!isnull)
{
string = (char *) (*fmgr_faddr(&out_functions[i]))
- (value, elements[i], typmod[i]);
+ (value, elements[i], typmod[i]);
CopyAttributeOut(fp, string, delim);
pfree(string);
}
@@ -582,8 +583,8 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
{
values[i] =
(Datum) (*fmgr_faddr(&in_functions[i])) (string,
- elements[i],
- typmod[i]);
+ elements[i],
+ typmod[i]);
/*
* Sanity check - by reference attributes cannot
@@ -592,7 +593,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
if (!PointerIsValid(values[i]) &&
!(rel->rd_att->attrs[i]->attbyval))
{
- elog(ERROR, "copy from line %d: Bad file format",lineno);
+ elog(ERROR, "copy from line %d: Bad file format", lineno);
}
}
}
diff --git a/src/backend/commands/creatinh.c b/src/backend/commands/creatinh.c
index 13f43d7a75c..4d57b560954 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.25 1998/02/10 04:00:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.26 1998/02/26 04:30:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,7 +58,7 @@ DefineRelation(CreateStmt *stmt)
if (strlen(stmt->relname) >= NAMEDATALEN)
elog(ERROR, "the relation name %s is >= %d characters long", stmt->relname,
NAMEDATALEN);
- StrNCpy(relname, stmt->relname, NAMEDATALEN); /* make full length for
+ StrNCpy(relname, stmt->relname, NAMEDATALEN); /* make full length for
* copy */
/* ----------------
@@ -253,7 +253,7 @@ MergeAttributes(List *schema, List *supers, List **supconstr)
if (relation == NULL)
{
elog(ERROR,
- "MergeAttr: Can't inherit from non-existent superclass '%s'", name);
+ "MergeAttr: Can't inherit from non-existent superclass '%s'", name);
}
if (relation->rd_rel->relkind == 'S')
{
@@ -334,7 +334,8 @@ MergeAttributes(List *schema, List *supers, List **supconstr)
for (i = 0; i < constr->num_check; i++)
{
- Constraint *cdef = (Constraint *) makeNode(Constraint); /* palloc(sizeof(Constraint)); */
+ Constraint *cdef = (Constraint *) makeNode(Constraint); /* palloc(sizeof(Constrai
+ * nt)); */
cdef->contype = CONSTR_CHECK;
if (check[i].ccname[0] == '$')
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 9326b1a5493..104091fb288 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.7 1998/02/25 13:06:09 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.8 1998/02/26 04:30:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,10 +61,10 @@ createdb(char *dbname, char *dbpath)
closeAllVfds();
/* Now create directory for this new database */
- if ((dbpath != NULL) && (strcmp(dbpath,dbname) != 0))
+ if ((dbpath != NULL) && (strcmp(dbpath, dbname) != 0))
{
- if (*(dbpath+strlen(dbpath)-1) == SEP_CHAR)
- *(dbpath+strlen(dbpath)-1) = '\0';
+ if (*(dbpath + strlen(dbpath) - 1) == SEP_CHAR)
+ *(dbpath + strlen(dbpath) - 1) = '\0';
sprintf(loc, "%s%c%s", dbpath, SEP_CHAR, dbname);
}
else
@@ -75,12 +75,12 @@ createdb(char *dbname, char *dbpath)
lp = ExpandDatabasePath(loc);
if (lp == NULL)
- elog(ERROR,"Unable to locate path '%s'"
- "\n\tThis may be due to a missing environment variable"
- " in the server",loc);
+ elog(ERROR, "Unable to locate path '%s'"
+ "\n\tThis may be due to a missing environment variable"
+ " in the server", loc);
- if (mkdir(lp,S_IRWXU) != 0)
- elog(ERROR,"Unable to create database directory %s",lp);
+ if (mkdir(lp, S_IRWXU) != 0)
+ elog(ERROR, "Unable to create database directory %s", lp);
sprintf(buf, "%s %s%cbase%ctemplate1%c* %s",
COPY_CMD, DataDir, SEP_CHAR, SEP_CHAR, SEP_CHAR, lp);
@@ -93,7 +93,7 @@ createdb(char *dbname, char *dbpath)
#endif
sprintf(buf, "insert into pg_database (datname, datdba, datpath)"
- " values (\'%s\', \'%d\', \'%s\');", dbname, user_id, loc);
+ " values (\'%s\', \'%d\', \'%s\');", dbname, user_id, loc);
pg_exec_query(buf, (char **) NULL, (Oid *) NULL, 0);
}
@@ -104,7 +104,7 @@ destroydb(char *dbname)
Oid user_id,
db_id;
char *path;
- char dbpath[MAXPGPATH+1];
+ char dbpath[MAXPGPATH + 1];
char buf[512];
/*
@@ -122,10 +122,10 @@ destroydb(char *dbname)
stop_vacuum(dbpath, dbname);
path = ExpandDatabasePath(dbpath);
- if (path == NULL)
- elog(ERROR,"Unable to locate path '%s'"
- "\n\tThis may be due to a missing environment variable"
- " in the server",dbpath);
+ if (path == NULL)
+ elog(ERROR, "Unable to locate path '%s'"
+ "\n\tThis may be due to a missing environment variable"
+ " in the server", dbpath);
/*
* remove the pg_database tuple FIRST, this may fail due to
@@ -206,7 +206,7 @@ check_permissions(char *command,
bool use_super;
char *userName;
text *dbtext;
- char path[MAXPGPATH+1];
+ char path[MAXPGPATH + 1];
userName = GetPgUserName();
utup = SearchSysCacheTuple(USENAME, PointerGetDatum(userName),
@@ -264,12 +264,12 @@ check_permissions(char *command,
(char *) NULL);
*dbIdP = dbtup->t_oid;
dbtext = (text *) heap_getattr(dbtup,
- Anum_pg_database_datpath,
- RelationGetTupleDescriptor(dbrel),
- (char *) NULL);
+ Anum_pg_database_datpath,
+ RelationGetTupleDescriptor(dbrel),
+ (char *) NULL);
- strncpy(path, VARDATA(dbtext), (VARSIZE(dbtext)-VARHDRSZ));
- *(path+VARSIZE(dbtext)-VARHDRSZ) = '\0';
+ strncpy(path, VARDATA(dbtext), (VARSIZE(dbtext) - VARHDRSZ));
+ *(path + VARSIZE(dbtext) - VARHDRSZ) = '\0';
}
else
{
@@ -304,7 +304,7 @@ check_permissions(char *command,
if (dbfound && !strcmp(command, "destroydb"))
strcpy(dbpath, path);
-} /* check_permissions() */
+} /* check_permissions() */
/*
* stop_vacuum() -- stop the vacuum daemon on the database, if one is running.
@@ -319,7 +319,7 @@ stop_vacuum(char *dbpath, char *dbname)
if (strchr(dbpath, SEP_CHAR) != 0)
{
sprintf(filename, "%s%cbase%c%s%c%s.vacuum", DataDir, SEP_CHAR, SEP_CHAR,
- dbname, SEP_CHAR, dbname);
+ dbname, SEP_CHAR, dbname);
}
else
{
diff --git a/src/backend/commands/define.c b/src/backend/commands/define.c
index e5d524cd07a..15ad37d76ee 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.23 1998/02/25 13:06:12 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.24 1998/02/26 04:30:57 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -265,39 +265,42 @@ CreateFunction(ProcedureStmt *stmt, CommandDest dest)
}
else
{
- HeapTuple languageTuple;
- Form_pg_language languageStruct;
+ HeapTuple languageTuple;
+ Form_pg_language languageStruct;
- /* Lookup the language in the system cache */
+ /* Lookup the language in the system cache */
languageTuple = SearchSysCacheTuple(LANNAME,
- PointerGetDatum(languageName),
- 0, 0, 0);
-
- if (!HeapTupleIsValid(languageTuple)) {
-
- elog(ERROR,
- "Unrecognized language specified in a CREATE FUNCTION: "
- "'%s'. Recognized languages are sql, C, internal "
- "and the created procedural languages.",
- languageName);
+ PointerGetDatum(languageName),
+ 0, 0, 0);
+
+ if (!HeapTupleIsValid(languageTuple))
+ {
+
+ elog(ERROR,
+ "Unrecognized language specified in a CREATE FUNCTION: "
+ "'%s'. Recognized languages are sql, C, internal "
+ "and the created procedural languages.",
+ languageName);
}
/* Check that this language is a PL */
languageStruct = (Form_pg_language) GETSTRUCT(languageTuple);
- if (!(languageStruct->lanispl)) {
- elog(ERROR,
- "Language '%s' isn't defined as PL", languageName);
+ if (!(languageStruct->lanispl))
+ {
+ elog(ERROR,
+ "Language '%s' isn't defined as PL", languageName);
}
/*
- * Functions in untrusted procedural languages are
- * restricted to be defined by postgres superusers only
+ * Functions in untrusted procedural languages are restricted to
+ * be defined by postgres superusers only
*/
- if (languageStruct->lanpltrusted == false && !superuser()) {
- elog(ERROR, "Only users with Postgres superuser privilege "
- "are permitted to create a function in the '%s' "
- "language.",
- languageName);
+ if (languageStruct->lanpltrusted == false && !superuser())
+ {
+ elog(ERROR, "Only users with Postgres superuser privilege "
+ "are permitted to create a function in the '%s' "
+ "language.",
+ languageName);
}
lanisPL = true;
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 879fdc82d05..a8b32e2e0a1 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.17 1998/02/13 03:21:30 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.18 1998/02/26 04:30:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -204,23 +204,23 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
appendStringInfo(str, buf);
}
appendStringInfo(str, "\n");
-
+
/* initPlan-s */
if (plan->initPlan)
{
- List *saved_rtable = es->rtable;
- List *lst;
-
+ List *saved_rtable = es->rtable;
+ List *lst;
+
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
appendStringInfo(str, " InitPlan\n");
- foreach (lst, plan->initPlan)
+ foreach(lst, plan->initPlan)
{
- es->rtable = ((SubPlan*) lfirst(lst))->rtable;
+ es->rtable = ((SubPlan *) lfirst(lst))->rtable;
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
appendStringInfo(str, " -> ");
- explain_outNode(str, ((SubPlan*) lfirst(lst))->plan, indent + 4, es);
+ explain_outNode(str, ((SubPlan *) lfirst(lst))->plan, indent + 4, es);
}
es->rtable = saved_rtable;
}
@@ -242,23 +242,23 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
appendStringInfo(str, " -> ");
explain_outNode(str, innerPlan(plan), indent + 3, es);
}
-
+
/* subPlan-s */
if (plan->subPlan)
{
- List *saved_rtable = es->rtable;
- List *lst;
-
+ List *saved_rtable = es->rtable;
+ List *lst;
+
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
appendStringInfo(str, " SubPlan\n");
- foreach (lst, plan->subPlan)
+ foreach(lst, plan->subPlan)
{
- es->rtable = ((SubPlan*) lfirst(lst))->rtable;
+ es->rtable = ((SubPlan *) lfirst(lst))->rtable;
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
appendStringInfo(str, " -> ");
- explain_outNode(str, ((SubPlan*) lfirst(lst))->plan, indent + 4, es);
+ explain_outNode(str, ((SubPlan *) lfirst(lst))->plan, indent + 4, es);
}
es->rtable = saved_rtable;
}
diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c
index 870a0fb65a9..aac12979509 100644
--- a/src/backend/commands/proclang.c
+++ b/src/backend/commands/proclang.c
@@ -43,7 +43,7 @@ case_translate_language_name(const char *input, char *output)
* ---------------------------------------------------------------------
*/
void
-CreateProceduralLanguage(CreatePLangStmt * stmt)
+CreateProceduralLanguage(CreatePLangStmt *stmt)
{
char languageName[NAMEDATALEN];
HeapTuple langTup;
@@ -139,7 +139,7 @@ CreateProceduralLanguage(CreatePLangStmt * stmt)
* ---------------------------------------------------------------------
*/
void
-DropProceduralLanguage(DropPLangStmt * stmt)
+DropProceduralLanguage(DropPLangStmt *stmt)
{
char languageName[NAMEDATALEN];
HeapTuple langTup;
diff --git a/src/backend/commands/recipe.c b/src/backend/commands/recipe.c
index a95913392ca..8034a515311 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.19 1998/02/10 04:00:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.20 1998/02/26 04:30:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -493,9 +493,9 @@ tg_replaceNumberedParam(Node *expression,
{
newVar = makeVar(rt_ind,
0, /* the whole tuple */
- TypeGet(teeRelName, &defined),
+ TypeGet(teeRelName, &defined),
-1,
- 0,
+ 0,
rt_ind,
0);
return (Node *) newVar;
@@ -504,9 +504,9 @@ tg_replaceNumberedParam(Node *expression,
newVar = makeVar(rt_ind,
1, /* just the first field,
* which is 'result' */
- TypeGet(teeRelName, &defined),
+ TypeGet(teeRelName, &defined),
-1,
- 0,
+ 0,
rt_ind,
0);
return (Node *) newVar;
@@ -1052,7 +1052,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
tupdesc = rel->rd_att;
relid = heap_create_with_catalog(
- child->nodeElem->outTypes->val[0], tupdesc);
+ child->nodeElem->outTypes->val[0], tupdesc);
}
else
{
@@ -1077,7 +1077,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
else
{
relid = heap_create_with_catalog(
- child->nodeElem->outTypes->val[0], tupdesc);
+ child->nodeElem->outTypes->val[0], tupdesc);
}
}
}
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 33062b911bb..c0ab43da7cc 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -38,7 +38,7 @@ TriggerData *CurrentTriggerData = NULL;
void RelationBuildTriggers(Relation relation);
void FreeTriggerDesc(Relation relation);
-static void DescribeTrigger(TriggerDesc * trigdesc, Trigger * trigger);
+static void DescribeTrigger(TriggerDesc *trigdesc, Trigger *trigger);
static HeapTuple
GetTupleForTrigger(Relation relation, ItemPointer tid,
bool before);
@@ -46,7 +46,7 @@ GetTupleForTrigger(Relation relation, ItemPointer tid,
extern GlobalMemory CacheCxt;
void
-CreateTrigger(CreateTrigStmt * stmt)
+CreateTrigger(CreateTrigStmt *stmt)
{
int16 tgtype;
int16 tgattr[8] = {0};
@@ -249,7 +249,7 @@ CreateTrigger(CreateTrigStmt * stmt)
}
void
-DropTrigger(DropTrigStmt * stmt)
+DropTrigger(DropTrigStmt *stmt)
{
Relation rel;
Relation tgrel;
@@ -519,7 +519,7 @@ FreeTriggerDesc(Relation relation)
}
static void
-DescribeTrigger(TriggerDesc * trigdesc, Trigger * trigger)
+DescribeTrigger(TriggerDesc *trigdesc, Trigger *trigger)
{
uint16 *n;
Trigger ***t,
@@ -593,7 +593,7 @@ DescribeTrigger(TriggerDesc * trigdesc, Trigger * trigger)
}
static HeapTuple
-ExecCallTriggerFunc(Trigger * trigger)
+ExecCallTriggerFunc(Trigger *trigger)
{
if (trigger->tgfunc.fn_addr == NULL)
@@ -601,9 +601,10 @@ ExecCallTriggerFunc(Trigger * trigger)
fmgr_info(trigger->tgfoid, &trigger->tgfunc);
}
- if (trigger->tgfunc.fn_plhandler != NULL) {
+ if (trigger->tgfunc.fn_plhandler != NULL)
+ {
return (HeapTuple) (*(trigger->tgfunc.fn_plhandler))
- (&trigger->tgfunc);
+ (&trigger->tgfunc);
}
return (HeapTuple) ((*fmgr_faddr(&trigger->tgfunc)) ());
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 05506fd93fc..9ef2613a4f4 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -43,34 +43,39 @@ static void CheckPgUserAclNotNull(void);
*---------------------------------------------------------------------
*/
static
-void UpdatePgPwdFile(char* sql) {
-
- char* filename;
- char* tempname;
-
- /* Create a temporary filename to be renamed later. This prevents the
- * backend from clobbering the pg_pwd file while the postmaster might be
- * reading from it.
- */
- filename = crypt_getpwdfilename();
- tempname = (char*)malloc(strlen(filename) + 12);
- sprintf(tempname, "%s.%d", filename, MyProcPid);
-
- /* Copy the contents of pg_shadow to the pg_pwd ASCII file using a the SEPCHAR
- * character as the delimiter between fields. Then rename the file to its
- * final name.
- */
- sprintf(sql, "copy %s to '%s' using delimiters %s", ShadowRelationName, tempname, CRYPT_PWD_FILE_SEPCHAR);
- pg_exec_query(sql, (char**)NULL, (Oid*)NULL, 0);
- rename(tempname, filename);
- free((void*)tempname);
-
- /* Create a flag file the postmaster will detect the next time it tries to
- * authenticate a user. The postmaster will know to reload the pg_pwd file
- * contents.
- */
- filename = crypt_getpwdreloadfilename();
- creat(filename, S_IRUSR | S_IWUSR);
+void
+UpdatePgPwdFile(char *sql)
+{
+
+ char *filename;
+ char *tempname;
+
+ /*
+ * Create a temporary filename to be renamed later. This prevents the
+ * backend from clobbering the pg_pwd file while the postmaster might
+ * be reading from it.
+ */
+ filename = crypt_getpwdfilename();
+ tempname = (char *) malloc(strlen(filename) + 12);
+ sprintf(tempname, "%s.%d", filename, MyProcPid);
+
+ /*
+ * Copy the contents of pg_shadow to the pg_pwd ASCII file using a the
+ * SEPCHAR character as the delimiter between fields. Then rename the
+ * file to its final name.
+ */
+ sprintf(sql, "copy %s to '%s' using delimiters %s", ShadowRelationName, tempname, CRYPT_PWD_FILE_SEPCHAR);
+ pg_exec_query(sql, (char **) NULL, (Oid *) NULL, 0);
+ rename(tempname, filename);
+ free((void *) tempname);
+
+ /*
+ * Create a flag file the postmaster will detect the next time it
+ * tries to authenticate a user. The postmaster will know to reload
+ * the pg_pwd file contents.
+ */
+ filename = crypt_getpwdreloadfilename();
+ creat(filename, S_IRUSR | S_IWUSR);
}
/*---------------------------------------------------------------------
@@ -80,352 +85,407 @@ void UpdatePgPwdFile(char* sql) {
* user is specified in the desired groups of defined in pg_group.
*---------------------------------------------------------------------
*/
-void DefineUser(CreateUserStmt *stmt) {
-
- char* pg_user;
- Relation pg_shadow_rel;
- TupleDesc pg_shadow_dsc;
- HeapScanDesc scan;
- HeapTuple tuple;
- Datum datum;
- Buffer buffer;
- char sql[512];
- char* sql_end;
- bool exists = false,
- n,
- inblock;
- int max_id = -1;
-
- if (stmt->password)
- CheckPgUserAclNotNull();
- if (!(inblock = IsTransactionBlock()))
- BeginTransactionBlock();
-
- /* Make sure the user attempting to create a user can insert into the pg_shadow
- * relation.
- */
- pg_user = GetPgUserName();
- if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR | ACL_AP) != ACLCHECK_OK) {
- UserAbortTransactionBlock();
- elog(ERROR, "defineUser: user \"%s\" does not have SELECT and INSERT privilege for \"%s\"",
- pg_user, ShadowRelationName);
- return;
- }
-
- /* Scan the pg_shadow relation to be certain the user doesn't already exist.
- */
- pg_shadow_rel = heap_openr(ShadowRelationName);
- pg_shadow_dsc = RelationGetTupleDescriptor(pg_shadow_rel);
- /* Secure a write lock on pg_shadow so we can be sure of what the next usesysid
- * should be.
- */
- RelationSetLockForWrite(pg_shadow_rel);
-
- scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
- while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
- datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_shadow_dsc, &n);
-
- if (!exists && !strncmp((char*)datum, stmt->user, strlen(stmt->user)))
- exists = true;
-
- datum = heap_getattr(tuple, Anum_pg_shadow_usesysid, pg_shadow_dsc, &n);
- if ((int)datum > max_id)
- max_id = (int)datum;
-
- ReleaseBuffer(buffer);
- }
- heap_endscan(scan);
-
- if (exists) {
- RelationUnsetLockForWrite(pg_shadow_rel);
- heap_close(pg_shadow_rel);
- UserAbortTransactionBlock();
- elog(ERROR, "defineUser: user \"%s\" has already been created", stmt->user);
- return;
- }
-
- /* Build the insert statment to be executed.
- */
- sprintf(sql, "insert into %s(usename,usesysid,usecreatedb,usetrace,usesuper,usecatupd,passwd", ShadowRelationName);
-/* if (stmt->password)
- strcat(sql, ",passwd"); -- removed so that insert empty string when no password */
- if (stmt->validUntil)
- strcat(sql, ",valuntil");
-
- sql_end = sql + strlen(sql);
- sprintf(sql_end, ") values('%s',%d", stmt->user, max_id + 1);
- if (stmt->createdb && *stmt->createdb)
- strcat(sql_end, ",'t','t'");
- else
- strcat(sql_end, ",'f','t'");
- if (stmt->createuser && *stmt->createuser)
- strcat(sql_end, ",'t','t'");
- else
- strcat(sql_end, ",'f','t'");
- sql_end += strlen(sql_end);
- if (stmt->password) {
- sprintf(sql_end, ",'%s'", stmt->password);
- sql_end += strlen(sql_end);
- } else {
- strcpy(sql_end, ",''");
- sql_end += strlen(sql_end);
- }
- if (stmt->validUntil) {
- sprintf(sql_end, ",'%s'", stmt->validUntil);
- sql_end += strlen(sql_end);
- }
- strcat(sql_end, ")");
-
- pg_exec_query(sql, (char**)NULL, (Oid*)NULL, 0);
-
- /* Add the stuff here for groups.
- */
-
- UpdatePgPwdFile(sql);
-
- /* This goes after the UpdatePgPwdFile to be certain that two backends to not
- * attempt to write to the pg_pwd file at the same time.
- */
- RelationUnsetLockForWrite(pg_shadow_rel);
- heap_close(pg_shadow_rel);
-
- if (IsTransactionBlock() && !inblock)
- EndTransactionBlock();
+void
+DefineUser(CreateUserStmt *stmt)
+{
+
+ char *pg_user;
+ Relation pg_shadow_rel;
+ TupleDesc pg_shadow_dsc;
+ HeapScanDesc scan;
+ HeapTuple tuple;
+ Datum datum;
+ Buffer buffer;
+ char sql[512];
+ char *sql_end;
+ bool exists = false,
+ n,
+ inblock;
+ int max_id = -1;
+
+ if (stmt->password)
+ CheckPgUserAclNotNull();
+ if (!(inblock = IsTransactionBlock()))
+ BeginTransactionBlock();
+
+ /*
+ * Make sure the user attempting to create a user can insert into the
+ * pg_shadow relation.
+ */
+ pg_user = GetPgUserName();
+ if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR | ACL_AP) != ACLCHECK_OK)
+ {
+ UserAbortTransactionBlock();
+ elog(ERROR, "defineUser: user \"%s\" does not have SELECT and INSERT privilege for \"%s\"",
+ pg_user, ShadowRelationName);
+ return;
+ }
+
+ /*
+ * Scan the pg_shadow relation to be certain the user doesn't already
+ * exist.
+ */
+ pg_shadow_rel = heap_openr(ShadowRelationName);
+ pg_shadow_dsc = RelationGetTupleDescriptor(pg_shadow_rel);
+
+ /*
+ * Secure a write lock on pg_shadow so we can be sure of what the next
+ * usesysid should be.
+ */
+ RelationSetLockForWrite(pg_shadow_rel);
+
+ scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
+ while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
+ {
+ datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_shadow_dsc, &n);
+
+ if (!exists && !strncmp((char *) datum, stmt->user, strlen(stmt->user)))
+ exists = true;
+
+ datum = heap_getattr(tuple, Anum_pg_shadow_usesysid, pg_shadow_dsc, &n);
+ if ((int) datum > max_id)
+ max_id = (int) datum;
+
+ ReleaseBuffer(buffer);
+ }
+ heap_endscan(scan);
+
+ if (exists)
+ {
+ RelationUnsetLockForWrite(pg_shadow_rel);
+ heap_close(pg_shadow_rel);
+ UserAbortTransactionBlock();
+ elog(ERROR, "defineUser: user \"%s\" has already been created", stmt->user);
+ return;
+ }
+
+ /*
+ * Build the insert statment to be executed.
+ */
+ sprintf(sql, "insert into %s(usename,usesysid,usecreatedb,usetrace,usesuper,usecatupd,passwd", ShadowRelationName);
+/* if (stmt->password)
+ strcat(sql, ",passwd"); -- removed so that insert empty string when no password */
+ if (stmt->validUntil)
+ strcat(sql, ",valuntil");
+
+ sql_end = sql + strlen(sql);
+ sprintf(sql_end, ") values('%s',%d", stmt->user, max_id + 1);
+ if (stmt->createdb && *stmt->createdb)
+ strcat(sql_end, ",'t','t'");
+ else
+ strcat(sql_end, ",'f','t'");
+ if (stmt->createuser && *stmt->createuser)
+ strcat(sql_end, ",'t','t'");
+ else
+ strcat(sql_end, ",'f','t'");
+ sql_end += strlen(sql_end);
+ if (stmt->password)
+ {
+ sprintf(sql_end, ",'%s'", stmt->password);
+ sql_end += strlen(sql_end);
+ }
+ else
+ {
+ strcpy(sql_end, ",''");
+ sql_end += strlen(sql_end);
+ }
+ if (stmt->validUntil)
+ {
+ sprintf(sql_end, ",'%s'", stmt->validUntil);
+ sql_end += strlen(sql_end);
+ }
+ strcat(sql_end, ")");
+
+ pg_exec_query(sql, (char **) NULL, (Oid *) NULL, 0);
+
+ /*
+ * Add the stuff here for groups.
+ */
+
+ UpdatePgPwdFile(sql);
+
+ /*
+ * This goes after the UpdatePgPwdFile to be certain that two backends
+ * to not attempt to write to the pg_pwd file at the same time.
+ */
+ RelationUnsetLockForWrite(pg_shadow_rel);
+ heap_close(pg_shadow_rel);
+
+ if (IsTransactionBlock() && !inblock)
+ EndTransactionBlock();
}
-extern void AlterUser(AlterUserStmt *stmt) {
-
- char* pg_user;
- Relation pg_shadow_rel;
- TupleDesc pg_shadow_dsc;
- HeapScanDesc scan;
- HeapTuple tuple;
- Datum datum;
- Buffer buffer;
- char sql[512];
- char* sql_end;
- bool exists = false,
- n,
- inblock;
-
- if (stmt->password)
- CheckPgUserAclNotNull();
- if (!(inblock = IsTransactionBlock()))
- BeginTransactionBlock();
-
- /* Make sure the user attempting to create a user can insert into the pg_shadow
- * relation.
- */
- pg_user = GetPgUserName();
- if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR) != ACLCHECK_OK) {
- UserAbortTransactionBlock();
- elog(ERROR, "alterUser: user \"%s\" does not have SELECT and UPDATE privilege for \"%s\"",
- pg_user, ShadowRelationName);
- return;
- }
-
- /* Scan the pg_shadow relation to be certain the user exists.
- */
- pg_shadow_rel = heap_openr(ShadowRelationName);
- pg_shadow_dsc = RelationGetTupleDescriptor(pg_shadow_rel);
- /* Secure a write lock on pg_shadow so we can be sure that when the dump of
- * the pg_pwd file is done, there is not another backend doing the same.
- */
- RelationSetLockForWrite(pg_shadow_rel);
-
- scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
- while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
- datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_shadow_dsc, &n);
-
- if (!strncmp((char*)datum, stmt->user, strlen(stmt->user))) {
- exists = true;
- ReleaseBuffer(buffer);
- break;
- }
- }
- heap_endscan(scan);
-
- if (!exists) {
- RelationUnsetLockForWrite(pg_shadow_rel);
- heap_close(pg_shadow_rel);
- UserAbortTransactionBlock();
- elog(ERROR, "alterUser: user \"%s\" does not exist", stmt->user);
- return;
- }
-
- /* Create the update statement to modify the user.
- */
- sprintf(sql, "update %s set", ShadowRelationName);
- sql_end = sql;
- if (stmt->password) {
- sql_end += strlen(sql_end);
- sprintf(sql_end, " passwd = '%s'", stmt->password);
- }
- if (stmt->createdb) {
- if (sql_end != sql)
- strcat(sql_end, ",");
- sql_end += strlen(sql_end);
- if (*stmt->createdb)
- strcat(sql_end, " usecreatedb = 't'");
- else
- strcat(sql_end, " usecreatedb = 'f'");
- }
- if (stmt->createuser) {
- if (sql_end != sql)
- strcat(sql_end, ",");
- sql_end += strlen(sql_end);
- if (*stmt->createuser)
- strcat(sql_end, " usesuper = 't'");
- else
- strcat(sql_end, " usesuper = 'f'");
- }
- if (stmt->validUntil) {
- if (sql_end != sql)
- strcat(sql_end, ",");
- sql_end += strlen(sql_end);
- sprintf(sql_end, " valuntil = '%s'", stmt->validUntil);
- }
- if (sql_end != sql) {
- sql_end += strlen(sql_end);
- sprintf(sql_end, " where usename = '%s'", stmt->user);
- pg_exec_query(sql, (char**)NULL, (Oid*)NULL, 0);
- }
-
- /* do the pg_group stuff here */
-
- UpdatePgPwdFile(sql);
-
- RelationUnsetLockForWrite(pg_shadow_rel);
- heap_close(pg_shadow_rel);
-
- if (IsTransactionBlock() && !inblock)
- EndTransactionBlock();
+extern void
+AlterUser(AlterUserStmt *stmt)
+{
+
+ char *pg_user;
+ Relation pg_shadow_rel;
+ TupleDesc pg_shadow_dsc;
+ HeapScanDesc scan;
+ HeapTuple tuple;
+ Datum datum;
+ Buffer buffer;
+ char sql[512];
+ char *sql_end;
+ bool exists = false,
+ n,
+ inblock;
+
+ if (stmt->password)
+ CheckPgUserAclNotNull();
+ if (!(inblock = IsTransactionBlock()))
+ BeginTransactionBlock();
+
+ /*
+ * Make sure the user attempting to create a user can insert into the
+ * pg_shadow relation.
+ */
+ pg_user = GetPgUserName();
+ if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR) != ACLCHECK_OK)
+ {
+ UserAbortTransactionBlock();
+ elog(ERROR, "alterUser: user \"%s\" does not have SELECT and UPDATE privilege for \"%s\"",
+ pg_user, ShadowRelationName);
+ return;
+ }
+
+ /*
+ * Scan the pg_shadow relation to be certain the user exists.
+ */
+ pg_shadow_rel = heap_openr(ShadowRelationName);
+ pg_shadow_dsc = RelationGetTupleDescriptor(pg_shadow_rel);
+
+ /*
+ * Secure a write lock on pg_shadow so we can be sure that when the
+ * dump of the pg_pwd file is done, there is not another backend doing
+ * the same.
+ */
+ RelationSetLockForWrite(pg_shadow_rel);
+
+ scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
+ while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
+ {
+ datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_shadow_dsc, &n);
+
+ if (!strncmp((char *) datum, stmt->user, strlen(stmt->user)))
+ {
+ exists = true;
+ ReleaseBuffer(buffer);
+ break;
+ }
+ }
+ heap_endscan(scan);
+
+ if (!exists)
+ {
+ RelationUnsetLockForWrite(pg_shadow_rel);
+ heap_close(pg_shadow_rel);
+ UserAbortTransactionBlock();
+ elog(ERROR, "alterUser: user \"%s\" does not exist", stmt->user);
+ return;
+ }
+
+ /*
+ * Create the update statement to modify the user.
+ */
+ sprintf(sql, "update %s set", ShadowRelationName);
+ sql_end = sql;
+ if (stmt->password)
+ {
+ sql_end += strlen(sql_end);
+ sprintf(sql_end, " passwd = '%s'", stmt->password);
+ }
+ if (stmt->createdb)
+ {
+ if (sql_end != sql)
+ strcat(sql_end, ",");
+ sql_end += strlen(sql_end);
+ if (*stmt->createdb)
+ strcat(sql_end, " usecreatedb = 't'");
+ else
+ strcat(sql_end, " usecreatedb = 'f'");
+ }
+ if (stmt->createuser)
+ {
+ if (sql_end != sql)
+ strcat(sql_end, ",");
+ sql_end += strlen(sql_end);
+ if (*stmt->createuser)
+ strcat(sql_end, " usesuper = 't'");
+ else
+ strcat(sql_end, " usesuper = 'f'");
+ }
+ if (stmt->validUntil)
+ {
+ if (sql_end != sql)
+ strcat(sql_end, ",");
+ sql_end += strlen(sql_end);
+ sprintf(sql_end, " valuntil = '%s'", stmt->validUntil);
+ }
+ if (sql_end != sql)
+ {
+ sql_end += strlen(sql_end);
+ sprintf(sql_end, " where usename = '%s'", stmt->user);
+ pg_exec_query(sql, (char **) NULL, (Oid *) NULL, 0);
+ }
+
+ /* do the pg_group stuff here */
+
+ UpdatePgPwdFile(sql);
+
+ RelationUnsetLockForWrite(pg_shadow_rel);
+ heap_close(pg_shadow_rel);
+
+ if (IsTransactionBlock() && !inblock)
+ EndTransactionBlock();
}
-extern void RemoveUser(char* user) {
-
- char* pg_user;
- Relation pg_shadow_rel,
- pg_rel;
- TupleDesc pg_dsc;
- HeapScanDesc scan;
- HeapTuple tuple;
- Datum datum;
- Buffer buffer;
- char sql[512];
- bool n,
- inblock;
- int usesysid = -1,
- ndbase = 0;
- char** dbase = NULL;
-
- if (!(inblock = IsTransactionBlock()))
- BeginTransactionBlock();
-
- /* Make sure the user attempting to create a user can delete from the pg_shadow
- * relation.
- */
- pg_user = GetPgUserName();
- if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR) != ACLCHECK_OK) {
- UserAbortTransactionBlock();
- elog(ERROR, "removeUser: user \"%s\" does not have SELECT and DELETE privilege for \"%s\"",
- pg_user, ShadowRelationName);
- return;
- }
-
- /* Perform a scan of the pg_shadow relation to find the usesysid of the user to
- * be deleted. If it is not found, then return a warning message.
- */
- pg_shadow_rel = heap_openr(ShadowRelationName);
- pg_dsc = RelationGetTupleDescriptor(pg_shadow_rel);
- /* Secure a write lock on pg_shadow so we can be sure that when the dump of
- * the pg_pwd file is done, there is not another backend doing the same.
- */
- RelationSetLockForWrite(pg_shadow_rel);
-
- scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
- while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
- datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_dsc, &n);
-
- if (!strncmp((char*)datum, user, strlen(user))) {
- usesysid = (int)heap_getattr(tuple, Anum_pg_shadow_usesysid, pg_dsc, &n);
- ReleaseBuffer(buffer);
- break;
- }
- ReleaseBuffer(buffer);
- }
- heap_endscan(scan);
-
- if (usesysid == -1) {
- RelationUnsetLockForWrite(pg_shadow_rel);
- heap_close(pg_shadow_rel);
- UserAbortTransactionBlock();
- elog(ERROR, "removeUser: user \"%s\" does not exist", user);
- return;
- }
-
- /* Perform a scan of the pg_database relation to find the databases owned by
- * usesysid. Then drop them.
- */
- pg_rel = heap_openr(DatabaseRelationName);
- pg_dsc = RelationGetTupleDescriptor(pg_rel);
-
- scan = heap_beginscan(pg_rel, false, false, 0, NULL);
- while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer))) {
- datum = heap_getattr(tuple, Anum_pg_database_datdba, pg_dsc, &n);
-
- if ((int)datum == usesysid) {
- datum = heap_getattr(tuple, Anum_pg_database_datname, pg_dsc, &n);
- if (memcmp((void*)datum, "template1", 9)) {
- dbase = (char**)realloc((void*)dbase, sizeof(char*) * (ndbase + 1));
- dbase[ndbase] = (char*)malloc(NAMEDATALEN + 1);
- memcpy((void*)dbase[ndbase], (void*)datum, NAMEDATALEN);
- dbase[ndbase++][NAMEDATALEN] = '\0';
- }
- }
- ReleaseBuffer(buffer);
- }
- heap_endscan(scan);
- heap_close(pg_rel);
-
- while (ndbase--) {
- elog(NOTICE, "Dropping database %s", dbase[ndbase]);
- sprintf(sql, "drop database %s", dbase[ndbase]);
- free((void*)dbase[ndbase]);
- pg_exec_query(sql, (char**)NULL, (Oid*)NULL, 0);
- }
- if (dbase)
- free((void*)dbase);
-
- /* Since pg_shadow is global over all databases, one of two things must be done
- * to insure complete consistency. First, pg_shadow could be made non-global.
- * This would elminate the code above for deleting database and would require
- * the addition of code to delete tables, views, etc owned by the user.
- *
- * The second option would be to create a means of deleting tables, view,
- * etc. owned by the user from other databases. Pg_user is global and so
- * this must be done at some point.
- *
- * Let us not forget that the user should be removed from the pg_groups also.
- *
- * Todd A. Brandys 11/18/1997
- *
- */
-
- /* Remove the user from the pg_shadow table
- */
- sprintf(sql, "delete from %s where usename = '%s'", ShadowRelationName, user);
- pg_exec_query(sql, (char**)NULL, (Oid*)NULL, 0);
-
- UpdatePgPwdFile(sql);
-
- RelationUnsetLockForWrite(pg_shadow_rel);
- heap_close(pg_shadow_rel);
-
- if (IsTransactionBlock() && !inblock)
- EndTransactionBlock();
+extern void
+RemoveUser(char *user)
+{
+
+ char *pg_user;
+ Relation pg_shadow_rel,
+ pg_rel;
+ TupleDesc pg_dsc;
+ HeapScanDesc scan;
+ HeapTuple tuple;
+ Datum datum;
+ Buffer buffer;
+ char sql[512];
+ bool n,
+ inblock;
+ int usesysid = -1,
+ ndbase = 0;
+ char **dbase = NULL;
+
+ if (!(inblock = IsTransactionBlock()))
+ BeginTransactionBlock();
+
+ /*
+ * Make sure the user attempting to create a user can delete from the
+ * pg_shadow relation.
+ */
+ pg_user = GetPgUserName();
+ if (pg_aclcheck(ShadowRelationName, pg_user, ACL_RD | ACL_WR) != ACLCHECK_OK)
+ {
+ UserAbortTransactionBlock();
+ elog(ERROR, "removeUser: user \"%s\" does not have SELECT and DELETE privilege for \"%s\"",
+ pg_user, ShadowRelationName);
+ return;
+ }
+
+ /*
+ * Perform a scan of the pg_shadow relation to find the usesysid of
+ * the user to be deleted. If it is not found, then return a warning
+ * message.
+ */
+ pg_shadow_rel = heap_openr(ShadowRelationName);
+ pg_dsc = RelationGetTupleDescriptor(pg_shadow_rel);
+
+ /*
+ * Secure a write lock on pg_shadow so we can be sure that when the
+ * dump of the pg_pwd file is done, there is not another backend doing
+ * the same.
+ */
+ RelationSetLockForWrite(pg_shadow_rel);
+
+ scan = heap_beginscan(pg_shadow_rel, false, false, 0, NULL);
+ while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
+ {
+ datum = heap_getattr(tuple, Anum_pg_shadow_usename, pg_dsc, &n);
+
+ if (!strncmp((char *) datum, user, strlen(user)))
+ {
+ usesysid = (int) heap_getattr(tuple, Anum_pg_shadow_usesysid, pg_dsc, &n);
+ ReleaseBuffer(buffer);
+ break;
+ }
+ ReleaseBuffer(buffer);
+ }
+ heap_endscan(scan);
+
+ if (usesysid == -1)
+ {
+ RelationUnsetLockForWrite(pg_shadow_rel);
+ heap_close(pg_shadow_rel);
+ UserAbortTransactionBlock();
+ elog(ERROR, "removeUser: user \"%s\" does not exist", user);
+ return;
+ }
+
+ /*
+ * Perform a scan of the pg_database relation to find the databases
+ * owned by usesysid. Then drop them.
+ */
+ pg_rel = heap_openr(DatabaseRelationName);
+ pg_dsc = RelationGetTupleDescriptor(pg_rel);
+
+ scan = heap_beginscan(pg_rel, false, false, 0, NULL);
+ while (HeapTupleIsValid(tuple = heap_getnext(scan, 0, &buffer)))
+ {
+ datum = heap_getattr(tuple, Anum_pg_database_datdba, pg_dsc, &n);
+
+ if ((int) datum == usesysid)
+ {
+ datum = heap_getattr(tuple, Anum_pg_database_datname, pg_dsc, &n);
+ if (memcmp((void *) datum, "template1", 9))
+ {
+ dbase = (char **) realloc((void *) dbase, sizeof(char *) * (ndbase + 1));
+ dbase[ndbase] = (char *) malloc(NAMEDATALEN + 1);
+ memcpy((void *) dbase[ndbase], (void *) datum, NAMEDATALEN);
+ dbase[ndbase++][NAMEDATALEN] = '\0';
+ }
+ }
+ ReleaseBuffer(buffer);
+ }
+ heap_endscan(scan);
+ heap_close(pg_rel);
+
+ while (ndbase--)
+ {
+ elog(NOTICE, "Dropping database %s", dbase[ndbase]);
+ sprintf(sql, "drop database %s", dbase[ndbase]);
+ free((void *) dbase[ndbase]);
+ pg_exec_query(sql, (char **) NULL, (Oid *) NULL, 0);
+ }
+ if (dbase)
+ free((void *) dbase);
+
+ /*
+ * Since pg_shadow is global over all databases, one of two things
+ * must be done to insure complete consistency. First, pg_shadow
+ * could be made non-global. This would elminate the code above for
+ * deleting database and would require the addition of code to delete
+ * tables, views, etc owned by the user.
+ *
+ * The second option would be to create a means of deleting tables, view,
+ * etc. owned by the user from other databases. Pg_user is global and
+ * so this must be done at some point.
+ *
+ * Let us not forget that the user should be removed from the pg_groups
+ * also.
+ *
+ * Todd A. Brandys 11/18/1997
+ *
+ */
+
+ /*
+ * Remove the user from the pg_shadow table
+ */
+ sprintf(sql, "delete from %s where usename = '%s'", ShadowRelationName, user);
+ pg_exec_query(sql, (char **) NULL, (Oid *) NULL, 0);
+
+ UpdatePgPwdFile(sql);
+
+ RelationUnsetLockForWrite(pg_shadow_rel);
+ heap_close(pg_shadow_rel);
+
+ if (IsTransactionBlock() && !inblock)
+ EndTransactionBlock();
}
/*
@@ -433,9 +493,10 @@ extern void RemoveUser(char* user) {
*
* check to see if there is an ACL on pg_shadow
*/
-static void CheckPgUserAclNotNull()
+static void
+CheckPgUserAclNotNull()
{
-HeapTuple htp;
+ HeapTuple htp;
htp = SearchSysCacheTuple(RELNAME, PointerGetDatum(ShadowRelationName),
0, 0, 0);
@@ -451,6 +512,6 @@ HeapTuple htp;
elog(NOTICE, "so normal users can not read the passwords.");
elog(ERROR, "Try 'REVOKE ALL ON pg_shadow FROM PUBLIC'");
}
-
+
return;
}
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 47d5d2fb47a..882f5ca106b 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.62 1998/02/25 23:40:32 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.63 1998/02/26 04:31:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -54,9 +54,9 @@
#include <sys/resource.h>
#endif
-/* #include <port-protos.h> */ /* Why? */
+ /* #include <port-protos.h> *//* Why? */
-extern int BlowawayRelationBuffers(Relation rdesc, BlockNumber block);
+extern int BlowawayRelationBuffers(Relation rdesc, BlockNumber block);
bool VacuumRunning = false;
@@ -136,7 +136,7 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec)
old = MemoryContextSwitchTo((MemoryContext) pmem);
if (va_spec != NIL && !analyze)
- elog(ERROR,"Can't vacuum columns, only tables. You can 'vacuum analyze' columns.");
+ elog(ERROR, "Can't vacuum columns, only tables. You can 'vacuum analyze' columns.");
foreach(le, va_spec)
{
@@ -725,8 +725,9 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
}
else if (!TransactionIdIsInProgress(htup->t_xmin))
{
+
/*
- * Not Aborted, Not Committed, Not in Progress -
+ * Not Aborted, Not Committed, Not in Progress -
* so it's from crashed process. - vadim 11/26/96
*/
ncrash++;
@@ -741,11 +742,11 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
}
}
- /*
- * here we are concerned about tuples with xmin committed
- * and xmax unknown or committed
+ /*
+ * here we are concerned about tuples with xmin committed and
+ * xmax unknown or committed
*/
- if (htup->t_infomask & HEAP_XMIN_COMMITTED &&
+ if (htup->t_infomask & HEAP_XMIN_COMMITTED &&
!(htup->t_infomask & HEAP_XMAX_INVALID))
{
if (htup->t_infomask & HEAP_XMAX_COMMITTED)
@@ -759,6 +760,7 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
tupgone = true;
else if (!TransactionIdIsInProgress(htup->t_xmax))
{
+
/*
* Not Aborted, Not Committed, Not in Progress - so it
* from crashed process. - vadim 06/02/97
@@ -916,7 +918,7 @@ Tup %u: Vac %u, Crash %u, UnUsed %u, MinLen %u, MaxLen %u; Re-using: Free/Avail.
ru1.ru_stime.tv_sec - ru0.ru_stime.tv_sec,
ru1.ru_utime.tv_sec - ru0.ru_utime.tv_sec);
-} /* vc_scanheap */
+} /* vc_scanheap */
/*
@@ -1087,15 +1089,15 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
* But we can't remove last page - this is our
* "show-stopper" !!! - vadim 02/25/98
*/
- if (ToVpd != Fvplast &&
+ if (ToVpd != Fvplast &&
!vc_enough_space(ToVpd, vacrelstats->min_tlen))
{
Assert(Fnpages > ToVpI + 1);
memmove(Fvpl->vpl_pgdesc + ToVpI,
Fvpl->vpl_pgdesc + ToVpI + 1,
- sizeof(VPageDescr *) * (Fnpages - ToVpI - 1));
+ sizeof(VPageDescr *) * (Fnpages - ToVpI - 1));
Fnpages--;
- Assert (Fvplast == Fvpl->vpl_pgdesc[Fnpages - 1]);
+ Assert(Fvplast == Fvpl->vpl_pgdesc[Fnpages - 1]);
}
}
for (i = 0; i < Fnpages; i++)
@@ -1333,7 +1335,7 @@ Elapsed %u/%u sec.",
{
i = BlowawayRelationBuffers(onerel, blkno);
if (i < 0)
- elog (FATAL, "VACUUM (vc_rpfheap): BlowawayRelationBuffers returned %d", i);
+ elog(FATAL, "VACUUM (vc_rpfheap): BlowawayRelationBuffers returned %d", i);
blkno = smgrtruncate(DEFAULT_SMGR, onerel, blkno);
Assert(blkno >= 0);
vacrelstats->npages = blkno; /* set new number of blocks */
@@ -1349,7 +1351,7 @@ Elapsed %u/%u sec.",
pfree(vpc);
-} /* vc_rpfheap */
+} /* vc_rpfheap */
/*
* vc_vacheap() -- free dead tuples
@@ -1367,7 +1369,7 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList Vvpl)
int i;
nblocks = Vvpl->vpl_npages;
- nblocks -= Vvpl->vpl_nemend; /* nothing to do with them */
+ nblocks -= Vvpl->vpl_nemend;/* nothing to do with them */
for (i = 0, vpp = Vvpl->vpl_pgdesc; i < nblocks; i++, vpp++)
{
@@ -1394,17 +1396,17 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList Vvpl)
* it) before truncation
*/
FlushBufferPool(!TransactionFlushEnabled());
-
+
i = BlowawayRelationBuffers(onerel, nblocks);
if (i < 0)
- elog (FATAL, "VACUUM (vc_vacheap): BlowawayRelationBuffers returned %d", i);
+ elog(FATAL, "VACUUM (vc_vacheap): BlowawayRelationBuffers returned %d", i);
nblocks = smgrtruncate(DEFAULT_SMGR, onerel, nblocks);
Assert(nblocks >= 0);
vacrelstats->npages = nblocks; /* set new number of blocks */
}
-} /* vc_vacheap */
+} /* vc_vacheap */
/*
* vc_vacpage() -- free dead tuples on a page
@@ -1424,7 +1426,7 @@ vc_vacpage(Page page, VPageDescr vpd)
}
PageRepairFragmentation(page);
-} /* vc_vacpage */
+} /* vc_vacpage */
/*
* _vc_scanoneind() -- scan one index relation to update statistic.
@@ -1470,7 +1472,7 @@ vc_scanoneind(Relation indrel, int nhtups)
elog(NOTICE, "Ind %s: NUMBER OF INDEX' TUPLES (%u) IS NOT THE SAME AS HEAP' (%u)",
indrel->rd_rel->relname.data, nitups, nhtups);
-} /* vc_scanoneind */
+} /* vc_scanoneind */
/*
* vc_vaconeind() -- vacuum one index relation.
@@ -1553,7 +1555,7 @@ vc_vaconeind(VPageList vpl, Relation indrel, int nhtups)
elog(NOTICE, "Ind %s: NUMBER OF INDEX' TUPLES (%u) IS NOT THE SAME AS HEAP' (%u)",
indrel->rd_rel->relname.data, nitups, nhtups);
-} /* vc_vaconeind */
+} /* vc_vaconeind */
/*
* vc_tidreapped() -- is a particular tid reapped?
@@ -1597,7 +1599,7 @@ vc_tidreapped(ItemPointer itemptr, VPageList vpl)
return (vp);
-} /* vc_tidreapped */
+} /* vc_tidreapped */
/*
* vc_attrstats() -- compute column statistics used by the optimzer
@@ -2011,7 +2013,7 @@ vc_reappage(VPageList vpl, VPageDescr vpc)
/* insert this page into vpl list */
vc_vpinsert(vpl, newvpd);
-} /* vc_reappage */
+} /* vc_reappage */
static void
vc_vpinsert(VPageList vpl, VPageDescr vpnew)
@@ -2101,7 +2103,7 @@ vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, cha
first_move = true;
}
-} /* vc_find_eq */
+} /* vc_find_eq */
static int
vc_cmp_blk(char *left, char *right)
@@ -2118,7 +2120,7 @@ vc_cmp_blk(char *left, char *right)
return (0);
return (1);
-} /* vc_cmp_blk */
+} /* vc_cmp_blk */
static int
vc_cmp_offno(char *left, char *right)
@@ -2130,7 +2132,7 @@ vc_cmp_offno(char *left, char *right)
return (0);
return (1);
-} /* vc_cmp_offno */
+} /* vc_cmp_offno */
static void
@@ -2207,7 +2209,7 @@ vc_getindices(Oid relid, int *nindices, Relation **Irel)
*Irel = (Relation *) NULL;
}
-} /* vc_getindices */
+} /* vc_getindices */
static void
@@ -2223,7 +2225,7 @@ vc_clsindices(int nindices, Relation *Irel)
}
pfree(Irel);
-} /* vc_clsindices */
+} /* vc_clsindices */
static void
@@ -2262,7 +2264,7 @@ vc_mkindesc(Relation onerel, int nindices, Relation *Irel, IndDesc **Idesc)
idcur->natts = natts;
}
-} /* vc_mkindesc */
+} /* vc_mkindesc */
static bool
@@ -2283,4 +2285,4 @@ vc_enough_space(VPageDescr vpd, Size len)
return (false);
-} /* vc_enough_space */
+} /* vc_enough_space */
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 7ab04df99c7..364eed343b7 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -1,8 +1,8 @@
/*
* Routines for handling of 'SET var TO',
- * 'SHOW var' and 'RESET var' statements.
+ * 'SHOW var' and 'RESET var' statements.
*
- * $Id: variable.c,v 1.3 1998/02/03 16:06:49 thomas Exp $
+ * $Id: variable.c,v 1.4 1998/02/26 04:31:05 momjian Exp $
*
*/
@@ -61,7 +61,7 @@ get_token(char **tok, char **val, const char *str)
}
*tok = (char *) palloc(len + 1);
- StrNCpy(*tok, start, len+1);
+ StrNCpy(*tok, start, len + 1);
/* skip white spaces */
while (isspace(*str))
@@ -107,7 +107,7 @@ get_token(char **tok, char **val, const char *str)
}
*val = (char *) palloc(len + 1);
- StrNCpy(*val, start, len+1);
+ StrNCpy(*val, start, len + 1);
/* skip white spaces */
while (isspace(*str))
@@ -342,18 +342,21 @@ parse_date(const char *value)
DateStyle = USE_GERMAN_DATES;
dcnt++;
EuroDates = TRUE;
- if ((ecnt > 0) && (! EuroDates)) ecnt++;
+ if ((ecnt > 0) && (!EuroDates))
+ ecnt++;
}
else if (!strncasecmp(tok, "EURO", 4))
{
EuroDates = TRUE;
- if ((dcnt <= 0) || (DateStyle != USE_GERMAN_DATES)) ecnt++;
+ if ((dcnt <= 0) || (DateStyle != USE_GERMAN_DATES))
+ ecnt++;
}
else if ((!strcasecmp(tok, "US"))
|| (!strncasecmp(tok, "NONEURO", 7)))
{
EuroDates = FALSE;
- if ((dcnt <= 0) || (DateStyle == USE_GERMAN_DATES)) ecnt++;
+ if ((dcnt <= 0) || (DateStyle == USE_GERMAN_DATES))
+ ecnt++;
}
else if (!strcasecmp(tok, "DEFAULT"))
{
@@ -445,7 +448,7 @@ parse_timezone(const char *value)
if ((defaultTZ = getenv("TZ")) != NULL)
strcpy(TZvalue, defaultTZ);
- /* found nothing so mark with an invalid pointer */
+ /* found nothing so mark with an invalid pointer */
else
defaultTZ = (char *) -1;
@@ -459,7 +462,7 @@ parse_timezone(const char *value)
}
return TRUE;
-} /* parse_timezone() */
+} /* parse_timezone() */
bool
show_timezone()
@@ -468,10 +471,10 @@ show_timezone()
tz = getenv("TZ");
- elog(NOTICE, "Time zone is %s", ((tz != NULL)? tz: "unknown"));
+ elog(NOTICE, "Time zone is %s", ((tz != NULL) ? tz : "unknown"));
return TRUE;
-} /* show_timezone() */
+} /* show_timezone() */
/* reset_timezone()
* Set TZ environment variable to original value.
@@ -501,7 +504,10 @@ reset_timezone()
tzset();
}
- /* otherwise, time zone was set but no original explicit time zone available */
+ /*
+ * otherwise, time zone was set but no original explicit time zone
+ * available
+ */
else
{
strcpy(tzbuf, "=");
@@ -511,7 +517,7 @@ reset_timezone()
}
return TRUE;
-} /* reset_timezone() */
+} /* reset_timezone() */
/*-----------------------------------------------------------------------*/
struct VariableParsers
@@ -523,13 +529,27 @@ struct VariableParsers
} VariableParsers[] =
{
- { "datestyle", parse_date, show_date, reset_date },
- { "timezone", parse_timezone, show_timezone, reset_timezone },
- { "cost_heap", parse_cost_heap, show_cost_heap, reset_cost_heap },
- { "cost_index", parse_cost_index, show_cost_index, reset_cost_index },
- { "geqo", parse_geqo, show_geqo, reset_geqo },
- { "r_plans", parse_r_plans, show_r_plans, reset_r_plans },
- { NULL, NULL, NULL, NULL }
+ {
+ "datestyle", parse_date, show_date, reset_date
+ },
+ {
+ "timezone", parse_timezone, show_timezone, reset_timezone
+ },
+ {
+ "cost_heap", parse_cost_heap, show_cost_heap, reset_cost_heap
+ },
+ {
+ "cost_index", parse_cost_index, show_cost_index, reset_cost_index
+ },
+ {
+ "geqo", parse_geqo, show_geqo, reset_geqo
+ },
+ {
+ "r_plans", parse_r_plans, show_r_plans, reset_r_plans
+ },
+ {
+ NULL, NULL, NULL, NULL
+ }
};
/*-----------------------------------------------------------------------*/
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index 38a39ed3923..5602cc992d7 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.20 1998/02/10 04:00:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.21 1998/02/26 04:31:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -118,7 +118,7 @@ DefineVirtualRelation(char *relname, List *tlist)
* This routine is called when defining/removing a view.
*------------------------------------------------------------------
*/
-char *
+char *
MakeRetrieveViewRuleName(char *viewName)
{
char *buf;
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 450f6e5358b..b2851d83b4a 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.18 1998/02/23 06:26:53 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.19 1998/02/26 04:31:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -296,29 +296,32 @@ void
ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent)
{
- if ( node->chgParam != NULL ) /* Wow! */
+ if (node->chgParam != NULL) /* Wow! */
{
- List *lst;
-
- foreach (lst, node->initPlan)
+ List *lst;
+
+ foreach(lst, node->initPlan)
{
- Plan *splan = ((SubPlan*) lfirst (lst))->plan;
- if ( splan->extParam != NULL ) /* don't care about child locParam */
- SetChangedParamList (splan, node->chgParam);
- if ( splan->chgParam != NULL )
- ExecReScanSetParamPlan ((SubPlan*) lfirst (lst), node);
+ Plan *splan = ((SubPlan *) lfirst(lst))->plan;
+
+ if (splan->extParam != NULL) /* don't care about child
+ * locParam */
+ SetChangedParamList(splan, node->chgParam);
+ if (splan->chgParam != NULL)
+ ExecReScanSetParamPlan((SubPlan *) lfirst(lst), node);
}
- foreach (lst, node->subPlan)
+ foreach(lst, node->subPlan)
{
- Plan *splan = ((SubPlan*) lfirst (lst))->plan;
- if ( splan->extParam != NULL )
- SetChangedParamList (splan, node->chgParam);
+ Plan *splan = ((SubPlan *) lfirst(lst))->plan;
+
+ if (splan->extParam != NULL)
+ SetChangedParamList(splan, node->chgParam);
}
/* Well. Now set chgParam for left/right trees. */
- if ( node->lefttree != NULL )
- SetChangedParamList (node->lefttree, node->chgParam);
- if ( node->righttree != NULL )
- SetChangedParamList (node->righttree, node->chgParam);
+ if (node->lefttree != NULL)
+ SetChangedParamList(node->lefttree, node->chgParam);
+ if (node->righttree != NULL)
+ SetChangedParamList(node->righttree, node->chgParam);
}
switch (nodeTag(node))
@@ -332,38 +335,38 @@ ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent)
break;
case T_Material:
- ExecMaterialReScan((Material*) node, exprCtxt, parent);
+ ExecMaterialReScan((Material *) node, exprCtxt, parent);
break;
case T_NestLoop:
- ExecReScanNestLoop((NestLoop*) node, exprCtxt, parent);
+ ExecReScanNestLoop((NestLoop *) node, exprCtxt, parent);
break;
case T_HashJoin:
- ExecReScanHashJoin((HashJoin*) node, exprCtxt, parent);
+ ExecReScanHashJoin((HashJoin *) node, exprCtxt, parent);
break;
case T_Hash:
- ExecReScanHash((Hash*) node, exprCtxt, parent);
+ ExecReScanHash((Hash *) node, exprCtxt, parent);
break;
case T_Agg:
- ExecReScanAgg((Agg*) node, exprCtxt, parent);
+ ExecReScanAgg((Agg *) node, exprCtxt, parent);
break;
case T_Result:
- ExecReScanResult((Result*) node, exprCtxt, parent);
+ ExecReScanResult((Result *) node, exprCtxt, parent);
break;
case T_Unique:
- ExecReScanUnique((Unique*) node, exprCtxt, parent);
+ ExecReScanUnique((Unique *) node, exprCtxt, parent);
break;
case T_Sort:
- ExecReScanSort((Sort*) node, exprCtxt, parent);
+ ExecReScanSort((Sort *) node, exprCtxt, parent);
break;
-/*
+/*
* Tee is never used
case T_Tee:
ExecTeeReScan((Tee *) node, exprCtxt, parent);
@@ -373,10 +376,10 @@ ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent)
elog(ERROR, "ExecReScan: node type %u not supported", nodeTag(node));
return;
}
-
- if ( node->chgParam != NULL )
+
+ if (node->chgParam != NULL)
{
- freeList (node->chgParam);
+ freeList(node->chgParam);
node->chgParam = NULL;
}
}
@@ -415,7 +418,7 @@ ExecMarkPos(Plan *node)
{
switch (nodeTag(node))
{
- case T_SeqScan:
+ case T_SeqScan:
ExecSeqMarkPos((SeqScan *) node);
break;
@@ -445,7 +448,7 @@ ExecRestrPos(Plan *node)
{
switch (nodeTag(node))
{
- case T_SeqScan:
+ case T_SeqScan:
ExecSeqRestrPos((SeqScan *) node);
return;
@@ -510,7 +513,7 @@ ExecCreatR(TupleDesc tupType,
* '\0 '
*/
relDesc = heap_create("", tupType);
- }
+ }
else
{
/* ----------------
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 760d277dee9..6326ab215d9 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.43 1998/02/21 06:31:37 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.44 1998/02/26 04:31:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,22 +57,28 @@
/* decls for local routines only used within this module */
-static void ExecCheckPerms(CmdType operation, int resultRelation, List *rangeTable,
+static void
+ExecCheckPerms(CmdType operation, int resultRelation, List *rangeTable,
Query *parseTree);
-static TupleDesc InitPlan(CmdType operation, Query *parseTree,
+static TupleDesc
+InitPlan(CmdType operation, Query *parseTree,
Plan *plan, EState *estate);
static void EndPlan(Plan *plan, EState *estate);
-static TupleTableSlot * ExecutePlan(EState *estate, Plan *plan,
+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 ExecAppend(TupleTableSlot *slot, ItemPointer tupleid,
+static void
+ExecAppend(TupleTableSlot *slot, ItemPointer tupleid,
EState *estate);
-static void ExecDelete(TupleTableSlot *slot, ItemPointer tupleid,
+static void
+ExecDelete(TupleTableSlot *slot, ItemPointer tupleid,
EState *estate);
-static void ExecReplace(TupleTableSlot *slot, ItemPointer tupleid,
+static void
+ExecReplace(TupleTableSlot *slot, ItemPointer tupleid,
EState *estate, Query *parseTree);
/* end of local decls */
@@ -83,13 +89,14 @@ static int queryLimit = ALL_TUPLES;
#undef ALL_TUPLES
#define ALL_TUPLES queryLimit
-int ExecutorLimit(int limit);
+int ExecutorLimit(int limit);
int
ExecutorLimit(int limit)
{
return queryLimit = limit;
}
+
#endif
/* ----------------------------------------------------------------
@@ -110,14 +117,14 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
/* sanity checks */
Assert(queryDesc != NULL);
-
+
if (queryDesc->plantree->nParamExec > 0)
{
- estate->es_param_exec_vals = (ParamExecData*)
- palloc (queryDesc->plantree->nParamExec * sizeof (ParamExecData));
- memset (estate->es_param_exec_vals, 0 , queryDesc->plantree->nParamExec * sizeof (ParamExecData));
+ estate->es_param_exec_vals = (ParamExecData *)
+ palloc(queryDesc->plantree->nParamExec * sizeof(ParamExecData));
+ memset(estate->es_param_exec_vals, 0, queryDesc->plantree->nParamExec * sizeof(ParamExecData));
}
-
+
result = InitPlan(queryDesc->operation,
queryDesc->parsetree,
queryDesc->plantree,
@@ -301,11 +308,12 @@ ExecCheckPerms(CmdType operation,
if (rte->skipAcl)
{
+
/*
- * This happens if the access to this table is due
- * to a view query rewriting - the rewrite handler
- * checked the permissions against the view owner,
- * so we just skip this entry.
+ * This happens if the access to this table is due to a view
+ * query rewriting - the rewrite handler checked the
+ * permissions against the view owner, so we just skip this
+ * entry.
*/
continue;
}
@@ -1239,8 +1247,8 @@ ExecAttrDefault(Relation rel, HeapTuple tuple)
econtext->ecxt_outertuple = NULL; /* outer tuple slot */
econtext->ecxt_relation = NULL; /* relation */
econtext->ecxt_relid = 0; /* relid */
- econtext->ecxt_param_list_info = NULL; /* param list info */
- econtext->ecxt_param_exec_vals = NULL; /* exec param values */
+ econtext->ecxt_param_list_info = NULL; /* param list info */
+ econtext->ecxt_param_exec_vals = NULL; /* exec param values */
econtext->ecxt_range_table = NULL; /* range table */
for (i = 0; i < ndef; i++)
{
@@ -1283,6 +1291,7 @@ ExecAttrDefault(Relation rel, HeapTuple tuple)
return (newtuple);
}
+
#endif
static char *
diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c
index 017fdfba4d1..f5842ecad32 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.8 1998/02/13 03:26:40 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.9 1998/02/26 04:31:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -116,14 +116,14 @@ ExecInitNode(Plan *node, EState *estate, Plan *parent)
*/
if (node == NULL)
return FALSE;
-
- foreach (subp, node->initPlan)
+
+ foreach(subp, node->initPlan)
{
- result = ExecInitSubPlan ((SubPlan*) lfirst (subp), estate, node);
- if ( result == FALSE )
+ result = ExecInitSubPlan((SubPlan *) lfirst(subp), estate, node);
+ if (result == FALSE)
return (FALSE);
}
-
+
switch (nodeTag(node))
{
/* ----------------
@@ -202,13 +202,13 @@ ExecInitNode(Plan *node, EState *estate, Plan *parent)
elog(ERROR, "ExecInitNode: node %d unsupported", nodeTag(node));
result = FALSE;
}
-
- if ( result != FALSE )
+
+ if (result != FALSE)
{
- foreach (subp, node->subPlan)
+ foreach(subp, node->subPlan)
{
- result = ExecInitSubPlan ((SubPlan*) lfirst (subp), estate, node);
- if ( result == FALSE )
+ result = ExecInitSubPlan((SubPlan *) lfirst(subp), estate, node);
+ if (result == FALSE)
return (FALSE);
}
}
@@ -235,10 +235,10 @@ ExecProcNode(Plan *node, Plan *parent)
*/
if (node == NULL)
return NULL;
-
- if ( node->chgParam != NULL ) /* something changed */
- ExecReScan (node, NULL, parent); /* let ReScan handle this */
-
+
+ if (node->chgParam != NULL) /* something changed */
+ ExecReScan(node, NULL, parent); /* let ReScan handle this */
+
switch (nodeTag(node))
{
/* ----------------
@@ -410,7 +410,7 @@ void
ExecEndNode(Plan *node, Plan *parent)
{
List *subp;
-
+
/* ----------------
* do nothing when we get to the end
* of a leaf on tree.
@@ -418,18 +418,18 @@ ExecEndNode(Plan *node, Plan *parent)
*/
if (node == NULL)
return;
-
- foreach (subp, node->initPlan)
+
+ foreach(subp, node->initPlan)
{
- ExecEndSubPlan ((SubPlan*) lfirst (subp));
+ ExecEndSubPlan((SubPlan *) lfirst(subp));
}
- foreach (subp, node->subPlan)
+ foreach(subp, node->subPlan)
{
- ExecEndSubPlan ((SubPlan*) lfirst (subp));
+ ExecEndSubPlan((SubPlan *) lfirst(subp));
}
- if ( node->chgParam != NULL )
+ if (node->chgParam != NULL)
{
- freeList (node->chgParam);
+ freeList(node->chgParam);
node->chgParam = NULL;
}
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 78c91539c7f..55a12bd8317 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.25 1998/02/13 03:26:42 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.26 1998/02/26 04:31:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -71,19 +71,24 @@ int execConstLen;
/* static functions decls */
static Datum ExecEvalAggreg(Aggreg *agg, ExprContext *econtext, bool *isNull);
-static Datum ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
+static Datum
+ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
bool *isNull, bool *isDone);
static Datum ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull);
-static Datum ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
+static Datum
+ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
bool *isNull, bool *isDone);
-static void ExecEvalFuncArgs(FunctionCachePtr fcache, ExprContext *econtext,
+static void
+ExecEvalFuncArgs(FunctionCachePtr fcache, ExprContext *econtext,
List *argList, Datum argV[], bool *argIsDone);
static Datum ExecEvalNot(Expr *notclause, ExprContext *econtext, bool *isNull);
-static Datum ExecEvalOper(Expr *opClause, ExprContext *econtext,
+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 ExecMakeFunctionResult(Node *node, List *arguments,
+static Datum
+ExecMakeFunctionResult(Node *node, List *arguments,
ExprContext *econtext, bool *isNull, bool *isDone);
static bool ExecQualClause(Node *clause, ExprContext *econtext);
@@ -301,10 +306,11 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
return (Datum) tempSlot;
}
- result = heap_getattr(heapTuple, /* tuple containing attribute */
- attnum, /* attribute number of desired attribute */
- tuple_type,/* tuple descriptor of tuple */
- isNull); /* return: is attribute null? */
+ result = heap_getattr(heapTuple, /* tuple containing attribute */
+ attnum, /* attribute number of desired
+ * attribute */
+ tuple_type, /* tuple descriptor of tuple */
+ isNull); /* return: is attribute null? */
/* ----------------
* return null if att is null
@@ -379,18 +385,18 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
AttrNumber thisParameterId = expression->paramid;
int matchFound;
ParamListInfo paramList;
-
- if ( thisParameterKind == PARAM_EXEC )
+
+ if (thisParameterKind == PARAM_EXEC)
{
- ParamExecData *prm = &(econtext->ecxt_param_exec_vals[thisParameterId]);
-
- if ( prm->execPlan != NULL )
- ExecSetParamPlan (prm->execPlan);
- Assert (prm->execPlan == NULL);
+ ParamExecData *prm = &(econtext->ecxt_param_exec_vals[thisParameterId]);
+
+ if (prm->execPlan != NULL)
+ ExecSetParamPlan(prm->execPlan);
+ Assert(prm->execPlan == NULL);
*isNull = prm->isnull;
return (prm->value);
}
-
+
thisParameterName = expression->paramname;
paramList = econtext->ecxt_param_list_info;
@@ -544,7 +550,7 @@ GetAttributeByNum(TupleTableSlot *slot,
/* XXX char16 name for catalogs */
#ifdef NOT_USED
-char *
+char *
att_by_num(TupleTableSlot *slot,
AttrNumber attrno,
bool *isNull)
@@ -554,7 +560,7 @@ att_by_num(TupleTableSlot *slot,
#endif
-char *
+char *
GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
{
AttrNumber attrno;
@@ -605,7 +611,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));
@@ -1045,19 +1051,21 @@ ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull)
if (*isNull)
{
IsNull = *isNull;
+
/*
- * Many functions don't (or can't!) check is an argument
- * NULL or NOT_NULL and may return TRUE (1) with *isNull TRUE
- * (an_int4_column <> 1: int4ne returns TRUE for NULLs).
- * Not having time to fix function manager I want to fix
- * OR: if we had 'x <> 1 OR x isnull' then TRUE, TRUE were
- * returned by 'x <> 1' for NULL ... but ExecQualClause say
- * that qualification *fails* if isnull is TRUE for all values
- * returned by ExecEvalExpr. So, force this rule here: if isnull
- * is TRUE then clause failed. Note: nullvalue() & nonnullvalue()
- * always set isnull to FALSE for NULLs. - vadim 09/22/97
+ * Many functions don't (or can't!) check is an argument NULL
+ * or NOT_NULL and may return TRUE (1) with *isNull TRUE
+ * (an_int4_column <> 1: int4ne returns TRUE for NULLs). Not
+ * having time to fix function manager I want to fix OR: if we
+ * had 'x <> 1 OR x isnull' then TRUE, TRUE were returned by
+ * 'x <> 1' for NULL ... but ExecQualClause say that
+ * qualification *fails* if isnull is TRUE for all values
+ * returned by ExecEvalExpr. So, force this rule here: if
+ * isnull is TRUE then clause failed. Note: nullvalue() &
+ * nonnullvalue() always set isnull to FALSE for NULLs. -
+ * vadim 09/22/97
*/
- const_value = 0;
+ const_value = 0;
}
/* ----------------
@@ -1238,7 +1246,7 @@ ExecEvalExpr(Node *expression,
retDatum = (Datum) ExecEvalNot(expr, econtext, isNull);
break;
case SUBPLAN_EXPR:
- retDatum = (Datum) ExecSubPlan((SubPlan*) expr->oper, expr->args, econtext);
+ retDatum = (Datum) ExecSubPlan((SubPlan *) expr->oper, expr->args, econtext);
break;
default:
elog(ERROR, "ExecEvalExpr: unknown expression type %d", expr->opType);
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index 5f2336ce19d..3d64ba0095b 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.16 1998/02/10 04:00:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.17 1998/02/26 04:31:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -986,8 +986,8 @@ ExecTypeFromTL(List *targetList)
resdom->resno,
resdom->resname,
/* fix for SELECT NULL ... */
- (restype ? restype : UNKNOWNOID),
- resdom->restypmod,
+ (restype ? restype : UNKNOWNOID),
+ resdom->restypmod,
0,
false);
@@ -1021,7 +1021,7 @@ ExecTypeFromTL(List *targetList)
fjRes->resno,
fjRes->resname,
restype,
- fjRes->restypmod,
+ fjRes->restypmod,
0,
false);
/*
@@ -1045,7 +1045,7 @@ ExecTypeFromTL(List *targetList)
fjRes->resno,
fjRes->resname,
restype,
- fjRes->restypmod,
+ fjRes->restypmod,
0,
false);
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 69ef6671075..6f30db27cff 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.29 1998/02/13 03:26:43 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.30 1998/02/26 04:31:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -189,7 +189,7 @@ ExecAssignExprContext(EState *estate, CommonState *commonstate)
econtext->ecxt_relid = 0; /* relid */
econtext->ecxt_param_list_info = estate->es_param_list_info;
econtext->ecxt_param_exec_vals = estate->es_param_exec_vals;
- econtext->ecxt_range_table = estate->es_range_table; /* range table */
+ econtext->ecxt_range_table = estate->es_range_table; /* range table */
commonstate->cs_ExprContext = econtext;
}
@@ -1176,24 +1176,24 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
pfree(econtext);
}
-void
-SetChangedParamList (Plan *node, List *newchg)
+void
+SetChangedParamList(Plan *node, List *newchg)
{
- List *nl;
-
- foreach (nl, newchg)
+ List *nl;
+
+ foreach(nl, newchg)
{
- int paramId = lfirsti(nl);
-
+ int paramId = lfirsti(nl);
+
/* if this node doesn't depend on a param ... */
- if ( !intMember (paramId, node->extParam) &&
- !intMember (paramId, node->locParam) )
+ if (!intMember(paramId, node->extParam) &&
+ !intMember(paramId, node->locParam))
continue;
/* if this param is already in list of changed ones ... */
- if ( intMember (paramId, node->chgParam) )
+ if (intMember(paramId, node->chgParam))
continue;
/* else - add this param to the list */
- node->chgParam = lappendi (node->chgParam, paramId);
+ node->chgParam = lappendi(node->chgParam, paramId);
}
}
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 9778e365a58..848bd616bf0 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -121,7 +121,7 @@ ExecAgg(Agg *node)
econtext = aggstate->csstate.cstate.cs_ExprContext;
nagg = length(node->aggs);
- aggregates = (Aggreg **)palloc(sizeof(Aggreg *) * nagg);
+ aggregates = (Aggreg **) palloc(sizeof(Aggreg *) * nagg);
/* take List* and make it an array that can be quickly indexed */
alist = node->aggs;
@@ -333,18 +333,18 @@ ExecAgg(Agg *node)
break;
case T_Expr:
- {
- FunctionCachePtr fcache_ptr;
-
- if (nodeTag(tagnode) == T_Func)
- fcache_ptr = ((Func *) tagnode)->func_fcache;
- else
- fcache_ptr = ((Oper *) tagnode)->op_fcache;
- attlen = fcache_ptr->typlen;
- byVal = fcache_ptr->typbyval;
-
- break;
- }
+ {
+ FunctionCachePtr fcache_ptr;
+
+ if (nodeTag(tagnode) == T_Func)
+ fcache_ptr = ((Func *) tagnode)->func_fcache;
+ else
+ fcache_ptr = ((Oper *) tagnode)->op_fcache;
+ attlen = fcache_ptr->typlen;
+ byVal = fcache_ptr->typbyval;
+
+ break;
+ }
case T_Const:
attlen = ((Const *) aggregates[i]->target)->constlen;
byVal = ((Const *) aggregates[i]->target)->constbyval;
@@ -375,8 +375,8 @@ ExecAgg(Agg *node)
args[0] = value1[i];
args[1] = newVal;
value1[i] =
- (Datum) fmgr_c(&aggfns->xfn1,
- (FmgrValues *) args,
+ (Datum) fmgr_c(&aggfns->xfn1,
+ (FmgrValues *) args,
&isNull1);
Assert(!isNull1);
}
@@ -440,7 +440,7 @@ ExecAgg(Agg *node)
else
elog(NOTICE, "ExecAgg: no valid transition functions??");
value1[i] = (Datum) fmgr_c(&aggfns->finalfn,
- (FmgrValues *) args, &(nulls[i]));
+ (FmgrValues *) args, &(nulls[i]));
}
else if (aggfns->xfn1.fn_addr != NULL)
{
@@ -545,15 +545,15 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
ExecInitNode(outerPlan, estate, (Plan *) node);
/*
- * Result runs in its own context, but make it use our aggregates
- * fix for 'select sum(2+2)'
+ * Result runs in its own context, but make it use our aggregates fix
+ * for 'select sum(2+2)'
*/
if (nodeTag(outerPlan) == T_Result)
{
- ((Result *)outerPlan)->resstate->cstate.cs_ProjInfo->pi_exprContext->ecxt_values =
- econtext->ecxt_values;
- ((Result *)outerPlan)->resstate->cstate.cs_ProjInfo->pi_exprContext->ecxt_nulls =
- econtext->ecxt_nulls;
+ ((Result *) outerPlan)->resstate->cstate.cs_ProjInfo->pi_exprContext->ecxt_values =
+ econtext->ecxt_values;
+ ((Result *) outerPlan)->resstate->cstate.cs_ProjInfo->pi_exprContext->ecxt_nulls =
+ econtext->ecxt_nulls;
}
@@ -661,7 +661,7 @@ aggGetAttr(TupleTableSlot *slot,
return (Datum) tempSlot;
}
- result =
+ result =
heap_getattr(heapTuple, /* tuple containing attribute */
attnum, /* attribute number of desired attribute */
tuple_type,/* tuple descriptor of tuple */
@@ -680,17 +680,18 @@ aggGetAttr(TupleTableSlot *slot,
void
ExecReScanAgg(Agg *node, ExprContext *exprCtxt, Plan *parent)
{
- AggState *aggstate = node->aggstate;
- ExprContext *econtext = aggstate->csstate.cstate.cs_ExprContext;
+ AggState *aggstate = node->aggstate;
+ ExprContext *econtext = aggstate->csstate.cstate.cs_ExprContext;
aggstate->agg_done = FALSE;
MemSet(econtext->ecxt_values, 0, sizeof(Datum) * length(node->aggs));
MemSet(econtext->ecxt_nulls, 0, length(node->aggs));
- /*
- * if chgParam of subnode is not null then plan
- * will be re-scanned by first ExecProcNode.
+
+ /*
+ * if chgParam of subnode is not null then plan will be re-scanned by
+ * first ExecProcNode.
*/
- if (((Plan*) node)->lefttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->lefttree, exprCtxt, (Plan *) node);
-
+ if (((Plan *) node)->lefttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
+
}
diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c
index cdc0e56a1b7..86286284e91 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.10 1997/12/27 06:40:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.11 1998/02/26 04:31:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -150,7 +150,7 @@ exec_append_initialize_next(Append *node)
}
else
estate->es_range_table = nth(whichplan, rts);
-
+
if (unionstate->as_junkFilter_list)
{
estate->es_junkFilter =
@@ -161,7 +161,7 @@ exec_append_initialize_next(Append *node)
{
estate->es_result_relation_info =
(RelationInfo *) nth(whichplan,
- unionstate->as_result_relation_info_list);
+ unionstate->as_result_relation_info_list);
}
result_slot->ttc_whichplan = whichplan;
diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c
index fa733e2da09..81e4b540ec0 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.17 1998/02/18 12:40:43 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.18 1998/02/26 04:31:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -113,24 +113,25 @@ ExecGroupEveryTuple(Group *node)
firsttuple = grpstate->grp_firstTuple;
/* this should occur on the first call only */
- if (firsttuple == NULL)
+ if (firsttuple == NULL)
{
- grpstate->grp_firstTuple = heap_copytuple (outerTuple);
+ grpstate->grp_firstTuple = heap_copytuple(outerTuple);
}
else
{
+
/*
- * Compare with first tuple and see if this tuple is of
- * the same group.
+ * Compare with first tuple and see if this tuple is of the
+ * same group.
*/
if (!sameGroup(firsttuple, outerslot->val,
- node->numCols, node->grpColIdx,
- ExecGetScanType(&grpstate->csstate)))
+ node->numCols, node->grpColIdx,
+ ExecGetScanType(&grpstate->csstate)))
{
grpstate->grp_useFirstTuple = TRUE;
- pfree (firsttuple);
- grpstate->grp_firstTuple = heap_copytuple (outerTuple);
-
+ pfree(firsttuple);
+ grpstate->grp_firstTuple = heap_copytuple(outerTuple);
+
return NULL; /* signifies the end of the group */
}
}
@@ -188,7 +189,7 @@ ExecGroupOneTuple(Group *node)
firsttuple = grpstate->grp_firstTuple;
/* this should occur on the first call only */
- if (firsttuple == NULL)
+ if (firsttuple == NULL)
{
outerslot = ExecProcNode(outerPlan(node), (Plan *) node);
if (outerslot)
@@ -198,7 +199,7 @@ ExecGroupOneTuple(Group *node)
grpstate->grp_done = TRUE;
return NULL;
}
- grpstate->grp_firstTuple = firsttuple = heap_copytuple (outerTuple);
+ grpstate->grp_firstTuple = firsttuple = heap_copytuple(outerTuple);
}
/*
@@ -238,12 +239,12 @@ ExecGroupOneTuple(Group *node)
false);
econtext->ecxt_scantuple = grpstate->csstate.css_ScanTupleSlot;
resultSlot = ExecProject(projInfo, &isDone);
-
+
/* save outerTuple if we are not done yet */
if (!grpstate->grp_done)
{
- pfree (firsttuple);
- grpstate->grp_firstTuple = heap_copytuple (outerTuple);
+ pfree(firsttuple);
+ grpstate->grp_firstTuple = heap_copytuple(outerTuple);
}
return resultSlot;
@@ -340,7 +341,7 @@ ExecEndGroup(Group *node)
ExecClearTuple(grpstate->csstate.css_ScanTupleSlot);
if (grpstate->grp_firstTuple != NULL)
{
- pfree (grpstate->grp_firstTuple);
+ pfree(grpstate->grp_firstTuple);
grpstate->grp_firstTuple = NULL;
}
}
@@ -362,7 +363,7 @@ sameGroup(HeapTuple oldtuple,
bool isNull1,
isNull2;
Datum attr1,
- attr2;
+ attr2;
char *val1,
*val2;
int i;
@@ -391,10 +392,10 @@ sameGroup(HeapTuple oldtuple,
val1 = fmgr(typoutput, attr1,
gettypelem(tupdesc->attrs[att - 1]->atttypid),
- tupdesc->attrs[att - 1]->atttypmod);
+ tupdesc->attrs[att - 1]->atttypmod);
val2 = fmgr(typoutput, attr2,
gettypelem(tupdesc->attrs[att - 1]->atttypid),
- tupdesc->attrs[att - 1]->atttypmod);
+ tupdesc->attrs[att - 1]->atttypmod);
/*
* now, val1 and val2 are ascii representations so we can use
@@ -402,12 +403,12 @@ sameGroup(HeapTuple oldtuple,
*/
if (strcmp(val1, val2) != 0)
{
- pfree (val1);
- pfree (val2);
+ pfree(val1);
+ pfree(val2);
return FALSE;
}
- pfree (val1);
- pfree (val2);
+ pfree(val1);
+ pfree(val2);
}
else
{
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 5ebf508c0c0..81eca617fb4 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.19 1998/02/13 03:26:46 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.20 1998/02/26 04:31:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -781,7 +781,7 @@ static int
hashFunc(char *key, int len)
{
unsigned int h;
- int l;
+ int l;
unsigned char *k;
/*
@@ -901,12 +901,12 @@ ExecReScanHash(Hash *node, ExprContext *exprCtxt, Plan *parent)
pfree(hashstate->hashBatches);
hashstate->hashBatches = NULL;
}
-
- /*
- * if chgParam of subnode is not null then plan
- * will be re-scanned by first ExecProcNode.
- */
- if (((Plan*) node)->lefttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->lefttree, exprCtxt, (Plan *) node);
-
+
+ /*
+ * if chgParam of subnode is not null then plan will be re-scanned by
+ * first ExecProcNode.
+ */
+ if (((Plan *) node)->lefttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
+
}
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index 21132410d45..9a99e80da58 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.10 1998/02/13 03:26:47 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.11 1998/02/26 04:31:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -156,7 +156,7 @@ ExecHashJoin(HashJoin *node)
}
else if (hashtable == NULL)
return (NULL);
-
+
nbatch = hashtable->nbatch;
outerbatches = hjstate->hj_OuterBatches;
if (nbatch > 0 && outerbatches == NULL)
@@ -212,12 +212,14 @@ ExecHashJoin(HashJoin *node)
while (curbatch <= nbatch && TupIsNull(outerTupleSlot))
{
+
/*
* if the current batch runs out, switch to new batch
*/
curbatch = ExecHashJoinNewBatch(hjstate);
if (curbatch > nbatch)
{
+
/*
* when the last batch runs out, clean up
*/
@@ -350,6 +352,7 @@ ExecHashJoin(HashJoin *node)
curbatch = ExecHashJoinNewBatch(hjstate);
if (curbatch > nbatch)
{
+
/*
* when the last batch runs out, clean up
*/
@@ -806,7 +809,7 @@ ExecHashJoinGetBatch(int bucketno, HashJoinTable hashtable, int nbatch)
* ----------------------------------------------------------------
*/
-char *
+char *
ExecHashJoinSaveTuple(HeapTuple heapTuple,
char *buffer,
File file,
@@ -845,16 +848,16 @@ ExecHashJoinSaveTuple(HeapTuple heapTuple,
void
ExecReScanHashJoin(HashJoin *node, ExprContext *exprCtxt, Plan *parent)
{
- HashJoinState *hjstate = node->hashjoinstate;
+ HashJoinState *hjstate = node->hashjoinstate;
if (!node->hashdone)
return;
-
+
node->hashdone = false;
-
- /*
- * Unfortunately, currently we have to destroy hashtable
- * in all cases...
+
+ /*
+ * Unfortunately, currently we have to destroy hashtable in all
+ * cases...
*/
if (hjstate->hj_HashTable)
{
@@ -872,14 +875,14 @@ ExecReScanHashJoin(HashJoin *node, ExprContext *exprCtxt, Plan *parent)
hjstate->jstate.cs_OuterTupleSlot = (TupleTableSlot *) NULL;
hjstate->jstate.cs_TupFromTlist = (bool) false;
-
- /*
- * if chgParam of subnodes is not null then plans
- * will be re-scanned by first ExecProcNode.
+
+ /*
+ * if chgParam of subnodes is not null then plans will be re-scanned
+ * by first ExecProcNode.
*/
- if (((Plan*) node)->lefttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->lefttree, exprCtxt, (Plan *) node);
- if (((Plan*) node)->righttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->righttree, exprCtxt, (Plan *) node);
-
+ if (((Plan *) node)->lefttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
+ if (((Plan *) node)->righttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->righttree, exprCtxt, (Plan *) node);
+
}
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index d15c9bfb35a..4c01e5b1f2a 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.14 1998/02/13 03:26:49 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.15 1998/02/26 04:31:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -267,11 +267,11 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
n_keys = numScanKeys[indexPtr];
run_keys = (int *) runtimeKeyInfo[indexPtr];
scan_keys = (ScanKey) scanKeys[indexPtr];
-
+
/* it's possible in subselects */
if (exprCtxt == NULL)
exprCtxt = node->scan.scanstate->cstate.cs_ExprContext;
-
+
for (j = 0; j < n_keys; j++)
{
@@ -488,7 +488,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
HeapScanDesc currentScanDesc;
ScanDirection direction;
int baseid;
-
+
List *execParam = NULL;
/* ----------------
@@ -711,22 +711,22 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
* it identifies the value to place in our scan key.
* ----------------
*/
-
+
/* Life was so easy before ... subselects */
- if ( ((Param *) leftop)->paramkind == PARAM_EXEC )
+ if (((Param *) leftop)->paramkind == PARAM_EXEC)
{
have_runtime_keys = true;
run_keys[j] = LEFT_OP;
- execParam = lappendi (execParam, ((Param*) leftop)->paramid);
+ execParam = lappendi(execParam, ((Param *) leftop)->paramid);
}
else
{
scanvalue = ExecEvalParam((Param *) leftop,
- scanstate->cstate.cs_ExprContext,
+ scanstate->cstate.cs_ExprContext,
&isnull);
if (isnull)
flags |= SK_ISNULL;
-
+
run_keys[j] = NO_OP;
}
}
@@ -804,22 +804,22 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
* it identifies the value to place in our scan key.
* ----------------
*/
-
+
/* Life was so easy before ... subselects */
- if ( ((Param *) rightop)->paramkind == PARAM_EXEC )
+ if (((Param *) rightop)->paramkind == PARAM_EXEC)
{
have_runtime_keys = true;
run_keys[j] = RIGHT_OP;
- execParam = lappendi (execParam, ((Param*) rightop)->paramid);
+ execParam = lappendi(execParam, ((Param *) rightop)->paramid);
}
else
{
scanvalue = ExecEvalParam((Param *) rightop,
- scanstate->cstate.cs_ExprContext,
+ scanstate->cstate.cs_ExprContext,
&isnull);
if (isnull)
flags |= SK_ISNULL;
-
+
run_keys[j] = NO_OP;
}
}
@@ -989,13 +989,13 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
indexstate->iss_ScanDescs = scanDescs;
indexstate->cstate.cs_TupFromTlist = false;
-
- /*
- * if there are some PARAM_EXEC in skankeys then
- * force index rescan on first scan.
+
+ /*
+ * if there are some PARAM_EXEC in skankeys then force index rescan on
+ * first scan.
*/
- ((Plan*) node)->chgParam = execParam;
-
+ ((Plan *) node)->chgParam = execParam;
+
/* ----------------
* all done.
* ----------------
diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c
index 800bab2b315..596b199ddc5 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.12 1998/02/13 03:26:50 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.13 1998/02/26 04:31:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -350,16 +350,16 @@ ExecEndMaterial(Material *node)
void
ExecMaterialReScan(Material *node, ExprContext *exprCtxt, Plan *parent)
{
- MaterialState *matstate = node->matstate;
+ MaterialState *matstate = node->matstate;
if (matstate->mat_Flag == false)
return;
-
- matstate->csstate.css_currentScanDesc =
- ExecReScanR (matstate->csstate.css_currentRelation,
- matstate->csstate.css_currentScanDesc,
- node->plan.state->es_direction, 0, NULL);
-
+
+ matstate->csstate.css_currentScanDesc =
+ ExecReScanR(matstate->csstate.css_currentRelation,
+ matstate->csstate.css_currentScanDesc,
+ node->plan.state->es_direction, 0, NULL);
+
}
#ifdef NOT_USED /* not used */
diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c
index e592bb31642..005047f337f 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.12 1997/09/08 21:43:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.13 1998/02/26 04:31:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -749,7 +749,8 @@ ExecMergeJoin(MergeJoin *node)
*
* new outer tuple > marked tuple
*
- *****************************
+ ****************************
+ *
*
*
*
@@ -831,7 +832,8 @@ ExecMergeJoin(MergeJoin *node)
* we have to advance the outer scan until we find the outer
* 8.
*
- *****************************
+ ****************************
+ *
*
*
*
@@ -935,7 +937,8 @@ ExecMergeJoin(MergeJoin *node)
* we have to advance the inner scan until we find the inner
* 12.
*
- *****************************
+ ****************************
+ *
*
*
*
diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c
index 4d1fb12cd2f..0d5b210945f 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.8 1998/02/13 03:26:51 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.9 1998/02/26 04:31:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -380,18 +380,18 @@ ExecEndNestLoop(NestLoop *node)
void
ExecReScanNestLoop(NestLoop *node, ExprContext *exprCtxt, Plan *parent)
{
- NestLoopState *nlstate = node->nlstate;
- Plan *outerPlan = outerPlan((Plan*) node);
+ NestLoopState *nlstate = node->nlstate;
+ Plan *outerPlan = outerPlan((Plan *) node);
/*
- * If outerPlan->chgParam is not null then plan will be
- * automatically re-scanned by first ExecProcNode.
- * innerPlan is re-scanned for each new outer tuple and MUST NOT
- * be re-scanned from here or you'll get troubles from inner
- * index scans when outer Vars are used as run-time keys...
+ * If outerPlan->chgParam is not null then plan will be automatically
+ * re-scanned by first ExecProcNode. innerPlan is re-scanned for each
+ * new outer tuple and MUST NOT be re-scanned from here or you'll get
+ * troubles from inner index scans when outer Vars are used as
+ * run-time keys...
*/
if (outerPlan->chgParam == NULL)
- ExecReScan (outerPlan, exprCtxt, (Plan *) node);
+ ExecReScan(outerPlan, exprCtxt, (Plan *) node);
/* let outerPlan to free its result typle ... */
nlstate->jstate.cs_OuterTupleSlot = NULL;
diff --git a/src/backend/executor/nodeResult.c b/src/backend/executor/nodeResult.c
index 8c2edfd44a2..9bc6342b668 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.7 1998/02/18 07:19:34 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.8 1998/02/26 04:31:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -79,8 +79,8 @@ ExecResult(Result *node)
*/
if (resstate->rs_checkqual)
{
- bool qualResult = ExecQual((List *) node->resconstantqual, econtext);
-
+ bool qualResult = ExecQual((List *) node->resconstantqual, econtext);
+
resstate->rs_checkqual = false;
if (qualResult == false)
{
@@ -195,7 +195,7 @@ ExecInitResult(Result *node, EState *estate, Plan *parent)
resstate->rs_done = false;
resstate->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
node->resstate = resstate;
-
+
/* ----------------
* Miscellanious initialization
*
@@ -281,18 +281,18 @@ ExecEndResult(Result *node)
void
ExecReScanResult(Result *node, ExprContext *exprCtxt, Plan *parent)
{
- ResultState *resstate = node->resstate;
+ ResultState *resstate = node->resstate;
resstate->rs_done = false;
resstate->cstate.cs_TupFromTlist = false;
resstate->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
-
- /*
- * if chgParam of subnode is not null then plan
- * will be re-scanned by first ExecProcNode.
+
+ /*
+ * if chgParam of subnode is not null then plan will be re-scanned by
+ * first ExecProcNode.
*/
- if (((Plan*) node)->lefttree &&
- ((Plan*) node)->lefttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->lefttree, exprCtxt, (Plan *) node);
-
+ if (((Plan *) node)->lefttree &&
+ ((Plan *) node)->lefttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
+
}
diff --git a/src/backend/executor/nodeSort.c b/src/backend/executor/nodeSort.c
index 77d43f928a9..665555fa456 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.13 1998/02/23 06:26:56 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.14 1998/02/26 04:31:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -112,7 +112,7 @@ ExecSort(Sort *node)
ScanKey sortkeys;
HeapTuple heapTuple;
TupleTableSlot *slot;
- bool should_free;
+ bool should_free;
/* ----------------
* get state info from node
@@ -395,21 +395,21 @@ ExecReScanSort(Sort *node, ExprContext *exprCtxt, Plan *parent)
SortState *sortstate = node->sortstate;
/*
- * If we haven't sorted yet, just return. If outerplan'
- * chgParam is not NULL then it will be re-scanned by
- * ExecProcNode, else - no reason to re-scan it at all.
+ * If we haven't sorted yet, just return. If outerplan' chgParam is
+ * not NULL then it will be re-scanned by ExecProcNode, else - no
+ * reason to re-scan it at all.
*/
if (sortstate->sort_Flag == false)
return;
-
+
ExecClearTuple(sortstate->csstate.cstate.cs_ResultTupleSlot);
-
- psort_rescan (node);
-
+
+ psort_rescan(node);
+
/*
* If subnode is to be rescanned then we aren't sorted
*/
- if (((Plan*) node)->lefttree->chgParam != NULL)
+ if (((Plan *) node)->lefttree->chgParam != NULL)
sortstate->sort_Flag = false;
}
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c
index 3c5560d13bd..edd1908fc37 100644
--- a/src/backend/executor/nodeSubplan.c
+++ b/src/backend/executor/nodeSubplan.c
@@ -7,9 +7,9 @@
*/
/*
* INTERFACE ROUTINES
- * ExecSubPlan - process a subselect
+ * ExecSubPlan - process a subselect
* ExecInitSubPlan - initialize a subselect
- * ExecEndSubPlan - shut down a subselect
+ * ExecEndSubPlan - shut down a subselect
*/
#include "postgres.h"
@@ -27,77 +27,77 @@
Datum
ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext)
{
- Plan *plan = node->plan;
- SubLink *sublink = node->sublink;
+ Plan *plan = node->plan;
+ SubLink *sublink = node->sublink;
TupleTableSlot *slot;
- List *lst;
- bool result = false;
- bool found = false;
-
- if ( node->setParam != NULL )
- elog (ERROR, "ExecSubPlan: can't set parent params from subquery");
-
+ List *lst;
+ bool result = false;
+ bool found = false;
+
+ if (node->setParam != NULL)
+ elog(ERROR, "ExecSubPlan: can't set parent params from subquery");
+
/*
* Set Params of this plan from parent plan correlation Vars
*/
- if ( node->parParam != NULL )
+ if (node->parParam != NULL)
{
- foreach (lst, node->parParam)
+ foreach(lst, node->parParam)
{
- ParamExecData *prm = &(econtext->ecxt_param_exec_vals[lfirsti(lst)]);
-
- prm->value = ExecEvalExpr ((Node*) lfirst(pvar),
- econtext,
- &(prm->isnull), NULL);
- pvar = lnext (pvar);
+ ParamExecData *prm = &(econtext->ecxt_param_exec_vals[lfirsti(lst)]);
+
+ prm->value = ExecEvalExpr((Node *) lfirst(pvar),
+ econtext,
+ &(prm->isnull), NULL);
+ pvar = lnext(pvar);
}
- plan->chgParam = nconc (plan->chgParam, listCopy(node->parParam));
+ plan->chgParam = nconc(plan->chgParam, listCopy(node->parParam));
}
-
- ExecReScan (plan, (ExprContext*) NULL, plan);
-
- for (slot = ExecProcNode (plan, plan);
- !TupIsNull(slot);
- slot = ExecProcNode (plan, plan))
+
+ ExecReScan(plan, (ExprContext *) NULL, plan);
+
+ for (slot = ExecProcNode(plan, plan);
+ !TupIsNull(slot);
+ slot = ExecProcNode(plan, plan))
{
HeapTuple tup = slot->val;
TupleDesc tdesc = slot->ttc_tupleDescriptor;
int i = 1;
-
- if ( sublink->subLinkType == EXPR_SUBLINK && found )
+
+ if (sublink->subLinkType == EXPR_SUBLINK && found)
{
- elog (ERROR, "ExecSubPlan: more than one tuple returned by expression subselect");
+ elog(ERROR, "ExecSubPlan: more than one tuple returned by expression subselect");
return ((Datum) false);
}
-
- if ( sublink->subLinkType == EXISTS_SUBLINK )
+
+ if (sublink->subLinkType == EXISTS_SUBLINK)
return ((Datum) true);
-
+
found = true;
-
- foreach (lst, sublink->oper)
+
+ foreach(lst, sublink->oper)
{
- Expr *expr = (Expr*) lfirst(lst);
- Const *con = lsecond(expr->args);
- bool isnull;
-
- con->constvalue = heap_getattr (tup, i, tdesc, &(con->constisnull));
- result = (bool) ExecEvalExpr ((Node*) expr, econtext, &isnull, (bool*) NULL);
- if ( isnull )
+ Expr *expr = (Expr *) lfirst(lst);
+ Const *con = lsecond(expr->args);
+ bool isnull;
+
+ con->constvalue = heap_getattr(tup, i, tdesc, &(con->constisnull));
+ result = (bool) ExecEvalExpr((Node *) expr, econtext, &isnull, (bool *) NULL);
+ if (isnull)
result = false;
- if ( (!result && !(sublink->useor)) || (result && sublink->useor) )
+ if ((!result && !(sublink->useor)) || (result && sublink->useor))
break;
i++;
}
-
- if ( (!result && sublink->subLinkType == ALL_SUBLINK) ||
- (result && sublink->subLinkType == ANY_SUBLINK) )
+
+ if ((!result && sublink->subLinkType == ALL_SUBLINK) ||
+ (result && sublink->subLinkType == ANY_SUBLINK))
break;
}
-
- if ( !found && sublink->subLinkType == ALL_SUBLINK )
+
+ if (!found && sublink->subLinkType == ALL_SUBLINK)
return ((Datum) true);
-
+
return ((Datum) result);
}
@@ -109,42 +109,43 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext)
bool
ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent)
{
- EState *sp_estate = CreateExecutorState ();
-
+ EState *sp_estate = CreateExecutorState();
+
sp_estate->es_range_table = node->rtable;
sp_estate->es_param_list_info = estate->es_param_list_info;
sp_estate->es_param_exec_vals = estate->es_param_exec_vals;
- sp_estate->es_tupleTable =
- ExecCreateTupleTable (ExecCountSlotsNode(node->plan) + 10);
- pfree (sp_estate->es_refcount);
+ sp_estate->es_tupleTable =
+ ExecCreateTupleTable(ExecCountSlotsNode(node->plan) + 10);
+ pfree(sp_estate->es_refcount);
sp_estate->es_refcount = estate->es_refcount;
-
- if ( !ExecInitNode (node->plan, sp_estate, NULL) )
+
+ if (!ExecInitNode(node->plan, sp_estate, NULL))
return (false);
-
+
node->shutdown = true;
-
+
/*
- * If this plan is un-correlated or undirect correlated one and
- * want to set params for parent plan then prepare parameters.
+ * If this plan is un-correlated or undirect correlated one and want
+ * to set params for parent plan then prepare parameters.
*/
- if ( node->setParam != NULL )
+ if (node->setParam != NULL)
{
- List *lst;
-
- foreach (lst, node->setParam)
+ List *lst;
+
+ foreach(lst, node->setParam)
{
- ParamExecData *prm = &(estate->es_param_exec_vals[lfirsti(lst)]);
-
+ ParamExecData *prm = &(estate->es_param_exec_vals[lfirsti(lst)]);
+
prm->execPlan = node;
}
+
/*
* Note that in the case of un-correlated subqueries we don't care
- * about setting parent->chgParam here: indices take care about it,
- * for others - it doesn't matter...
+ * about setting parent->chgParam here: indices take care about
+ * it, for others - it doesn't matter...
*/
}
-
+
return (true);
}
@@ -155,92 +156,92 @@ ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent)
* ----------------------------------------------------------------
*/
void
-ExecSetParamPlan (SubPlan *node)
+ExecSetParamPlan(SubPlan *node)
{
- Plan *plan = node->plan;
- SubLink *sublink = node->sublink;
+ Plan *plan = node->plan;
+ SubLink *sublink = node->sublink;
TupleTableSlot *slot;
- List *lst;
- bool found = false;
-
- if ( sublink->subLinkType == ANY_SUBLINK ||
- sublink->subLinkType == ALL_SUBLINK )
- elog (ERROR, "ExecSetParamPlan: ANY/ALL subselect unsupported");
-
- if ( plan->chgParam != NULL )
- ExecReScan (plan, (ExprContext*) NULL, plan);
-
- for (slot = ExecProcNode (plan, plan);
- !TupIsNull(slot);
- slot = ExecProcNode (plan, plan))
+ List *lst;
+ bool found = false;
+
+ if (sublink->subLinkType == ANY_SUBLINK ||
+ sublink->subLinkType == ALL_SUBLINK)
+ elog(ERROR, "ExecSetParamPlan: ANY/ALL subselect unsupported");
+
+ if (plan->chgParam != NULL)
+ ExecReScan(plan, (ExprContext *) NULL, plan);
+
+ for (slot = ExecProcNode(plan, plan);
+ !TupIsNull(slot);
+ slot = ExecProcNode(plan, plan))
{
HeapTuple tup = slot->val;
TupleDesc tdesc = slot->ttc_tupleDescriptor;
int i = 1;
-
- if ( sublink->subLinkType == EXPR_SUBLINK && found )
+
+ if (sublink->subLinkType == EXPR_SUBLINK && found)
{
- elog (ERROR, "ExecSetParamPlan: more than one tuple returned by expression subselect");
+ elog(ERROR, "ExecSetParamPlan: more than one tuple returned by expression subselect");
return;
}
-
+
found = true;
-
- if ( sublink->subLinkType == EXISTS_SUBLINK )
+
+ if (sublink->subLinkType == EXISTS_SUBLINK)
{
- ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(node->setParam)]);
-
+ ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(node->setParam)]);
+
prm->execPlan = NULL;
prm->value = (Datum) true;
prm->isnull = false;
break;
}
-
- /*
+
+ /*
* If this is uncorrelated subquery then its plan will be closed
* (see below) and this tuple will be free-ed - bad for not byval
* types... But is free-ing possible in the next ExecProcNode in
- * this loop ? Who knows... Someday we'll keep track of saved
+ * this loop ? Who knows... Someday we'll keep track of saved
* tuples...
*/
- tup = heap_copytuple (tup);
-
- foreach (lst, node->setParam)
+ tup = heap_copytuple(tup);
+
+ foreach(lst, node->setParam)
{
- ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
-
+ ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
+
prm->execPlan = NULL;
- prm->value = heap_getattr (tup, i, tdesc, &(prm->isnull));
+ prm->value = heap_getattr(tup, i, tdesc, &(prm->isnull));
i++;
}
}
-
- if ( !found )
+
+ if (!found)
{
- if ( sublink->subLinkType == EXISTS_SUBLINK )
+ if (sublink->subLinkType == EXISTS_SUBLINK)
{
- ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(node->setParam)]);
-
+ ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(node->setParam)]);
+
prm->execPlan = NULL;
prm->value = (Datum) false;
prm->isnull = false;
}
else
{
- foreach (lst, node->setParam)
+ foreach(lst, node->setParam)
{
- ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
-
+ ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
+
prm->execPlan = NULL;
prm->value = (Datum) NULL;
prm->isnull = true;
}
}
}
-
- if ( plan->extParam == NULL ) /* un-correlated ... */
+
+ if (plan->extParam == NULL) /* un-correlated ... */
{
- ExecEndNode (plan, plan);
+ ExecEndNode(plan, plan);
node->shutdown = false;
}
}
@@ -252,41 +253,40 @@ ExecSetParamPlan (SubPlan *node)
void
ExecEndSubPlan(SubPlan *node)
{
-
- if ( node->shutdown )
+
+ if (node->shutdown)
{
- ExecEndNode (node->plan, node->plan);
+ ExecEndNode(node->plan, node->plan);
node->shutdown = false;
}
-
+
}
-void
-ExecReScanSetParamPlan (SubPlan *node, Plan *parent)
+void
+ExecReScanSetParamPlan(SubPlan *node, Plan *parent)
{
- Plan *plan = node->plan;
- List *lst;
-
- if ( node->parParam != NULL )
- elog (ERROR, "ExecReScanSetParamPlan: direct correlated subquery unsupported, yet");
- if ( node->setParam == NULL )
- elog (ERROR, "ExecReScanSetParamPlan: setParam list is NULL");
- if ( plan->extParam == NULL )
- elog (ERROR, "ExecReScanSetParamPlan: extParam list of plan is NULL");
-
- /*
- * Don't actual re-scan: ExecSetParamPlan does re-scan if
- * node->plan->chgParam is not NULL...
- ExecReScan (plan, NULL, plan);
+ Plan *plan = node->plan;
+ List *lst;
+
+ if (node->parParam != NULL)
+ elog(ERROR, "ExecReScanSetParamPlan: direct correlated subquery unsupported, yet");
+ if (node->setParam == NULL)
+ elog(ERROR, "ExecReScanSetParamPlan: setParam list is NULL");
+ if (plan->extParam == NULL)
+ elog(ERROR, "ExecReScanSetParamPlan: extParam list of plan is NULL");
+
+ /*
+ * Don't actual re-scan: ExecSetParamPlan does re-scan if
+ * node->plan->chgParam is not NULL... ExecReScan (plan, NULL, plan);
*/
-
- foreach (lst, node->setParam)
+
+ foreach(lst, node->setParam)
{
- ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
-
+ ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
+
prm->execPlan = node;
}
-
- parent->chgParam = nconc (parent->chgParam, listCopy(node->setParam));
+
+ parent->chgParam = nconc(parent->chgParam, listCopy(node->setParam));
}
diff --git a/src/backend/executor/nodeTee.c b/src/backend/executor/nodeTee.c
index f059ef8d6e3..23e09682ea9 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.15 1998/01/07 21:02:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.16 1998/02/26 04:31:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -168,7 +168,7 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent)
bufferRel = heap_openr(teeState->tee_bufferRelname);
else
bufferRel = heap_open(
- heap_create_with_catalog(teeState->tee_bufferRelname, tupType));
+ heap_create_with_catalog(teeState->tee_bufferRelname, tupType));
}
else
{
@@ -177,7 +177,7 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent)
newoid());
/* bufferRel = ExecCreatR(len, tupType, _TEMP_RELATION_ID); */
bufferRel = heap_open(
- heap_create_with_catalog(teeState->tee_bufferRelname, tupType));
+ heap_create_with_catalog(teeState->tee_bufferRelname, tupType));
}
teeState->tee_bufferRel = bufferRel;
@@ -246,7 +246,7 @@ initTeeScanDescs(Tee *node)
{
teeState->tee_leftScanDesc = heap_beginscan(bufferRel,
ScanDirectionIsBackward(dir),
- false, /* seeself */
+ false, /* seeself */
0, /* num scan keys */
NULL /* scan keys */
);
@@ -255,7 +255,7 @@ initTeeScanDescs(Tee *node)
{
teeState->tee_rightScanDesc = heap_beginscan(bufferRel,
ScanDirectionIsBackward(dir),
- false, /* seeself */
+ false, /* seeself */
0, /* num scan keys */
NULL /* scan keys */
);
diff --git a/src/backend/executor/nodeUnique.c b/src/backend/executor/nodeUnique.c
index 31c80e759a7..66b11a66600 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.16 1998/02/23 06:26:58 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.17 1998/02/26 04:31:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -187,7 +187,7 @@ ExecUnique(Unique *node)
char *val1,
*val2;
- attr1 = heap_getattr(slot->val,
+ attr1 = heap_getattr(slot->val,
uniqueAttrNum, tupDesc, &isNull1);
attr2 = heap_getattr(resultTupleSlot->val,
uniqueAttrNum, tupDesc, &isNull2);
@@ -197,11 +197,11 @@ ExecUnique(Unique *node)
if (isNull1) /* both are null, they are equal */
continue;
val1 = fmgr(typoutput, attr1,
- gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
- tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
+ gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
+ tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
val2 = fmgr(typoutput, attr2,
- gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
- tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
+ gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
+ tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
/*
* now, val1 and val2 are ascii representations so we can
@@ -209,12 +209,12 @@ ExecUnique(Unique *node)
*/
if (strcmp(val1, val2) == 0) /* they are equal */
{
- pfree (val1);
- pfree (val2);
+ pfree(val1);
+ pfree(val2);
continue;
}
- pfree (val1);
- pfree (val2);
+ pfree(val1);
+ pfree(val2);
break;
}
else
@@ -361,13 +361,14 @@ void
ExecReScanUnique(Unique *node, ExprContext *exprCtxt, Plan *parent)
{
UniqueState *uniquestate = node->uniquestate;
-
+
ExecClearTuple(uniquestate->cs_ResultTupleSlot);
- /*
- * if chgParam of subnode is not null then plan
- * will be re-scanned by first ExecProcNode.
+
+ /*
+ * if chgParam of subnode is not null then plan will be re-scanned by
+ * first ExecProcNode.
*/
- if (((Plan*) node)->lefttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->lefttree, exprCtxt, (Plan *) node);
-
+ if (((Plan *) node)->lefttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
+
}
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index f1dfe837e24..040baa7d42e 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -18,7 +18,7 @@ typedef struct
Portal portal; /* portal per procedure */
MemoryContext savedcxt;
CommandId savedId;
-} _SPI_connection;
+} _SPI_connection;
static Portal _SPI_portal = (Portal) NULL;
static _SPI_connection *_SPI_stack = NULL;
@@ -38,24 +38,24 @@ typedef struct
List *ptlist;
int nargs;
Oid *argtypes;
-} _SPI_plan;
+} _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
-_SPI_execute_plan(_SPI_plan * plan,
- Datum * Values, char *Nulls, int tcount);
+_SPI_execute_plan(_SPI_plan *plan,
+ Datum *Values, char *Nulls, int tcount);
#define _SPI_CPLAN_CURCXT 0
#define _SPI_CPLAN_PROCXT 1
#define _SPI_CPLAN_TOPCXT 2
-static _SPI_plan *_SPI_copy_plan(_SPI_plan * plan, int location);
+static _SPI_plan *_SPI_copy_plan(_SPI_plan *plan, int location);
static int _SPI_begin_call(bool execmem);
static int _SPI_end_call(bool procmem);
@@ -202,7 +202,7 @@ SPI_exec(char *src, int tcount)
}
int
-SPI_execp(void *plan, Datum * Values, char *Nulls, int tcount)
+SPI_execp(void *plan, Datum *Values, char *Nulls, int tcount)
{
int res;
@@ -225,8 +225,8 @@ SPI_execp(void *plan, Datum * Values, char *Nulls, int tcount)
return (res);
}
-void *
-SPI_prepare(char *src, int nargs, Oid * argtypes)
+void *
+SPI_prepare(char *src, int nargs, Oid *argtypes)
{
_SPI_plan *plan;
@@ -257,7 +257,7 @@ SPI_prepare(char *src, int nargs, Oid * argtypes)
}
-void *
+void *
SPI_saveplan(void *plan)
{
_SPI_plan *newplan;
@@ -310,7 +310,7 @@ SPI_copytuple(HeapTuple tuple)
HeapTuple
SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
- Datum * Values, char *Nulls)
+ Datum *Values, char *Nulls)
{
MemoryContext oldcxt = NULL;
HeapTuple mtuple;
@@ -392,7 +392,7 @@ SPI_fnumber(TupleDesc tupdesc, char *fname)
return (SPI_ERROR_NOATTRIBUTE);
}
-char *
+char *
SPI_fname(TupleDesc tupdesc, int fnumber)
{
@@ -406,7 +406,7 @@ SPI_fname(TupleDesc tupdesc, int fnumber)
return (nameout(&(tupdesc->attrs[fnumber - 1]->attname)));
}
-char *
+char *
SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
{
Datum val;
@@ -431,12 +431,12 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
}
return (fmgr(foutoid, val,
- gettypelem(tupdesc->attrs[fnumber - 1]->atttypid),
- tupdesc->attrs[fnumber - 1]->atttypmod));
+ gettypelem(tupdesc->attrs[fnumber - 1]->atttypid),
+ tupdesc->attrs[fnumber - 1]->atttypmod));
}
Datum
-SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
+SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull)
{
Datum val;
@@ -453,7 +453,7 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
return (val);
}
-char *
+char *
SPI_gettype(TupleDesc tupdesc, int fnumber)
{
HeapTuple typeTuple;
@@ -492,70 +492,70 @@ SPI_gettypeid(TupleDesc tupdesc, int fnumber)
return (tupdesc->attrs[fnumber - 1]->atttypid);
}
-char *
+char *
SPI_getrelname(Relation rel)
{
return (pstrdup(rel->rd_rel->relname.data));
}
void *
-SPI_palloc (Size size)
+SPI_palloc(Size size)
{
- MemoryContext oldcxt = NULL;
- void *pointer;
-
+ MemoryContext oldcxt = NULL;
+ void *pointer;
+
if (_SPI_curid + 1 == _SPI_connected) /* connected */
{
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
elog(FATAL, "SPI: stack corrupted");
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
}
-
- pointer = palloc (size);
-
+
+ pointer = palloc(size);
+
if (oldcxt)
MemoryContextSwitchTo(oldcxt);
-
+
return (pointer);
}
void *
-SPI_repalloc (void *pointer, Size size)
+SPI_repalloc(void *pointer, Size size)
{
- MemoryContext oldcxt = NULL;
-
+ MemoryContext oldcxt = NULL;
+
if (_SPI_curid + 1 == _SPI_connected) /* connected */
{
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
elog(FATAL, "SPI: stack corrupted");
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
}
-
- pointer = repalloc (pointer, size);
-
+
+ pointer = repalloc(pointer, size);
+
if (oldcxt)
MemoryContextSwitchTo(oldcxt);
-
+
return (pointer);
}
-void
-SPI_pfree (void *pointer)
+void
+SPI_pfree(void *pointer)
{
- MemoryContext oldcxt = NULL;
-
+ MemoryContext oldcxt = NULL;
+
if (_SPI_curid + 1 == _SPI_connected) /* connected */
{
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
elog(FATAL, "SPI: stack corrupted");
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
}
-
- pfree (pointer);
-
+
+ pfree(pointer);
+
if (oldcxt)
MemoryContextSwitchTo(oldcxt);
-
+
return;
}
@@ -613,7 +613,7 @@ spi_printtup(HeapTuple tuple, TupleDesc tupdesc)
*/
static int
-_SPI_execute(char *src, int tcount, _SPI_plan * plan)
+_SPI_execute(char *src, int tcount, _SPI_plan *plan)
{
QueryTreeList *queryTree_list;
List *planTree_list;
@@ -710,7 +710,7 @@ _SPI_execute(char *src, int tcount, _SPI_plan * plan)
}
static int
-_SPI_execute_plan(_SPI_plan * plan, Datum * Values, char *Nulls, int tcount)
+_SPI_execute_plan(_SPI_plan *plan, Datum *Values, char *Nulls, int tcount)
{
QueryTreeList *queryTree_list = plan->qtlist;
List *planTree_list = plan->ptlist;
@@ -781,12 +781,12 @@ _SPI_execute_plan(_SPI_plan * plan, Datum * Values, char *Nulls, int tcount)
}
static int
-_SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
+_SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount)
{
Query *parseTree = queryDesc->parsetree;
Plan *plan = queryDesc->plantree;
int operation = queryDesc->operation;
- CommandDest dest = queryDesc->dest;
+ CommandDest dest = queryDesc->dest;
TupleDesc tupdesc;
bool isRetrieveIntoPortal = false;
bool isRetrieveIntoRelation = false;
@@ -810,7 +810,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
{
res = SPI_OK_SELINTO;
isRetrieveIntoRelation = true;
- queryDesc->dest = None; /* */
+ queryDesc->dest = None; /* */
}
break;
case CMD_INSERT:
@@ -878,7 +878,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
#if 0
static void
-_SPI_fetch(FetchStmt * stmt)
+_SPI_fetch(FetchStmt *stmt)
{
char *name = stmt->portalname;
int feature = (stmt->direction == FORWARD) ? EXEC_FOR : EXEC_BACK;
@@ -1001,7 +1001,8 @@ _SPI_checktuples()
if (tuptable != NULL)
failed = true;
}
- else /* some tuples were processed */
+ else
+/* some tuples were processed */
{
if (tuptable == NULL) /* spi_printtup was not called */
failed = true;
@@ -1013,7 +1014,7 @@ _SPI_checktuples()
}
static _SPI_plan *
-_SPI_copy_plan(_SPI_plan * plan, int location)
+_SPI_copy_plan(_SPI_plan *plan, int location)
{
_SPI_plan *newplan;
MemoryContext oldcxt = NULL;
diff --git a/src/backend/lib/dllist.c b/src/backend/lib/dllist.c
index 85d1d7c5cd3..2464d4ddeff 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.8 1997/09/08 21:43:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.9 1998/02/26 04:31:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,7 +18,7 @@
#include <lib/dllist.h>
-Dllist *
+Dllist *
DLNewList(void)
{
Dllist *l;
@@ -42,7 +42,7 @@ DLFreeList(Dllist *l)
free(l);
}
-Dlelem *
+Dlelem *
DLNewElem(void *val)
{
Dlelem *e;
@@ -61,7 +61,7 @@ DLFreeElem(Dlelem *e)
free(e);
}
-Dlelem *
+Dlelem *
DLGetHead(Dllist *l)
{
return (l ? l->dll_head : 0);
@@ -69,7 +69,7 @@ DLGetHead(Dllist *l)
/* get the value stored in the first element */
#ifdef NOT_USED
-void *
+void *
DLGetHeadVal(Dllist *l)
{
Dlelem *e = DLGetHead(l);
@@ -79,7 +79,7 @@ DLGetHeadVal(Dllist *l)
#endif
-Dlelem *
+Dlelem *
DLGetTail(Dllist *l)
{
return (l ? l->dll_tail : 0);
@@ -87,7 +87,7 @@ DLGetTail(Dllist *l)
/* get the value stored in the first element */
#ifdef NOT_USED
-void *
+void *
DLGetTailVal(Dllist *l)
{
Dlelem *e = DLGetTail(l);
@@ -97,13 +97,13 @@ DLGetTailVal(Dllist *l)
#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);
@@ -162,7 +162,7 @@ DLAddTail(Dllist *l, Dlelem *e)
l->dll_head = l->dll_tail;
}
-Dlelem *
+Dlelem *
DLRemHead(Dllist *l)
{
/* remove and return the head */
@@ -188,7 +188,7 @@ DLRemHead(Dllist *l)
return result;
}
-Dlelem *
+Dlelem *
DLRemTail(Dllist *l)
{
/* remove and return the tail */
diff --git a/src/backend/lib/lispsort.c b/src/backend/lib/lispsort.c
index 6ddae8fb7bb..c6e2bdbab6a 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.7 1997/09/08 21:43:31 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/lib/Attic/lispsort.c,v 1.8 1998/02/26 04:31:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,7 +29,7 @@
** 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 */
{
diff --git a/src/backend/lib/qsort.c b/src/backend/lib/qsort.c
index 01dada8fc22..264b9417945 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.5 1998/02/11 19:10:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/lib/Attic/qsort.c,v 1.6 1998/02/26 04:31:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -129,13 +129,13 @@ pg_qsort(void *bot,
static void
quick_sort(char *bot, int nmemb, int size, int (*compar) ())
{
- int cnt;
- u_char ch;
- char *top,
+ int cnt;
+ u_char ch;
+ char *top,
*mid,
*t1,
*t2;
- int n1,
+ int n1,
n2;
char *bsv;
@@ -277,9 +277,9 @@ swap: SWAP(bot, replace);
static void
insertion_sort(char *bot, int nmemb, int size, int (*compar) ())
{
- int cnt;
- u_char ch;
- char *s1,
+ int cnt;
+ u_char ch;
+ char *s1,
*s2,
*t1,
*t2,
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index 2ea1f703cca..7cf875222ad 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.26 1998/02/25 13:06:49 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.27 1998/02/26 04:31:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,16 +40,16 @@
#include <libpq/crypt.h>
-static void sendAuthRequest(Port *port, AuthRequest areq, void (*handler)());
+static void sendAuthRequest(Port *port, AuthRequest areq, void (*handler) ());
static void handle_done_auth(Port *port);
static void handle_krb4_auth(Port *port);
static void handle_krb5_auth(Port *port);
static void handle_password_auth(Port *port);
static void readPasswordPacket(char *arg, PacketLen len, char *pkt);
static void pg_passwordv0_recvauth(char *arg, PacketLen len, char *pkt);
-static int checkPassword(Port *port, char *user, char *password);
-static int old_be_recvauth(Port *port);
-static int map_old_to_new(Port *port, UserAuth old, int status);
+static int checkPassword(Port *port, char *user, char *password);
+static int old_be_recvauth(Port *port);
+static int map_old_to_new(Port *port, UserAuth old, int status);
#ifdef KRB4
@@ -327,14 +327,18 @@ pg_krb5_recvauth(Port *port)
* Handle a v0 password packet.
*/
-static void pg_passwordv0_recvauth(char *arg, PacketLen len, char *pkt)
+static void
+pg_passwordv0_recvauth(char *arg, PacketLen len, char *pkt)
{
- Port *port;
+ Port *port;
PasswordPacketV0 *pp;
- char *user, *password, *cp, *start;
+ char *user,
+ *password,
+ *cp,
+ *start;
- port = (Port *)arg;
- pp = (PasswordPacketV0 *)pkt;
+ port = (Port *) arg;
+ pp = (PasswordPacketV0 *) pkt;
/*
* The packet is supposed to comprise the user name and the password
@@ -343,7 +347,7 @@ static void pg_passwordv0_recvauth(char *arg, PacketLen len, char *pkt)
user = password = NULL;
- len -= sizeof (pp->unused);
+ len -= sizeof(pp->unused);
cp = start = pp->data;
@@ -372,8 +376,8 @@ static void pg_passwordv0_recvauth(char *arg, PacketLen len, char *pkt)
}
else
{
- int status;
- UserAuth saved;
+ int status;
+ UserAuth saved;
/* Check the password. */
@@ -396,7 +400,8 @@ static void pg_passwordv0_recvauth(char *arg, PacketLen len, char *pkt)
* Tell the user the authentication failed, but not why.
*/
-void auth_failed(Port *port)
+void
+auth_failed(Port *port)
{
PacketSendError(&port->pktInfo, "User authentication failed");
}
@@ -405,15 +410,17 @@ void auth_failed(Port *port)
/*
* be_recvauth -- server demux routine for incoming authentication information
*/
-void be_recvauth(Port *port)
+void
+be_recvauth(Port *port)
{
+
/*
* Get the authentication method to use for this frontend/database
* combination.
*/
if (hba_getauthmethod(&port->raddr, port->database, port->auth_arg,
- &port->auth_method) != STATUS_OK)
+ &port->auth_method) != STATUS_OK)
PacketSendError(&port->pktInfo, "Missing or mis-configured pg_hba.conf file");
else if (PG_PROTOCOL_MAJOR(port->proto) == 0)
@@ -426,7 +433,7 @@ void be_recvauth(Port *port)
else
{
AuthRequest areq;
- void (*auth_handler)();
+ void (*auth_handler) ();
/* Keep the compiler quiet. */
@@ -438,44 +445,44 @@ void be_recvauth(Port *port)
switch (port->auth_method)
{
- case uaReject:
- break;
-
- case uaKrb4:
- areq = AUTH_REQ_KRB4;
- auth_handler = handle_krb4_auth;
- break;
+ case uaReject:
+ break;
- case uaKrb5:
- areq = AUTH_REQ_KRB5;
- auth_handler = handle_krb5_auth;
- break;
+ case uaKrb4:
+ areq = AUTH_REQ_KRB4;
+ auth_handler = handle_krb4_auth;
+ break;
- case uaTrust:
- areq = AUTH_REQ_OK;
- auth_handler = handle_done_auth;
- break;
+ case uaKrb5:
+ areq = AUTH_REQ_KRB5;
+ auth_handler = handle_krb5_auth;
+ break;
- case uaIdent:
- if (authident(&port->raddr.in, &port->laddr.in,
- port->user, port->auth_arg) == STATUS_OK)
- {
+ case uaTrust:
areq = AUTH_REQ_OK;
auth_handler = handle_done_auth;
- }
+ break;
- break;
+ case uaIdent:
+ if (authident(&port->raddr.in, &port->laddr.in,
+ port->user, port->auth_arg) == STATUS_OK)
+ {
+ areq = AUTH_REQ_OK;
+ auth_handler = handle_done_auth;
+ }
- case uaPassword:
- areq = AUTH_REQ_PASSWORD;
- auth_handler = handle_password_auth;
- break;
+ break;
- case uaCrypt:
- areq = AUTH_REQ_CRYPT;
- auth_handler = handle_password_auth;
- break;
- }
+ case uaPassword:
+ areq = AUTH_REQ_PASSWORD;
+ auth_handler = handle_password_auth;
+ break;
+
+ case uaCrypt:
+ areq = AUTH_REQ_CRYPT;
+ auth_handler = handle_password_auth;
+ break;
+ }
/* Tell the frontend what we want next. */
@@ -485,24 +492,26 @@ void be_recvauth(Port *port)
auth_failed(port);
}
}
-
+
/*
* Send an authentication request packet to the frontend.
*/
-static void sendAuthRequest(Port *port, AuthRequest areq, void (*handler)())
+static void
+sendAuthRequest(Port *port, AuthRequest areq, void (*handler) ())
{
- char *dp, *sp;
- int i;
- uint32 net_areq;
+ char *dp,
+ *sp;
+ int i;
+ uint32 net_areq;
/* Convert to a byte stream. */
net_areq = htonl(areq);
dp = port->pktInfo.pkt.ar.data;
- sp = (char *)&net_areq;
+ sp = (char *) &net_areq;
*dp++ = 'R';
@@ -518,7 +527,7 @@ static void sendAuthRequest(Port *port, AuthRequest areq, void (*handler)())
i += 2;
}
- PacketSendSetup(&port -> pktInfo, i, handler, (char *)port);
+ PacketSendSetup(&port->pktInfo, i, handler, (char *) port);
}
@@ -526,8 +535,10 @@ static void sendAuthRequest(Port *port, AuthRequest areq, void (*handler)())
* Called when we have told the front end that it is authorised.
*/
-static void handle_done_auth(Port *port)
+static void
+handle_done_auth(Port *port)
{
+
/*
* Don't generate any more traffic. This will cause the backend to
* start.
@@ -542,7 +553,8 @@ static void handle_done_auth(Port *port)
* authentication.
*/
-static void handle_krb4_auth(Port *port)
+static void
+handle_krb4_auth(Port *port)
{
if (pg_krb4_recvauth(port) != STATUS_OK)
auth_failed(port);
@@ -556,7 +568,8 @@ static void handle_krb4_auth(Port *port)
* authentication.
*/
-static void handle_krb5_auth(Port *port)
+static void
+handle_krb5_auth(Port *port)
{
if (pg_krb5_recvauth(port) != STATUS_OK)
auth_failed(port);
@@ -570,11 +583,12 @@ static void handle_krb5_auth(Port *port)
* authentication.
*/
-static void handle_password_auth(Port *port)
+static void
+handle_password_auth(Port *port)
{
/* Set up the read of the password packet. */
- PacketReceiveSetup(&port->pktInfo, readPasswordPacket, (char *)port);
+ PacketReceiveSetup(&port->pktInfo, readPasswordPacket, (char *) port);
}
@@ -582,19 +596,20 @@ static void handle_password_auth(Port *port)
* Called when we have received the password packet.
*/
-static void readPasswordPacket(char *arg, PacketLen len, char *pkt)
+static void
+readPasswordPacket(char *arg, PacketLen len, char *pkt)
{
- char password[sizeof (PasswordPacket) + 1];
- Port *port;
+ char password[sizeof(PasswordPacket) + 1];
+ Port *port;
- port = (Port *)arg;
+ port = (Port *) arg;
/* Silently truncate a password that is too big. */
- if (len > sizeof (PasswordPacket))
- len = sizeof (PasswordPacket);
-
- StrNCpy(password, ((PasswordPacket *)pkt)->passwd, len);
+ if (len > sizeof(PasswordPacket))
+ len = sizeof(PasswordPacket);
+
+ StrNCpy(password, ((PasswordPacket *) pkt)->passwd, len);
if (checkPassword(port, port->user, password) != STATUS_OK)
auth_failed(port);
@@ -609,7 +624,8 @@ static void readPasswordPacket(char *arg, PacketLen len, char *pkt)
* not.
*/
-static int checkPassword(Port *port, char *user, char *password)
+static int
+checkPassword(Port *port, char *user, char *password)
{
if (port->auth_method == uaPassword && port->auth_arg[0] != '\0')
return verify_password(port->auth_arg, user, password);
@@ -622,83 +638,85 @@ static int checkPassword(Port *port, char *user, char *password)
* Server demux routine for incoming authentication information for protocol
* version 0.
*/
-static int old_be_recvauth(Port *port)
+static int
+old_be_recvauth(Port *port)
{
- int status;
- MsgType msgtype = (MsgType)port->proto;
+ int status;
+ MsgType msgtype = (MsgType) port->proto;
/* Handle the authentication that's offered. */
switch (msgtype)
- {
- case STARTUP_KRB4_MSG:
- status = map_old_to_new(port,uaKrb4,pg_krb4_recvauth(port));
- break;
+ {
+ case STARTUP_KRB4_MSG:
+ status = map_old_to_new(port, uaKrb4, pg_krb4_recvauth(port));
+ break;
- case STARTUP_KRB5_MSG:
- status = map_old_to_new(port,uaKrb5,pg_krb5_recvauth(port));
- break;
+ case STARTUP_KRB5_MSG:
+ status = map_old_to_new(port, uaKrb5, pg_krb5_recvauth(port));
+ break;
- case STARTUP_MSG:
- status = map_old_to_new(port,uaTrust,STATUS_OK);
- break;
+ case STARTUP_MSG:
+ status = map_old_to_new(port, uaTrust, STATUS_OK);
+ break;
- case STARTUP_PASSWORD_MSG:
- PacketReceiveSetup(&port->pktInfo, pg_passwordv0_recvauth,
- (char *)port);
+ case STARTUP_PASSWORD_MSG:
+ PacketReceiveSetup(&port->pktInfo, pg_passwordv0_recvauth,
+ (char *) port);
- return STATUS_OK;
+ return STATUS_OK;
- default:
- fprintf(stderr, "Invalid startup message type: %u\n", msgtype);
+ default:
+ fprintf(stderr, "Invalid startup message type: %u\n", msgtype);
- return STATUS_OK;
- }
+ return STATUS_OK;
+ }
return status;
}
-
+
/*
- * The old style authentication has been done. Modify the result of this (eg.
+ * The old style authentication has been done. Modify the result of this (eg.
* allow the connection anyway, disallow it anyway, or use the result)
* depending on what authentication we really want to use.
*/
-static int map_old_to_new(Port *port, UserAuth old, int status)
+static int
+map_old_to_new(Port *port, UserAuth old, int status)
{
switch (port->auth_method)
{
- case uaCrypt:
- case uaReject:
- status = STATUS_ERROR;
- break;
-
- case uaKrb4:
- if (old != uaKrb4)
+ case uaCrypt:
+ case uaReject:
status = STATUS_ERROR;
- break;
+ break;
- case uaKrb5:
- if (old != uaKrb5)
- status = STATUS_ERROR;
- break;
+ case uaKrb4:
+ if (old != uaKrb4)
+ status = STATUS_ERROR;
+ break;
- case uaTrust:
- status = STATUS_OK;
- break;
+ case uaKrb5:
+ if (old != uaKrb5)
+ status = STATUS_ERROR;
+ break;
- case uaIdent:
- status = authident(&port->raddr.in, &port->laddr.in,
- port->user, port->auth_arg);
- break;
+ case uaTrust:
+ status = STATUS_OK;
+ break;
- case uaPassword:
- if (old != uaPassword)
- status = STATUS_ERROR;
+ case uaIdent:
+ status = authident(&port->raddr.in, &port->laddr.in,
+ port->user, port->auth_arg);
+ break;
+
+ case uaPassword:
+ if (old != uaPassword)
+ status = STATUS_ERROR;
- break;
+ break;
}
-
+
return status;
}
diff --git a/src/backend/libpq/be-dumpdata.c b/src/backend/libpq/be-dumpdata.c
index f6622828989..9ac6af1d1f0 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.13 1998/02/10 16:03:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.14 1998/02/26 04:31:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -313,8 +313,8 @@ be_printtup(HeapTuple tuple, TupleDesc typeinfo)
if (!isnull && OidIsValid(typoutput))
{
values[i] = fmgr(typoutput, attr,
- gettypelem(typeinfo->attrs[i]->atttypid),
- typeinfo->attrs[i]->atttypmod);
+ gettypelem(typeinfo->attrs[i]->atttypid),
+ typeinfo->attrs[i]->atttypmod);
}
else
values[i] = NULL;
diff --git a/src/backend/libpq/be-pqexec.c b/src/backend/libpq/be-pqexec.c
index a63ff431616..9b3886065d0 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.14 1998/01/26 01:41:06 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.15 1998/02/26 04:31:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -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,
@@ -129,7 +129,7 @@ PQfn(int fnid,
* returns because the system longjmp's back to the main loop.
* ----------------
*/
-char *
+char *
PQexec(char *query)
{
PortalEntry *entry = NULL;
diff --git a/src/backend/libpq/crypt.c b/src/backend/libpq/crypt.c
index e6d3a7cf439..2dcb4f1be95 100644
--- a/src/backend/libpq/crypt.c
+++ b/src/backend/libpq/crypt.c
@@ -1,8 +1,8 @@
/*-------------------------------------------------------------------------
*
* crypt.c--
- * Look into pg_shadow and check the encrypted password with the one
- * passed in from the frontend.
+ * Look into pg_shadow and check the encrypted password with the one
+ * passed in from the frontend.
*
* Modification History
*
@@ -28,262 +28,313 @@
#include <crypt.h>
#endif
-char** pwd_cache = NULL;
-int pwd_cache_count = 0;
+char **pwd_cache = NULL;
+int pwd_cache_count = 0;
/*-------------------------------------------------------------------------*/
-char* crypt_getpwdfilename() {
+char *
+crypt_getpwdfilename()
+{
- static char* pfnam = NULL;
+ static char *pfnam = NULL;
- if (!pfnam) {
- pfnam = (char*)malloc(strlen(DataDir) + strlen(CRYPT_PWD_FILE) + 2);
- sprintf(pfnam, "%s/%s", DataDir, CRYPT_PWD_FILE);
- }
+ if (!pfnam)
+ {
+ pfnam = (char *) malloc(strlen(DataDir) + strlen(CRYPT_PWD_FILE) + 2);
+ sprintf(pfnam, "%s/%s", DataDir, CRYPT_PWD_FILE);
+ }
- return pfnam;
+ return pfnam;
}
/*-------------------------------------------------------------------------*/
-char* crypt_getpwdreloadfilename() {
+char *
+crypt_getpwdreloadfilename()
+{
- static char* rpfnam = NULL;
+ static char *rpfnam = NULL;
- if (!rpfnam) {
- char* pwdfilename;
+ if (!rpfnam)
+ {
+ char *pwdfilename;
- pwdfilename = crypt_getpwdfilename();
- rpfnam = (char*)malloc(strlen(pwdfilename) + strlen(CRYPT_PWD_RELOAD_SUFX) + 1);
- sprintf(rpfnam, "%s%s", pwdfilename, CRYPT_PWD_RELOAD_SUFX);
- }
+ pwdfilename = crypt_getpwdfilename();
+ rpfnam = (char *) malloc(strlen(pwdfilename) + strlen(CRYPT_PWD_RELOAD_SUFX) + 1);
+ sprintf(rpfnam, "%s%s", pwdfilename, CRYPT_PWD_RELOAD_SUFX);
+ }
- return rpfnam;
+ return rpfnam;
}
/*-------------------------------------------------------------------------*/
static
-FILE* crypt_openpwdfile() {
- char* filename;
- FILE* pwdfile;
+FILE *
+crypt_openpwdfile()
+{
+ char *filename;
+ FILE *pwdfile;
- filename = crypt_getpwdfilename();
- pwdfile = AllocateFile(filename, "r");
+ filename = crypt_getpwdfilename();
+ pwdfile = AllocateFile(filename, "r");
- return pwdfile;
+ return pwdfile;
}
/*-------------------------------------------------------------------------*/
static
-int compar_user(const void* user_a, const void* user_b) {
-
- int min,
- value;
- char* login_a;
- char* login_b;
-
- login_a = *((char**)user_a);
- login_b = *((char**)user_b);
-
- /* We only really want to compare the user logins which are first. We look
- * for the first SEPSTR char getting the number of chars there are before it.
- * We only need to compare to the min count from the two strings.
- */
- min = strcspn(login_a, CRYPT_PWD_FILE_SEPSTR);
- value = strcspn(login_b, CRYPT_PWD_FILE_SEPSTR);
- if (value < min)
- min = value;
-
- /* We add one to min so that the separator character is included in the
- * comparison. Why? I believe this will prevent logins that are proper
- * prefixes of other logins from being 'masked out'. Being conservative!
- */
- return strncmp(login_a, login_b, min + 1);
+int
+compar_user(const void *user_a, const void *user_b)
+{
+
+ int min,
+ value;
+ char *login_a;
+ char *login_b;
+
+ login_a = *((char **) user_a);
+ login_b = *((char **) user_b);
+
+ /*
+ * We only really want to compare the user logins which are first. We
+ * look for the first SEPSTR char getting the number of chars there
+ * are before it. We only need to compare to the min count from the
+ * two strings.
+ */
+ min = strcspn(login_a, CRYPT_PWD_FILE_SEPSTR);
+ value = strcspn(login_b, CRYPT_PWD_FILE_SEPSTR);
+ if (value < min)
+ min = value;
+
+ /*
+ * We add one to min so that the separator character is included in
+ * the comparison. Why? I believe this will prevent logins that are
+ * proper prefixes of other logins from being 'masked out'. Being
+ * conservative!
+ */
+ return strncmp(login_a, login_b, min + 1);
}
/*-------------------------------------------------------------------------*/
static
-void crypt_loadpwdfile() {
-
- char* filename;
- int result;
- FILE* pwd_file;
- char buffer[256];
-
- filename = crypt_getpwdreloadfilename();
- result = unlink(filename);
-
- /* We want to delete the flag file before reading the contents of the pg_pwd
- * file. If result == 0 then the unlink of the reload file was successful.
- * This means that a backend performed a COPY of the pg_shadow file to
- * pg_pwd. Therefore we must now do a reload.
- */
- if (!pwd_cache || !result) {
- if (pwd_cache) { /* free the old data only if this is a reload */
- while (pwd_cache_count--) {
- free((void*)pwd_cache[pwd_cache_count]);
- }
- free((void*)pwd_cache);
- pwd_cache = NULL;
- pwd_cache_count = 0;
- }
-
- if (!(pwd_file = crypt_openpwdfile()))
- return;
-
- /* Here is where we load the data from pg_pwd.
- */
- while (fgets(buffer, 256, pwd_file) != NULL) {
- /* We must remove the return char at the end of the string, as this will
- * affect the correct parsing of the password entry.
- */
- if (buffer[(result = strlen(buffer) - 1)] == '\n')
- buffer[result] = '\0';
-
- pwd_cache = (char**)realloc((void*)pwd_cache, sizeof(char*) * (pwd_cache_count + 1));
- pwd_cache[pwd_cache_count++] = strdup(buffer);
- }
- fclose(pwd_file);
-
- /* Now sort the entries in the cache for faster searching later.
- */
- qsort((void*)pwd_cache, pwd_cache_count, sizeof(char*), compar_user);
- }
+void
+crypt_loadpwdfile()
+{
+
+ char *filename;
+ int result;
+ FILE *pwd_file;
+ char buffer[256];
+
+ filename = crypt_getpwdreloadfilename();
+ result = unlink(filename);
+
+ /*
+ * We want to delete the flag file before reading the contents of the
+ * pg_pwd file. If result == 0 then the unlink of the reload file was
+ * successful. This means that a backend performed a COPY of the
+ * pg_shadow file to pg_pwd. Therefore we must now do a reload.
+ */
+ if (!pwd_cache || !result)
+ {
+ if (pwd_cache)
+ { /* free the old data only if this is a
+ * reload */
+ while (pwd_cache_count--)
+ {
+ free((void *) pwd_cache[pwd_cache_count]);
+ }
+ free((void *) pwd_cache);
+ pwd_cache = NULL;
+ pwd_cache_count = 0;
+ }
+
+ if (!(pwd_file = crypt_openpwdfile()))
+ return;
+
+ /*
+ * Here is where we load the data from pg_pwd.
+ */
+ while (fgets(buffer, 256, pwd_file) != NULL)
+ {
+
+ /*
+ * We must remove the return char at the end of the string, as
+ * this will affect the correct parsing of the password entry.
+ */
+ if (buffer[(result = strlen(buffer) - 1)] == '\n')
+ buffer[result] = '\0';
+
+ pwd_cache = (char **) realloc((void *) pwd_cache, sizeof(char *) * (pwd_cache_count + 1));
+ pwd_cache[pwd_cache_count++] = strdup(buffer);
+ }
+ fclose(pwd_file);
+
+ /*
+ * Now sort the entries in the cache for faster searching later.
+ */
+ qsort((void *) pwd_cache, pwd_cache_count, sizeof(char *), compar_user);
+ }
}
/*-------------------------------------------------------------------------*/
static
-void crypt_parsepwdentry(char* buffer, char** pwd, char** valdate) {
-
- char* parse = buffer;
- int count,
- i;
-
- /* skip to the password field
- */
- for (i = 0; i < 6; i++)
- parse += (strcspn(parse, CRYPT_PWD_FILE_SEPSTR) + 1);
-
- /* store a copy of user password to return
- */
- count = strcspn(parse, CRYPT_PWD_FILE_SEPSTR);
- *pwd = (char*)malloc(count + 1);
- strncpy(*pwd, parse, count);
- (*pwd)[count] = '\0';
- parse += (count + 1);
-
- /* store a copy of date login becomes invalid
- */
- count = strcspn(parse, CRYPT_PWD_FILE_SEPSTR);
- *valdate = (char*)malloc(count + 1);
- strncpy(*valdate, parse, count);
- (*valdate)[count] = '\0';
- parse += (count + 1);
+void
+crypt_parsepwdentry(char *buffer, char **pwd, char **valdate)
+{
+
+ char *parse = buffer;
+ int count,
+ i;
+
+ /*
+ * skip to the password field
+ */
+ for (i = 0; i < 6; i++)
+ parse += (strcspn(parse, CRYPT_PWD_FILE_SEPSTR) + 1);
+
+ /*
+ * store a copy of user password to return
+ */
+ count = strcspn(parse, CRYPT_PWD_FILE_SEPSTR);
+ *pwd = (char *) malloc(count + 1);
+ strncpy(*pwd, parse, count);
+ (*pwd)[count] = '\0';
+ parse += (count + 1);
+
+ /*
+ * store a copy of date login becomes invalid
+ */
+ count = strcspn(parse, CRYPT_PWD_FILE_SEPSTR);
+ *valdate = (char *) malloc(count + 1);
+ strncpy(*valdate, parse, count);
+ (*valdate)[count] = '\0';
+ parse += (count + 1);
}
/*-------------------------------------------------------------------------*/
static
-int crypt_getloginfo(const char* user, char** passwd, char** valuntil) {
-
- char* pwd;
- char* valdate;
- void* fakeout;
-
- *passwd = NULL;
- *valuntil = NULL;
- crypt_loadpwdfile();
-
- if (pwd_cache) {
- char** pwd_entry;
- char user_search[NAMEDATALEN + 2];
-
- sprintf(user_search, "%s\t", user);
- fakeout = (void*)&user_search;
- if ((pwd_entry = (char**)bsearch((void*)&fakeout, (void*)pwd_cache, pwd_cache_count, sizeof(char*), compar_user))) {
- crypt_parsepwdentry(*pwd_entry, &pwd, &valdate);
- *passwd = pwd;
- *valuntil = valdate;
- return STATUS_OK;
- }
-
- return STATUS_OK;
- }
-
- return STATUS_ERROR;
+int
+crypt_getloginfo(const char *user, char **passwd, char **valuntil)
+{
+
+ char *pwd;
+ char *valdate;
+ void *fakeout;
+
+ *passwd = NULL;
+ *valuntil = NULL;
+ crypt_loadpwdfile();
+
+ if (pwd_cache)
+ {
+ char **pwd_entry;
+ char user_search[NAMEDATALEN + 2];
+
+ sprintf(user_search, "%s\t", user);
+ fakeout = (void *) &user_search;
+ if ((pwd_entry = (char **) bsearch((void *) &fakeout, (void *) pwd_cache, pwd_cache_count, sizeof(char *), compar_user)))
+ {
+ crypt_parsepwdentry(*pwd_entry, &pwd, &valdate);
+ *passwd = pwd;
+ *valuntil = valdate;
+ return STATUS_OK;
+ }
+
+ return STATUS_OK;
+ }
+
+ return STATUS_ERROR;
}
/*-------------------------------------------------------------------------*/
#if 0
-MsgType crypt_salt(const char* user) {
-
- char* passwd;
- char* valuntil;
-
- if (crypt_getloginfo(user, &passwd, &valuntil) == STATUS_ERROR)
- return STARTUP_UNSALT_MSG;
-
- if (passwd == NULL || *passwd == '\0' || !strcmp(passwd, "\\N")) {
- if (passwd) free((void*)passwd);
- if (valuntil) free((void*)valuntil);
- return STARTUP_UNSALT_MSG;
- }
-
- free((void*)passwd);
- if (valuntil) free((void*)valuntil);
- return STARTUP_SALT_MSG;
+MsgType
+crypt_salt(const char *user)
+{
+
+ char *passwd;
+ char *valuntil;
+
+ if (crypt_getloginfo(user, &passwd, &valuntil) == STATUS_ERROR)
+ return STARTUP_UNSALT_MSG;
+
+ if (passwd == NULL || *passwd == '\0' || !strcmp(passwd, "\\N"))
+ {
+ if (passwd)
+ free((void *) passwd);
+ if (valuntil)
+ free((void *) valuntil);
+ return STARTUP_UNSALT_MSG;
+ }
+
+ free((void *) passwd);
+ if (valuntil)
+ free((void *) valuntil);
+ return STARTUP_SALT_MSG;
}
+
#endif
/*-------------------------------------------------------------------------*/
-int crypt_verify(Port* port, const char* user, const char* pgpass) {
-
- char* passwd;
- char* valuntil;
- char* crypt_pwd;
- int retval = STATUS_ERROR;
- AbsoluteTime vuntil,
- current;
-
- if (crypt_getloginfo(user, &passwd, &valuntil) == STATUS_ERROR)
- return STATUS_ERROR;
-
- if (passwd == NULL || *passwd == '\0') {
- if (passwd) free((void*)passwd);
- if (valuntil) free((void*)valuntil);
- return STATUS_ERROR;
- }
-
- /*
- * Compare with the encrypted or plain password depending on the
- * authentication method being used for this connection.
- */
-
- crypt_pwd = (port->auth_method == uaCrypt ? crypt(passwd, port->salt) : passwd);
-
- if (!strcmp(pgpass, crypt_pwd)) {
- /* check here to be sure we are not past valuntil
- */
- if (!valuntil || strcmp(valuntil, "\\N") == 0)
- vuntil = INVALID_ABSTIME;
- else
- vuntil = nabstimein(valuntil);
- current = GetCurrentAbsoluteTime();
- if (vuntil != INVALID_ABSTIME && vuntil < current)
- retval = STATUS_ERROR;
- else
- retval = STATUS_OK;
- }
-
- free((void*)passwd);
- if (valuntil) free((void*)valuntil);
-
- return retval;
+int
+crypt_verify(Port *port, const char *user, const char *pgpass)
+{
+
+ char *passwd;
+ char *valuntil;
+ char *crypt_pwd;
+ int retval = STATUS_ERROR;
+ AbsoluteTime vuntil,
+ current;
+
+ if (crypt_getloginfo(user, &passwd, &valuntil) == STATUS_ERROR)
+ return STATUS_ERROR;
+
+ if (passwd == NULL || *passwd == '\0')
+ {
+ if (passwd)
+ free((void *) passwd);
+ if (valuntil)
+ free((void *) valuntil);
+ return STATUS_ERROR;
+ }
+
+ /*
+ * Compare with the encrypted or plain password depending on the
+ * authentication method being used for this connection.
+ */
+
+ crypt_pwd = (port->auth_method == uaCrypt ? crypt(passwd, port->salt) : passwd);
+
+ if (!strcmp(pgpass, crypt_pwd))
+ {
+
+ /*
+ * check here to be sure we are not past valuntil
+ */
+ if (!valuntil || strcmp(valuntil, "\\N") == 0)
+ vuntil = INVALID_ABSTIME;
+ else
+ vuntil = nabstimein(valuntil);
+ current = GetCurrentAbsoluteTime();
+ if (vuntil != INVALID_ABSTIME && vuntil < current)
+ retval = STATUS_ERROR;
+ else
+ retval = STATUS_OK;
+ }
+
+ free((void *) passwd);
+ if (valuntil)
+ free((void *) valuntil);
+
+ return retval;
}
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index 872601293c7..97045ff012c 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.28 1998/02/24 15:18:41 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.29 1998/02/26 04:31:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -97,8 +97,8 @@ read_through_eol(FILE *file)
static void
-read_hba_entry2(FILE *file, UserAuth * userauth_p, char auth_arg[],
- bool *error_p)
+read_hba_entry2(FILE *file, UserAuth *userauth_p, char auth_arg[],
+ bool *error_p)
{
/*--------------------------------------------------------------------------
Read from file FILE the rest of a host record, after the mask field,
@@ -156,7 +156,7 @@ read_hba_entry2(FILE *file, UserAuth * userauth_p, char auth_arg[],
static void
process_hba_record(FILE *file, SockAddr *raddr, const char database[],
bool *matches_p, bool *error_p,
- UserAuth * userauth_p, char auth_arg[])
+ UserAuth *userauth_p, char auth_arg[])
{
/*---------------------------------------------------------------------------
Process the non-comment record in the config file that is next on the file.
@@ -167,7 +167,8 @@ process_hba_record(FILE *file, SockAddr *raddr, const char database[],
return *error_p true, after issuing a message to stderr. If no error,
leave *error_p as it was.
---------------------------------------------------------------------------*/
- char db[MAX_TOKEN], buf[MAX_TOKEN];
+ char db[MAX_TOKEN],
+ buf[MAX_TOKEN];
/* Read the record type field. */
@@ -196,9 +197,9 @@ process_hba_record(FILE *file, SockAddr *raddr, const char database[],
*/
if (!*error_p &&
- (*userauth_p == uaIdent ||
- *userauth_p == uaKrb4 ||
- *userauth_p == uaKrb5))
+ (*userauth_p == uaIdent ||
+ *userauth_p == uaKrb4 ||
+ *userauth_p == uaKrb5))
*error_p = true;
if (*error_p)
@@ -210,12 +211,13 @@ process_hba_record(FILE *file, SockAddr *raddr, const char database[],
*/
if ((strcmp(db, database) != 0 && strcmp(db, "all") != 0) ||
- raddr->sa.sa_family != AF_UNIX)
+ raddr->sa.sa_family != AF_UNIX)
return;
}
else if (strcmp(buf, "host") == 0)
{
- struct in_addr file_ip_addr, mask;
+ struct in_addr file_ip_addr,
+ mask;
/* Get the database. */
@@ -284,7 +286,7 @@ process_hba_record(FILE *file, SockAddr *raddr, const char database[],
syntax:
sprintf(PQerrormsg,
- "process_hba_record: invalid syntax in pg_hba.conf file\n");
+ "process_hba_record: invalid syntax in pg_hba.conf file\n");
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
@@ -296,8 +298,8 @@ syntax:
static void
process_open_config_file(FILE *file, SockAddr *raddr, const char database[],
- bool *host_ok_p, UserAuth * userauth_p,
- char auth_arg[])
+ bool *host_ok_p, UserAuth *userauth_p,
+ char auth_arg[])
{
/*---------------------------------------------------------------------------
This function does the same thing as find_hba_entry, only with
@@ -332,7 +334,7 @@ process_open_config_file(FILE *file, SockAddr *raddr, const char database[],
else
{
process_hba_record(file, raddr, database,
- &found_entry, &error, userauth_p, auth_arg);
+ &found_entry, &error, userauth_p, auth_arg);
}
}
}
@@ -352,7 +354,7 @@ process_open_config_file(FILE *file, SockAddr *raddr, const char database[],
static void
find_hba_entry(SockAddr *raddr, const char database[], bool *host_ok_p,
- UserAuth * userauth_p, char auth_arg[])
+ UserAuth *userauth_p, char auth_arg[])
{
/*--------------------------------------------------------------------------
Read the config file and find an entry that allows connection from
@@ -812,7 +814,7 @@ verify_against_usermap(const char pguser[],
int
-authident(struct sockaddr_in *raddr, struct sockaddr_in *laddr,
+authident(struct sockaddr_in * raddr, struct sockaddr_in * laddr,
const char postgres_username[],
const char auth_arg[])
{
@@ -840,7 +842,7 @@ authident(struct sockaddr_in *raddr, struct sockaddr_in *laddr,
return STATUS_ERROR;
verify_against_usermap(postgres_username, ident_username, auth_arg,
- &checks_out);
+ &checks_out);
return (checks_out ? STATUS_OK : STATUS_ERROR);
}
@@ -849,193 +851,207 @@ authident(struct sockaddr_in *raddr, struct sockaddr_in *laddr,
#ifdef CYR_RECODE
#define CHARSET_FILE "charset.conf"
#define MAX_CHARSETS 10
-#define KEY_HOST 1
-#define KEY_BASE 2
-#define KEY_TABLE 3
+#define KEY_HOST 1
+#define KEY_BASE 2
+#define KEY_TABLE 3
struct CharsetItem
{
- char Orig[MAX_TOKEN];
- char Dest[MAX_TOKEN];
- char Table[MAX_TOKEN];
+ char Orig[MAX_TOKEN];
+ char Dest[MAX_TOKEN];
+ char Table[MAX_TOKEN];
};
-int InRange(char *buf,int host)
+int
+InRange(char *buf, int host)
{
- int valid,i,FromAddr,ToAddr,tmp;
- struct in_addr file_ip_addr;
- char *p;
- unsigned int one=0x80000000,NetMask=0;
- unsigned char mask;
- p = strchr(buf,'/');
- if(p)
- {
- *p++ = '\0';
- valid = inet_aton(buf, &file_ip_addr);
- if(valid)
- {
- mask = strtoul(p,0,0);
- FromAddr = ntohl(file_ip_addr.s_addr);
- ToAddr = ntohl(file_ip_addr.s_addr);
- for(i=0;i<mask;i++)
- {
- NetMask |= one;
- one >>= 1;
- }
- FromAddr &= NetMask;
- ToAddr = ToAddr | ~NetMask;
- tmp = ntohl(host);
- return ((unsigned)tmp>=(unsigned)FromAddr &&
- (unsigned)tmp<=(unsigned)ToAddr);
- }
- }
- else
- {
- p = strchr(buf,'-');
- if(p)
- {
- *p++ = '\0';
- valid = inet_aton(buf, &file_ip_addr);
- if(valid)
- {
- FromAddr = ntohl(file_ip_addr.s_addr);
- valid = inet_aton(p, &file_ip_addr);
- if(valid)
- {
- ToAddr = ntohl(file_ip_addr.s_addr);
- tmp = ntohl(host);
- return ((unsigned)tmp>=(unsigned)FromAddr &&
- (unsigned)tmp<=(unsigned)ToAddr);
- }
- }
- }
- else
- {
- valid = inet_aton(buf, &file_ip_addr);
- if(valid)
- {
- FromAddr = file_ip_addr.s_addr;
- return ((unsigned)FromAddr == (unsigned)host);
- }
- }
- }
- return false;
+ int valid,
+ i,
+ FromAddr,
+ ToAddr,
+ tmp;
+ struct in_addr file_ip_addr;
+ char *p;
+ unsigned int one = 0x80000000,
+ NetMask = 0;
+ unsigned char mask;
+
+ p = strchr(buf, '/');
+ if (p)
+ {
+ *p++ = '\0';
+ valid = inet_aton(buf, &file_ip_addr);
+ if (valid)
+ {
+ mask = strtoul(p, 0, 0);
+ FromAddr = ntohl(file_ip_addr.s_addr);
+ ToAddr = ntohl(file_ip_addr.s_addr);
+ for (i = 0; i < mask; i++)
+ {
+ NetMask |= one;
+ one >>= 1;
+ }
+ FromAddr &= NetMask;
+ ToAddr = ToAddr | ~NetMask;
+ tmp = ntohl(host);
+ return ((unsigned) tmp >= (unsigned) FromAddr &&
+ (unsigned) tmp <= (unsigned) ToAddr);
+ }
+ }
+ else
+ {
+ p = strchr(buf, '-');
+ if (p)
+ {
+ *p++ = '\0';
+ valid = inet_aton(buf, &file_ip_addr);
+ if (valid)
+ {
+ FromAddr = ntohl(file_ip_addr.s_addr);
+ valid = inet_aton(p, &file_ip_addr);
+ if (valid)
+ {
+ ToAddr = ntohl(file_ip_addr.s_addr);
+ tmp = ntohl(host);
+ return ((unsigned) tmp >= (unsigned) FromAddr &&
+ (unsigned) tmp <= (unsigned) ToAddr);
+ }
+ }
+ }
+ else
+ {
+ valid = inet_aton(buf, &file_ip_addr);
+ if (valid)
+ {
+ FromAddr = file_ip_addr.s_addr;
+ return ((unsigned) FromAddr == (unsigned) host);
+ }
+ }
+ }
+ return false;
}
-void GetCharSetByHost(char TableName[],int host, const char DataDir[])
+void
+GetCharSetByHost(char TableName[], int host, const char DataDir[])
{
- FILE *file;
- char buf[MAX_TOKEN],BaseCharset[MAX_TOKEN],
- OrigCharset[MAX_TOKEN],DestCharset[MAX_TOKEN],HostCharset[MAX_TOKEN];
- char c,eof=false;
- char *map_file;
- int key=0,i;
- struct CharsetItem* ChArray[MAX_CHARSETS];
- int ChIndex=0;
-
- *TableName = '\0';
- map_file = (char *) malloc((strlen(DataDir) +
- strlen(CHARSET_FILE)+2)*sizeof(char));
- sprintf(map_file, "%s/%s", DataDir, CHARSET_FILE);
- file = fopen(map_file, "r");
- if (file == NULL)
- return;
- while (!eof)
- {
- c = getc(file);
- ungetc(c, file);
- if (c == EOF)
- eof = true;
- else
- {
- if (c == '#')
- read_through_eol(file);
- else
- {
- /* Read the key */
- next_token(file, buf, sizeof(buf));
- if (buf[0] != '\0')
- {
- if (strcasecmp(buf, "HostCharset") == 0)
- key = KEY_HOST;
- if (strcasecmp(buf, "BaseCharset") == 0)
- key = KEY_BASE;
- if (strcasecmp(buf, "RecodeTable") == 0)
- key = KEY_TABLE;
- switch(key)
- {
- case KEY_HOST:
- /* Read the host */
- next_token(file, buf, sizeof(buf));
- if (buf[0] != '\0')
- {
- if (InRange(buf,host))
- {
- /* Read the charset */
- next_token(file, buf, sizeof(buf));
- if (buf[0] != '\0')
- {
- strcpy(HostCharset,buf);
- }
- }
- }
- break;
- case KEY_BASE:
- /* Read the base charset */
- next_token(file, buf, sizeof(buf));
- if (buf[0] != '\0')
- {
- strcpy(BaseCharset,buf);
- }
- break;
- case KEY_TABLE:
- /* Read the original charset */
- next_token(file, buf, sizeof(buf));
- if (buf[0] != '\0')
- {
- strcpy(OrigCharset,buf);
- /* Read the destination charset */
- next_token(file, buf, sizeof(buf));
- if (buf[0] != '\0')
- {
- strcpy(DestCharset,buf);
- /* Read the table filename */
- next_token(file, buf, sizeof(buf));
- if (buf[0] != '\0')
- {
- ChArray[ChIndex] = (struct CharsetItem *) malloc(sizeof(struct CharsetItem));
- strcpy(ChArray[ChIndex]->Orig,OrigCharset);
- strcpy(ChArray[ChIndex]->Dest,DestCharset);
- strcpy(ChArray[ChIndex]->Table,buf);
- ChIndex++;
- }
- }
- }
- break;
- }
- read_through_eol(file);
- }
- }
- }
- }
- fclose(file);
- free(map_file);
-
- for(i=0; i<ChIndex; i++)
- {
- if(!strcasecmp(BaseCharset,ChArray[i]->Orig) &&
- !strcasecmp(HostCharset,ChArray[i]->Dest))
- {
- strncpy(TableName,ChArray[i]->Table,79);
- }
- free((struct CharsetItem *) ChArray[i]);
- }
+ FILE *file;
+ char buf[MAX_TOKEN],
+ BaseCharset[MAX_TOKEN],
+ OrigCharset[MAX_TOKEN],
+ DestCharset[MAX_TOKEN],
+ HostCharset[MAX_TOKEN];
+ char c,
+ eof = false;
+ char *map_file;
+ int key = 0,
+ i;
+ struct CharsetItem *ChArray[MAX_CHARSETS];
+ int ChIndex = 0;
+
+ *TableName = '\0';
+ map_file = (char *) malloc((strlen(DataDir) +
+ strlen(CHARSET_FILE) + 2) * sizeof(char));
+ sprintf(map_file, "%s/%s", DataDir, CHARSET_FILE);
+ file = fopen(map_file, "r");
+ if (file == NULL)
+ return;
+ while (!eof)
+ {
+ c = getc(file);
+ ungetc(c, file);
+ if (c == EOF)
+ eof = true;
+ else
+ {
+ if (c == '#')
+ read_through_eol(file);
+ else
+ {
+ /* Read the key */
+ next_token(file, buf, sizeof(buf));
+ if (buf[0] != '\0')
+ {
+ if (strcasecmp(buf, "HostCharset") == 0)
+ key = KEY_HOST;
+ if (strcasecmp(buf, "BaseCharset") == 0)
+ key = KEY_BASE;
+ if (strcasecmp(buf, "RecodeTable") == 0)
+ key = KEY_TABLE;
+ switch (key)
+ {
+ case KEY_HOST:
+ /* Read the host */
+ next_token(file, buf, sizeof(buf));
+ if (buf[0] != '\0')
+ {
+ if (InRange(buf, host))
+ {
+ /* Read the charset */
+ next_token(file, buf, sizeof(buf));
+ if (buf[0] != '\0')
+ {
+ strcpy(HostCharset, buf);
+ }
+ }
+ }
+ break;
+ case KEY_BASE:
+ /* Read the base charset */
+ next_token(file, buf, sizeof(buf));
+ if (buf[0] != '\0')
+ {
+ strcpy(BaseCharset, buf);
+ }
+ break;
+ case KEY_TABLE:
+ /* Read the original charset */
+ next_token(file, buf, sizeof(buf));
+ if (buf[0] != '\0')
+ {
+ strcpy(OrigCharset, buf);
+ /* Read the destination charset */
+ next_token(file, buf, sizeof(buf));
+ if (buf[0] != '\0')
+ {
+ strcpy(DestCharset, buf);
+ /* Read the table filename */
+ next_token(file, buf, sizeof(buf));
+ if (buf[0] != '\0')
+ {
+ ChArray[ChIndex] = (struct CharsetItem *) malloc(sizeof(struct CharsetItem));
+ strcpy(ChArray[ChIndex]->Orig, OrigCharset);
+ strcpy(ChArray[ChIndex]->Dest, DestCharset);
+ strcpy(ChArray[ChIndex]->Table, buf);
+ ChIndex++;
+ }
+ }
+ }
+ break;
+ }
+ read_through_eol(file);
+ }
+ }
+ }
+ }
+ fclose(file);
+ free(map_file);
+
+ for (i = 0; i < ChIndex; i++)
+ {
+ if (!strcasecmp(BaseCharset, ChArray[i]->Orig) &&
+ !strcasecmp(HostCharset, ChArray[i]->Dest))
+ {
+ strncpy(TableName, ChArray[i]->Table, 79);
+ }
+ free((struct CharsetItem *) ChArray[i]);
+ }
}
+
#endif
extern int
hba_getauthmethod(SockAddr *raddr, char *database, char *auth_arg,
- UserAuth *auth_method)
+ UserAuth *auth_method)
{
/*---------------------------------------------------------------------------
Determine what authentication method should be used when accessing database
diff --git a/src/backend/libpq/password.c b/src/backend/libpq/password.c
index c77b065e336..1bb503bdcf0 100644
--- a/src/backend/libpq/password.c
+++ b/src/backend/libpq/password.c
@@ -12,8 +12,8 @@
int
verify_password(char *auth_arg, char *user, char *password)
{
- char *pw_file_fullname;
- FILE *pw_file;
+ char *pw_file_fullname;
+ FILE *pw_file;
pw_file_fullname = (char *) palloc(strlen(DataDir) + strlen(auth_arg) + 2);
strcpy(pw_file_fullname, DataDir);
@@ -36,9 +36,12 @@ verify_password(char *auth_arg, char *user, char *password)
while (!feof(pw_file))
{
- char pw_file_line[255], *p, *test_user, *test_pw;
+ char pw_file_line[255],
+ *p,
+ *test_user,
+ *test_pw;
- fgets(pw_file_line, sizeof (pw_file_line), pw_file);
+ fgets(pw_file_line, sizeof(pw_file_line), pw_file);
p = pw_file_line;
test_user = strtok(p, ":");
diff --git a/src/backend/libpq/portal.c b/src/backend/libpq/portal.c
index 14c11127bc5..922b622b4e5 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.12 1997/12/09 03:10:43 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.13 1998/02/26 04:31:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -295,7 +295,7 @@ 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;
@@ -451,7 +451,7 @@ 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;
@@ -578,7 +578,7 @@ PQGetTupleBlock(PortalBuffer *portal,
* PQgetvalue - Return an attribute (field) value
* --------------------------------
*/
-char *
+char *
PQgetvalue(PortalBuffer *portal,
int tuple_index,
int field_number)
@@ -598,7 +598,7 @@ 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)
diff --git a/src/backend/libpq/portalbuf.c b/src/backend/libpq/portalbuf.c
index 7bdebc2b348..f3cbf22a20b 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.9 1997/12/09 03:10:45 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.10 1998/02/26 04:31:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -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
@@ -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 e1252d2a747..204578cb64b 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.38 1998/02/24 04:01:53 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.39 1998/02/26 04:31:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,9 +38,9 @@
#include <stdio.h>
#if defined(HAVE_STRING_H)
-# include <string.h>
+#include <string.h>
#else
-# include <strings.h>
+#include <strings.h>
#endif
#include <signal.h>
#include <errno.h>
@@ -558,7 +558,7 @@ pq_async_notify()
* RETURNS: STATUS_OK or STATUS_ERROR
*/
-static char sock_path[MAXPGPATH+1] = "";
+static char sock_path[MAXPGPATH + 1] = "";
/* do_unlink()
* Shutdown routine for backend connection
@@ -574,7 +574,7 @@ do_unlink()
int
StreamServerPort(char *hostName, short portName, int *fdP)
{
- SockAddr saddr;
+ SockAddr saddr;
int fd,
err,
family;
@@ -613,22 +613,22 @@ StreamServerPort(char *hostName, short portName, int *fdP)
{
saddr.in.sin_addr.s_addr = htonl(INADDR_ANY);
saddr.in.sin_port = htons(portName);
- len = sizeof (struct sockaddr_in);
+ len = sizeof(struct sockaddr_in);
}
err = bind(fd, &saddr.sa, len);
if (err < 0)
{
- sprintf(PQerrormsg,
- "FATAL: StreamServerPort: bind() failed: errno=%d\n",
- errno);
- pqdebug("%s", PQerrormsg);
- strcat(PQerrormsg, "\tIs another postmaster already running on that port?\n");
- if (family == AF_UNIX)
- strcat(PQerrormsg, "\tIf not, remove socket node (/tmp/.s.PGSQL.<portnr>)and retry.\n");
- else
- strcat(PQerrormsg, "\tIf not, wait a few seconds and retry.\n");
- fputs(PQerrormsg, stderr);
- return (STATUS_ERROR);
+ sprintf(PQerrormsg,
+ "FATAL: StreamServerPort: bind() failed: errno=%d\n",
+ errno);
+ pqdebug("%s", PQerrormsg);
+ strcat(PQerrormsg, "\tIs another postmaster already running on that port?\n");
+ if (family == AF_UNIX)
+ strcat(PQerrormsg, "\tIf not, remove socket node (/tmp/.s.PGSQL.<portnr>)and retry.\n");
+ else
+ strcat(PQerrormsg, "\tIf not, wait a few seconds and retry.\n");
+ fputs(PQerrormsg, stderr);
+ return (STATUS_ERROR);
}
listen(fd, SOMAXCONN);
@@ -643,10 +643,10 @@ StreamServerPort(char *hostName, short portName, int *fdP)
*fdP = fd;
if (family == AF_UNIX)
- {
- chmod(sock_path, 0777);
- atexit(do_unlink);
- }
+ {
+ chmod(sock_path, 0777);
+ atexit(do_unlink);
+ }
return (STATUS_OK);
}
diff --git a/src/backend/libpq/pqcomprim.c b/src/backend/libpq/pqcomprim.c
index 96acff11963..7631e1c7650 100644
--- a/src/backend/libpq/pqcomprim.c
+++ b/src/backend/libpq/pqcomprim.c
@@ -63,12 +63,12 @@
int
pqPutShort(int integer, FILE *f)
{
- uint16 n;
+ uint16 n;
#ifdef FRONTEND
- n = htons((uint16)integer);
+ n = htons((uint16) integer);
#else
- n = ((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ? hton_s(integer) : htons((uint16)integer));
+ n = ((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ? hton_s(integer) : htons((uint16) integer));
#endif
if (fwrite(&n, 2, 1, f) != 1)
@@ -81,12 +81,12 @@ pqPutShort(int integer, FILE *f)
int
pqPutLong(int integer, FILE *f)
{
- uint32 n;
+ uint32 n;
#ifdef FRONTEND
- n = htonl((uint32)integer);
+ n = htonl((uint32) integer);
#else
- n = ((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ? hton_l(integer) : htonl((uint32)integer));
+ n = ((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ? hton_l(integer) : htonl((uint32) integer));
#endif
if (fwrite(&n, 4, 1, f) != 1)
@@ -99,15 +99,15 @@ pqPutLong(int integer, FILE *f)
int
pqGetShort(int *result, FILE *f)
{
- uint16 n;
+ uint16 n;
if (fread(&n, 2, 1, f) != 1)
return EOF;
#ifdef FRONTEND
- *result = (int)ntohs(n);
+ *result = (int) ntohs(n);
#else
- *result = (int)((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ? ntoh_s(n) : ntohs(n));
+ *result = (int) ((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ? ntoh_s(n) : ntohs(n));
#endif
return 0;
@@ -117,15 +117,15 @@ pqGetShort(int *result, FILE *f)
int
pqGetLong(int *result, FILE *f)
{
- uint32 n;
+ uint32 n;
if (fread(&n, 4, 1, f) != 1)
return EOF;
#ifdef FRONTEND
- *result = (int)ntohl(n);
+ *result = (int) ntohl(n);
#else
- *result = (int)((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ? ntoh_l(n) : ntohl(n));
+ *result = (int) ((PG_PROTOCOL_MAJOR(FrontendProtocol) == 0) ? ntoh_l(n) : ntohl(n));
#endif
return 0;
@@ -139,7 +139,7 @@ pqGetLong(int *result, FILE *f)
int
pqGetNBytes(char *s, size_t len, FILE *f)
{
- int cnt;
+ int cnt;
if (f == NULL)
return EOF;
@@ -167,7 +167,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 66b7ea4393e..97caae952ac 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.14 1998/01/31 20:12:09 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.15 1998/02/26 04:31:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,30 +33,31 @@
* Set up a packet read for the postmaster event loop.
*/
-void PacketReceiveSetup(Packet *pkt, void (*iodone)(), char *arg)
+void PacketReceiveSetup(Packet *pkt, void (*iodone) (), char *arg)
{
- pkt->nrtodo = sizeof (pkt->len);
- pkt->ptr = (char *)&pkt->len;
+ pkt->nrtodo = sizeof(pkt->len);
+ pkt->ptr = (char *) &pkt->len;
pkt->iodone = iodone;
pkt->arg = arg;
pkt->state = ReadingPacketLength;
/* Clear the destination. */
- MemSet(&pkt->pkt, 0, sizeof (pkt->pkt));
+ MemSet(&pkt->pkt, 0, sizeof(pkt->pkt));
}
/*
- * Read a packet fragment. Return STATUS_OK if the connection should stay
+ * Read a packet fragment. Return STATUS_OK if the connection should stay
* open.
*/
-int PacketReceiveFragment(Packet *pkt, int sock)
+int
+PacketReceiveFragment(Packet *pkt, int sock)
{
- int got;
+ int got;
- if ((got = read(sock,pkt->ptr,pkt->nrtodo)) > 0)
+ if ((got = read(sock, pkt->ptr, pkt->nrtodo)) > 0)
{
pkt->nrtodo -= got;
pkt->ptr += got;
@@ -67,18 +68,18 @@ int PacketReceiveFragment(Packet *pkt, int sock)
{
pkt->len = ntohl(pkt->len);
- if (pkt->len < sizeof (pkt->len) ||
- pkt->len > sizeof (pkt->len) + sizeof (pkt->pkt))
+ if (pkt->len < sizeof(pkt->len) ||
+ pkt->len > sizeof(pkt->len) + sizeof(pkt->pkt))
{
- PacketSendError(pkt,"Invalid packet length");
+ PacketSendError(pkt, "Invalid packet length");
return STATUS_OK;
}
/* Set up for the rest of the packet. */
- pkt->nrtodo = pkt->len - sizeof (pkt->len);
- pkt->ptr = (char *)&pkt->pkt;
+ pkt->nrtodo = pkt->len - sizeof(pkt->len);
+ pkt->ptr = (char *) &pkt->pkt;
pkt->state = ReadingPacket;
}
@@ -93,8 +94,8 @@ int PacketReceiveFragment(Packet *pkt, int sock)
if (pkt->iodone == NULL)
return STATUS_ERROR;
- (*pkt->iodone)(pkt->arg, pkt->len - sizeof (pkt->len),
- (char *)&pkt->pkt);
+ (*pkt->iodone) (pkt->arg, pkt->len - sizeof(pkt->len),
+ (char *) &pkt->pkt);
}
return STATUS_OK;
@@ -116,10 +117,10 @@ int PacketReceiveFragment(Packet *pkt, int sock)
* Set up a packet write for the postmaster event loop.
*/
-void PacketSendSetup(Packet *pkt, int nbytes, void (*iodone)(), char *arg)
+void PacketSendSetup(Packet *pkt, int nbytes, void (*iodone) (), char *arg)
{
pkt->nrtodo = nbytes;
- pkt->ptr = (char *)&pkt->pkt;
+ pkt->ptr = (char *) &pkt->pkt;
pkt->iodone = iodone;
pkt->arg = arg;
pkt->state = WritingPacket;
@@ -131,11 +132,12 @@ void PacketSendSetup(Packet *pkt, int nbytes, void (*iodone)(), char *arg)
* open.
*/
-int PacketSendFragment(Packet *pkt, int sock)
+int
+PacketSendFragment(Packet *pkt, int sock)
{
- int done;
+ int done;
- if ((done = write(sock,pkt->ptr,pkt->nrtodo)) > 0)
+ if ((done = write(sock, pkt->ptr, pkt->nrtodo)) > 0)
{
pkt->nrtodo -= done;
pkt->ptr += done;
@@ -151,7 +153,7 @@ int PacketSendFragment(Packet *pkt, int sock)
if (pkt->iodone == NULL)
return STATUS_ERROR;
- (*pkt->iodone)(pkt->arg);
+ (*pkt->iodone) (pkt->arg);
}
return STATUS_OK;
@@ -173,12 +175,13 @@ int PacketSendFragment(Packet *pkt, int sock)
* Send an error message from the postmaster to the frontend.
*/
-void PacketSendError(Packet *pkt, char *errormsg)
+void
+PacketSendError(Packet *pkt, char *errormsg)
{
fprintf(stderr, "%s\n", errormsg);
pkt->pkt.em.data[0] = 'E';
- StrNCpy(&pkt->pkt.em.data[1], errormsg, sizeof (pkt->pkt.em.data) - 2);
+ StrNCpy(&pkt->pkt.em.data[1], errormsg, sizeof(pkt->pkt.em.data) - 2);
/*
* The NULL i/o callback will cause the connection to be broken when
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index 4c78339ad42..8d09242bf54 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.13 1998/02/05 04:21:56 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.14 1998/02/26 04:31:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,17 +36,19 @@ main(int argc, char *argv[])
int len;
#if defined(alpha)
-# ifdef NOFIXADE
- int buffer[] = {SSIN_UACPROC, UAC_SIGBUS};
-# endif /* NOFIXADE */
-# ifdef NOPRINTADE
- int buffer[] = {SSIN_UACPROC, UAC_NOPRINT};
-# endif /* NOPRINTADE */
+#ifdef NOFIXADE
+ int buffer[] = {SSIN_UACPROC, UAC_SIGBUS};
+
+#endif /* NOFIXADE */
+#ifdef NOPRINTADE
+ int buffer[] = {SSIN_UACPROC, UAC_NOPRINT};
+
+#endif /* NOPRINTADE */
#endif
#ifdef USE_LOCALE
setlocale(LC_CTYPE, ""); /* take locale information from an
- * environment */
+ * environment */
setlocale(LC_COLLATE, "");
setlocale(LC_MONETARY, "");
#endif
@@ -58,18 +60,18 @@ main(int argc, char *argv[])
*/
#if defined(ultrix4)
- syscall(SYS_sysmips, MIPS_FIXADE, 0, NULL, NULL, NULL);
+ syscall(SYS_sysmips, MIPS_FIXADE, 0, NULL, NULL, NULL);
#endif
#if defined(alpha)
if (setsysinfo(SSI_NVPAIRS, buffer, 1, (caddr_t) NULL,
- (unsigned long) NULL) < 0)
+ (unsigned long) NULL) < 0)
{
elog(NOTICE, "setsysinfo failed: %d\n", errno);
}
-#endif
+#endif
-#endif /* NOFIXADE || NOPRINTADE */
+#endif /* NOFIXADE || NOPRINTADE */
/*
* use one executable for both postgres and postmaster, invoke one or
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 991965436ae..40d8abce0c2 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.40 1998/02/23 02:54:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.41 1998/02/26 04:32:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@
* 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;
@@ -79,8 +79,8 @@ listCopy(List *list)
static void
CopyPlanFields(Plan *from, Plan *newnode)
{
- extern List *SS_pull_subplan (void *expr);
-
+ extern List *SS_pull_subplan(void *expr);
+
newnode->cost = from->cost;
newnode->plan_size = from->plan_size;
newnode->plan_width = from->plan_width;
@@ -90,12 +90,12 @@ CopyPlanFields(Plan *from, Plan *newnode)
newnode->qual = copyObject(from->qual);
newnode->lefttree = copyObject(from->lefttree);
newnode->righttree = copyObject(from->righttree);
- newnode->extParam = listCopy (from->extParam);
- newnode->locParam = listCopy (from->locParam);
- newnode->chgParam = listCopy (from->chgParam);
+ newnode->extParam = listCopy(from->extParam);
+ newnode->locParam = listCopy(from->locParam);
+ newnode->chgParam = listCopy(from->chgParam);
Node_Copy(from, newnode, initPlan);
- if ( from->subPlan != NULL )
- newnode->subPlan = SS_pull_subplan (newnode->qual);
+ if (from->subPlan != NULL)
+ newnode->subPlan = SS_pull_subplan(newnode->qual);
else
newnode->subPlan = NULL;
newnode->nParamExec = from->nParamExec;
@@ -471,7 +471,7 @@ _copySort(Sort *from)
Node_Copy(from, newnode, sortstate);
Node_Copy(from, newnode, psortstate);
newnode->cleaned = from->cleaned;
-
+
return newnode;
}
@@ -484,13 +484,13 @@ static Group *
_copyGroup(Group *from)
{
Group *newnode = makeNode(Group);
-
+
CopyPlanFields((Plan *) from, (Plan *) newnode);
newnode->tuplePerGroup = from->tuplePerGroup;
newnode->numCols = from->numCols;
- newnode->grpColIdx = palloc (from->numCols * sizeof (AttrNumber));
- memcpy (newnode->grpColIdx, from->grpColIdx, from->numCols * sizeof (AttrNumber));
+ newnode->grpColIdx = palloc(from->numCols * sizeof(AttrNumber));
+ memcpy(newnode->grpColIdx, from->grpColIdx, from->numCols * sizeof(AttrNumber));
Node_Copy(from, newnode, grpstate);
return newnode;
@@ -520,12 +520,12 @@ _copyAgg(Agg *from)
static GroupClause *
_copyGroupClause(GroupClause *from)
{
- GroupClause *newnode = makeNode(GroupClause);
+ GroupClause *newnode = makeNode(GroupClause);
- Node_Copy(from, newnode, entry);
- newnode->grpOpoid = from->grpOpoid;
+ Node_Copy(from, newnode, entry);
+ newnode->grpOpoid = from->grpOpoid;
- return newnode;
+ return newnode;
}
@@ -592,13 +592,13 @@ _copyHash(Hash *from)
static SubPlan *
_copySubPlan(SubPlan *from)
{
- SubPlan *newnode = makeNode(SubPlan);
-
+ SubPlan *newnode = makeNode(SubPlan);
+
Node_Copy(from, newnode, plan);
newnode->plan_id = from->plan_id;
Node_Copy(from, newnode, rtable);
- newnode->setParam = listCopy (from->setParam);
- newnode->parParam = listCopy (from->parParam);
+ newnode->setParam = listCopy(from->setParam);
+ newnode->parParam = listCopy(from->parParam);
Node_Copy(from, newnode, sublink);
newnode->shutdown = from->shutdown;
@@ -761,7 +761,7 @@ _copyConst(Const *from)
* XXX super cheesy hack until parser/planner
* puts in the right values here.
*
- * But I like cheese.
+ * But I like cheese.
* ----------------
*/
if (!from->constisnull && cached_type != from->consttype)
@@ -931,7 +931,7 @@ _copyAggreg(Aggreg *from)
static SubLink *
_copySubLink(SubLink *from)
{
- SubLink *newnode = makeNode(SubLink);
+ SubLink *newnode = makeNode(SubLink);
/* ----------------
* copy remainder of node
@@ -1049,7 +1049,7 @@ _copyRel(Rel *from)
newnode->relam = from->relam;
newnode->indproc = from->indproc;
Node_Copy(from, newnode, indpred);
-
+
if (from->ordering)
{
for (len = 0; from->ordering[len] != 0; len++)
@@ -1389,7 +1389,7 @@ _copyHInfo(HInfo *from)
* copy remainder of node
* ----------------
*/
- CopyJoinMethodFields((JoinMethod *)from, (JoinMethod *)newnode);
+ CopyJoinMethodFields((JoinMethod *) from, (JoinMethod *) newnode);
newnode->hashop = from->hashop;
return newnode;
@@ -1408,7 +1408,7 @@ _copyMInfo(MInfo *from)
* copy remainder of node
* ----------------
*/
- CopyJoinMethodFields((JoinMethod *)from, (JoinMethod *)newnode);
+ CopyJoinMethodFields((JoinMethod *) from, (JoinMethod *) newnode);
Node_Copy(from, newnode, m_ordering);
return newnode;
@@ -1498,9 +1498,9 @@ _copyRangeTblEntry(RangeTblEntry *from)
newnode->relid = from->relid;
newnode->inh = from->inh;
newnode->inFromCl = from->inFromCl;
- newnode->skipAcl = from->skipAcl;
+ newnode->skipAcl = from->skipAcl;
+
-
return newnode;
}
@@ -1545,7 +1545,7 @@ static Query *
_copyQuery(Query *from)
{
Query *newnode = makeNode(Query);
-
+
newnode->commandType = from->commandType;
if (from->utilityStmt && nodeTag(from->utilityStmt) == T_NotifyStmt)
{
@@ -1576,13 +1576,14 @@ _copyQuery(Query *from)
if (from->unionClause)
{
- List *ulist, *temp_list = NIL;
+ List *ulist,
+ *temp_list = NIL;
foreach(ulist, from->unionClause)
- temp_list = lappend(temp_list,copyObject(lfirst(ulist)));
+ temp_list = lappend(temp_list, copyObject(lfirst(ulist)));
newnode->unionClause = temp_list;
}
-
+
return newnode;
}
@@ -1625,7 +1626,7 @@ _copyValue(Value *from)
* recursively copies its items.
* ----------------
*/
-void *
+void *
copyObject(void *from)
{
void *retval;
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index b0eb91c11fc..3c6bbe4d306 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.15 1998/02/13 03:27:44 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.16 1998/02/26 04:32:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -512,7 +512,7 @@ _equalSubPlan(SubPlan *a, SubPlan *b)
if (!equal((a->sublink->oper), (b->sublink->oper)))
return (false);
-
+
return (true);
}
diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c
index 6a7b7e12be6..e0e7f7f9bec 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.11 1998/01/15 18:59:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.12 1998/02/26 04:32:08 momjian Exp $
*
* NOTES
* XXX a few of the following functions are duplicated to handle
@@ -29,7 +29,7 @@
#include "utils/elog.h"
#include "utils/palloc.h"
-List *
+List *
makeList(void *elem,...)
{
va_list args;
@@ -57,7 +57,7 @@ makeList(void *elem,...)
return (retval);
}
-List *
+List *
lcons(void *obj, List *list)
{
List *l = makeNode(List);
@@ -67,7 +67,7 @@ lcons(void *obj, List *list)
return l;
}
-List *
+List *
lconsi(int datum, List *list)
{
List *l = makeNode(List);
@@ -77,19 +77,19 @@ lconsi(int datum, List *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));
}
-List *
+List *
nconc(List *l1, List *l2)
{
List *temp;
@@ -109,7 +109,7 @@ nconc(List *l1, List *l2)
}
-List *
+List *
nreverse(List *list)
{
List *rlist = NIL;
@@ -131,7 +131,7 @@ nreverse(List *list)
return (list);
}
-Value *
+Value *
makeInteger(long i)
{
Value *v = makeNode(Value);
@@ -141,7 +141,7 @@ makeInteger(long i)
return v;
}
-Value *
+Value *
makeFloat(double d)
{
Value *v = makeNode(Value);
@@ -151,7 +151,7 @@ makeFloat(double d)
return v;
}
-Value *
+Value *
makeString(char *str)
{
Value *v = makeNode(Value);
@@ -162,7 +162,7 @@ makeString(char *str)
}
/* n starts with 0 */
-void *
+void *
nth(int n, List *l)
{
/* XXX assume list is long enough */
@@ -228,7 +228,7 @@ freeList(List *list)
/*
* below are for backwards compatibility
*/
-List *
+List *
append(List *l1, List *l2)
{
List *newlist,
@@ -250,7 +250,7 @@ append(List *l1, List *l2)
/*
* below are for backwards compatibility
*/
-List *
+List *
intAppend(List *l1, List *l2)
{
List *newlist,
@@ -299,7 +299,7 @@ same(List *l1, List *l2)
}
-List *
+List *
LispUnion(List *l1, List *l2)
{
List *retval = NIL;
@@ -331,7 +331,7 @@ LispUnion(List *l1, List *l2)
return (retval);
}
-List *
+List *
LispUnioni(List *l1, List *l2)
{
List *retval = NIL;
@@ -394,7 +394,7 @@ intMember(int l1, List *l2)
* lremove -
* only does pointer comparisons. Removes 'elem' from the the linked list.
*/
-List *
+List *
lremove(void *elem, List *list)
{
List *l;
@@ -421,7 +421,7 @@ lremove(void *elem, List *list)
return result;
}
-List *
+List *
LispRemove(void *elem, List *list)
{
List *temp = NIL;
@@ -446,7 +446,7 @@ LispRemove(void *elem, List *list)
}
#ifdef NOT_USED
-List *
+List *
intLispRemove(int elem, List *list)
{
List *temp = NIL;
@@ -472,7 +472,7 @@ intLispRemove(int elem, List *list)
#endif
-List *
+List *
set_difference(List *l1, List *l2)
{
List *temp1 = NIL;
@@ -489,7 +489,7 @@ set_difference(List *l1, List *l2)
return (result);
}
-List *
+List *
set_differencei(List *l1, List *l2)
{
List *temp1 = NIL;
diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c
index 4dbdea460e1..4a9581bd1ee 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.8 1998/02/21 16:58:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.9 1998/02/26 04:32:08 momjian Exp $
*
* NOTES
* Creator functions in POSTGRES 4.2 are generated automatically. Most of
@@ -27,7 +27,7 @@
* makeOper -
* creates an Oper node
*/
-Oper *
+Oper *
makeOper(Oid opno,
Oid opid,
Oid opresulttype,
@@ -49,7 +49,7 @@ makeOper(Oid opno,
* creates a Var node
*
*/
-Var *
+Var *
makeVar(Index varno,
AttrNumber varattno,
Oid vartype,
@@ -75,7 +75,7 @@ makeVar(Index varno,
* makeResdom -
* creates a Resdom (Result Domain) node
*/
-Resdom *
+Resdom *
makeResdom(AttrNumber resno,
Oid restype,
int16 restypmod,
@@ -100,7 +100,7 @@ makeResdom(AttrNumber resno,
* makeConst -
* creates a Const node
*/
-Const *
+Const *
makeConst(Oid consttype,
int constlen,
Datum constvalue,
diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c
index a7c5364ba1f..6ea35a3af79 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.6 1997/09/08 21:44:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.7 1998/02/26 04:32:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -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 cab477ca260..c11928f8cdc 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.4 1997/09/18 20:20:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/nodes.c,v 1.5 1998/02/26 04:32:10 momjian Exp $
*
* HISTORY
* Andrew Yu Oct 20, 1994 file creation
@@ -31,7 +31,7 @@
* macro makeNode. eg. to create a Resdom node, use makeNode(Resdom)
*
*/
-Node *
+Node *
newNode(Size size, NodeTag tag)
{
Node *newNode;
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 47380545203..309d2f96cd4 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.32 1998/02/21 18:17:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.33 1998/02/26 04:32:12 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -102,9 +102,9 @@ _outIndexStmt(StringInfo str, IndexStmt *node)
appendStringInfo(str, " :rangetable ");
_outNode(str, node->rangetable);
appendStringInfo(str, " :lossy ");
- appendStringInfo(str, (node->lossy ? "true": "false"));
+ appendStringInfo(str, (node->lossy ? "true" : "false"));
appendStringInfo(str, " :unique ");
- appendStringInfo(str, (node->unique ? "true": "false"));
+ appendStringInfo(str, (node->unique ? "true" : "false"));
}
static void
@@ -117,7 +117,7 @@ _outColumnDef(StringInfo str, ColumnDef *node)
appendStringInfo(str, " :typename ");
_outNode(str, node->typename);
appendStringInfo(str, " :is_not_null ");
- appendStringInfo(str, (node->is_not_null ? "true": "false"));
+ appendStringInfo(str, (node->is_not_null ? "true" : "false"));
appendStringInfo(str, " :defval ");
appendStringInfo(str, node->defval);
appendStringInfo(str, " :constraints");
@@ -127,8 +127,8 @@ _outColumnDef(StringInfo str, ColumnDef *node)
static void
_outTypeName(StringInfo str, TypeName *node)
{
- char buf[500];
-
+ char buf[500];
+
appendStringInfo(str, "TYPENAME");
appendStringInfo(str, " :name ");
@@ -138,7 +138,7 @@ _outTypeName(StringInfo str, TypeName *node)
appendStringInfo(str, " :setof ");
appendStringInfo(str, (node->setof ? "true" : "false"));
appendStringInfo(str, " :typmod ");
- sprintf(buf," %d ", node->typmod);
+ sprintf(buf, " %d ", node->typmod);
appendStringInfo(str, buf);
appendStringInfo(str, " :arrayBounds ");
_outNode(str, node->arrayBounds);
@@ -163,11 +163,11 @@ static void
_outQuery(StringInfo str, Query *node)
{
char buf[500];
-
+
appendStringInfo(str, "QUERY");
appendStringInfo(str, " :command ");
- sprintf(buf," %d ", node->commandType);
+ sprintf(buf, " %d ", node->commandType);
appendStringInfo(str, buf);
if (node->utilityStmt)
@@ -227,26 +227,26 @@ _outQuery(StringInfo str, Query *node)
appendStringInfo(str, " :groupClause ");
_outNode(str, node->groupClause);
appendStringInfo(str, " :havingQual ");
- _outNode(str, node->havingQual);
+ _outNode(str, node->havingQual);
appendStringInfo(str, " :hasAggs ");
appendStringInfo(str, (node->hasAggs ? "true" : "false"));
appendStringInfo(str, " :hasSubLinks ");
appendStringInfo(str, (node->hasSubLinks ? "true" : "false"));
appendStringInfo(str, " :unionClause ");
- _outNode(str, node->unionClause);
+ _outNode(str, node->unionClause);
}
static void
_outSortClause(StringInfo str, SortClause *node)
{
char buf[500];
-
+
appendStringInfo(str, "SORTCLAUSE");
appendStringInfo(str, " :resdom ");
_outNode(str, node->resdom);
appendStringInfo(str, " :opoid ");
- sprintf(buf," %u ", node->opoid);
+ sprintf(buf, " %u ", node->opoid);
appendStringInfo(str, buf);
}
@@ -254,13 +254,13 @@ static void
_outGroupClause(StringInfo str, GroupClause *node)
{
char buf[500];
-
+
appendStringInfo(str, "GROUPCLAUSE");
appendStringInfo(str, " :entry ");
_outNode(str, node->entry);
appendStringInfo(str, " :grpOpoid ");
- sprintf(buf," %u ", node->grpOpoid);
+ sprintf(buf, " %u ", node->grpOpoid);
appendStringInfo(str, buf);
}
@@ -279,7 +279,7 @@ _outPlanInfo(StringInfo str, Plan *node)
sprintf(buf, " :width %d ", node->plan_width);
appendStringInfo(str, buf);
appendStringInfo(str, " :state ");
- appendStringInfo(str, node->state ? "not-NULL" : "<>");
+ appendStringInfo(str, node->state ? "not-NULL" : "<>");
appendStringInfo(str, " :qptargetlist ");
_outNode(str, node->targetlist);
appendStringInfo(str, " :qpqual ");
@@ -428,9 +428,9 @@ _outSubPlan(StringInfo str, SubPlan *node)
appendStringInfo(str, " :rtable ");
_outNode(str, node->rtable);
appendStringInfo(str, " :setprm ");
- _outIntList (str, node->setParam);
+ _outIntList(str, node->setParam);
appendStringInfo(str, " :parprm ");
- _outIntList (str, node->parParam);
+ _outIntList(str, node->parParam);
appendStringInfo(str, " :slink ");
_outNode(str, node->sublink);
}
@@ -1815,7 +1815,7 @@ _outNode(StringInfo str, void *obj)
* nodeToString -
* returns the ascii representation of the Node
*/
-char *
+char *
nodeToString(void *obj)
{
StringInfo str;
diff --git a/src/backend/nodes/read.c b/src/backend/nodes/read.c
index 58153ad9ce5..a0a627899c2 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.10 1998/01/07 21:03:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.11 1998/02/26 04:32:16 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -28,7 +28,7 @@
* stringToNode -
* returns a Node with a given legal ascii representation
*/
-void *
+void *
stringToNode(char *str)
{
void *retval;
@@ -94,7 +94,7 @@ nodeTokenType(char *token, int length)
retval = (*token != '.') ? T_Integer : T_Float;
}
- else if (isalpha(*token) || *token == '_' ||
+ else if (isalpha(*token) || *token == '_' ||
(token[0] == '<' && token[1] == '>'))
retval = ATOM_TOKEN;
else if (*token == '(')
@@ -117,7 +117,7 @@ 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;
@@ -151,8 +151,8 @@ lsptok(char *string, int *length)
(*length)++;
local_str++;
}
- /* NULL */
- else if (local_str[0] == '<' && local_str[1] == '>' )
+ /* NULL */
+ else if (local_str[0] == '<' && local_str[1] == '>')
{
*length = 0;
local_str += 2;
@@ -182,7 +182,7 @@ 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;
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index 0c6d22d69f8..79611ba0583 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.27 1998/02/21 18:17:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.28 1998/02/26 04:32:17 momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -76,7 +76,7 @@ _readQuery()
Query *local_node;
char *token;
int length;
-
+
local_node = makeNode(Query);
token = lsptok(NULL, &length); /* skip the :command */
@@ -84,7 +84,7 @@ _readQuery()
local_node->commandType = atoi(token);
token = lsptok(NULL, &length); /* skip :utility */
- /* we can't get create or index here, can we? */
+ /* we can't get create or index here, can we? */
token = lsptok(NULL, &length); /* get the notify name if any */
if (length == 0)
@@ -94,7 +94,7 @@ _readQuery()
NotifyStmt *n = makeNode(NotifyStmt);
n->relname = palloc(length + 1);
- StrNCpy(n->relname, token, length+1);
+ StrNCpy(n->relname, token, length + 1);
local_node->utilityStmt = (Node *) n;
}
@@ -109,21 +109,21 @@ _readQuery()
else
{
local_node->into = palloc(length + 1);
- StrNCpy(local_node->into, token, length+1);
+ StrNCpy(local_node->into, token, length + 1);
}
token = lsptok(NULL, &length); /* skip :isPortal */
token = lsptok(NULL, &length); /* get isPortal */
local_node->isPortal = (token[0] == 't') ? true : false;
-
+
token = lsptok(NULL, &length); /* skip :isBinary */
token = lsptok(NULL, &length); /* get isBinary */
local_node->isBinary = (token[0] == 't') ? true : false;
-
+
token = lsptok(NULL, &length); /* skip :unionall */
token = lsptok(NULL, &length); /* get unionall */
local_node->unionall = (token[0] == 't') ? true : false;
-
+
token = lsptok(NULL, &length); /* skip :uniqueFlag */
token = lsptok(NULL, &length); /* get uniqueFlag */
if (length == 0)
@@ -131,7 +131,7 @@ _readQuery()
else
{
local_node->uniqueFlag = palloc(length + 1);
- StrNCpy(local_node->uniqueFlag, token, length+1);
+ StrNCpy(local_node->uniqueFlag, token, length + 1);
}
token = lsptok(NULL, &length); /* skip :sortClause */
@@ -184,7 +184,7 @@ _readSortClause()
token = lsptok(NULL, &length); /* skip :opoid */
token = lsptok(NULL, &length); /* get opoid */
- local_node->opoid = strtoul(token,NULL,10);
+ local_node->opoid = strtoul(token, NULL, 10);
return (local_node);
}
@@ -207,7 +207,7 @@ _readGroupClause()
token = lsptok(NULL, &length); /* skip :grpOpoid */
token = lsptok(NULL, &length); /* get grpOpoid */
- local_node->grpOpoid = strtoul(token,NULL,10);
+ local_node->grpOpoid = strtoul(token, NULL, 10);
return (local_node);
}
@@ -328,11 +328,11 @@ _readAppend()
local_node->unionplans = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* eat :unionrts */
- local_node->unionrts = nodeRead(true); /* now read it */
+ local_node->unionrts = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* eat :unionrelid */
token = lsptok(NULL, &length); /* get unionrelid */
- local_node->unionrelid = strtoul(token,NULL,10);
+ local_node->unionrelid = strtoul(token, NULL, 10);
token = lsptok(NULL, &length); /* eat :unionrtentries */
local_node->unionrtentries = nodeRead(true); /* now read it */
@@ -438,7 +438,7 @@ _readHashJoin()
token = lsptok(NULL, &length); /* eat :hashjoinop */
token = lsptok(NULL, &length); /* get hashjoinop */
- local_node->hashjoinop = strtoul(token,NULL,10);
+ local_node->hashjoinop = strtoul(token, NULL, 10);
token = lsptok(NULL, &length); /* eat :hashjointable */
token = lsptok(NULL, &length); /* eat hashjointable */
@@ -479,7 +479,7 @@ _getScan(Scan *node)
token = lsptok(NULL, &length); /* eat :scanrelid */
token = lsptok(NULL, &length); /* get scanrelid */
- node->scanrelid = strtoul(token,NULL,10);
+ node->scanrelid = strtoul(token, NULL, 10);
}
/* ----------------
@@ -718,12 +718,12 @@ _readResdom()
else
{
local_node->resname = (char *) palloc(length + 1);
- StrNCpy(local_node->resname, token, length+1);
+ StrNCpy(local_node->resname, token, length + 1);
}
token = lsptok(NULL, &length); /* eat :reskey */
token = lsptok(NULL, &length); /* get reskey */
- local_node->reskey = strtoul(token,NULL,10);
+ local_node->reskey = strtoul(token, NULL, 10);
token = lsptok(NULL, &length); /* eat :reskeyop */
token = lsptok(NULL, &length); /* get reskeyop */
@@ -808,7 +808,7 @@ _readVar()
token = lsptok(NULL, &length); /* eat :varno */
token = lsptok(NULL, &length); /* get varno */
- local_node->varno = strtoul(token,NULL,10);
+ local_node->varno = strtoul(token, NULL, 10);
token = lsptok(NULL, &length); /* eat :varattno */
token = lsptok(NULL, &length); /* get varattno */
@@ -854,7 +854,7 @@ _readArray()
token = lsptok(NULL, &length); /* eat :arrayelemtype */
token = lsptok(NULL, &length); /* get arrayelemtype */
- local_node->arrayelemtype = strtoul(token,NULL,10);
+ local_node->arrayelemtype = strtoul(token, NULL, 10);
token = lsptok(NULL, &length); /* eat :arrayelemlength */
token = lsptok(NULL, &length); /* get arrayelemlength */
@@ -896,7 +896,7 @@ _readArrayRef()
token = lsptok(NULL, &length); /* eat :refelemtype */
token = lsptok(NULL, &length); /* get refelemtype */
- local_node->refelemtype = strtoul(token,NULL,10);
+ local_node->refelemtype = strtoul(token, NULL, 10);
token = lsptok(NULL, &length); /* eat :refattrlength */
token = lsptok(NULL, &length); /* get refattrlength */
@@ -947,7 +947,7 @@ _readConst()
token = lsptok(NULL, &length); /* get :constlen */
token = lsptok(NULL, &length); /* now read it */
- local_node->constlen = strtol(token,NULL,10);
+ local_node->constlen = strtol(token, NULL, 10);
token = lsptok(NULL, &length); /* get :constisnull */
token = lsptok(NULL, &length); /* now read it */
@@ -1112,7 +1112,7 @@ _readParam()
else
{
local_node->paramname = (char *) palloc(length + 1);
- StrNCpy(local_node->paramname, token, length+1);
+ StrNCpy(local_node->paramname, token, length + 1);
}
token = lsptok(NULL, &length); /* get :paramtype */
@@ -1143,7 +1143,7 @@ _readAggreg()
token = lsptok(NULL, &length); /* eat :aggname */
token = lsptok(NULL, &length); /* get aggname */
local_node->aggname = (char *) palloc(length + 1);
- StrNCpy(local_node->aggname, token, length+1);
+ StrNCpy(local_node->aggname, token, length + 1);
token = lsptok(NULL, &length); /* eat :basetype */
token = lsptok(NULL, &length); /* get basetype */
@@ -1176,7 +1176,7 @@ _readAggreg()
static SubLink *
_readSubLink()
{
- SubLink *local_node;
+ SubLink *local_node;
char *token;
int length;
@@ -1194,7 +1194,7 @@ _readSubLink()
local_node->lefthand = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* eat :oper */
- local_node->oper = nodeRead(true); /* now read it */
+ local_node->oper = nodeRead(true); /* now read it */
token = lsptok(NULL, &length); /* eat :subselect */
local_node->subselect = nodeRead(true); /* now read it */
@@ -1367,7 +1367,7 @@ _readRangeTblEntry()
else
{
local_node->relname = (char *) palloc(length + 1);
- StrNCpy(local_node->relname, token, length+1);
+ StrNCpy(local_node->relname, token, length + 1);
}
token = lsptok(NULL, &length); /* eat :refname */
@@ -1377,12 +1377,12 @@ _readRangeTblEntry()
else
{
local_node->refname = (char *) palloc(length + 1);
- StrNCpy(local_node->refname, token, length+1);
+ StrNCpy(local_node->refname, token, length + 1);
}
token = lsptok(NULL, &length); /* eat :relid */
token = lsptok(NULL, &length); /* get :relid */
- local_node->relid = strtoul(token,NULL,10);
+ local_node->relid = strtoul(token, NULL, 10);
token = lsptok(NULL, &length); /* eat :inh */
token = lsptok(NULL, &length); /* get :inh */
@@ -1719,7 +1719,7 @@ _readOrderKey()
token = lsptok(NULL, &length); /* get :array_index */
token = lsptok(NULL, &length); /* now read it */
- local_node->array_index = strtoul(token,NULL,10);
+ local_node->array_index = strtoul(token, NULL, 10);
return (local_node);
}
@@ -1881,7 +1881,7 @@ _readHInfo()
token = lsptok(NULL, &length); /* get :hashop */
token = lsptok(NULL, &length); /* now read it */
- local_node->hashop = strtoul(token,NULL,10);
+ local_node->hashop = strtoul(token, NULL, 10);
token = lsptok(NULL, &length); /* get :jmkeys */
local_node->jmethod.jmkeys = nodeRead(true); /* now read it */
@@ -1969,7 +1969,7 @@ _readIter()
* The string passed to parsePlanString must be null-terminated.
* ----------------
*/
-Node *
+Node *
parsePlanString(void)
{
char *token;
diff --git a/src/backend/optimizer/geqo/geqo_erx.c b/src/backend/optimizer/geqo/geqo_erx.c
index de001f9ee90..8dc2f9fb4bd 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.7 1998/01/07 21:03:40 momjian Exp $
+* $Id: geqo_erx.c,v 1.8 1998/02/26 04:32:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,7 +65,7 @@ static Gene edge_failure(Gene *gene, int index, Edge *edge_table, int num_gene);
*
*/
-Edge *
+Edge *
alloc_edge_table(int num_gene)
{
Edge *edge_table;
diff --git a/src/backend/optimizer/geqo/geqo_eval.c b/src/backend/optimizer/geqo/geqo_eval.c
index 89ce1625055..67b967533fe 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.17 1998/01/07 21:03:42 momjian Exp $
+ * $Id: geqo_eval.c,v 1.18 1998/02/26 04:32:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -98,7 +98,7 @@ 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 */
diff --git a/src/backend/optimizer/geqo/geqo_main.c b/src/backend/optimizer/geqo/geqo_main.c
index 027beb934fc..2073416c2e4 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.6 1997/09/08 21:44:25 momjian Exp $
+ * $Id: geqo_main.c,v 1.7 1998/02/26 04:32:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,7 +63,7 @@
* similar to a constrained Traveling Salesman Problem (TSP)
*/
-Rel *
+Rel *
geqo(Query *root)
{
int generation;
diff --git a/src/backend/optimizer/geqo/geqo_paths.c b/src/backend/optimizer/geqo/geqo_paths.c
index 16e67c8bfc9..f347ebb784a 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.7 1997/09/08 21:44:32 momjian Exp $
+ * $Id: geqo_paths.c,v 1.8 1998/02/26 04:32:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,7 +39,7 @@ static Path *set_paths(Rel *rel, Path *unorderedpath);
* Returns the resulting list.
*
*/
-List *
+List *
geqo_prune_rels(List *rel_list)
{
List *temp_list = NIL;
diff --git a/src/backend/optimizer/geqo/geqo_pool.c b/src/backend/optimizer/geqo/geqo_pool.c
index f6f3d6372c3..085a649796a 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.4 1997/09/08 21:44:34 momjian Exp $
+ * $Id: geqo_pool.c,v 1.5 1998/02/26 04:32:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,7 +50,7 @@ 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;
diff --git a/src/backend/optimizer/geqo/geqo_recombination.c b/src/backend/optimizer/geqo/geqo_recombination.c
index 14bf7131407..a045c327691 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.4 1997/09/08 21:44:36 momjian Exp $
+* $Id: geqo_recombination.c,v 1.5 1998/02/26 04:32:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -84,7 +84,7 @@ init_tour(Gene *tour, int num_gene)
* allocate memory for city table
*
*/
-City *
+City *
alloc_city_table(int num_gene)
{
City *city_table;
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index e691e8cfc5b..8548dcf5426 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.14 1997/12/21 05:18:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.15 1998/02/26 04:32:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,7 +53,7 @@ static List *find_join_paths(Query *root, List *outer_rels, int levels_needed);
*
* 'rels' is the list of single relation entries appearing in the query
*/
-List *
+List *
find_paths(Query *root, List *rels)
{
int levels_needed;
@@ -189,66 +189,69 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
* rest will be deprecated in case of GEQO *
*******************************************/
- while (--levels_needed)
- {
+ while (--levels_needed)
+ {
+
/*
* Determine all possible pairs of relations to be joined at this
- * level. Determine paths for joining these relation pairs and modify
- * 'new-rels' accordingly, then eliminate redundant join relations.
+ * level. Determine paths for joining these relation pairs and
+ * modify 'new-rels' accordingly, then eliminate redundant join
+ * relations.
*/
new_rels = find_join_rels(root, outer_rels);
-
+
find_all_join_paths(root, new_rels);
-
+
prune_joinrels(new_rels);
-
+
#if 0
-
+
/*
- * * for each expensive predicate in each path in each distinct rel, *
- * consider doing pullup -- JMH
+ * * for each expensive predicate in each path in each distinct
+ * rel, * consider doing pullup -- JMH
*/
if (XfuncMode != XFUNC_NOPULL && XfuncMode != XFUNC_OFF)
foreach(x, new_rels)
xfunc_trypullup((Rel *) lfirst(x));
#endif
-
+
prune_rel_paths(new_rels);
-
+
if (BushyPlanFlag)
{
-
+
/*
- * In case of bushy trees if there is still a join between a join
- * relation and another relation, add a new joininfo that involves
- * the join relation to the joininfo list of the other relation
+ * In case of bushy trees if there is still a join between a
+ * join relation and another relation, add a new joininfo that
+ * involves the join relation to the joininfo list of the
+ * other relation
*/
add_new_joininfos(root, new_rels, outer_rels);
}
-
+
foreach(x, new_rels)
{
rel = (Rel *) lfirst(x);
if (rel->size <= 0)
rel->size = compute_rel_size(rel);
rel->width = compute_rel_width(rel);
-
- /*#define OPTIMIZER_DEBUG*/
+
+ /* #define OPTIMIZER_DEBUG */
#ifdef OPTIMIZER_DEBUG
printf("levels left: %d\n", levels_left);
debug_print_rel(root, rel);
#endif
}
-
+
if (BushyPlanFlag)
{
-
+
/*
- * prune rels that have been completely incorporated into new join
- * rels
+ * prune rels that have been completely incorporated into new
+ * join rels
*/
outer_rels = prune_oldrels(outer_rels);
-
+
/*
* merge join rels if then contain the same list of base rels
*/
diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c
index 54c2c9b831d..2911f19f4c2 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.5 1998/02/13 03:29:36 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.6 1998/02/26 04:32:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -273,16 +273,17 @@ compute_selec(Query *root, List *clauses, List *or_selectivities)
/* this isn't an Oper, it's a Func!! */
/*
- * This is not an operator, so we guess at the selectivity.
- * THIS IS A HACK TO GET V4 OUT THE DOOR. FUNCS SHOULD BE ABLE
- * TO HAVE SELECTIVITIES THEMSELVES. -- JMH 7/9/92
+ * This is not an operator, so we guess at the selectivity. THIS
+ * IS A HACK TO GET V4 OUT THE DOOR. FUNCS SHOULD BE ABLE TO HAVE
+ * SELECTIVITIES THEMSELVES. -- JMH 7/9/92
*/
s1 = 0.1;
}
- else if (is_subplan ((Node *) clause))
+ else if (is_subplan((Node *) clause))
{
+
/*
- * Just for the moment! FIX ME! - vadim 02/04/98
+ * Just for the moment! FIX ME! - vadim 02/04/98
*/
s1 = 1.0;
}
diff --git a/src/backend/optimizer/path/hashutils.c b/src/backend/optimizer/path/hashutils.c
index ffc332e8b26..88206ea6b09 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.4 1997/09/08 21:44:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.5 1998/02/26 04:32:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,7 +34,7 @@ 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)
{
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 50d8fb934eb..849b9f9406a 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.13 1998/02/13 03:29:39 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.14 1998/02/26 04:32:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -113,7 +113,7 @@ static bool SingleAttributeIndex(Rel *index);
* Returns a list of index nodes.
*
*/
-List *
+List *
find_index_paths(Query *root,
Rel *rel,
List *indices,
diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c
index 7e28ee5cc67..7917baed097 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.7 1997/09/08 21:45:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.8 1998/02/26 04:32:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,7 +58,7 @@ 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;
@@ -486,7 +486,7 @@ 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;
diff --git a/src/backend/optimizer/path/joinutils.c b/src/backend/optimizer/path/joinutils.c
index 2c08c77b091..2dfad7ec594 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.4 1997/09/08 21:45:01 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.5 1998/02/26 04:32:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -73,7 +73,7 @@ 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,
@@ -211,7 +211,7 @@ 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,
@@ -263,7 +263,7 @@ 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)
@@ -325,7 +325,7 @@ 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)
diff --git a/src/backend/optimizer/path/mergeutils.c b/src/backend/optimizer/path/mergeutils.c
index 92103268772..938fb13864d 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.4 1997/09/08 21:45:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.5 1998/02/26 04:32:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,7 +33,7 @@
* Returns the new list of mergeinfo nodes.
*
*/
-List *
+List *
group_clauses_by_order(List *clauseinfo_list,
int inner_relid)
{
@@ -105,7 +105,7 @@ 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;
diff --git a/src/backend/optimizer/path/orindxpath.c b/src/backend/optimizer/path/orindxpath.c
index 60d36ae3490..073aa18eb9a 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.4 1997/09/08 21:45:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.5 1998/02/26 04:32:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,7 +50,7 @@ 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)
{
diff --git a/src/backend/optimizer/path/predmig.c b/src/backend/optimizer/path/predmig.c
index 807a297f0cc..544a3c1c8e7 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.8 1998/01/07 21:03:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.9 1998/02/26 04:32:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -78,7 +78,7 @@ 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
@@ -495,7 +495,7 @@ xfunc_form_groups(Query *queryInfo, Stream root, Stream bottom)
}
-/* ------------------- UTILITY FUNCTIONS ------------------------- */
+/* ------------------- UTILITY FUNCTIONS ------------------------- */
/*
** xfunc_free_stream --
@@ -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
diff --git a/src/backend/optimizer/path/prune.c b/src/backend/optimizer/path/prune.c
index e6b83a643dd..014c72e9060 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.11 1998/01/07 21:03:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.12 1998/02/26 04:32:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,7 +40,8 @@ prune_joinrels(List *rel_list)
List *i;
/*
- * rel_list can shorten while running as duplicate relations are deleted
+ * rel_list can shorten while running as duplicate relations are
+ * deleted
*/
foreach(i, rel_list)
lnext(i) = prune_joinrel((Rel *) lfirst(i), lnext(i));
@@ -60,13 +61,13 @@ prune_joinrels(List *rel_list)
static List *
prune_joinrel(Rel *rel, List *other_rels)
{
- List *cur = NIL;
- List *return_list = NIL;
+ List *cur = NIL;
+ List *return_list = NIL;
/* find first relation that doesn't match */
foreach(cur, other_rels)
{
- Rel *other_rel = (Rel *) lfirst(cur);
+ Rel *other_rel = (Rel *) lfirst(cur);
if (!same(rel->relids, other_rel->relids))
break;
@@ -74,18 +75,21 @@ prune_joinrel(Rel *rel, List *other_rels)
/* we now know cur doesn't match, or is NIL */
return_list = cur;
-
- /* remove relations that do match, we use lnext so we can remove easily */
+
+ /*
+ * remove relations that do match, we use lnext so we can remove
+ * easily
+ */
while (cur != NIL && lnext(cur) != NIL)
{
- Rel *other_rel = (Rel *) lfirst(lnext(cur));
+ Rel *other_rel = (Rel *) lfirst(lnext(cur));
if (same(rel->relids, other_rel->relids))
{
rel->pathlist = add_pathlist(rel,
rel->pathlist,
other_rel->pathlist);
- lnext(cur) = lnext(lnext(cur)); /* delete it */
+ lnext(cur) = lnext(lnext(cur)); /* delete it */
}
cur = lnext(cur);
}
@@ -145,7 +149,7 @@ 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);
@@ -176,7 +180,7 @@ 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;
@@ -202,7 +206,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
*
* Returns a new list of rel nodes
*/
-List *
+List *
prune_oldrels(List *old_rels)
{
Rel *rel;
@@ -223,7 +227,7 @@ prune_oldrels(List *old_rels)
foreach(xjoininfo, joininfo_list)
{
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
-
+
if (!joininfo->inactive)
{
temp_list = lcons(rel, temp_list);
@@ -232,5 +236,5 @@ prune_oldrels(List *old_rels)
}
}
}
- return temp_list;
+ return temp_list;
}
diff --git a/src/backend/optimizer/path/xfunc.c b/src/backend/optimizer/path/xfunc.c
index cf23b225103..3b77217481a 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.12 1998/01/13 04:04:07 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.13 1998/02/26 04:32:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,7 +34,7 @@
#include "optimizer/internal.h"
#include "optimizer/keys.h"
#include "optimizer/pathnode.h"
-#include "optimizer/tlist.h" /* for get_expr */
+#include "optimizer/tlist.h" /* for get_expr */
#include "optimizer/xfunc.h"
#include "storage/buf_internals.h" /* for NBuffers */
#include "tcop/dest.h"
@@ -532,7 +532,7 @@ xfunc_func_expense(LispValue node, LispValue args)
if (nargs > 0)
argOidVect = proc->proargtypes;
planlist = (List) pg_parse_and_plan(pq_src, argOidVect, nargs,
- &parseTree_list, None);
+ &parseTree_list, None);
if (IsA(node, Func))
set_func_planlist((Func) node, planlist);
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index 85ede31987e..7c450104ce7 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.26 1998/02/13 03:36:54 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.27 1998/02/26 04:32:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,33 +46,44 @@
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,
+static SeqScan *
+create_seqscan_node(Path *best_path, List *tlist,
List *scan_clauses);
-static IndexScan *create_indexscan_node(IndexPath *best_path, List *tlist,
+static IndexScan *
+create_indexscan_node(IndexPath *best_path, List *tlist,
List *scan_clauses);
-static NestLoop *create_nestloop_node(JoinPath *best_path, List *tlist,
+static NestLoop *
+create_nestloop_node(JoinPath *best_path, List *tlist,
List *clauses, Plan *outer_node, List *outer_tlist,
Plan *inner_node, List *inner_tlist);
-static MergeJoin *create_mergejoin_node(MergePath *best_path, List *tlist,
+static MergeJoin *
+create_mergejoin_node(MergePath *best_path, List *tlist,
List *clauses, Plan *outer_node, List *outer_tlist,
Plan *inner_node, List *inner_tlist);
-static HashJoin *create_hashjoin_node(HashPath *best_path, List *tlist,
+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 *make_temp(List *tlist, List *keys, Oid *operators,
+static Temp *
+make_temp(List *tlist, List *keys, Oid *operators,
Plan *plan_node, int temptype);
-static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
+static IndexScan *
+make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
List *indxid, List *indxqual, Cost cost);
-static NestLoop *make_nestloop(List *qptlist, List *qpqual, Plan *lefttree,
+static NestLoop *
+make_nestloop(List *qptlist, List *qpqual, Plan *lefttree,
Plan *righttree);
-static HashJoin *make_hashjoin(List *tlist, List *qpqual,
+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 MergeJoin *make_mergesort(List *tlist, List *qpqual,
+static MergeJoin *
+make_mergesort(List *tlist, List *qpqual,
List *mergeclauses, Oid opcode, Oid *rightorder,
Oid *leftorder, Plan *righttree, Plan *lefttree);
-static Material *make_material(List *tlist, Oid tempid, Plan *lefttree,
+static Material *
+make_material(List *tlist, Oid tempid, Plan *lefttree,
int keycount);
/*
@@ -90,7 +101,7 @@ static Material *make_material(List *tlist, Oid tempid, Plan *lefttree,
*
* Returns the optimal(?) access plan.
*/
-Plan *
+Plan *
create_plan(Path *best_path)
{
List *tlist;
@@ -931,7 +942,7 @@ make_seqscan(List *qptlist,
SeqScan *node = makeNode(SeqScan);
Plan *plan = &node->plan;
- plan->cost = (lefttree ? lefttree->cost : 0);
+ plan->cost = (lefttree ? lefttree->cost : 0);
plan->state = (EState *) NULL;
plan->targetlist = qptlist;
plan->qual = qpqual;
@@ -949,7 +960,7 @@ make_indexscan(List *qptlist,
Index scanrelid,
List *indxid,
List *indxqual,
- Cost cost)
+ Cost cost)
{
IndexScan *node = makeNode(IndexScan);
Plan *plan = &node->scan.plan;
@@ -978,8 +989,8 @@ make_nestloop(List *qptlist,
NestLoop *node = makeNode(NestLoop);
Plan *plan = &node->join;
- plan->cost = (lefttree ? lefttree->cost : 0) +
- (righttree ? righttree->cost : 0);
+ plan->cost = (lefttree ? lefttree->cost : 0) +
+ (righttree ? righttree->cost : 0);
plan->state = (EState *) NULL;
plan->targetlist = qptlist;
plan->qual = qpqual;
@@ -1000,8 +1011,8 @@ make_hashjoin(List *tlist,
HashJoin *node = makeNode(HashJoin);
Plan *plan = &node->join;
- plan->cost = (lefttree ? lefttree->cost : 0) +
- (righttree ? righttree->cost : 0);
+ plan->cost = (lefttree ? lefttree->cost : 0) +
+ (righttree ? righttree->cost : 0);
plan->cost = 0.0;
plan->state = (EState *) NULL;
plan->targetlist = tlist;
@@ -1023,7 +1034,7 @@ make_hash(List *tlist, Var *hashkey, Plan *lefttree)
Hash *node = makeNode(Hash);
Plan *plan = &node->plan;
- plan->cost = (lefttree ? lefttree->cost : 0);
+ plan->cost = (lefttree ? lefttree->cost : 0);
plan->cost = 0.0;
plan->state = (EState *) NULL;
plan->targetlist = tlist;
@@ -1051,8 +1062,8 @@ make_mergesort(List *tlist,
MergeJoin *node = makeNode(MergeJoin);
Plan *plan = &node->join;
- plan->cost = (lefttree ? lefttree->cost : 0) +
- (righttree ? righttree->cost : 0);
+ plan->cost = (lefttree ? lefttree->cost : 0) +
+ (righttree ? righttree->cost : 0);
plan->state = (EState *) NULL;
plan->targetlist = tlist;
plan->qual = qpqual;
@@ -1066,13 +1077,13 @@ 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;
- plan->cost = (lefttree ? lefttree->cost : 0);
+ plan->cost = (lefttree ? lefttree->cost : 0);
plan->state = (EState *) NULL;
plan->targetlist = tlist;
plan->qual = NIL;
@@ -1093,7 +1104,7 @@ make_material(List *tlist,
Material *node = makeNode(Material);
Plan *plan = &node->plan;
- plan->cost = (lefttree ? lefttree->cost : 0);
+ plan->cost = (lefttree ? lefttree->cost : 0);
plan->state = (EState *) NULL;
plan->targetlist = tlist;
plan->qual = NIL;
@@ -1105,12 +1116,12 @@ make_material(List *tlist,
return (node);
}
-Agg *
+Agg *
make_agg(List *tlist, Plan *lefttree)
{
Agg *node = makeNode(Agg);
- node->plan.cost = (lefttree ? lefttree->cost : 0);
+ node->plan.cost = (lefttree ? lefttree->cost : 0);
node->plan.state = (EState *) NULL;
node->plan.qual = NULL;
node->plan.targetlist = tlist;
@@ -1121,7 +1132,7 @@ make_agg(List *tlist, Plan *lefttree)
return (node);
}
-Group *
+Group *
make_group(List *tlist,
bool tuplePerGroup,
int ngrp,
@@ -1130,7 +1141,7 @@ make_group(List *tlist,
{
Group *node = makeNode(Group);
- node->plan.cost = (lefttree ? lefttree->plan.cost : 0);
+ node->plan.cost = (lefttree ? lefttree->plan.cost : 0);
node->plan.state = (EState *) NULL;
node->plan.qual = NULL;
node->plan.targetlist = tlist;
@@ -1151,13 +1162,13 @@ make_group(List *tlist,
* or "*"
*/
-Unique *
+Unique *
make_unique(List *tlist, Plan *lefttree, char *uniqueAttr)
{
Unique *node = makeNode(Unique);
Plan *plan = &node->plan;
- plan->cost = (lefttree ? lefttree->cost : 0);
+ plan->cost = (lefttree ? lefttree->cost : 0);
plan->state = (EState *) NULL;
plan->targetlist = tlist;
plan->qual = NIL;
@@ -1175,7 +1186,7 @@ make_unique(List *tlist, Plan *lefttree, char *uniqueAttr)
}
#ifdef NOT_USED
-List *
+List *
generate_fjoin(List *tlist)
{
List tlistP;
@@ -1228,5 +1239,5 @@ generate_fjoin(List *tlist)
return newTlist;
return tlist; /* do nothing for now - ay 10/94 */
}
-#endif
+#endif
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c
index ca5859cb04b..132cda732b2 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.19 1998/02/13 03:36:57 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.20 1998/02/26 04:32:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -64,7 +64,7 @@ make_groupPlan(List **tlist, bool tuplePerGroup,
*
* Returns a query plan.
*/
-Plan *
+Plan *
query_planner(Query *root,
int command_type,
List *tlist,
@@ -74,18 +74,18 @@ query_planner(Query *root,
List *var_only_tlist = NIL;
List *level_tlist = NIL;
Plan *subplan = NULL;
-
- if ( PlannerQueryLevel > 1 )
+
+ if (PlannerQueryLevel > 1)
{
/* should copy be made ? */
- tlist = (List *) SS_replace_correlation_vars ((Node*)tlist);
- qual = (List *) SS_replace_correlation_vars ((Node*)qual);
+ tlist = (List *) SS_replace_correlation_vars((Node *) tlist);
+ qual = (List *) SS_replace_correlation_vars((Node *) qual);
}
if (root->hasSubLinks)
- qual = (List *) SS_process_sublinks ((Node*) qual);
-
+ qual = (List *) SS_process_sublinks((Node *) qual);
+
qual = cnfify((Expr *) qual, true);
-
+
/*
* A command without a target list or qualification is an error,
* except for "delete foo".
@@ -158,7 +158,7 @@ query_planner(Query *root,
if (constant_qual != NULL)
{
return ((Plan *) make_result(tlist,
- (Node *) constant_qual,
+ (Node *) constant_qual,
(Plan *) scan));
}
else
@@ -187,10 +187,10 @@ query_planner(Query *root,
*/
if (constant_qual)
{
- subplan = (Plan *)make_result((!root->hasAggs && !root->groupClause)
- ? tlist : subplan->targetlist,
- (Node *) constant_qual,
- subplan);
+ subplan = (Plan *) make_result((!root->hasAggs && !root->groupClause)
+ ? tlist : subplan->targetlist,
+ (Node *) constant_qual,
+ subplan);
/*
* Change all varno's of the Result's node target list.
@@ -200,6 +200,7 @@ query_planner(Query *root,
return subplan;
}
+
/*
* fix up the flattened target list of the plan root node so that
* expressions are evaluated. this forces expression evaluations that
@@ -213,15 +214,16 @@ query_planner(Query *root,
* aggregates fixing only other entries (i.e. - GroupBy-ed and so
* fixed by make_groupPlan). - vadim 04/05/97
*/
- else
- {
+ else
+ {
if (!root->hasAggs && !root->groupClause)
subplan->targetlist = flatten_tlist_vars(tlist,
- subplan->targetlist);
+ subplan->targetlist);
return subplan;
- }
-
+ }
+
#ifdef NOT_USED
+
/*
* Destructively modify the query plan's targetlist to add fjoin lists
* to flatten functions that return sets of base types
@@ -330,7 +332,7 @@ make_result(List *tlist,
#ifdef NOT_USED
tlist = generate_fjoin(tlist);
#endif
- plan->cost = (subplan ? subplan->cost : 0);
+ plan->cost = (subplan ? subplan->cost : 0);
plan->state = (EState *) NULL;
plan->targetlist = tlist;
plan->lefttree = subplan;
@@ -379,9 +381,9 @@ make_groupPlan(List **tlist,
*/
foreach(sl, sort_tlist)
{
- Resdom *resdom = NULL;
- TargetEntry *te = (TargetEntry *) lfirst(sl);
- int keyno = 0;
+ Resdom *resdom = NULL;
+ TargetEntry *te = (TargetEntry *) lfirst(sl);
+ int keyno = 0;
foreach(gl, groupClause)
{
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 367978eb57b..824c0d29b35 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.22 1998/02/13 03:36:59 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.23 1998/02/26 04:32:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,7 +49,8 @@
#include "executor/executor.h"
static Plan *make_sortplan(List *tlist, List *sortcls, Plan *plannode);
-extern Plan *make_groupPlan(List **tlist, bool tuplePerGroup,
+extern Plan *
+make_groupPlan(List **tlist, bool tuplePerGroup,
List *groupClause, Plan *subplan);
/*****************************************************************************
@@ -58,27 +59,27 @@ extern Plan *make_groupPlan(List **tlist, bool tuplePerGroup,
*
*****************************************************************************/
-Plan*
+Plan *
planner(Query *parse)
{
Plan *result_plan;
-
+
PlannerQueryLevel = 1;
PlannerVarParam = NULL;
PlannerParamVar = NULL;
PlannerInitPlan = NULL;
PlannerPlanId = 0;
-
- result_plan = union_planner (parse);
-
- Assert (PlannerQueryLevel == 1);
- if ( PlannerPlanId > 0 )
+
+ result_plan = union_planner(parse);
+
+ Assert(PlannerQueryLevel == 1);
+ if (PlannerPlanId > 0)
{
result_plan->initPlan = PlannerInitPlan;
- (void) SS_finalize_plan (result_plan);
+ (void) SS_finalize_plan(result_plan);
}
- result_plan->nParamExec = length (PlannerParamVar);
-
+ result_plan->nParamExec = length(PlannerParamVar);
+
return (result_plan);
}
@@ -91,7 +92,7 @@ planner(Query *parse)
* Returns a query plan.
*
*/
-Plan *
+Plan *
union_planner(Query *parse)
{
List *tlist = parse->targetList;
@@ -100,7 +101,7 @@ union_planner(Query *parse)
Plan *result_plan = (Plan *) NULL;
Index rt_index;
-
+
if (parse->unionClause)
{
@@ -112,7 +113,7 @@ union_planner(Query *parse)
parse->rtable);
}
else if ((rt_index =
- first_inherit_rt_entry(rangetable)) != -1)
+ first_inherit_rt_entry(rangetable)) != -1)
{
result_plan = (Plan *) plan_inherit_queries(parse, rt_index);
/* XXX do we need to do this? bjm 12/19/97 */
@@ -123,27 +124,27 @@ union_planner(Query *parse)
}
else
{
- List **vpm = NULL;
-
+ List **vpm = NULL;
+
tlist = preprocess_targetlist(tlist,
parse->commandType,
parse->resultRelation,
parse->rtable);
- if ( parse->rtable != NULL )
+ if (parse->rtable != NULL)
{
- vpm = (List **) palloc (length (parse->rtable) * sizeof (List*));
- memset (vpm, 0, length (parse->rtable) * sizeof (List*));
+ vpm = (List **) palloc(length(parse->rtable) * sizeof(List *));
+ memset(vpm, 0, length(parse->rtable) * sizeof(List *));
}
- PlannerVarParam = lcons (vpm, PlannerVarParam);
+ PlannerVarParam = lcons(vpm, PlannerVarParam);
result_plan = query_planner(parse,
parse->commandType,
tlist,
- (List*) parse->qual);
- PlannerVarParam = lnext (PlannerVarParam);
- if ( vpm != NULL )
- pfree (vpm);
+ (List *) parse->qual);
+ PlannerVarParam = lnext(PlannerVarParam);
+ if (vpm != NULL)
+ pfree(vpm);
}
-
+
/*
* If we have a GROUP BY clause, insert a group node (with the
* appropriate sort node.)
@@ -161,10 +162,10 @@ union_planner(Query *parse)
tuplePerGroup = parse->hasAggs;
result_plan =
- make_groupPlan( &tlist,
- tuplePerGroup,
- parse->groupClause,
- result_plan);
+ make_groupPlan(&tlist,
+ tuplePerGroup,
+ parse->groupClause,
+ result_plan);
}
@@ -173,14 +174,14 @@ union_planner(Query *parse)
*/
if (parse->hasAggs)
{
- result_plan = (Plan *)make_agg(tlist, result_plan);
+ result_plan = (Plan *) make_agg(tlist, result_plan);
/*
* set the varno/attno entries to the appropriate references to
* the result tuple of the subplans.
*/
- ((Agg *)result_plan)->aggs =
- set_agg_tlist_references((Agg *)result_plan);
+ ((Agg *) result_plan)->aggs =
+ set_agg_tlist_references((Agg *) result_plan);
}
/*
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c
index fc51657b8d0..c82a711637b 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.18 1998/02/13 03:37:02 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.19 1998/02/26 04:32:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,9 +36,11 @@
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,
+static List *
+replace_clause_joinvar_refs(Expr *clause,
List *outer_tlist, List *inner_tlist);
-static List *replace_subclause_joinvar_refs(List *clauses,
+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);
@@ -216,7 +218,7 @@ set_temp_tlist_references(Temp *temp)
* Returns the new join clauses.
*
*/
-List *
+List *
join_references(List *clauses,
List *outer_tlist,
List *inner_tlist)
@@ -242,7 +244,7 @@ join_references(List *clauses,
* Returns the new list of clauses.
*
*/
-List *
+List *
index_outerjoin_references(List *inner_indxqual,
List *outer_tlist,
Index inner_relid)
@@ -407,19 +409,19 @@ replace_clause_joinvar_refs(Expr *clause,
}
else if (is_subplan(clause))
{
- ((Expr*) clause)->args =
- replace_subclause_joinvar_refs(((Expr*) clause)->args,
- outer_tlist,
- inner_tlist);
- ((SubPlan*) ((Expr*) clause)->oper)->sublink->oper =
- replace_subclause_joinvar_refs(((SubPlan*) ((Expr*) clause)->oper)->sublink->oper,
- outer_tlist,
- inner_tlist);
- return ((List*) clause);
+ ((Expr *) clause)->args =
+ replace_subclause_joinvar_refs(((Expr *) clause)->args,
+ outer_tlist,
+ inner_tlist);
+ ((SubPlan *) ((Expr *) clause)->oper)->sublink->oper =
+ replace_subclause_joinvar_refs(((SubPlan *) ((Expr *) clause)->oper)->sublink->oper,
+ outer_tlist,
+ inner_tlist);
+ return ((List *) clause);
}
/* shouldn't reach here */
- elog (ERROR, "replace_clause_joinvar_refs: unsupported clause %d",
- nodeTag (clause));
+ elog(ERROR, "replace_clause_joinvar_refs: unsupported clause %d",
+ nodeTag(clause));
return NULL;
}
@@ -612,7 +614,7 @@ replace_result_clause(Node *clause,
}
else if (is_funcclause(clause))
{
- List *subExpr;
+ List *subExpr;
/*
* This is a function. Recursively call this routine for its
@@ -627,7 +629,7 @@ replace_result_clause(Node *clause,
else if (IsA(clause, ArrayRef))
{
ArrayRef *aref = (ArrayRef *) clause;
-
+
/*
* This is an arrayref. Recursively call this routine for its
* expression and its index expression...
@@ -647,18 +649,18 @@ replace_result_clause(Node *clause,
}
else if (is_opclause(clause))
{
- Node *subNode;
+ Node *subNode;
/*
* This is an operator. Recursively call this routine for both its
* left and right operands
*/
- subNode = (Node *)get_leftop((Expr *) clause);
+ subNode = (Node *) get_leftop((Expr *) clause);
replace_result_clause(subNode, subplanTargetList);
subNode = (Node *) get_rightop((Expr *) clause);
replace_result_clause(subNode, subplanTargetList);
}
- else if (IsA(clause, Param) || IsA(clause, Const))
+ else if (IsA(clause, Param) ||IsA(clause, Const))
{
/* do nothing! */
}
@@ -730,7 +732,7 @@ set_agg_tlist_references(Agg *aggNode)
TargetEntry *tle = lfirst(tl);
aggreg_list = nconc(
- replace_agg_clause(tle->expr, subplanTargetList),aggreg_list);
+ replace_agg_clause(tle->expr, subplanTargetList), aggreg_list);
}
return aggreg_list;
}
@@ -739,7 +741,7 @@ static List *
replace_agg_clause(Node *clause, List *subplanTargetList)
{
List *t;
- List *agg_list = NIL;
+ List *agg_list = NIL;
if (IsA(clause, Var))
{
@@ -760,6 +762,7 @@ replace_agg_clause(Node *clause, List *subplanTargetList)
}
else if (is_funcclause(clause))
{
+
/*
* This is a function. Recursively call this routine for its
* arguments...
@@ -767,19 +770,19 @@ replace_agg_clause(Node *clause, List *subplanTargetList)
foreach(t, ((Expr *) clause)->args)
{
agg_list = nconc(agg_list,
- replace_agg_clause(lfirst(t), subplanTargetList));
+ replace_agg_clause(lfirst(t), subplanTargetList));
}
return agg_list;
}
else if (IsA(clause, Aggreg))
{
return lcons(clause,
- replace_agg_clause(((Aggreg *) clause)->target, subplanTargetList));
+ replace_agg_clause(((Aggreg *) clause)->target, subplanTargetList));
}
else if (IsA(clause, ArrayRef))
{
ArrayRef *aref = (ArrayRef *) clause;
-
+
/*
* This is an arrayref. Recursively call this routine for its
* expression and its index expression...
@@ -787,35 +790,36 @@ replace_agg_clause(Node *clause, List *subplanTargetList)
foreach(t, aref->refupperindexpr)
{
agg_list = nconc(agg_list,
- replace_agg_clause(lfirst(t), subplanTargetList));
+ replace_agg_clause(lfirst(t), subplanTargetList));
}
foreach(t, aref->reflowerindexpr)
{
agg_list = nconc(agg_list,
- replace_agg_clause(lfirst(t), subplanTargetList));
+ replace_agg_clause(lfirst(t), subplanTargetList));
}
agg_list = nconc(agg_list,
- replace_agg_clause(aref->refexpr, subplanTargetList));
+ replace_agg_clause(aref->refexpr, subplanTargetList));
agg_list = nconc(agg_list,
- replace_agg_clause(aref->refassgnexpr, subplanTargetList));
+ replace_agg_clause(aref->refassgnexpr, subplanTargetList));
return agg_list;
}
else if (is_opclause(clause))
{
+
/*
* 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);
-
+
if (left != (Node *) NULL)
agg_list = nconc(agg_list,
- replace_agg_clause(left, subplanTargetList));
+ replace_agg_clause(left, subplanTargetList));
if (right != (Node *) NULL)
agg_list = nconc(agg_list,
- replace_agg_clause(right, subplanTargetList));
+ replace_agg_clause(right, subplanTargetList));
return agg_list;
}
@@ -840,7 +844,8 @@ replace_agg_clause(Node *clause, List *subplanTargetList)
* Remove the Agg nodes from the target list
* We do this so inheritance only does aggregates in the upper node
*/
-void del_agg_tlist_references(List *tlist)
+void
+del_agg_tlist_references(List *tlist)
{
List *tl;
@@ -863,6 +868,7 @@ del_agg_clause(Node *clause)
}
else if (is_funcclause(clause))
{
+
/*
* This is a function. Recursively call this routine for its
* arguments...
diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c
index 4d4378780c2..11e466ce5ef 100644
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -26,61 +26,61 @@
#include "optimizer/var.h"
#include "optimizer/cost.h"
-int PlannerQueryLevel; /* level of current query */
-List *PlannerVarParam; /* correlation Vars to Param mapper */
-List *PlannerParamVar; /* to get Var from Param->paramid */
-List *PlannerInitPlan; /* init subplans for current query */
-int PlannerPlanId;
+int PlannerQueryLevel; /* level of current query */
+List *PlannerVarParam; /* correlation Vars to Param mapper */
+List *PlannerParamVar; /* to get Var from Param->paramid */
+List *PlannerInitPlan; /* init subplans for current query */
+int PlannerPlanId;
static int
-_new_param (Var *var, int varlevel)
+_new_param(Var *var, int varlevel)
{
- List *last;
- int i = 0;
-
- if ( PlannerParamVar == NULL )
+ List *last;
+ int i = 0;
+
+ if (PlannerParamVar == NULL)
last = PlannerParamVar = makeNode(List);
else
{
- for (last = PlannerParamVar; ; )
+ for (last = PlannerParamVar;;)
{
i++;
- if ( lnext(last) == NULL )
+ if (lnext(last) == NULL)
break;
last = lnext(last);
}
lnext(last) = makeNode(List);
last = lnext(last);
}
-
+
lnext(last) = NULL;
- lfirst(last) = makeVar (var->varno, var->varattno, var->vartype,
- var->vartypmod, varlevel, var->varnoold, var->varoattno);
-
+ lfirst(last) = makeVar(var->varno, var->varattno, var->vartype,
+ var->vartypmod, varlevel, var->varnoold, var->varoattno);
+
return (i);
}
-static Param*
-_replace_var (Var *var)
+static Param *
+_replace_var(Var *var)
{
- List **rt = (List**) nth (var->varlevelsup, PlannerVarParam);
- List *vpe = rt[var->varno - 1];
- Param *retval;
- int i;
-
- if ( vpe == NULL )
+ List **rt = (List **) nth(var->varlevelsup, PlannerVarParam);
+ List *vpe = rt[var->varno - 1];
+ Param *retval;
+ int i;
+
+ if (vpe == NULL)
{
vpe = rt[var->varno - 1] = makeNode(List);
lfirsti(vpe) = -1;
lnext(vpe) = NULL;
}
-
- for (i = 1; ; i++)
+
+ for (i = 1;; i++)
{
- if ( i == var->varattno )
+ if (i == var->varattno)
break;
- if ( lnext(vpe) == NULL )
+ if (lnext(vpe) == NULL)
{
lnext(vpe) = makeNode(List);
vpe = lnext(vpe);
@@ -90,381 +90,385 @@ _replace_var (Var *var)
else
vpe = lnext(vpe);
}
-
- if ( (i = lfirsti(vpe)) < 0 ) /* parameter is not assigned */
+
+ if ((i = lfirsti(vpe)) < 0) /* parameter is not assigned */
{
- i = _new_param (var, PlannerQueryLevel - var->varlevelsup);
+ i = _new_param(var, PlannerQueryLevel - var->varlevelsup);
}
-
+
retval = makeNode(Param);
retval->paramkind = PARAM_EXEC;
retval->paramid = (AttrNumber) i;
retval->paramtype = var->vartype;
-
+
return (retval);
}
-static Node*
-_make_subplan (SubLink *slink)
+static Node *
+_make_subplan(SubLink *slink)
{
- SubPlan *node = makeNode (SubPlan);
+ SubPlan *node = makeNode(SubPlan);
Plan *plan;
List *lst;
Node *result;
List *saved_ip = PlannerInitPlan;
-
+
PlannerInitPlan = NULL;
-
+
PlannerQueryLevel++; /* we becomes child */
-
- node->plan = plan = union_planner ((Query*) slink->subselect);
-
- /*
- * Assign subPlan, extParam and locParam to plan nodes.
- * At the moment, SS_finalize_plan doesn't handle initPlan-s
- * and so we assigne them to the topmost plan node and take
- * care about its extParam too.
+
+ node->plan = plan = union_planner((Query *) slink->subselect);
+
+ /*
+ * Assign subPlan, extParam and locParam to plan nodes. At the moment,
+ * SS_finalize_plan doesn't handle initPlan-s and so we assigne them
+ * to the topmost plan node and take care about its extParam too.
*/
- (void) SS_finalize_plan (plan);
+ (void) SS_finalize_plan(plan);
plan->initPlan = PlannerInitPlan;
-
+
/* Get extParam from InitPlan-s */
- foreach (lst, PlannerInitPlan)
+ foreach(lst, PlannerInitPlan)
{
- List *lp;
-
- foreach (lp, ((SubPlan*) lfirst (lst))->plan->extParam)
+ List *lp;
+
+ foreach(lp, ((SubPlan *) lfirst(lst))->plan->extParam)
{
- if ( !intMember (lfirsti(lp), plan->extParam) )
- plan->extParam = lappendi (plan->extParam, lfirsti(lp));
+ if (!intMember(lfirsti(lp), plan->extParam))
+ plan->extParam = lappendi(plan->extParam, lfirsti(lp));
}
}
-
+
/* and now we are parent again */
PlannerInitPlan = saved_ip;
PlannerQueryLevel--;
-
+
node->plan_id = PlannerPlanId++;
- node->rtable = ((Query*) slink->subselect)->rtable;
+ node->rtable = ((Query *) slink->subselect)->rtable;
node->sublink = slink;
slink->subselect = NULL; /* cool ?! */
-
+
/* make parParam list */
- foreach (lst, plan->extParam)
+ foreach(lst, plan->extParam)
{
- Var *var = nth (lfirsti(lst), PlannerParamVar);
-
- if ( var->varlevelsup == PlannerQueryLevel )
- node->parParam = lappendi (node->parParam, lfirsti(lst));
+ Var *var = nth(lfirsti(lst), PlannerParamVar);
+
+ if (var->varlevelsup == PlannerQueryLevel)
+ node->parParam = lappendi(node->parParam, lfirsti(lst));
}
-
- /*
- * Un-correlated or undirect correlated plans of EXISTS or EXPR
- * types can be used as initPlans...
+
+ /*
+ * Un-correlated or undirect correlated plans of EXISTS or EXPR types
+ * can be used as initPlans...
*/
- if ( node->parParam == NULL && slink->subLinkType == EXPR_SUBLINK )
+ if (node->parParam == NULL && slink->subLinkType == EXPR_SUBLINK)
{
- int i = 0;
-
+ int i = 0;
+
/* transform right side of all sublink Oper-s into Param */
- foreach (lst, slink->oper)
+ foreach(lst, slink->oper)
{
- List *rside = lnext(((Expr*) lfirst(lst))->args);
- TargetEntry *te = nth (i, plan->targetlist);
- Var *var = makeVar (0, 0, te->resdom->restype,
- te->resdom->restypmod,
- PlannerQueryLevel, 0, 0);
- Param *prm = makeNode(Param);
-
+ List *rside = lnext(((Expr *) lfirst(lst))->args);
+ TargetEntry *te = nth(i, plan->targetlist);
+ Var *var = makeVar(0, 0, te->resdom->restype,
+ te->resdom->restypmod,
+ PlannerQueryLevel, 0, 0);
+ Param *prm = makeNode(Param);
+
prm->paramkind = PARAM_EXEC;
- prm->paramid = (AttrNumber) _new_param (var, PlannerQueryLevel);
+ prm->paramid = (AttrNumber) _new_param(var, PlannerQueryLevel);
prm->paramtype = var->vartype;
lfirst(rside) = prm;
- node->setParam = lappendi (node->setParam, prm->paramid);
- pfree (var);
+ node->setParam = lappendi(node->setParam, prm->paramid);
+ pfree(var);
i++;
}
- PlannerInitPlan = lappend (PlannerInitPlan, node);
- if ( i > 1 )
- result = (Node*) ((slink->useor) ? make_orclause (slink->oper) :
- make_andclause (slink->oper));
+ PlannerInitPlan = lappend(PlannerInitPlan, node);
+ if (i > 1)
+ result = (Node *) ((slink->useor) ? make_orclause(slink->oper) :
+ make_andclause(slink->oper));
else
- result = (Node*) lfirst (slink->oper);
+ result = (Node *) lfirst(slink->oper);
}
- else if ( node->parParam == NULL && slink->subLinkType == EXISTS_SUBLINK )
+ else if (node->parParam == NULL && slink->subLinkType == EXISTS_SUBLINK)
{
- Var *var = makeVar (0, 0, BOOLOID, -1, PlannerQueryLevel, 0, 0);
+ Var *var = makeVar(0, 0, BOOLOID, -1, PlannerQueryLevel, 0, 0);
Param *prm = makeNode(Param);
-
+
prm->paramkind = PARAM_EXEC;
- prm->paramid = (AttrNumber) _new_param (var, PlannerQueryLevel);
+ prm->paramid = (AttrNumber) _new_param(var, PlannerQueryLevel);
prm->paramtype = var->vartype;
- node->setParam = lappendi (node->setParam, prm->paramid);
- pfree (var);
- PlannerInitPlan = lappend (PlannerInitPlan, node);
- result = (Node*) prm;
+ node->setParam = lappendi(node->setParam, prm->paramid);
+ pfree(var);
+ PlannerInitPlan = lappend(PlannerInitPlan, node);
+ result = (Node *) prm;
}
- else /* make expression of SUBPLAN type */
+ else
+/* make expression of SUBPLAN type */
{
- Expr *expr = makeNode (Expr);
- List *args = NULL;
- int i = 0;
-
+ Expr *expr = makeNode(Expr);
+ List *args = NULL;
+ int i = 0;
+
expr->typeOid = BOOLOID;
expr->opType = SUBPLAN_EXPR;
- expr->oper = (Node*) node;
-
- /*
- * Make expr->args from parParam. Left sides of sublink Oper-s
- * are handled by optimizer directly...
- * Also, transform right side of sublink Oper-s into Const.
+ expr->oper = (Node *) node;
+
+ /*
+ * Make expr->args from parParam. Left sides of sublink Oper-s are
+ * handled by optimizer directly... Also, transform right side of
+ * sublink Oper-s into Const.
*/
- foreach (lst, node->parParam)
+ foreach(lst, node->parParam)
{
- Var *var = nth (lfirsti (lst), PlannerParamVar);
-
- var = (Var*) copyObject (var);
+ Var *var = nth(lfirsti(lst), PlannerParamVar);
+
+ var = (Var *) copyObject(var);
var->varlevelsup = 0;
- args = lappend (args, var);
+ args = lappend(args, var);
}
- foreach (lst, slink->oper)
+ foreach(lst, slink->oper)
{
- List *rside = lnext(((Expr*) lfirst(lst))->args);
- TargetEntry *te = nth (i, plan->targetlist);
- Const *con = makeConst (te->resdom->restype,
- 0, 0, true, 0, 0, 0);
+ List *rside = lnext(((Expr *) lfirst(lst))->args);
+ TargetEntry *te = nth(i, plan->targetlist);
+ Const *con = makeConst(te->resdom->restype,
+ 0, 0, true, 0, 0, 0);
+
lfirst(rside) = con;
i++;
}
expr->args = args;
- result = (Node*) expr;
+ result = (Node *) expr;
}
-
+
return (result);
-
+
}
static List *
-set_unioni (List *l1, List *l2)
+set_unioni(List *l1, List *l2)
{
if (l1 == NULL)
return (l2);
if (l2 == NULL)
return (l1);
-
- return (nconc (l1, set_differencei (l2, l1)));
+
+ return (nconc(l1, set_differencei(l2, l1)));
}
static List *
-_finalize_primnode (void *expr, List **subplan)
+_finalize_primnode(void *expr, List **subplan)
{
- List *result = NULL;
-
- if ( expr == NULL )
+ List *result = NULL;
+
+ if (expr == NULL)
return (NULL);
-
- if (IsA (expr, Param))
+
+ if (IsA(expr, Param))
{
- if ( ((Param*) expr)->paramkind == PARAM_EXEC )
- return (lconsi (((Param*) expr)->paramid, (List*) NULL));
+ if (((Param *) expr)->paramkind == PARAM_EXEC)
+ return (lconsi(((Param *) expr)->paramid, (List *) NULL));
}
else if (single_node(expr))
return (NULL);
- else if (IsA (expr, List))
+ else if (IsA(expr, List))
{
- List *le;
- foreach (le, (List*) expr)
- result = set_unioni (result,
- _finalize_primnode (lfirst(le), subplan));
+ List *le;
+
+ foreach(le, (List *) expr)
+ result = set_unioni(result,
+ _finalize_primnode(lfirst(le), subplan));
}
- else if (IsA (expr, Iter))
- return (_finalize_primnode (((Iter*) expr)->iterexpr, subplan));
- else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
- not_clause (expr) || is_funcclause(expr))
- return (_finalize_primnode (((Expr*) expr)->args, subplan));
- else if (IsA (expr, Aggreg))
- return (_finalize_primnode (((Aggreg *) expr)->target, subplan));
- else if (IsA (expr, ArrayRef))
+ else if (IsA(expr, Iter))
+ return (_finalize_primnode(((Iter *) expr)->iterexpr, subplan));
+ else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
+ not_clause(expr) || is_funcclause(expr))
+ return (_finalize_primnode(((Expr *) expr)->args, subplan));
+ else if (IsA(expr, Aggreg))
+ return (_finalize_primnode(((Aggreg *) expr)->target, subplan));
+ else if (IsA(expr, ArrayRef))
{
- result = _finalize_primnode (((ArrayRef*) expr)->refupperindexpr, subplan);
- result = set_unioni (result,
- _finalize_primnode (((ArrayRef *) expr)->reflowerindexpr, subplan));
- result = set_unioni (result,
- _finalize_primnode (((ArrayRef *) expr)->refexpr, subplan));
- result = set_unioni (result,
- _finalize_primnode (((ArrayRef *) expr)->refassgnexpr, subplan));
+ result = _finalize_primnode(((ArrayRef *) expr)->refupperindexpr, subplan);
+ result = set_unioni(result,
+ _finalize_primnode(((ArrayRef *) expr)->reflowerindexpr, subplan));
+ result = set_unioni(result,
+ _finalize_primnode(((ArrayRef *) expr)->refexpr, subplan));
+ result = set_unioni(result,
+ _finalize_primnode(((ArrayRef *) expr)->refassgnexpr, subplan));
}
- else if (IsA (expr, TargetEntry))
- return (_finalize_primnode (((TargetEntry*) expr)->expr, subplan));
- else if (is_subplan (expr))
+ else if (IsA(expr, TargetEntry))
+ return (_finalize_primnode(((TargetEntry *) expr)->expr, subplan));
+ else if (is_subplan(expr))
{
- List *lst;
-
- *subplan = lappend (*subplan, ((Expr*) expr)->oper);
- foreach (lst, ((SubPlan*) ((Expr*) expr)->oper)->plan->extParam)
+ List *lst;
+
+ *subplan = lappend(*subplan, ((Expr *) expr)->oper);
+ foreach(lst, ((SubPlan *) ((Expr *) expr)->oper)->plan->extParam)
{
- Var *var = nth (lfirsti(lst), PlannerParamVar);
-
- if ( var->varlevelsup < PlannerQueryLevel &&
- !intMember (lfirsti(lst), result) )
- result = lappendi (result, lfirsti(lst));
+ Var *var = nth(lfirsti(lst), PlannerParamVar);
+
+ if (var->varlevelsup < PlannerQueryLevel &&
+ !intMember(lfirsti(lst), result))
+ result = lappendi(result, lfirsti(lst));
}
}
else
- elog (ERROR, "_finalize_primnode: can't handle node %d",
- nodeTag (expr));
-
+ elog(ERROR, "_finalize_primnode: can't handle node %d",
+ nodeTag(expr));
+
return (result);
}
Node *
-SS_replace_correlation_vars (Node *expr)
+SS_replace_correlation_vars(Node *expr)
{
- if ( expr == NULL )
+ if (expr == NULL)
return (NULL);
- if (IsA (expr, List))
+ if (IsA(expr, List))
{
- List *le;
- foreach (le, (List*) expr)
- lfirst(le) = SS_replace_correlation_vars ((Node*) lfirst(le));
+ List *le;
+
+ foreach(le, (List *) expr)
+ lfirst(le) = SS_replace_correlation_vars((Node *) lfirst(le));
}
- else if (IsA (expr, Var))
+ else if (IsA(expr, Var))
{
- if ( ((Var*) expr)->varlevelsup > 0 )
+ if (((Var *) expr)->varlevelsup > 0)
{
- Assert (((Var*) expr)->varlevelsup < PlannerQueryLevel);
- expr = (Node*) _replace_var ((Var*) expr);
+ Assert(((Var *) expr)->varlevelsup < PlannerQueryLevel);
+ expr = (Node *) _replace_var((Var *) expr);
}
}
- else if (IsA (expr, Iter))
+ else if (IsA(expr, Iter))
{
- ((Iter*) expr)->iterexpr =
- SS_replace_correlation_vars(((Iter*) expr)->iterexpr);
+ ((Iter *) expr)->iterexpr =
+ SS_replace_correlation_vars(((Iter *) expr)->iterexpr);
}
else if (single_node(expr))
return (expr);
- else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
- not_clause (expr) || is_funcclause(expr))
- ((Expr *) expr)->args = (List*)
- SS_replace_correlation_vars ((Node*) ((Expr *) expr)->args);
- else if (IsA (expr, Aggreg))
- ((Aggreg *) expr)->target =
- SS_replace_correlation_vars ((Node*) ((Aggreg *) expr)->target);
- else if (IsA (expr, ArrayRef))
+ else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
+ not_clause(expr) || is_funcclause(expr))
+ ((Expr *) expr)->args = (List *)
+ SS_replace_correlation_vars((Node *) ((Expr *) expr)->args);
+ else if (IsA(expr, Aggreg))
+ ((Aggreg *) expr)->target =
+ SS_replace_correlation_vars((Node *) ((Aggreg *) expr)->target);
+ else if (IsA(expr, ArrayRef))
{
- ((ArrayRef *) expr)->refupperindexpr = (List*)
- SS_replace_correlation_vars ((Node*) ((ArrayRef *) expr)->refupperindexpr);
- ((ArrayRef *) expr)->reflowerindexpr = (List*)
- SS_replace_correlation_vars ((Node*) ((ArrayRef *) expr)->reflowerindexpr);
- ((ArrayRef *) expr)->refexpr =
- SS_replace_correlation_vars ((Node*) ((ArrayRef *) expr)->refexpr);
- ((ArrayRef *) expr)->refassgnexpr =
- SS_replace_correlation_vars (((ArrayRef *) expr)->refassgnexpr);
+ ((ArrayRef *) expr)->refupperindexpr = (List *)
+ SS_replace_correlation_vars((Node *) ((ArrayRef *) expr)->refupperindexpr);
+ ((ArrayRef *) expr)->reflowerindexpr = (List *)
+ SS_replace_correlation_vars((Node *) ((ArrayRef *) expr)->reflowerindexpr);
+ ((ArrayRef *) expr)->refexpr =
+ SS_replace_correlation_vars((Node *) ((ArrayRef *) expr)->refexpr);
+ ((ArrayRef *) expr)->refassgnexpr =
+ SS_replace_correlation_vars(((ArrayRef *) expr)->refassgnexpr);
}
- else if (IsA (expr, TargetEntry))
- ((TargetEntry*) expr)->expr =
- SS_replace_correlation_vars ((Node*) ((TargetEntry*) expr)->expr);
- else if (IsA (expr, SubLink))
+ else if (IsA(expr, TargetEntry))
+ ((TargetEntry *) expr)->expr =
+ SS_replace_correlation_vars((Node *) ((TargetEntry *) expr)->expr);
+ else if (IsA(expr, SubLink))
{
- List *le;
-
- foreach (le, ((SubLink*) expr)->oper) /* left sides only */
+ List *le;
+
+ foreach(le, ((SubLink *) expr)->oper) /* left sides only */
{
- List *oparg = ((Expr*) lfirst (le))->args;
-
- lfirst (oparg) = (List*)
- SS_replace_correlation_vars ((Node*) lfirst (oparg));
+ List *oparg = ((Expr *) lfirst(le))->args;
+
+ lfirst(oparg) = (List *)
+ SS_replace_correlation_vars((Node *) lfirst(oparg));
}
- ((SubLink*) expr)->lefthand = (List*)
- SS_replace_correlation_vars ((Node*) ((SubLink*) expr)->lefthand);
+ ((SubLink *) expr)->lefthand = (List *)
+ SS_replace_correlation_vars((Node *) ((SubLink *) expr)->lefthand);
}
else
- elog (NOTICE, "SS_replace_correlation_vars: can't handle node %d",
- nodeTag (expr));
-
+ elog(NOTICE, "SS_replace_correlation_vars: can't handle node %d",
+ nodeTag(expr));
+
return (expr);
}
-Node*
-SS_process_sublinks (Node *expr)
+Node *
+SS_process_sublinks(Node *expr)
{
- if ( expr == NULL )
+ if (expr == NULL)
return (NULL);
- if (IsA (expr, List))
+ if (IsA(expr, List))
{
- List *le;
- foreach (le, (List*) expr)
- lfirst(le) = SS_process_sublinks ((Node*) lfirst(le));
+ List *le;
+
+ foreach(le, (List *) expr)
+ lfirst(le) = SS_process_sublinks((Node *) lfirst(le));
}
- else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
- not_clause (expr) || is_funcclause(expr))
- ((Expr *) expr)->args = (List*)
- SS_process_sublinks ((Node*) ((Expr *) expr)->args);
- else if (IsA (expr, SubLink)) /* got it! */
- expr = _make_subplan ((SubLink*) expr);
-
+ else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
+ not_clause(expr) || is_funcclause(expr))
+ ((Expr *) expr)->args = (List *)
+ SS_process_sublinks((Node *) ((Expr *) expr)->args);
+ else if (IsA(expr, SubLink))/* got it! */
+ expr = _make_subplan((SubLink *) expr);
+
return (expr);
}
-List*
-SS_finalize_plan (Plan *plan)
+List *
+SS_finalize_plan(Plan *plan)
{
- List *extParam = NULL;
- List *locParam = NULL;
- List *subPlan = NULL;
- List *param_list;
- List *lst;
-
- if ( plan == NULL )
+ List *extParam = NULL;
+ List *locParam = NULL;
+ List *subPlan = NULL;
+ List *param_list;
+ List *lst;
+
+ if (plan == NULL)
return (NULL);
-
- param_list = _finalize_primnode (plan->targetlist, &subPlan);
- Assert (subPlan == NULL);
-
+
+ param_list = _finalize_primnode(plan->targetlist, &subPlan);
+ Assert(subPlan == NULL);
+
switch (nodeTag(plan))
{
case T_Result:
- param_list = set_unioni (param_list,
- _finalize_primnode (((Result*) plan)->resconstantqual, &subPlan));
+ param_list = set_unioni(param_list,
+ _finalize_primnode(((Result *) plan)->resconstantqual, &subPlan));
break;
case T_Append:
- foreach (lst, ((Append*) plan)->unionplans)
- param_list = set_unioni (param_list,
- SS_finalize_plan ((Plan*) lfirst (lst)));
+ foreach(lst, ((Append *) plan)->unionplans)
+ param_list = set_unioni(param_list,
+ SS_finalize_plan((Plan *) lfirst(lst)));
break;
-
+
case T_IndexScan:
- param_list = set_unioni (param_list,
- _finalize_primnode (((IndexScan*) plan)->indxqual, &subPlan));
- Assert (subPlan == NULL);
+ param_list = set_unioni(param_list,
+ _finalize_primnode(((IndexScan *) plan)->indxqual, &subPlan));
+ Assert(subPlan == NULL);
break;
case T_MergeJoin:
- param_list = set_unioni (param_list,
- _finalize_primnode (((MergeJoin*) plan)->mergeclauses, &subPlan));
- Assert (subPlan == NULL);
+ param_list = set_unioni(param_list,
+ _finalize_primnode(((MergeJoin *) plan)->mergeclauses, &subPlan));
+ Assert(subPlan == NULL);
break;
case T_HashJoin:
- param_list = set_unioni (param_list,
- _finalize_primnode (((HashJoin*) plan)->hashclauses, &subPlan));
- Assert (subPlan == NULL);
+ param_list = set_unioni(param_list,
+ _finalize_primnode(((HashJoin *) plan)->hashclauses, &subPlan));
+ Assert(subPlan == NULL);
break;
-
+
case T_Hash:
- param_list = set_unioni (param_list,
- _finalize_primnode (((Hash*) plan)->hashkey, &subPlan));
- Assert (subPlan == NULL);
+ param_list = set_unioni(param_list,
+ _finalize_primnode(((Hash *) plan)->hashkey, &subPlan));
+ Assert(subPlan == NULL);
break;
case T_Agg:
- param_list = set_unioni (param_list,
- _finalize_primnode (((Agg*) plan)->aggs, &subPlan));
- Assert (subPlan == NULL);
+ param_list = set_unioni(param_list,
+ _finalize_primnode(((Agg *) plan)->aggs, &subPlan));
+ Assert(subPlan == NULL);
break;
-
+
case T_SeqScan:
case T_NestLoop:
case T_Material:
@@ -476,74 +480,75 @@ SS_finalize_plan (Plan *plan)
elog(ERROR, "SS_finalize_plan: node %d unsupported", nodeTag(plan));
return (NULL);
}
-
- param_list = set_unioni (param_list, _finalize_primnode (plan->qual, &subPlan));
- param_list = set_unioni (param_list, SS_finalize_plan (plan->lefttree));
- param_list = set_unioni (param_list, SS_finalize_plan (plan->righttree));
-
- foreach (lst, param_list)
+
+ param_list = set_unioni(param_list, _finalize_primnode(plan->qual, &subPlan));
+ param_list = set_unioni(param_list, SS_finalize_plan(plan->lefttree));
+ param_list = set_unioni(param_list, SS_finalize_plan(plan->righttree));
+
+ foreach(lst, param_list)
{
- Var *var = nth (lfirsti(lst), PlannerParamVar);
-
- if ( var->varlevelsup < PlannerQueryLevel )
- extParam = lappendi (extParam, lfirsti(lst));
- else if ( var->varlevelsup > PlannerQueryLevel )
- elog (ERROR, "SS_finalize_plan: plan shouldn't reference subplan' variable");
+ Var *var = nth(lfirsti(lst), PlannerParamVar);
+
+ if (var->varlevelsup < PlannerQueryLevel)
+ extParam = lappendi(extParam, lfirsti(lst));
+ else if (var->varlevelsup > PlannerQueryLevel)
+ elog(ERROR, "SS_finalize_plan: plan shouldn't reference subplan' variable");
else
{
- Assert (var->varno == 0 && var->varattno == 0);
- locParam = lappendi (locParam, lfirsti(lst));
+ Assert(var->varno == 0 && var->varattno == 0);
+ locParam = lappendi(locParam, lfirsti(lst));
}
}
-
+
plan->extParam = extParam;
plan->locParam = locParam;
plan->subPlan = subPlan;
-
+
return (param_list);
}
-List *SS_pull_subplan (void *expr);
+List *SS_pull_subplan(void *expr);
List *
-SS_pull_subplan (void *expr)
+SS_pull_subplan(void *expr)
{
- List *result = NULL;
-
- if ( expr == NULL || single_node(expr) )
+ List *result = NULL;
+
+ if (expr == NULL || single_node(expr))
return (NULL);
-
- if (IsA (expr, List))
+
+ if (IsA(expr, List))
{
- List *le;
- foreach (le, (List*) expr)
- result = nconc (result, SS_pull_subplan (lfirst(le)));
+ List *le;
+
+ foreach(le, (List *) expr)
+ result = nconc(result, SS_pull_subplan(lfirst(le)));
}
- else if (IsA (expr, Iter))
- return (SS_pull_subplan (((Iter*) expr)->iterexpr));
- else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
- not_clause (expr) || is_funcclause(expr))
- return (SS_pull_subplan (((Expr*) expr)->args));
- else if (IsA (expr, Aggreg))
- return (SS_pull_subplan (((Aggreg *) expr)->target));
- else if (IsA (expr, ArrayRef))
+ else if (IsA(expr, Iter))
+ return (SS_pull_subplan(((Iter *) expr)->iterexpr));
+ else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
+ not_clause(expr) || is_funcclause(expr))
+ return (SS_pull_subplan(((Expr *) expr)->args));
+ else if (IsA(expr, Aggreg))
+ return (SS_pull_subplan(((Aggreg *) expr)->target));
+ else if (IsA(expr, ArrayRef))
{
- result = SS_pull_subplan (((ArrayRef*) expr)->refupperindexpr);
- result = nconc (result,
- SS_pull_subplan (((ArrayRef *) expr)->reflowerindexpr));
- result = nconc (result,
- SS_pull_subplan (((ArrayRef *) expr)->refexpr));
- result = nconc (result,
- SS_pull_subplan (((ArrayRef *) expr)->refassgnexpr));
+ result = SS_pull_subplan(((ArrayRef *) expr)->refupperindexpr);
+ result = nconc(result,
+ SS_pull_subplan(((ArrayRef *) expr)->reflowerindexpr));
+ result = nconc(result,
+ SS_pull_subplan(((ArrayRef *) expr)->refexpr));
+ result = nconc(result,
+ SS_pull_subplan(((ArrayRef *) expr)->refassgnexpr));
}
- else if (IsA (expr, TargetEntry))
- return (SS_pull_subplan (((TargetEntry*) expr)->expr));
- else if (is_subplan (expr))
- return (lcons (((Expr*) expr)->oper, NULL));
+ else if (IsA(expr, TargetEntry))
+ return (SS_pull_subplan(((TargetEntry *) expr)->expr));
+ else if (is_subplan(expr))
+ return (lcons(((Expr *) expr)->oper, NULL));
else
- elog (ERROR, "SS_pull_subplan: can't handle node %d",
- nodeTag (expr));
-
+ elog(ERROR, "SS_pull_subplan: can't handle node %d",
+ nodeTag(expr));
+
return (result);
}
diff --git a/src/backend/optimizer/prep/prepqual.c b/src/backend/optimizer/prep/prepqual.c
index ae65df8bf47..b6443b8a094 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.7 1997/12/18 12:54:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.8 1998/02/26 04:32:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -64,7 +64,7 @@ static List *remove_duplicates(List *list);
* and from the rule manager (removeAndFlag = false).
*
*/
-List *
+List *
cnfify(Expr *qual, bool removeAndFlag)
{
Expr *newqual = NULL;
diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c
index 43ba76ff54a..5e67d26010a 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.9 1998/02/10 04:01:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.10 1998/02/26 04:33:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,7 +55,7 @@ new_relation_targetlist(Oid relid, Index rt_index,
*
* Returns the new targetlist.
*/
-List *
+List *
preprocess_targetlist(List *tlist,
int command_type,
Index result_relation,
@@ -297,7 +297,7 @@ new_relation_targetlist(Oid relid, Index rt_index, NodeTag node_type)
temp,
(Datum) typedefault,
(typedefault == (struct varlena *) NULL),
- /* XXX ? */
+ /* XXX ? */
false,
false, /* not a set */
false);
@@ -325,7 +325,7 @@ new_relation_targetlist(Oid relid, Index rt_index, NodeTag node_type)
temp_list = MakeTLE(makeResdom(attno,
atttype,
- get_atttypmod(relid, attno),
+ get_atttypmod(relid, attno),
attname,
0,
(Oid) 0,
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index ae73d816913..7b36d3b8e8c 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.19 1998/02/13 03:39:26 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.20 1998/02/26 04:33:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,16 +34,21 @@
#include "optimizer/planner.h"
#include "optimizer/planmain.h"
-static List *plan_inherit_query(List *relids, Index rt_index,
- RangeTblEntry *rt_entry, Query *parse,
- List **union_rtentriesPtr);
-static RangeTblEntry *new_rangetable_entry(Oid new_relid,
+static List *
+plan_inherit_query(List *relids, Index rt_index,
+ RangeTblEntry *rt_entry, Query *parse,
+ List **union_rtentriesPtr);
+static RangeTblEntry *
+new_rangetable_entry(Oid new_relid,
RangeTblEntry *old_entry);
-static Query *subst_rangetable(Query *root, Index index,
+static Query *
+subst_rangetable(Query *root, Index index,
RangeTblEntry *new_entry);
-static void fix_parsetree_attnums(Index rt_index, Oid old_relid,
+static void
+fix_parsetree_attnums(Index rt_index, Oid old_relid,
Oid new_relid, Query *parsetree);
-static Append *make_append(List *unionplans, List *unionrts, Index rt_index,
+static Append *
+make_append(List *unionplans, List *unionrts, Index rt_index,
List *union_rt_entries, List *tlist);
@@ -54,61 +59,43 @@ static Append *make_append(List *unionplans, List *unionrts, Index rt_index,
*
* Returns a list containing a list of plans and a list of rangetables
*/
-Append *
+Append *
plan_union_queries(Query *parse)
{
- List *union_plans = NIL, *ulist, *unionall_queries, *union_rts,
- *last_union = NIL;
- bool union_all_found = false, union_found = false,
- last_unionall_flag = false;
-
+ List *union_plans = NIL,
+ *ulist,
+ *unionall_queries,
+ *union_rts,
+ *last_union = NIL;
+ bool union_all_found = false,
+ union_found = false,
+ last_unionall_flag = false;
+
/*
- * Do we need to split up our unions because we have UNION
- * and UNION ALL?
+ * Do we need to split up our unions because we have UNION and UNION
+ * ALL?
+ *
+ * We are checking for the case of: SELECT 1 UNION SELECT 2 UNION SELECT
+ * 3 UNION ALL SELECT 4 UNION ALL SELECT 5
*
- * We are checking for the case of:
- * SELECT 1
- * UNION
- * SELECT 2
- * UNION
- * SELECT 3
- * UNION ALL
- * SELECT 4
- * UNION ALL
- * SELECT 5
+ * where we have to do a DISTINCT on the output of the first three
+ * queries, then add the rest. If they have used UNION and UNION ALL,
+ * we grab all queries up to the last UNION query, make them their own
+ * UNION with the owner as the first query in the list. Then, we take
+ * the remaining queries, which is UNION ALL, and add them to the list
+ * of union queries.
*
- * where we have to do a DISTINCT on the output of the first three
- * queries, then add the rest. If they have used UNION and
- * UNION ALL, we grab all queries up to the last UNION query,
- * make them their own UNION with the owner as the first query
- * in the list. Then, we take the remaining queries, which is UNION
- * ALL, and add them to the list of union queries.
+ * So the above query becomes:
*
- * So the above query becomes:
+ * Append Node { Sort and Unique { Append Node { SELECT 1
+ * This is really a sub-UNION, unionClause We run a
+ * DISTINCT on these. { SELECT 2 SELECT 3 } } } SELECT 4 SELECT 5 }
*
- * Append Node
- * {
- * Sort and Unique
- * {
- * Append Node
- * {
- * SELECT 1 This is really a sub-UNION,
- * unionClause We run a DISTINCT on these.
- * {
- * SELECT 2
- * SELECT 3
- * }
- * }
- * }
- * SELECT 4
- * SELECT 5
- * }
- *
*/
foreach(ulist, parse->unionClause)
{
- Query *union_query = lfirst(ulist);
+ Query *union_query = lfirst(ulist);
if (union_query->unionall)
union_all_found = true;
@@ -123,18 +110,18 @@ plan_union_queries(Query *parse)
/* Is this a simple one */
if (!union_all_found ||
!union_found ||
- /* A trailing UNION negates the affect of earlier UNION ALLs */
+ /* A trailing UNION negates the affect of earlier UNION ALLs */
!last_unionall_flag)
{
- List *hold_unionClause = parse->unionClause;
+ List *hold_unionClause = parse->unionClause;
- parse->unionClause = NIL; /* prevent recursion */
+ parse->unionClause = NIL; /* prevent recursion */
union_plans = lcons(union_planner(parse), NIL);
union_rts = lcons(parse->rtable, NIL);
foreach(ulist, hold_unionClause)
{
- Query *union_query = lfirst(ulist);
+ Query *union_query = lfirst(ulist);
union_plans = lappend(union_plans, union_planner(union_query));
union_rts = lappend(union_rts, union_query->rtable);
@@ -142,22 +129,23 @@ plan_union_queries(Query *parse)
}
else
{
+
/*
- * We have mixed unions and non-unions
+ * We have mixed unions and non-unions
*
- * We need to restructure this to put the UNIONs on their own
- * so we can do a DISTINCT.
+ * We need to restructure this to put the UNIONs on their own so we
+ * can do a DISTINCT.
*/
- /* save off everthing past the last UNION */
+ /* save off everthing past the last UNION */
unionall_queries = lnext(last_union);
/* clip off the list to remove the trailing UNION ALLs */
lnext(last_union) = NIL;
/*
- * Recursion, but UNION only.
- * The last one is a UNION, so it will not come here in recursion,
+ * Recursion, but UNION only. The last one is a UNION, so it will
+ * not come here in recursion,
*/
union_plans = lcons(union_planner(parse), NIL);
union_rts = lcons(parse->rtable, NIL);
@@ -165,20 +153,20 @@ plan_union_queries(Query *parse)
/* Append the remainging UNION ALLs */
foreach(ulist, unionall_queries)
{
- Query *unionall_query = lfirst(ulist);
+ Query *unionall_query = lfirst(ulist);
union_plans = lappend(union_plans, union_planner(unionall_query));
union_rts = lappend(union_rts, unionall_query->rtable);
}
}
-
+
/* We have already split UNION and UNION ALL and we made it consistent */
if (!last_unionall_flag)
{
parse->uniqueFlag = "*";
parse->sortClause = transformSortClause(NULL, NIL,
- parse->sortClause,
- parse->targetList, "*");
+ parse->sortClause,
+ parse->targetList, "*");
}
else
/* needed so we don't take the flag from the first query */
@@ -204,7 +192,7 @@ plan_union_queries(Query *parse)
* entries to be inserted into an APPEND node.
* XXX - what exactly does this mean, look for make_append
*/
-Append *
+Append *
plan_inherit_queries(Query *parse, Index rt_index)
{
List *union_plans = NIL;
@@ -218,6 +206,7 @@ plan_inherit_queries(Query *parse, Index rt_index)
find_all_inheritors(lconsi(rt_entry->relid,
NIL),
NIL);
+
/*
* Remove the flag for this relation, since we're about to handle it
* (do it before recursing!). XXX destructive parse tree change
@@ -225,7 +214,7 @@ plan_inherit_queries(Query *parse, Index rt_index)
rt_fetch(rt_index, rangetable)->inh = false;
union_plans = plan_inherit_query(union_relids, rt_index, rt_entry,
- parse, &union_rt_entries);
+ parse, &union_rt_entries);
return (make_append(union_plans,
NULL,
@@ -241,10 +230,10 @@ plan_inherit_queries(Query *parse, Index rt_index)
*/
static List *
plan_inherit_query(List *relids,
- Index rt_index,
- RangeTblEntry *rt_entry,
- Query *root,
- List **union_rtentriesPtr)
+ Index rt_index,
+ RangeTblEntry *rt_entry,
+ Query *root,
+ List **union_rtentriesPtr)
{
List *i;
List *union_plans = NIL;
@@ -290,7 +279,7 @@ plan_inherit_query(List *relids,
* attributes from any relations listed in either of the argument relid
* lists.
*/
-List *
+List *
find_all_inheritors(List *unexamined_relids,
List *examined_relids)
{
diff --git a/src/backend/optimizer/util/clauseinfo.c b/src/backend/optimizer/util/clauseinfo.c
index 3dfa5de4f9a..7b7fdfc407a 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.6 1997/09/08 21:45:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.7 1998/02/26 04:33:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,7 +44,7 @@ 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;
@@ -173,7 +173,7 @@ 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;
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index aa77085c55e..17b6113be83 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.15 1998/02/13 03:40:19 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.16 1998/02/26 04:33:11 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -38,7 +38,7 @@
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 ||
@@ -58,7 +58,7 @@ make_clause(int type, Node *oper, List *args)
}
else
{
- elog (ERROR, "make_clause: unsupported type %d", type);
+ elog(ERROR, "make_clause: unsupported type %d", type);
/* will this ever happen? translated from lispy C code - ay 10/94 */
return ((Expr *) args);
}
@@ -94,7 +94,7 @@ is_opclause(Node *clause)
* operand (if it is non-null).
*
*/
-Expr *
+Expr *
make_opclause(Oper *op, Var *leftop, Var *rightop)
{
Expr *expr = makeNode(Expr);
@@ -113,7 +113,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)
@@ -128,7 +128,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)
@@ -173,7 +173,7 @@ is_funcclause(Node *clause)
* arguments.
*
*/
-Expr *
+Expr *
make_funcclause(Func *func, List *funcargs)
{
Expr *expr = makeNode(Expr);
@@ -209,7 +209,7 @@ or_clause(Node *clause)
* Creates an 'or' clause given a list of its subclauses.
*
*/
-Expr *
+Expr *
make_orclause(List *orclauses)
{
Expr *expr = makeNode(Expr);
@@ -245,7 +245,7 @@ not_clause(Node *clause)
* Create a 'not' clause given the expression to be negated.
*
*/
-Expr *
+Expr *
make_notclause(Expr *notclause)
{
Expr *expr = makeNode(Expr);
@@ -263,7 +263,7 @@ make_notclause(Expr *notclause)
* Retrieve the clause within a 'not' clause
*
*/
-Expr *
+Expr *
get_notclausearg(Expr *notclause)
{
return (lfirst(notclause->args));
@@ -294,7 +294,7 @@ and_clause(Node *clause)
* Create an 'and' clause given its arguments in a list.
*
*/
-Expr *
+Expr *
make_andclause(List *andclauses)
{
Expr *expr = makeNode(Expr);
@@ -322,7 +322,7 @@ make_andclause(List *andclauses)
* quals as the return value.
*
*/
-List *
+List *
pull_constant_clauses(List *quals, List **constantQual)
{
List *q;
@@ -377,8 +377,8 @@ clause_relids_vars(Node *clause, List **relids, List **vars)
foreach(vi, var_list)
{
Var *in_list = (Var *) lfirst(vi);
-
- Assert (var->varlevelsup == 0);
+
+ Assert(var->varlevelsup == 0);
if (in_list->varno == var->varno &&
in_list->varattno == var->varattno)
break;
@@ -553,15 +553,15 @@ fix_opid(Node *clause)
{
fix_opid(((Aggreg *) clause)->target);
}
- else if (is_subplan(clause) &&
- ((SubPlan*) ((Expr*) clause)->oper)->sublink->subLinkType != EXISTS_SUBLINK)
+ else if (is_subplan(clause) &&
+ ((SubPlan *) ((Expr *) clause)->oper)->sublink->subLinkType != EXISTS_SUBLINK)
{
- List *lst;
-
- foreach (lst, ((SubPlan*) ((Expr*) clause)->oper)->sublink->oper)
+ List *lst;
+
+ foreach(lst, ((SubPlan *) ((Expr *) clause)->oper)->sublink->oper)
{
- replace_opid((Oper*) ((Expr*) lfirst(lst))->oper);
- fix_opid((Node*) get_leftop((Expr*) lfirst(lst)));
+ replace_opid((Oper *) ((Expr *) lfirst(lst))->oper);
+ fix_opid((Node *) get_leftop((Expr *) lfirst(lst)));
}
}
@@ -574,7 +574,7 @@ fix_opid(Node *clause)
* Returns its argument.
*
*/
-List *
+List *
fix_opids(List *clauses)
{
List *clause;
@@ -642,7 +642,7 @@ get_relattval(Node *clause,
}
}
- else if (is_opclause(clause) && IsA(left, Var) && IsA(right, Param))
+ else if (is_opclause(clause) && IsA(left, Var) &&IsA(right, Param))
{
*relid = left->varno;
*attno = left->varattno;
@@ -653,8 +653,8 @@ get_relattval(Node *clause,
is_funcclause((Node *) left) &&
IsA(right, Const))
{
- List *vars = pull_var_clause((Node*)left);
-
+ List *vars = pull_var_clause((Node *) left);
+
*relid = ((Var *) lfirst(vars))->varno;
*attno = InvalidAttrNumber;
*constval = ((Const *) right)->constvalue;
@@ -664,8 +664,8 @@ get_relattval(Node *clause,
is_funcclause((Node *) right) &&
IsA(left, Const))
{
- List *vars = pull_var_clause((Node*)right);
-
+ List *vars = pull_var_clause((Node *) right);
+
*relid = ((Var *) lfirst(vars))->varno;
*attno = InvalidAttrNumber;
*constval = ((Const *) left)->constvalue;
@@ -692,7 +692,7 @@ get_relattval(Node *clause,
*flag = (_SELEC_NOT_CONSTANT_);
}
}
- else if (is_opclause(clause) && IsA(right, Var) && IsA(left, Param))
+ else if (is_opclause(clause) && IsA(right, Var) &&IsA(left, Param))
{
*relid = right->varno;
*attno = right->varattno;
diff --git a/src/backend/optimizer/util/indexnode.c b/src/backend/optimizer/util/indexnode.c
index 0c4b370db16..3b3c44c3be5 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.5 1997/09/08 21:45:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.6 1998/02/26 04:33:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -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)
diff --git a/src/backend/optimizer/util/internal.c b/src/backend/optimizer/util/internal.c
index 258f745a81e..fdb094a3db9 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.6 1997/09/08 21:45:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/internal.c,v 1.7 1998/02/26 04:33:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,7 +48,7 @@ MakeTLE(Resdom *resdom, Node *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 03ec95db618..90c03f3f8eb 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.5 1997/09/08 21:45:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.6 1998/02/26 04:33:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@
* exists.
*
*/
-JInfo *
+JInfo *
joininfo_member(List *join_relids, List *joininfo_list)
{
List *i = NIL;
@@ -61,7 +61,7 @@ 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,
@@ -88,7 +88,7 @@ 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;
diff --git a/src/backend/optimizer/util/keys.c b/src/backend/optimizer/util/keys.c
index 2699ec98b31..eb49cb5ad3b 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.5 1997/09/08 21:45:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.6 1998/02/26 04:33:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -85,7 +85,7 @@ equal_indexkey_var(int index_key, Var *var)
* lelation.
*
*/
-Var *
+Var *
extract_subkey(JoinKey *jk, int which_subkey)
{
Var *retval;
@@ -178,7 +178,7 @@ matching2_tlvar(int var, List *tlist, bool (*test) ())
}
-List *
+List *
collect_index_pathkeys(int *index_keys, List *tlist)
{
List *retval = NIL;
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 61cd7be84c9..96a5bb9a126 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.6 1997/09/08 21:45:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.7 1998/02/26 04:33:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,7 +61,7 @@ path_is_cheaper(Path *path1, Path *path2)
* is minimum.
*
*/
-Path *
+Path *
set_cheapest(Rel *parent_rel, List *pathlist)
{
List *p;
@@ -100,7 +100,7 @@ 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;
@@ -207,7 +207,7 @@ better_path(Path *new_path, List *unique_paths, bool *noOther)
* pathnode.
*
*/
-Path *
+Path *
create_seqscan_path(Rel *rel)
{
int relid = 0;
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index f00a9a9f280..2237d6c1b35 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.15 1998/02/11 19:10:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.16 1998/02/26 04:33:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -403,7 +403,7 @@ 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] = {
@@ -440,7 +440,7 @@ 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] = {
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
index dc242e531e6..b18f3342015 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.4 1997/09/08 21:45:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.5 1998/02/26 04:33:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,7 +27,7 @@
* necessary. This is for base relations.
*
*/
-Rel *
+Rel *
get_base_rel(Query *root, int relid)
{
List *relids;
@@ -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,7 +114,7 @@ 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;
diff --git a/src/backend/optimizer/util/tlist.c b/src/backend/optimizer/util/tlist.c
index a98ee8f22cc..2ed37d5f5c5 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.11 1998/02/13 03:40:21 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.12 1998/02/26 04:33:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -68,7 +68,7 @@ tlistentry_member(Var *var, List *targetlist)
* REQUIRES: "test" operates on lispval unions,
*
*/
-Expr *
+Expr *
matching_tlvar(Var *var, List *targetlist)
{
TargetEntry *tlentry;
@@ -153,7 +153,7 @@ create_tl_element(Var *var, int resdomno)
* Returns the targetlist elements from a relation tlist.
*
*/
-List *
+List *
get_actual_tlist(List *tlist)
{
@@ -200,7 +200,7 @@ 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;
@@ -230,7 +230,7 @@ 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;
@@ -273,7 +273,7 @@ match_varid(Var *test_var, List *tlist)
type_var = (Oid) test_var->vartype;
- Assert (test_var->varlevelsup == 0);
+ Assert(test_var->varlevelsup == 0);
foreach(tl, tlist)
{
TargetEntry *entry;
@@ -289,9 +289,9 @@ match_varid(Var *test_var, List *tlist)
* we test the original varno (instead of varno which might be
* changed to INNER/OUTER.
*/
- Assert (tlvar->varlevelsup == 0);
+ Assert(tlvar->varlevelsup == 0);
if (tlvar->varnoold == test_var->varnoold &&
- tlvar->varoattno == test_var->varoattno)
+ tlvar->varoattno == test_var->varoattno)
{
if (tlvar->vartype == type_var)
@@ -313,7 +313,7 @@ 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);
@@ -341,7 +341,7 @@ new_unsorted_tlist(List *targetlist)
* Returns a new target list.
*
*/
-List *
+List *
copy_vars(List *target, List *source)
{
List *result = NIL;
@@ -369,7 +369,7 @@ copy_vars(List *target, List *source)
* Returns the "flattened" new target list.
*
*/
-List *
+List *
flatten_tlist(List *tlist)
{
int last_resdomno = 1;
@@ -425,7 +425,7 @@ flatten_tlist(List *tlist)
* Returns the modified actual target list.
*
*/
-List *
+List *
flatten_tlist_vars(List *full_tlist, List *flat_tlist)
{
List *x = NIL;
@@ -556,7 +556,7 @@ MakeTLE(Resdom *resdom, Node *expr)
return rt;
}
-Var *
+Var *
get_expr(TargetEntry *tle)
{
Assert(tle != NULL);
diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c
index 4c3ebe7f326..346e1635892 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.10 1998/02/13 03:40:23 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.11 1998/02/26 04:33:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@
* 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,
@@ -107,9 +107,9 @@ contain_var_clause(Node *clause)
return TRUE;
}
/* Ok - check left sides of Oper-s */
- foreach(temp, ((SubPlan*) ((Expr *) clause)->oper)->sublink->oper)
+ foreach(temp, ((SubPlan *) ((Expr *) clause)->oper)->sublink->oper)
{
- if (contain_var_clause(lfirst(((Expr*) lfirst(temp))->args)))
+ if (contain_var_clause(lfirst(((Expr *) lfirst(temp))->args)))
return TRUE;
}
return FALSE;
@@ -150,7 +150,7 @@ contain_var_clause(Node *clause)
*
* Returns list of varnodes found.
*/
-List *
+List *
pull_var_clause(Node *clause)
{
List *retval = NIL;
@@ -174,12 +174,12 @@ pull_var_clause(Node *clause)
{
List *temp;
- foreach(temp, ((Expr*) clause)->args)
+ foreach(temp, ((Expr *) clause)->args)
retval = nconc(retval, pull_var_clause(lfirst(temp)));
/* Ok - get Var-s from left sides of Oper-s */
- foreach(temp, ((SubPlan*) ((Expr*) clause)->oper)->sublink->oper)
- retval = nconc(retval,
- pull_var_clause(lfirst(((Expr*) lfirst(temp))->args)));
+ foreach(temp, ((SubPlan *) ((Expr *) clause)->oper)->sublink->oper)
+ retval = nconc(retval,
+ pull_var_clause(lfirst(((Expr *) lfirst(temp))->args)));
}
else if (IsA(clause, Aggreg))
{
@@ -224,7 +224,7 @@ var_equal(Var *var1, Var *var2)
(((Var *) var1)->varlevelsup == ((Var *) var2)->varlevelsup) &&
(((Var *) var1)->varattno == ((Var *) var2)->varattno))
{
- Assert (((Var *) var1)->varlevelsup == 0);
+ Assert(((Var *) var1)->varlevelsup == 0);
return (true);
}
else
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index fc5ce5736e5..64ec5fa37d9 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.70 1998/02/10 04:01:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.71 1998/02/26 04:33:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,7 +42,7 @@ static Query *transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt);
static Query *transformCursorStmt(ParseState *pstate, SelectStmt *stmt);
static Query *transformCreateStmt(ParseState *pstate, CreateStmt *stmt);
-List *extras = NIL;
+List *extras = NIL;
/*
* parse_analyze -
@@ -102,10 +102,10 @@ transformStmt(ParseState *pstate, Node *parseTree)
switch (nodeTag(parseTree))
{
- /*------------------------
- * Non-optimizable statements
- *------------------------
- */
+ /*------------------------
+ * Non-optimizable statements
+ *------------------------
+ */
case T_CreateStmt:
result = transformCreateStmt(pstate, (CreateStmt *) parseTree);
break;
@@ -162,10 +162,10 @@ transformStmt(ParseState *pstate, Node *parseTree)
}
break;
- /*------------------------
- * Optimizable statements
- *------------------------
- */
+ /*------------------------
+ * Optimizable statements
+ *------------------------
+ */
case T_InsertStmt:
result = transformInsertStmt(pstate, (InsertStmt *) parseTree);
break;
@@ -179,7 +179,7 @@ transformStmt(ParseState *pstate, Node *parseTree)
break;
case T_SelectStmt:
- if (!((SelectStmt *)parseTree)->portalname)
+ if (!((SelectStmt *) parseTree)->portalname)
result = transformSelectStmt(pstate, (SelectStmt *) parseTree);
else
result = transformCursorStmt(pstate, (SelectStmt *) parseTree);
@@ -218,7 +218,7 @@ transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt)
/* fix where clause */
qry->qual = transformWhereClause(pstate, stmt->whereClause);
qry->hasSubLinks = pstate->p_hasSubLinks;
-
+
qry->rtable = pstate->p_rtable;
qry->resultRelation = refnameRangeTablePosn(pstate, stmt->relname, NULL);
@@ -249,43 +249,43 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
/* fix the target list */
icolumns = pstate->p_insert_columns = makeTargetNames(pstate, stmt->cols);
-
+
qry->targetList = transformTargetList(pstate, stmt->targetList);
-
+
/* DEFAULT handling */
if (length(qry->targetList) < pstate->p_target_relation->rd_att->natts &&
pstate->p_target_relation->rd_att->constr &&
pstate->p_target_relation->rd_att->constr->num_defval > 0)
{
- AttributeTupleForm *att = pstate->p_target_relation->rd_att->attrs;
- AttrDefault *defval = pstate->p_target_relation->rd_att->constr->defval;
- int ndef = pstate->p_target_relation->rd_att->constr->num_defval;
-
- /*
+ AttributeTupleForm *att = pstate->p_target_relation->rd_att->attrs;
+ AttrDefault *defval = pstate->p_target_relation->rd_att->constr->defval;
+ int ndef = pstate->p_target_relation->rd_att->constr->num_defval;
+
+ /*
* if stmt->cols == NIL then makeTargetNames returns list of all
* attrs: have to shorter icolumns list...
*/
if (stmt->cols == NIL)
{
- List *extrl;
- int i = length(qry->targetList);
-
- foreach (extrl, icolumns)
+ List *extrl;
+ int i = length(qry->targetList);
+
+ foreach(extrl, icolumns)
{
if (--i <= 0)
break;
}
- freeList (lnext(extrl));
+ freeList(lnext(extrl));
lnext(extrl) = NIL;
}
-
+
while (ndef-- > 0)
{
- List *tl;
- Ident *id;
- TargetEntry *te;
-
- foreach (tl, icolumns)
+ List *tl;
+ Ident *id;
+ TargetEntry *te;
+
+ foreach(tl, icolumns)
{
id = (Ident *) lfirst(tl);
if (!namestrcmp(&(att[defval[ndef].adnum - 1]->attname), id->name))
@@ -293,33 +293,34 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
}
if (tl != NIL) /* something given for this attr */
continue;
- /*
- * Nothing given for this attr with DEFAULT expr, so
- * add new TargetEntry to qry->targetList.
- * Note, that we set resno to defval[ndef].adnum:
- * it's what transformTargetList()->make_targetlist_expr()
- * does for INSERT ... SELECT. But for INSERT ... VALUES
- * pstate->p_last_resno is used. It doesn't matter for
- * "normal" using (planner creates proper target list
- * in preptlist.c), but may break RULEs in some way.
- * It seems better to create proper target list here...
+
+ /*
+ * Nothing given for this attr with DEFAULT expr, so add new
+ * TargetEntry to qry->targetList. Note, that we set resno to
+ * defval[ndef].adnum: it's what
+ * transformTargetList()->make_targetlist_expr() does for
+ * INSERT ... SELECT. But for INSERT ... VALUES
+ * pstate->p_last_resno is used. It doesn't matter for
+ * "normal" using (planner creates proper target list in
+ * preptlist.c), but may break RULEs in some way. It seems
+ * better to create proper target list here...
*/
te = makeNode(TargetEntry);
te->resdom = makeResdom(defval[ndef].adnum,
att[defval[ndef].adnum - 1]->atttypid,
- att[defval[ndef].adnum - 1]->atttypmod,
- pstrdup(nameout(&(att[defval[ndef].adnum - 1]->attname))),
+ att[defval[ndef].adnum - 1]->atttypmod,
+ pstrdup(nameout(&(att[defval[ndef].adnum - 1]->attname))),
0, 0, 0);
te->fjoin = NULL;
te->expr = (Node *) stringToNode(defval[ndef].adbin);
- qry->targetList = lappend (qry->targetList, te);
+ qry->targetList = lappend(qry->targetList, te);
}
}
-
+
/* fix where clause */
qry->qual = transformWhereClause(pstate, stmt->whereClause);
qry->hasSubLinks = pstate->p_hasSubLinks;
-
+
/* now the range table will not change */
qry->rtable = pstate->p_rtable;
qry->resultRelation = refnameRangeTablePosn(pstate, stmt->relname, NULL);
@@ -340,7 +341,8 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
parseCheckAggregates(pstate, qry);
/* The INSERT INTO ... SELECT ... could have a UNION */
- qry->unionall = stmt->unionall; /* in child, so unionClause may be false */
+ qry->unionall = stmt->unionall; /* in child, so unionClause may be
+ * false */
qry->unionClause = transformUnionClause(stmt->unionClause, qry->targetList);
return (Query *) qry;
@@ -353,33 +355,33 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
static char *
makeTableName(void *elem,...)
{
- va_list args;
+ va_list args;
- char *name;
- char buf[NAMEDATALEN+1];
+ char *name;
+ char buf[NAMEDATALEN + 1];
buf[0] = '\0';
- va_start(args,elem);
+ va_start(args, elem);
name = elem;
while (name != NULL)
{
/* not enough room for next part? then return nothing */
- if ((strlen(buf)+strlen(name)) >= (sizeof(buf)-1))
+ if ((strlen(buf) + strlen(name)) >= (sizeof(buf) - 1))
return (NULL);
if (strlen(buf) > 0)
- strcat(buf,"_");
- strcat(buf,name);
+ strcat(buf, "_");
+ strcat(buf, name);
- name = va_arg(args,void *);
+ name = va_arg(args, void *);
}
va_end(args);
- name = palloc(strlen(buf)+1);
- strcpy(name,buf);
+ name = palloc(strlen(buf) + 1);
+ strcpy(name, buf);
return (name);
}
@@ -391,10 +393,10 @@ CreateIndexName(char *tname, char *cname, char *label, List *indices)
char *iname = NULL;
List *ilist;
IndexStmt *index;
- char name2[NAMEDATALEN+1];
+ char name2[NAMEDATALEN + 1];
/* use working storage, since we might be trying several possibilities */
- strcpy(name2,cname);
+ strcpy(name2, cname);
while (iname == NULL)
{
iname = makeTableName(tname, name2, label, NULL);
@@ -406,7 +408,7 @@ CreateIndexName(char *tname, char *cname, char *label, List *indices)
while (ilist != NIL)
{
index = lfirst(ilist);
- if (strcasecmp(iname,index->idxname) == 0)
+ if (strcasecmp(iname, index->idxname) == 0)
break;
ilist = lnext(ilist);
@@ -419,7 +421,7 @@ CreateIndexName(char *tname, char *cname, char *label, List *indices)
pfree(iname);
iname = NULL;
pass++;
- sprintf(name2, "%s_%d", cname, (pass+1));
+ sprintf(name2, "%s_%d", cname, (pass + 1));
}
return (iname);
@@ -444,7 +446,8 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
List *columns;
List *dlist;
ColumnDef *column;
- List *constraints, *clist;
+ List *constraints,
+ *clist;
Constraint *constraint;
List *keys;
Ident *key;
@@ -467,7 +470,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
{
case T_ColumnDef:
column = (ColumnDef *) element;
- columns = lappend(columns,column);
+ columns = lappend(columns, column);
if (column->constraints != NIL)
{
clist = column->constraints;
@@ -478,15 +481,15 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
{
case CONSTR_NOTNULL:
if (column->is_not_null)
- elog(ERROR,"CREATE TABLE/NOT NULL already specified"
- " for %s.%s", stmt->relname, column->colname);
+ elog(ERROR, "CREATE TABLE/NOT NULL already specified"
+ " for %s.%s", stmt->relname, column->colname);
column->is_not_null = TRUE;
break;
case CONSTR_DEFAULT:
if (column->defval != NULL)
- elog(ERROR,"CREATE TABLE/DEFAULT multiple values specified"
- " for %s.%s", stmt->relname, column->colname);
+ elog(ERROR, "CREATE TABLE/DEFAULT multiple values specified"
+ " for %s.%s", stmt->relname, column->colname);
column->defval = constraint->def;
break;
@@ -513,7 +516,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
break;
default:
- elog(ERROR,"parser: internal error; unrecognized constraint",NULL);
+ elog(ERROR, "parser: internal error; unrecognized constraint", NULL);
break;
}
clist = lnext(clist);
@@ -545,16 +548,16 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
case CONSTR_NOTNULL:
case CONSTR_DEFAULT:
- elog(ERROR,"parser: internal error; illegal context for constraint",NULL);
+ elog(ERROR, "parser: internal error; illegal context for constraint", NULL);
break;
default:
- elog(ERROR,"parser: internal error; unrecognized constraint",NULL);
+ elog(ERROR, "parser: internal error; unrecognized constraint", NULL);
break;
}
break;
default:
- elog(ERROR,"parser: internal error; unrecognized node",NULL);
+ elog(ERROR, "parser: internal error; unrecognized node", NULL);
}
elements = lnext(elements);
@@ -568,25 +571,25 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
* For UNIQUE, create an index as for PRIMARY KEYS, but do not insist on NOT NULL.
*
* Note that this code does not currently look for all possible redundant cases
- * and either ignore or stop with warning. The create might fail later when
- * names for indices turn out to be redundant, or a user might have specified
- * extra useless indices which might hurt performance. - thomas 1997-12-08
+ * and either ignore or stop with warning. The create might fail later when
+ * names for indices turn out to be redundant, or a user might have specified
+ * extra useless indices which might hurt performance. - thomas 1997-12-08
*/
ilist = NIL;
while (dlist != NIL)
{
constraint = lfirst(dlist);
if (nodeTag(constraint) != T_Constraint)
- elog(ERROR,"parser: internal error; unrecognized deferred node",NULL);
+ elog(ERROR, "parser: internal error; unrecognized deferred node", NULL);
if (constraint->contype == CONSTR_PRIMARY)
if (have_pkey)
- elog(ERROR,"CREATE TABLE/PRIMARY KEY multiple primary keys"
- " for table %s are not legal", stmt->relname);
- else
+ elog(ERROR, "CREATE TABLE/PRIMARY KEY multiple primary keys"
+ " for table %s are not legal", stmt->relname);
+ else
have_pkey = TRUE;
else if (constraint->contype != CONSTR_UNIQUE)
- elog(ERROR,"parser: internal error; unrecognized deferred constraint",NULL);
+ elog(ERROR, "parser: internal error; unrecognized deferred constraint", NULL);
index = makeNode(IndexStmt);
@@ -596,7 +599,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
else if (constraint->contype == CONSTR_PRIMARY)
{
if (have_pkey)
- elog(ERROR,"CREATE TABLE/PRIMARY KEY multiple keys for table %s are not legal", stmt->relname);
+ elog(ERROR, "CREATE TABLE/PRIMARY KEY multiple keys for table %s are not legal", stmt->relname);
have_pkey = TRUE;
index->idxname = makeTableName(stmt->relname, "pkey", NULL);
@@ -609,7 +612,7 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
index->indexParams = NIL;
index->withClause = NIL;
index->whereClause = NULL;
-
+
keys = constraint->keys;
while (keys != NIL)
{
@@ -619,17 +622,19 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
while (columns != NIL)
{
column = lfirst(columns);
- if (strcasecmp(column->colname,key->name) == 0) break;
- else column = NULL;
+ if (strcasecmp(column->colname, key->name) == 0)
+ break;
+ else
+ column = NULL;
columns = lnext(columns);
}
if (column == NULL)
- elog(ERROR,"parser: column '%s' in key does not exist",key->name);
+ elog(ERROR, "parser: column '%s' in key does not exist", key->name);
if (constraint->contype == CONSTR_PRIMARY)
column->is_not_null = TRUE;
iparam = makeNode(IndexElem);
- iparam->name = strcpy(palloc(strlen(column->colname)+1), column->colname);
+ iparam->name = strcpy(palloc(strlen(column->colname) + 1), column->colname);
iparam->args = NIL;
iparam->class = NULL;
iparam->tname = NULL;
@@ -642,12 +647,12 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt)
}
if (index->idxname == NULL)
- elog(ERROR,"parser: unable to construct implicit index for table %s"
- "; name too long", stmt->relname);
+ elog(ERROR, "parser: unable to construct implicit index for table %s"
+ "; name too long", stmt->relname);
else
- elog(NOTICE,"CREATE TABLE/%s will create implicit index %s for table %s",
- ((constraint->contype == CONSTR_PRIMARY)? "PRIMARY KEY": "UNIQUE"),
- index->idxname, stmt->relname);
+ elog(NOTICE, "CREATE TABLE/%s will create implicit index %s for table %s",
+ ((constraint->contype == CONSTR_PRIMARY) ? "PRIMARY KEY" : "UNIQUE"),
+ index->idxname, stmt->relname);
ilist = lappend(ilist, index);
dlist = lnext(dlist);
@@ -674,7 +679,7 @@ transformIndexStmt(ParseState *pstate, IndexStmt *stmt)
/* take care of the where clause */
stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
qry->hasSubLinks = pstate->p_hasSubLinks;
-
+
stmt->rangetable = pstate->p_rtable;
qry->utilityStmt = (Node *) stmt;
@@ -793,7 +798,8 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
if (pstate->p_hasAggs)
parseCheckAggregates(pstate, qry);
- qry->unionall = stmt->unionall; /* in child, so unionClause may be false */
+ qry->unionall = stmt->unionall; /* in child, so unionClause may be
+ * false */
qry->unionClause = transformUnionClause(stmt->unionClause, qry->targetList);
return (Query *) qry;
diff --git a/src/backend/parser/parse.h b/src/backend/parser/parse.h
index 7b653a162b8..1bf37f80bf5 100644
--- a/src/backend/parser/parse.h
+++ b/src/backend/parser/parse.h
@@ -1,224 +1,225 @@
typedef union
{
- double dval;
- int ival;
- char chr;
- char *str;
- bool boolean;
- bool* pboolean; /* for pg_user privileges */
- List *list;
- Node *node;
- Value *value;
+ double dval;
+ int ival;
+ char chr;
+ char *str;
+ bool boolean;
+ bool *pboolean; /* for pg_user privileges */
+ List *list;
+ Node *node;
+ Value *value;
- Attr *attr;
+ Attr *attr;
- TypeName *typnam;
- DefElem *defelt;
- ParamString *param;
- SortGroupBy *sortgroupby;
- IndexElem *ielem;
- RangeVar *range;
- RelExpr *relexp;
- A_Indices *aind;
- ResTarget *target;
- ParamNo *paramno;
+ TypeName *typnam;
+ DefElem *defelt;
+ ParamString *param;
+ SortGroupBy *sortgroupby;
+ IndexElem *ielem;
+ RangeVar *range;
+ RelExpr *relexp;
+ A_Indices *aind;
+ ResTarget *target;
+ ParamNo *paramno;
- VersionStmt *vstmt;
- DefineStmt *dstmt;
- RuleStmt *rstmt;
- InsertStmt *astmt;
+ VersionStmt *vstmt;
+ DefineStmt *dstmt;
+ RuleStmt *rstmt;
+ InsertStmt *astmt;
} YYSTYPE;
-#define ACTION 258
-#define ADD 259
-#define ALL 260
-#define ALTER 261
-#define AND 262
-#define ANY 263
-#define AS 264
-#define ASC 265
-#define BEGIN_TRANS 266
-#define BETWEEN 267
-#define BOTH 268
-#define BY 269
-#define CASCADE 270
-#define CAST 271
-#define CHAR 272
-#define CHARACTER 273
-#define CHECK 274
-#define CLOSE 275
-#define COLLATE 276
-#define COLUMN 277
-#define COMMIT 278
-#define CONSTRAINT 279
-#define CREATE 280
-#define CROSS 281
-#define CURRENT 282
-#define CURRENT_DATE 283
-#define CURRENT_TIME 284
-#define CURRENT_TIMESTAMP 285
-#define CURRENT_USER 286
-#define CURSOR 287
-#define DAY_P 288
-#define DECIMAL 289
-#define DECLARE 290
-#define DEFAULT 291
-#define DELETE 292
-#define DESC 293
-#define DISTINCT 294
-#define DOUBLE 295
-#define DROP 296
-#define END_TRANS 297
-#define EXECUTE 298
-#define EXISTS 299
-#define EXTRACT 300
-#define FETCH 301
-#define FLOAT 302
-#define FOR 303
-#define FOREIGN 304
-#define FROM 305
-#define FULL 306
-#define GRANT 307
-#define GROUP 308
-#define HAVING 309
-#define HOUR_P 310
-#define IN 311
-#define INNER_P 312
-#define INSERT 313
-#define INTERVAL 314
-#define INTO 315
-#define IS 316
-#define JOIN 317
-#define KEY 318
-#define LANGUAGE 319
-#define LEADING 320
-#define LEFT 321
-#define LIKE 322
-#define LOCAL 323
-#define MATCH 324
-#define MINUTE_P 325
-#define MONTH_P 326
-#define NATIONAL 327
-#define NATURAL 328
-#define NCHAR 329
-#define NO 330
-#define NOT 331
-#define NOTIFY 332
-#define NULL_P 333
-#define NUMERIC 334
-#define ON 335
-#define OPTION 336
-#define OR 337
-#define ORDER 338
-#define OUTER_P 339
-#define PARTIAL 340
-#define POSITION 341
-#define PRECISION 342
-#define PRIMARY 343
-#define PRIVILEGES 344
-#define PROCEDURE 345
-#define PUBLIC 346
-#define REFERENCES 347
-#define REVOKE 348
-#define RIGHT 349
-#define ROLLBACK 350
-#define SECOND_P 351
-#define SELECT 352
-#define SET 353
-#define SUBSTRING 354
-#define TABLE 355
-#define TIME 356
-#define TIMESTAMP 357
-#define TO 358
-#define TRAILING 359
-#define TRANSACTION 360
-#define TRIM 361
-#define UNION 362
-#define UNIQUE 363
-#define UPDATE 364
-#define USING 365
-#define VALUES 366
-#define VARCHAR 367
-#define VARYING 368
-#define VIEW 369
-#define WHERE 370
-#define WITH 371
-#define WORK 372
-#define YEAR_P 373
-#define ZONE 374
-#define FALSE_P 375
-#define TRIGGER 376
-#define TRUE_P 377
-#define TYPE_P 378
-#define ABORT_TRANS 379
-#define AFTER 380
-#define AGGREGATE 381
-#define ANALYZE 382
-#define BACKWARD 383
-#define BEFORE 384
-#define BINARY 385
-#define CLUSTER 386
-#define COPY 387
-#define DATABASE 388
-#define DELIMITERS 389
-#define DO 390
-#define EACH 391
-#define EXPLAIN 392
-#define EXTEND 393
-#define FORWARD 394
-#define FUNCTION 395
-#define HANDLER 396
-#define INDEX 397
-#define INHERITS 398
-#define INSTEAD 399
-#define ISNULL 400
-#define LANCOMPILER 401
-#define LISTEN 402
-#define LOAD 403
-#define LOCK_P 404
-#define LOCATION 405
-#define MOVE 406
-#define NEW 407
-#define NONE 408
-#define NOTHING 409
-#define NOTNULL 410
-#define OIDS 411
-#define OPERATOR 412
-#define PROCEDURAL 413
-#define RECIPE 414
-#define RENAME 415
-#define RESET 416
-#define RETURNS 417
-#define ROW 418
-#define RULE 419
-#define SEQUENCE 420
-#define SETOF 421
-#define SHOW 422
-#define STATEMENT 423
-#define STDIN 424
-#define STDOUT 425
-#define TRUSTED 426
-#define VACUUM 427
-#define VERBOSE 428
-#define VERSION 429
-#define ARCHIVE 430
-#define USER 431
-#define PASSWORD 432
-#define CREATEDB 433
-#define NOCREATEDB 434
-#define CREATEUSER 435
-#define NOCREATEUSER 436
-#define VALID 437
-#define UNTIL 438
-#define IDENT 439
-#define SCONST 440
-#define Op 441
-#define ICONST 442
-#define PARAM 443
-#define FCONST 444
-#define OP 445
-#define UMINUS 446
-#define TYPECAST 447
-#define REDUCE 448
+
+#define ACTION 258
+#define ADD 259
+#define ALL 260
+#define ALTER 261
+#define AND 262
+#define ANY 263
+#define AS 264
+#define ASC 265
+#define BEGIN_TRANS 266
+#define BETWEEN 267
+#define BOTH 268
+#define BY 269
+#define CASCADE 270
+#define CAST 271
+#define CHAR 272
+#define CHARACTER 273
+#define CHECK 274
+#define CLOSE 275
+#define COLLATE 276
+#define COLUMN 277
+#define COMMIT 278
+#define CONSTRAINT 279
+#define CREATE 280
+#define CROSS 281
+#define CURRENT 282
+#define CURRENT_DATE 283
+#define CURRENT_TIME 284
+#define CURRENT_TIMESTAMP 285
+#define CURRENT_USER 286
+#define CURSOR 287
+#define DAY_P 288
+#define DECIMAL 289
+#define DECLARE 290
+#define DEFAULT 291
+#define DELETE 292
+#define DESC 293
+#define DISTINCT 294
+#define DOUBLE 295
+#define DROP 296
+#define END_TRANS 297
+#define EXECUTE 298
+#define EXISTS 299
+#define EXTRACT 300
+#define FETCH 301
+#define FLOAT 302
+#define FOR 303
+#define FOREIGN 304
+#define FROM 305
+#define FULL 306
+#define GRANT 307
+#define GROUP 308
+#define HAVING 309
+#define HOUR_P 310
+#define IN 311
+#define INNER_P 312
+#define INSERT 313
+#define INTERVAL 314
+#define INTO 315
+#define IS 316
+#define JOIN 317
+#define KEY 318
+#define LANGUAGE 319
+#define LEADING 320
+#define LEFT 321
+#define LIKE 322
+#define LOCAL 323
+#define MATCH 324
+#define MINUTE_P 325
+#define MONTH_P 326
+#define NATIONAL 327
+#define NATURAL 328
+#define NCHAR 329
+#define NO 330
+#define NOT 331
+#define NOTIFY 332
+#define NULL_P 333
+#define NUMERIC 334
+#define ON 335
+#define OPTION 336
+#define OR 337
+#define ORDER 338
+#define OUTER_P 339
+#define PARTIAL 340
+#define POSITION 341
+#define PRECISION 342
+#define PRIMARY 343
+#define PRIVILEGES 344
+#define PROCEDURE 345
+#define PUBLIC 346
+#define REFERENCES 347
+#define REVOKE 348
+#define RIGHT 349
+#define ROLLBACK 350
+#define SECOND_P 351
+#define SELECT 352
+#define SET 353
+#define SUBSTRING 354
+#define TABLE 355
+#define TIME 356
+#define TIMESTAMP 357
+#define TO 358
+#define TRAILING 359
+#define TRANSACTION 360
+#define TRIM 361
+#define UNION 362
+#define UNIQUE 363
+#define UPDATE 364
+#define USING 365
+#define VALUES 366
+#define VARCHAR 367
+#define VARYING 368
+#define VIEW 369
+#define WHERE 370
+#define WITH 371
+#define WORK 372
+#define YEAR_P 373
+#define ZONE 374
+#define FALSE_P 375
+#define TRIGGER 376
+#define TRUE_P 377
+#define TYPE_P 378
+#define ABORT_TRANS 379
+#define AFTER 380
+#define AGGREGATE 381
+#define ANALYZE 382
+#define BACKWARD 383
+#define BEFORE 384
+#define BINARY 385
+#define CLUSTER 386
+#define COPY 387
+#define DATABASE 388
+#define DELIMITERS 389
+#define DO 390
+#define EACH 391
+#define EXPLAIN 392
+#define EXTEND 393
+#define FORWARD 394
+#define FUNCTION 395
+#define HANDLER 396
+#define INDEX 397
+#define INHERITS 398
+#define INSTEAD 399
+#define ISNULL 400
+#define LANCOMPILER 401
+#define LISTEN 402
+#define LOAD 403
+#define LOCK_P 404
+#define LOCATION 405
+#define MOVE 406
+#define NEW 407
+#define NONE 408
+#define NOTHING 409
+#define NOTNULL 410
+#define OIDS 411
+#define OPERATOR 412
+#define PROCEDURAL 413
+#define RECIPE 414
+#define RENAME 415
+#define RESET 416
+#define RETURNS 417
+#define ROW 418
+#define RULE 419
+#define SEQUENCE 420
+#define SETOF 421
+#define SHOW 422
+#define STATEMENT 423
+#define STDIN 424
+#define STDOUT 425
+#define TRUSTED 426
+#define VACUUM 427
+#define VERBOSE 428
+#define VERSION 429
+#define ARCHIVE 430
+#define USER 431
+#define PASSWORD 432
+#define CREATEDB 433
+#define NOCREATEDB 434
+#define CREATEUSER 435
+#define NOCREATEUSER 436
+#define VALID 437
+#define UNTIL 438
+#define IDENT 439
+#define SCONST 440
+#define Op 441
+#define ICONST 442
+#define PARAM 443
+#define FCONST 444
+#define OP 445
+#define UMINUS 446
+#define TYPECAST 447
+#define REDUCE 448
extern YYSTYPE yylval;
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index 8474d2be411..e7a88101960 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.8 1998/01/20 05:04:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.9 1998/02/26 04:33:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -218,9 +218,9 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
}
-Aggreg *
+Aggreg *
ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
- List *target, int precedence)
+ List *target, int precedence)
{
Oid fintype;
Oid vartype;
@@ -229,7 +229,7 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
Aggreg *aggreg;
HeapTuple theAggTuple;
bool usenulls = false;
-
+
theAggTuple = SearchSysCacheTuple(AGGNAME, PointerGetDatum(aggname),
ObjectIdGetDatum(basetype),
0, 0);
@@ -237,34 +237,33 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
elog(ERROR, "aggregate %s does not exist", aggname);
/*
- * We do a major hack for count(*) here.
+ * We do a major hack for count(*) here.
*
- * Count(*) poses several problems. First, we need a field that is
- * guaranteed to be in the range table, and unique. Using a constant
- * causes the optimizer to properly remove the aggragate from any
- * elements of the query.
- * Using just 'oid', which can not be null, in the parser fails on:
+ * Count(*) poses several problems. First, we need a field that is
+ * guaranteed to be in the range table, and unique. Using a constant
+ * causes the optimizer to properly remove the aggragate from any
+ * elements of the query. Using just 'oid', which can not be null, in
+ * the parser fails on:
*
- * select count(*) from tab1, tab2 -- oid is not unique
- * select count(*) from viewtable -- views don't have real oids
+ * select count(*) from tab1, tab2 -- oid is not unique select
+ * count(*) from viewtable -- views don't have real oids
*
- * So, for an aggregate with parameter '*', we use the first valid
- * range table entry, and pick the first column from the table.
- * We set a flag to count nulls, because we could have nulls in
- * that column.
+ * So, for an aggregate with parameter '*', we use the first valid range
+ * table entry, and pick the first column from the table. We set a
+ * flag to count nulls, because we could have nulls in that column.
*
- * It's an ugly job, but someone has to do it.
- * bjm 1998/1/18
+ * It's an ugly job, but someone has to do it. bjm 1998/1/18
*/
-
+
if (nodeTag(lfirst(target)) == T_Const)
{
- Const *con = (Const *)lfirst(target);
-
+ Const *con = (Const *) lfirst(target);
+
if (con->consttype == UNKNOWNOID && VARSIZE(con->constvalue) == VARHDRSZ)
{
- Attr *attr = makeNode(Attr);
- List *rtable, *rlist;
+ Attr *attr = makeNode(Attr);
+ List *rtable,
+ *rlist;
RangeTblEntry *first_valid_rte;
Assert(lnext(target) == NULL);
@@ -273,12 +272,12 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
rtable = lnext(lnext(pstate->p_rtable));
else
rtable = pstate->p_rtable;
-
+
first_valid_rte = NULL;
foreach(rlist, rtable)
{
RangeTblEntry *rte = lfirst(rlist);
-
+
/* only entries on outer(non-function?) scope */
if (!rte->inFromCl && rte != pstate->p_target_rangetblentry)
continue;
@@ -288,16 +287,16 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
}
if (first_valid_rte == NULL)
elog(ERROR, "Can't find column to do aggregate(*) on.");
-
+
attr->relname = first_valid_rte->refname;
attr->attrs = lcons(makeString(
- get_attname(first_valid_rte->relid,1)),NIL);
+ get_attname(first_valid_rte->relid, 1)), NIL);
lfirst(target) = transformExpr(pstate, (Node *) attr, precedence);
usenulls = true;
}
}
-
+
aggform = (Form_pg_aggregate) GETSTRUCT(theAggTuple);
fintype = aggform->aggfinaltype;
xfn1 = aggform->aggtransfn1;
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index 8fdd77ea72f..ad38817a0bb 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.12 1998/01/20 22:55:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.13 1998/02/26 04:33:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,8 +26,9 @@
#include "parser/parse_relation.h"
#include "parser/parse_target.h"
-static TargetEntry *find_targetlist_entry(ParseState *pstate,
- SortGroupBy *sortgroupby, List *tlist);
+static TargetEntry *
+find_targetlist_entry(ParseState *pstate,
+ SortGroupBy *sortgroupby, List *tlist);
static void parseFromClause(ParseState *pstate, List *frmList);
/*
@@ -39,8 +40,8 @@ void
makeRangeTable(ParseState *pstate, char *relname, List *frmList)
{
RangeTblEntry *rte;
- int sublevels_up;
-
+ int sublevels_up;
+
parseFromClause(pstate, frmList);
if (relname == NULL)
@@ -48,7 +49,7 @@ makeRangeTable(ParseState *pstate, char *relname, List *frmList)
if (refnameRangeTablePosn(pstate, relname, &sublevels_up) == 0 ||
sublevels_up != 0)
- rte = addRangeTableEntry(pstate, relname, relname, FALSE, FALSE);
+ rte = addRangeTableEntry(pstate, relname, relname, FALSE, FALSE);
else
rte = refnameRangeTableEntry(pstate, relname);
@@ -69,7 +70,7 @@ transformWhereClause(ParseState *pstate, Node *a_expr)
Node *qual;
if (a_expr == NULL)
- return NULL; /* no qualifiers */
+ return NULL; /* no qualifiers */
pstate->p_in_where_clause = true;
qual = transformExpr(pstate, a_expr, EXPR_COLUMN_FIRST);
@@ -139,7 +140,7 @@ find_targetlist_entry(ParseState *pstate, SortGroupBy *sortgroupby, List *tlist)
TargetEntry *target_result = NULL;
if (sortgroupby->range)
- real_rtable_pos = refnameRangeTablePosn(pstate, sortgroupby->range, NULL);
+ real_rtable_pos = refnameRangeTablePosn(pstate, sortgroupby->range, NULL);
foreach(i, tlist)
{
@@ -216,21 +217,21 @@ transformGroupClause(ParseState *pstate, List *grouplist, List *targetlist)
else
{
List *i;
-
- foreach (i, glist)
+
+ foreach(i, glist)
{
- GroupClause *gcl = (GroupClause *) lfirst (i);
-
- if ( gcl->entry == grpcl->entry )
+ GroupClause *gcl = (GroupClause *) lfirst(i);
+
+ if (gcl->entry == grpcl->entry)
break;
}
- if ( i == NIL ) /* not in grouplist already */
+ if (i == NIL) /* not in grouplist already */
{
lnext(gl) = lcons(grpcl, NIL);
gl = lnext(gl);
}
else
- pfree (grpcl); /* get rid of this */
+ pfree(grpcl); /* get rid of this */
}
grouplist = lnext(grouplist);
}
@@ -259,7 +260,7 @@ transformSortClause(ParseState *pstate,
TargetEntry *restarget;
Resdom *resdom;
-
+
restarget = find_targetlist_entry(pstate, sortby, targetlist);
if (restarget == NULL)
elog(ERROR, "The field being ordered by must appear in the target list");
@@ -273,21 +274,21 @@ transformSortClause(ParseState *pstate,
else
{
List *i;
-
- foreach (i, sortlist)
+
+ foreach(i, sortlist)
{
- SortClause *scl = (SortClause *) lfirst (i);
-
- if ( scl->resdom == sortcl->resdom )
+ SortClause *scl = (SortClause *) lfirst(i);
+
+ if (scl->resdom == sortcl->resdom)
break;
}
- if ( i == NIL ) /* not in sortlist already */
+ if (i == NIL) /* not in sortlist already */
{
lnext(s) = lcons(sortcl, NIL);
s = lnext(s);
}
else
- pfree (sortcl); /* get rid of this */
+ pfree(sortcl); /* get rid of this */
}
orderlist = lnext(orderlist);
}
@@ -295,7 +296,7 @@ transformSortClause(ParseState *pstate,
if (uniqueFlag)
{
List *i;
-
+
if (uniqueFlag[0] == '*')
{
@@ -342,7 +343,7 @@ transformSortClause(ParseState *pstate,
}
if (i == NIL)
elog(ERROR, "The field specified in the UNIQUE ON clause is not in the targetlist");
-
+
foreach(s, sortlist)
{
SortClause *sortcl = lfirst(s);
@@ -375,15 +376,15 @@ transformSortClause(ParseState *pstate,
List *
transformUnionClause(List *unionClause, List *targetlist)
{
- List *union_list = NIL;
+ List *union_list = NIL;
QueryTreeList *qlist;
- int i;
+ int i;
if (unionClause)
{
qlist = parse_analyze(unionClause, NULL);
- for (i=0; i < qlist->len; i++)
+ for (i = 0; i < qlist->len; i++)
union_list = lappend(union_list, qlist->qtrees[i]);
/* we need to check return types are consistent here */
return union_list;
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 8f0a959682e..62a53976a5b 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.21 1998/02/13 08:10:33 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.22 1998/02/26 04:33:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,7 +57,7 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
/* what if att.attrs == "*"? */
temp = ParseNestedFuncOrColumn(pstate, att, &pstate->p_last_resno,
- precedence);
+ precedence);
if (att->indirection != NIL)
{
List *idx = att->indirection;
@@ -147,8 +147,8 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
result = ParseFuncOrColumn(pstate,
"nullvalue", lcons(lexpr, NIL),
- &pstate->p_last_resno,
- precedence);
+ &pstate->p_last_resno,
+ precedence);
}
break;
case NOTNULL:
@@ -157,8 +157,8 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
result = ParseFuncOrColumn(pstate,
"nonnullvalue", lcons(lexpr, NIL),
- &pstate->p_last_resno,
- precedence);
+ &pstate->p_last_resno,
+ precedence);
}
break;
case AND:
@@ -169,11 +169,11 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
if (exprType(lexpr) != BOOLOID)
elog(ERROR, "left-hand side of AND is type '%s', not bool",
- typeidTypeName(exprType(lexpr)));
+ typeidTypeName(exprType(lexpr)));
if (exprType(rexpr) != BOOLOID)
elog(ERROR, "right-hand side of AND is type '%s', not bool",
- typeidTypeName(exprType(rexpr)));
+ typeidTypeName(exprType(rexpr)));
expr->typeOid = BOOLOID;
expr->opType = AND_EXPR;
@@ -218,6 +218,7 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
}
case T_Ident:
{
+
/*
* look for a column name or a relation name (the default
* behavior)
@@ -234,58 +235,59 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
foreach(args, fn->args)
lfirst(args) = transformExpr(pstate, (Node *) lfirst(args), precedence);
result = ParseFuncOrColumn(pstate,
- fn->funcname, fn->args, &pstate->p_last_resno,
- precedence);
+ fn->funcname, fn->args, &pstate->p_last_resno,
+ precedence);
break;
}
case T_SubLink:
{
- SubLink *sublink = (SubLink *) expr;
- QueryTreeList *qtree;
- List *llist;
+ SubLink *sublink = (SubLink *) expr;
+ QueryTreeList *qtree;
+ List *llist;
pstate->p_hasSubLinks = true;
- qtree = parse_analyze(lcons(sublink->subselect,NIL), pstate);
- if (qtree->len != 1 ||
- qtree->qtrees[0]->commandType != CMD_SELECT ||
- qtree->qtrees[0]->resultRelation != 0 )
- elog (ERROR, "parser: bad query in subselect");
+ qtree = parse_analyze(lcons(sublink->subselect, NIL), pstate);
+ if (qtree->len != 1 ||
+ qtree->qtrees[0]->commandType != CMD_SELECT ||
+ qtree->qtrees[0]->resultRelation != 0)
+ elog(ERROR, "parser: bad query in subselect");
sublink->subselect = (Node *) qtree->qtrees[0];
-
+
if (sublink->subLinkType != EXISTS_SUBLINK)
{
- char *op = lfirst(sublink->oper);
- List *left_expr = sublink->lefthand;
- List *right_expr = ((Query*) sublink->subselect)->targetList;
- List *elist;
+ char *op = lfirst(sublink->oper);
+ List *left_expr = sublink->lefthand;
+ List *right_expr = ((Query *) sublink->subselect)->targetList;
+ List *elist;
foreach(llist, left_expr)
lfirst(llist) = transformExpr(pstate, lfirst(llist), precedence);
-
+
if (length(left_expr) !=
length(right_expr))
- elog(ERROR,"parser: Subselect has too many or too few fields.");
-
+ elog(ERROR, "parser: Subselect has too many or too few fields.");
+
sublink->oper = NIL;
foreach(elist, left_expr)
{
- Node *lexpr = lfirst(elist);
- Node *rexpr = lfirst(right_expr);
- TargetEntry *tent = (TargetEntry *)rexpr;
- Expr *op_expr;
+ Node *lexpr = lfirst(elist);
+ Node *rexpr = lfirst(right_expr);
+ TargetEntry *tent = (TargetEntry *) rexpr;
+ Expr *op_expr;
op_expr = make_op(op, lexpr, tent->expr);
+
/*
- * HACK! Second IF is more valid but currently
- * we don't support EXPR subqueries inside
+ * HACK! Second IF is more valid but currently we
+ * don't support EXPR subqueries inside
* expressions generally, only in WHERE clauses.
* After fixing this, first IF must be removed.
*/
if (op_expr->typeOid != BOOLOID)
- elog (ERROR, "parser: '%s' must return 'bool' to be used with subquery", op);
- if (op_expr->typeOid != BOOLOID &&
- sublink->subLinkType != EXPR_SUBLINK)
- elog (ERROR, "parser: '%s' must return 'bool' to be used with quantified predicate subquery", op);
+ elog(ERROR, "parser: '%s' must return 'bool' to be used with subquery", op);
+ if (op_expr->typeOid != BOOLOID &&
+ sublink->subLinkType != EXPR_SUBLINK)
+ elog(ERROR, "parser: '%s' must return 'bool' to be used with quantified predicate subquery", op);
sublink->oper = lappend(sublink->oper, op_expr);
right_expr = lnext(right_expr);
}
@@ -325,7 +327,7 @@ transformIdent(ParseState *pstate, Node *expr, int precedence)
att->attrs = lcons(makeString(ident->name), NIL);
column_result =
(Node *) ParseNestedFuncOrColumn(pstate, att, &pstate->p_last_resno,
- precedence);
+ precedence);
}
/* try to find the ident as a relation */
@@ -407,7 +409,7 @@ exprType(Node *expr)
return type;
}
-static Node *
+static Node *
parser_typecast(Value *expr, TypeName *typename, int16 atttypmod)
{
/* check for passing non-ints */
@@ -432,7 +434,7 @@ parser_typecast(Value *expr, TypeName *typename, int16 atttypmod)
break;
default:
elog(ERROR,
- "parser_typecast: cannot cast this expression to type '%s'",
+ "parser_typecast: cannot cast this expression to type '%s'",
typename->name);
}
@@ -485,7 +487,7 @@ parser_typecast(Value *expr, TypeName *typename, int16 atttypmod)
return (Node *) adt;
}
-Node *
+Node *
parser_typecast2(Node *expr, Oid exprType, Type tp, int16 atttypmod)
{
/* check for passing non-ints */
@@ -605,10 +607,11 @@ parser_typecast2(Node *expr, Oid exprType, Type tp, int16 atttypmod)
true /* is cast */ );
/*
- * printf("adt %s : %u %d %d\n",CString(expr),typeTypeId(tp) , len,cp);
+ * printf("adt %s : %u %d %d\n",CString(expr),typeTypeId(tp) ,
+ * len,cp);
*/
if (string_palloced)
pfree(const_string);
return ((Node *) adt);
-}
+}
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index e1a7e52d468..ba79cc42726 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.14 1998/02/10 16:03:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.15 1998/02/26 04:33:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,34 +43,39 @@
#include "utils/lsyscache.h"
#include "utils/syscache.h"
-static Node *ParseComplexProjection(ParseState *pstate,
- char *funcname,
- Node *first_arg,
- bool *attisset);
-static Oid ** argtype_inherit(int nargs, Oid *oid_array);
+static Node *
+ParseComplexProjection(ParseState *pstate,
+ char *funcname,
+ Node *first_arg,
+ bool *attisset);
+static Oid **argtype_inherit(int nargs, Oid *oid_array);
static bool can_coerce(int nargs, Oid *input_typeids, Oid *func_typeids);
-static int find_inheritors(Oid relid, Oid **supervec);
+static int find_inheritors(Oid relid, Oid **supervec);
static CandidateList func_get_candidates(char *funcname, int nargs);
-static bool func_get_detail(char *funcname,
- int nargs,
- Oid *oid_array,
- Oid *funcid, /* return value */
- Oid *rettype, /* return value */
- bool *retset, /* return value */
- Oid **true_typeids);
-static Oid * func_select_candidate(int nargs,
- Oid *input_typeids,
- CandidateList candidates);
-static Oid funcid_get_rettype(Oid funcid);
+static bool
+func_get_detail(char *funcname,
+ int nargs,
+ Oid *oid_array,
+ Oid *funcid, /* return value */
+ Oid *rettype, /* return value */
+ bool *retset, /* return value */
+ Oid **true_typeids);
+static Oid *
+func_select_candidate(int nargs,
+ Oid *input_typeids,
+ CandidateList candidates);
+static Oid funcid_get_rettype(Oid funcid);
static Oid **gen_cross_product(InhPaths *arginh, int nargs);
-static void make_arguments(int nargs,
- List *fargs,
- Oid *input_typeids,
- Oid *function_typeids);
-static int match_argtypes(int nargs,
- Oid *input_typeids,
- CandidateList function_typeids,
- CandidateList *candidates);
+static void
+make_arguments(int nargs,
+ List *fargs,
+ Oid *input_typeids,
+ Oid *function_typeids);
+static int
+match_argtypes(int nargs,
+ Oid *input_typeids,
+ CandidateList function_typeids,
+ CandidateList *candidates);
static List *setup_tlist(char *attname, Oid relid);
static List *setup_base_tlist(Oid typeid);
@@ -99,9 +104,9 @@ ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr, int *curr_resno, int pre
Param *param = (Param *) transformExpr(pstate, (Node *) attr->paramNo, EXPR_RELATION_FIRST);
retval = ParseFuncOrColumn(pstate, strVal(lfirst(attr->attrs)),
- lcons(param, NIL),
- curr_resno,
- precedence);
+ lcons(param, NIL),
+ curr_resno,
+ precedence);
}
else
{
@@ -110,18 +115,18 @@ ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr, int *curr_resno, int pre
ident->name = attr->relname;
ident->isRel = TRUE;
retval = ParseFuncOrColumn(pstate, strVal(lfirst(attr->attrs)),
- lcons(ident, NIL),
- curr_resno,
- precedence);
+ lcons(ident, NIL),
+ curr_resno,
+ precedence);
}
/* Do more attributes follow this one? */
foreach(mutator_iter, lnext(attr->attrs))
{
retval = ParseFuncOrColumn(pstate, strVal(lfirst(mutator_iter)),
- lcons(retval, NIL),
- curr_resno,
- precedence);
+ lcons(retval, NIL),
+ curr_resno,
+ precedence);
}
return (retval);
@@ -132,7 +137,7 @@ ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr, int *curr_resno, int pre
*/
Node *
ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
- int *curr_resno, int precedence)
+ int *curr_resno, int precedence)
{
Oid rettype = (Oid) 0;
Oid argrelid = (Oid) 0;
@@ -174,6 +179,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
{
RangeTblEntry *rte;
Ident *ident = (Ident *) first_arg;
+
/*
* first arg is a relation. This could be a projection.
*/
@@ -193,9 +199,9 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
if (get_attnum(relid, funcname) != InvalidAttrNumber)
{
return (Node *) make_var(pstate,
- relid,
- refname,
- funcname);
+ relid,
+ refname,
+ funcname);
}
else
{
@@ -262,8 +268,8 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
PointerGetDatum(funcname),
ObjectIdGetDatum(basetype),
0, 0))
- return (Node *)ParseAgg(pstate, funcname, basetype,
- fargs, precedence);
+ return (Node *) ParseAgg(pstate, funcname, basetype,
+ fargs, precedence);
}
}
@@ -285,6 +291,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
if (nodeTag(pair) == T_Ident && ((Ident *) pair)->isRel)
{
+
/*
* a relation
*/
@@ -415,15 +422,15 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
char *seqrel;
text *seqname;
int32 aclcheck_result = -1;
- extern text *lower (text *string);
+ extern text *lower(text *string);
Assert(length(fargs) == 1);
seq = (Const *) lfirst(fargs);
if (!IsA((Node *) seq, Const))
elog(ERROR, "%s: only constant sequence names are acceptable", funcname);
- seqname = lower ((text*)DatumGetPointer(seq->constvalue));
- pfree (DatumGetPointer(seq->constvalue));
- seq->constvalue = PointerGetDatum (seqname);
+ seqname = lower((text *) DatumGetPointer(seq->constvalue));
+ pfree(DatumGetPointer(seq->constvalue));
+ seq->constvalue = PointerGetDatum(seqname);
seqrel = textout(seqname);
if ((aclcheck_result = pg_aclcheck(seqrel, GetPgUserName(),
@@ -827,7 +834,8 @@ argtype_inherit(int nargs, Oid *oid_array)
return (gen_cross_product(arginh, nargs));
}
-static int find_inheritors(Oid relid, Oid **supervec)
+static int
+find_inheritors(Oid relid, Oid **supervec)
{
Oid *relidvec;
Relation inhrel;
@@ -1065,7 +1073,7 @@ setup_tlist(char *attname, Oid relid)
typeid = get_atttype(relid, attno);
type_mod = get_atttypmod(relid, attno);
-
+
resnode = makeResdom(1,
typeid,
type_mod,
@@ -1301,9 +1309,12 @@ func_error(char *caller, char *funcname, int nargs, Oid *argtypes)
ptr += strlen(ptr);
}
- if(caller == NULL) {
- elog(ERROR, "function %s(%s) does not exist", funcname, p);
- } else {
- elog(ERROR, "%s: function %s(%s) does not exist", caller, funcname, p);
- }
+ if (caller == NULL)
+ {
+ elog(ERROR, "function %s(%s) does not exist", funcname, p);
+ }
+ else
+ {
+ elog(ERROR, "%s: function %s(%s) does not exist", caller, funcname, p);
+ }
}
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c
index 708bb54103c..3a36fcd576c 100644
--- a/src/backend/parser/parse_node.c
+++ b/src/backend/parser/parse_node.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.13 1998/02/13 19:45:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.14 1998/02/26 04:33:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,7 +30,8 @@
#include "utils/lsyscache.h"
static void disallow_setop(char *op, Type optype, Node *operand);
-static Node *make_operand(char *opname,
+static Node *
+make_operand(char *opname,
Node *tree,
Oid orig_typeId,
Oid true_typeId);
@@ -52,7 +53,7 @@ make_parsestate(ParseState *parentParseState)
pstate->p_last_resno = 1;
pstate->parentParseState = parentParseState;
-
+
return (pstate);
}
@@ -125,7 +126,7 @@ disallow_setop(char *op, Type optype, Node *operand)
}
}
-Expr *
+Expr *
make_op(char *opname, Node *ltree, Node *rtree)
{
Oid ltypeId,
@@ -238,9 +239,9 @@ make_op(char *opname, Node *ltree, Node *rtree)
return result;
}
-Var *
+Var *
make_var(ParseState *pstate, Oid relid, char *refname,
- char *attrname)
+ char *attrname)
{
Var *varnode;
int vnum,
@@ -321,6 +322,7 @@ make_array_ref(Node *expr,
A_Indices *ind = lfirst(indirection);
if (ind->lidx)
+
/*
* XXX assumes all lower indices non null in this case
*/
@@ -426,7 +428,7 @@ make_array_set(Expr *target_expr,
*
* eventually, produces a "const" lisp-struct as per nodedefs.cl
*/
-Const *
+Const *
make_const(Value *value)
{
Type tp;
@@ -454,8 +456,8 @@ make_const(Value *value)
break;
case T_String:
- tp = typeidType(UNKNOWNOID); /* unknown for now, will be type
- * coerced */
+ tp = typeidType(UNKNOWNOID); /* unknown for now, will
+ * be type coerced */
val = PointerGetDatum(textin(strVal(value)));
break;
@@ -481,4 +483,3 @@ make_const(Value *value)
return (con);
}
-
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c
index ded519a72b8..b24094924aa 100644
--- a/src/backend/parser/parse_oper.c
+++ b/src/backend/parser/parse_oper.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.8 1998/01/20 05:04:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.9 1998/02/26 04:33:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,21 +26,24 @@
#include "storage/bufmgr.h"
#include "utils/syscache.h"
-static int binary_oper_get_candidates(char *opname,
+static int
+binary_oper_get_candidates(char *opname,
Oid leftTypeId,
Oid rightTypeId,
CandidateList *candidates);
-static CandidateList binary_oper_select_candidate(Oid arg1,
+static CandidateList
+binary_oper_select_candidate(Oid arg1,
Oid arg2,
CandidateList candidates);
static bool equivalentOpersAfterPromotion(CandidateList candidates);
static void op_error(char *op, Oid arg1, Oid arg2);
-static int unary_oper_get_candidates(char *op,
+static int
+unary_oper_get_candidates(char *op,
Oid typeId,
CandidateList *candidates,
char rightleft);
-
+
Oid
any_ordering_op(int restype)
{
@@ -577,7 +580,7 @@ op_error(char *op, Oid arg1, Oid arg2)
op, typeTypeName(tp1), typeTypeName(tp2));
#endif
elog(ERROR, "There is no operator '%s' for types '%s' and '%s'"
- "\n\tYou will either have to retype this query using an explicit cast,"
- "\n\tor you will have to define the operator using CREATE OPERATOR",
- op, typeTypeName(tp1), typeTypeName(tp2));
+ "\n\tYou will either have to retype this query using an explicit cast,"
+ "\n\tor you will have to define the operator using CREATE OPERATOR",
+ op, typeTypeName(tp1), typeTypeName(tp2));
}
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index e5a774dc894..6bd26066b23 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.10 1998/02/10 04:01:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.11 1998/02/26 04:33:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,8 @@
#include "utils/builtins.h"
#include "utils/lsyscache.h"
-static void checkTargetTypes(ParseState *pstate, char *target_colname,
+static void
+checkTargetTypes(ParseState *pstate, char *target_colname,
char *refname, char *colname);
struct
@@ -76,14 +77,15 @@ refnameRangeTableEntry(ParseState *pstate, char *refname)
foreach(temp, pstate->p_rtable)
{
RangeTblEntry *rte = lfirst(temp);
-
+
if (!strcmp(rte->refname, refname))
return rte;
}
/* only allow correlated columns in WHERE clause */
if (pstate->p_in_where_clause)
pstate = pstate->parentParseState;
- else break;
+ else
+ break;
}
return NULL;
}
@@ -95,7 +97,7 @@ refnameRangeTablePosn(ParseState *pstate, char *refname, int *sublevels_up)
int index;
List *temp;
-
+
if (sublevels_up)
*sublevels_up = 0;
@@ -105,7 +107,7 @@ refnameRangeTablePosn(ParseState *pstate, char *refname, int *sublevels_up)
foreach(temp, pstate->p_rtable)
{
RangeTblEntry *rte = lfirst(temp);
-
+
if (!strcmp(rte->refname, refname))
return index;
index++;
@@ -117,7 +119,8 @@ refnameRangeTablePosn(ParseState *pstate, char *refname, int *sublevels_up)
if (sublevels_up)
(*sublevels_up)++;
}
- else break;
+ else
+ break;
}
return 0;
}
@@ -143,11 +146,11 @@ colnameRangeTableEntry(ParseState *pstate, char *colname)
foreach(et, rtable)
{
RangeTblEntry *rte = lfirst(et);
-
+
/* only entries on outer(non-function?) scope */
if (!rte->inFromCl && rte != pstate->p_target_rangetblentry)
continue;
-
+
if (get_attnum(rte->relid, colname) != InvalidAttrNumber)
{
if (rte_result != NULL)
@@ -163,7 +166,8 @@ colnameRangeTableEntry(ParseState *pstate, char *colname)
/* only allow correlated columns in WHERE clause */
if (pstate->p_in_where_clause && rte_result == NULL)
pstate = pstate->parentParseState;
- else break;
+ else
+ break;
}
return rte_result;
}
@@ -181,31 +185,30 @@ addRangeTableEntry(ParseState *pstate,
{
Relation relation;
RangeTblEntry *rte = makeNode(RangeTblEntry);
- int sublevels_up;
+ int sublevels_up;
if (pstate != NULL)
{
if (refnameRangeTablePosn(pstate, refname, &sublevels_up) != 0 &&
- (!inFromCl || sublevels_up == 0))
+ (!inFromCl || sublevels_up == 0))
elog(ERROR, "Table name %s specified more than once", refname);
}
-
+
rte->relname = pstrdup(relname);
rte->refname = pstrdup(refname);
relation = heap_openr(relname);
if (relation == NULL)
elog(ERROR, "%s: %s",
- relname, aclcheck_error_strings[ACLCHECK_NO_CLASS]);
+ relname, aclcheck_error_strings[ACLCHECK_NO_CLASS]);
rte->relid = RelationGetRelationId(relation);
heap_close(relation);
/*
- * Flags - zero or more from inheritance,union,version or
- * recursive (transitive closure) [we don't support them all -- ay
- * 9/94 ]
+ * Flags - zero or more from inheritance,union,version or recursive
+ * (transitive closure) [we don't support them all -- ay 9/94 ]
*/
rte->inh = inh;
@@ -225,7 +228,7 @@ addRangeTableEntry(ParseState *pstate,
* expandAll -
* makes a list of attributes
*/
-List *
+List *
expandAll(ParseState *pstate, char *relname, char *refname, int *this_resno)
{
Relation rdesc;
@@ -308,7 +311,7 @@ attnameAttNum(Relation rd, char *a)
/* on failure */
elog(ERROR, "Relation %s does not have attribute %s",
RelationGetRelationName(rd), a);
- return 0; /* lint */
+ return 0; /* lint */
}
/*
diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index 7dbeb91ce63..b9ab916d882 100644
--- a/src/backend/parser/parse_target.c
+++ b/src/backend/parser/parse_target.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.10 1998/02/13 19:45:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.11 1998/02/26 04:33:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,7 +29,8 @@
static List *expandAllTables(ParseState *pstate);
static char *figureColname(Node *expr, Node *resval);
-static TargetEntry *make_targetlist_expr(ParseState *pstate,
+static TargetEntry *
+make_targetlist_expr(ParseState *pstate,
char *colname,
Node *expr,
List *arrayRef);
@@ -63,13 +64,14 @@ transformTargetList(ParseState *pstate, List *targetlist)
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)
+ * 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);
if (nodeTag(expr) == T_Var)
- type_mod = ((Var *)expr)->vartypmod;
+ type_mod = ((Var *) expr)->vartypmod;
else
type_mod = -1;
resname = (res->name) ? res->name : identname;
@@ -257,9 +259,10 @@ transformTargetList(ParseState *pstate, List *targetlist)
/*
- * Target item is fully specified: ie. relation.attribute
+ * Target item is fully specified: ie.
+ * relation.attribute
*/
- result = ParseNestedFuncOrColumn(pstate, att, &pstate->p_last_resno,EXPR_COLUMN_FIRST);
+ result = ParseNestedFuncOrColumn(pstate, att, &pstate->p_last_resno, EXPR_COLUMN_FIRST);
handleTargetColname(pstate, &res->name, att->relname, attrname);
if (att->indirection != NIL)
{
@@ -277,7 +280,7 @@ transformTargetList(ParseState *pstate, List *targetlist)
}
type_id = exprType(result);
if (nodeTag(result) == T_Var)
- type_mod = ((Var *)result)->vartypmod;
+ type_mod = ((Var *) result)->vartypmod;
else
type_mod = -1;
/* move to last entry */
@@ -345,7 +348,7 @@ make_targetlist_expr(ParseState *pstate,
type_id = exprType(expr);
if (nodeTag(expr) == T_Var)
- type_mod = ((Var *)expr)->vartypmod;
+ type_mod = ((Var *) expr)->vartypmod;
else
type_mod = -1;
@@ -395,7 +398,7 @@ make_targetlist_expr(ParseState *pstate,
makeConst(attrtype,
attrlen,
(Datum) fmgr(typeidInfunc(attrtype),
- val, typeidTypElem(attrtype), -1),
+ val, typeidTypElem(attrtype), -1),
false,
true /* Maybe correct-- 80% chance */ ,
false, /* is not a set */
@@ -464,8 +467,8 @@ make_targetlist_expr(ParseState *pstate,
att->relname = pstrdup(RelationGetRelationName(rd)->data);
att->attrs = lcons(makeString(colname), NIL);
target_expr = (Expr *) ParseNestedFuncOrColumn(pstate, att,
- &pstate->p_last_resno,
- EXPR_COLUMN_FIRST);
+ &pstate->p_last_resno,
+ EXPR_COLUMN_FIRST);
while (ar != NIL)
{
A_Indices *ind = lfirst(ar);
@@ -556,15 +559,15 @@ makeTargetNames(ParseState *pstate, List *cols)
{
List *nxt;
char *name = ((Ident *) lfirst(tl))->name;
-
+
/* elog on failure */
attnameAttNum(pstate->p_target_relation, name);
foreach(nxt, lnext(tl))
if (!strcmp(name, ((Ident *) lfirst(nxt))->name))
- elog(ERROR, "Attribute '%s' should be specified only once", name);
+ elog(ERROR, "Attribute '%s' should be specified only once", name);
}
}
-
+
return cols;
}
@@ -643,8 +646,8 @@ figureColname(Node *expr, Node *resval)
{
switch (nodeTag(expr))
{
- case T_Aggreg:
- return (char *) ((Aggreg *) expr)->aggname;
+ case T_Aggreg:
+ return (char *) ((Aggreg *) expr)->aggname;
case T_Expr:
if (((Expr *) expr)->opType == FUNC_EXPR)
{
diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c
index 6ca081b4e59..97c080ca242 100644
--- a/src/backend/parser/parse_type.c
+++ b/src/backend/parser/parse_type.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.6 1998/02/13 19:45:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.7 1998/02/26 04:33:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@ typeidIsValid(Oid id)
}
/* return a type name, given a typeid */
-char *
+char *
typeidTypeName(Oid id)
{
HeapTuple tup;
@@ -114,7 +114,7 @@ typeByVal(Type t)
}
/* given type (as type struct), return the name of type */
-char *
+char *
typeTypeName(Type t)
{
TypeTupleForm typ;
@@ -142,7 +142,8 @@ stringTypeString(Type tp, char *string, int16 atttypmod)
Oid typelem;
op = ((TypeTupleForm) GETSTRUCT(tp))->typinput;
- typelem = ((TypeTupleForm) GETSTRUCT(tp))->typelem; /* XXX - used for array_in */
+ typelem = ((TypeTupleForm) GETSTRUCT(tp))->typelem; /* XXX - used for
+ * array_in */
return ((char *) fmgr(op, string, typelem, atttypmod));
}
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c
index 0a7a8d58005..765a59c61ad 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.32 1998/01/19 05:06:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.33 1998/02/26 04:33:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,7 +58,7 @@ parser(char *str, Oid *typev, int nargs)
clearerr(stdin);
- if (yyresult) /* error */
+ if (yyresult) /* error */
return ((QueryTreeList *) NULL);
queryList = parse_analyze(parsetree, NULL);
@@ -175,5 +175,5 @@ define_sets(Node *clause)
define_sets(get_rightop(clause));
}
}
-#endif
+#endif
diff --git a/src/backend/parser/scansup.c b/src/backend/parser/scansup.c
index 84ef988ddb5..d82ffaa15c0 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.9 1997/11/26 01:11:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/scansup.c,v 1.10 1998/02/26 04:33:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,7 +38,7 @@
* ----------------
*/
-char *
+char *
scanstr(char *s)
{
static char newStr[MAX_PARSE_BUFFER];
diff --git a/src/backend/port/dynloader/aix.c b/src/backend/port/dynloader/aix.c
index d8ecbe12893..4e1f62cedf8 100644
--- a/src/backend/port/dynloader/aix.c
+++ b/src/backend/port/dynloader/aix.c
@@ -72,10 +72,10 @@ static int readExports(ModulePtr);
static void terminate(void);
static void *findMain(void);
-void *
+void *
dlopen(const char *path, int mode)
{
- ModulePtr mp;
+ ModulePtr mp;
static void *mainModule;
/*
@@ -168,7 +168,7 @@ dlopen(const char *path, int mode)
*/
if (mode & RTLD_GLOBAL)
{
- ModulePtr mp1;
+ ModulePtr mp1;
for (mp1 = mp->next; mp1; mp1 = mp1->next)
if (loadbind(0, mp1->entry, mp->entry) == -1)
@@ -221,7 +221,7 @@ dlopen(const char *path, int mode)
static void
caterr(char *s)
{
- char *p = s;
+ char *p = s;
while (*p >= '0' && *p <= '9')
p++;
@@ -255,12 +255,12 @@ caterr(char *s)
}
}
-void *
+void *
dlsym(void *handle, const char *symbol)
{
- ModulePtr mp = (ModulePtr) handle;
- ExportPtr ep;
- int i;
+ ModulePtr mp = (ModulePtr) handle;
+ ExportPtr ep;
+ 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)
@@ -289,9 +289,9 @@ dlerror(void)
int
dlclose(void *handle)
{
- ModulePtr mp = (ModulePtr) handle;
+ ModulePtr mp = (ModulePtr) handle;
int result;
- ModulePtr mp1;
+ ModulePtr mp1;
if (--mp->refCnt > 0)
return 0;
@@ -311,8 +311,8 @@ dlclose(void *handle)
}
if (mp->exports)
{
- ExportPtr ep;
- int i;
+ ExportPtr ep;
+ int i;
for (ep = mp->exports, i = mp->nExports; i; i--, ep++)
if (ep->name)
@@ -537,7 +537,7 @@ readExports(ModulePtr mp)
* first SYMNMLEN chars and make sure we have a zero byte at
* the end.
*/
- StrNCpy(tmpsym, ls->l_name, SYMNMLEN+1);
+ StrNCpy(tmpsym, ls->l_name, SYMNMLEN + 1);
symname = tmpsym;
}
ep->name = strdup(symname);
diff --git a/src/backend/port/dynloader/bsd.c b/src/backend/port/dynloader/bsd.c
index 8c9f680a812..957dc297677 100644
--- a/src/backend/port/dynloader/bsd.c
+++ b/src/backend/port/dynloader/bsd.c
@@ -48,7 +48,7 @@ static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91";
static char error_message[BUFSIZ];
-char *
+char *
BSD44_derived_dlerror(void)
{
static char ret[BUFSIZ];
@@ -58,7 +58,7 @@ BSD44_derived_dlerror(void)
return ((ret[0] == 0) ? (char *) NULL : ret);
}
-void *
+void *
BSD44_derived_dlopen(const char *file, int num)
{
#if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
@@ -75,7 +75,7 @@ BSD44_derived_dlopen(const char *file, int num)
#endif
}
-void *
+void *
BSD44_derived_dlsym(void *handle, const char *name)
{
#if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
diff --git a/src/backend/port/dynloader/bsdi.c b/src/backend/port/dynloader/bsdi.c
index fb275c8cbb5..f23267e5862 100644
--- a/src/backend/port/dynloader/bsdi.c
+++ b/src/backend/port/dynloader/bsdi.c
@@ -24,7 +24,7 @@
extern char pg_pathname[];
-void *
+void *
pg_dlopen(char *filename)
{
static int dl_initialized = 0;
@@ -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/dynloader/dgux.c b/src/backend/port/dynloader/dgux.c
index 37e836c2e63..a6462725423 100644
--- a/src/backend/port/dynloader/dgux.c
+++ b/src/backend/port/dynloader/dgux.c
@@ -2,6 +2,5 @@
*
* see dgux.h
*
- * $Id: dgux.c,v 1.2 1998/02/14 19:56:19 scrappy Exp $
+ * $Id: dgux.c,v 1.3 1998/02/26 04:34:24 momjian Exp $
*/
-
diff --git a/src/backend/port/dynloader/dgux.h b/src/backend/port/dynloader/dgux.h
index c7b5a53d48c..8942cb0981c 100644
--- a/src/backend/port/dynloader/dgux.h
+++ b/src/backend/port/dynloader/dgux.h
@@ -1,10 +1,10 @@
/*-------------------------------------------------------------------------
*
* dgux.h--
- *
+ *
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: dgux.h,v 1.2 1998/02/14 19:56:21 scrappy Exp $
+ * $Id: dgux.h,v 1.3 1998/02/26 04:34:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
diff --git a/src/backend/port/dynloader/hpux.c b/src/backend/port/dynloader/hpux.c
index 5649274da32..0f1517ac966 100644
--- a/src/backend/port/dynloader/hpux.c
+++ b/src/backend/port/dynloader/hpux.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.2 1998/02/02 00:10:10 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.3 1998/02/26 04:34:26 momjian Exp $
*
* NOTES
* all functions are defined here -- it's impossible to trace the
@@ -24,7 +24,7 @@
#include "utils/dynamic_loader.h"
#include "dynloader.h"
-void *
+void *
pg_dlopen(char *filename)
{
shl_t handle = shl_load(filename, BIND_DEFERRED, 0);
@@ -50,7 +50,7 @@ pg_dlclose(void *handle)
shl_unload((shl_t) handle);
}
-char *
+char *
pg_dlerror()
{
static char errmsg[] = "shl_load failed";
diff --git a/src/backend/port/dynloader/linux.c b/src/backend/port/dynloader/linux.c
index 065a6ca5db5..41507207d07 100644
--- a/src/backend/port/dynloader/linux.c
+++ b/src/backend/port/dynloader/linux.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.6 1998/01/07 21:04:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.7 1998/02/26 04:34:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,7 +28,7 @@
#if FALSE
extern char pg_pathname[];
-void *
+void *
pg_dlopen(char *filename)
{
#ifndef HAVE_DLD_H
@@ -106,7 +106,7 @@ pg_dlopen(char *filename)
#endif
}
-char *
+char *
pg_dlerror()
{
#ifndef HAVE_DLD_H
@@ -115,4 +115,5 @@ pg_dlerror()
return dld_strerror(dld_errno);
#endif
}
+
#endif
diff --git a/src/backend/port/dynloader/linux.h b/src/backend/port/dynloader/linux.h
index 148a0ce1daf..72e48925c63 100644
--- a/src/backend/port/dynloader/linux.h
+++ b/src/backend/port/dynloader/linux.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: linux.h,v 1.2 1998/01/01 06:02:04 thomas Exp $
+ * $Id: linux.h,v 1.3 1998/02/26 04:34:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,4 +39,4 @@
/* port.c */
-#endif /* PORT_PROTOS_H */
+#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/dynloader/univel.c b/src/backend/port/dynloader/univel.c
index c603e81f9e4..d0cd246636e 100644
--- a/src/backend/port/dynloader/univel.c
+++ b/src/backend/port/dynloader/univel.c
@@ -1,4 +1,4 @@
-/* Dummy file used for nothing at this point
- *
- * see univel.h
- */
+/* Dummy file used for nothing at this point
+ *
+ * see univel.h
+ */
diff --git a/src/backend/port/dynloader/univel.h b/src/backend/port/dynloader/univel.h
index 56b9961930d..38e43833da0 100644
--- a/src/backend/port/dynloader/univel.h
+++ b/src/backend/port/dynloader/univel.h
@@ -1,15 +1,15 @@
-/*-------------------------------------------------------------------------
- *
- * port-protos.h--
- * port-specific prototypes for Intel x86/UNIXWARE
- *
- *
- * Copyright (c) 1994, Regents of the University of California
- *
- * port-protos.h,v 1.2 1995/03/17 06:40:18 andrew Exp
- *
- *-------------------------------------------------------------------------
- */
+/*-------------------------------------------------------------------------
+ *
+ * port-protos.h--
+ * port-specific prototypes for Intel x86/UNIXWARE
+ *
+ *
+ * Copyright (c) 1994, Regents of the University of California
+ *
+ * port-protos.h,v 1.2 1995/03/17 06:40:18 andrew Exp
+ *
+ *-------------------------------------------------------------------------
+ */
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
@@ -17,18 +17,18 @@
#include "fmgr.h" /* for func_ptr */
#include "utils/dynamic_loader.h"
-/* dynloader.c */
-/*
- * Dynamic Loader on Intel x86/Intel SVR4.
- *
- * this dynamic loader uses the system dynamic loading interface for shared
- * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
- * library as the file to be dynamically loaded.
- *
- */
+ /* dynloader.c */
+/*
+ * Dynamic Loader on Intel x86/Intel SVR4.
+ *
+ * this dynamic loader uses the system dynamic loading interface for shared
+ * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
+ * library as the file to be dynamically loaded.
+ *
+ */
#define pg_dlopen(f) dlopen(f,RTLD_LAZY)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
-#endif /* PORT_PROTOS_H */
+#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/getrusage.c b/src/backend/port/getrusage.c
index 169e9063ff6..fb2a1fe7a3d 100644
--- a/src/backend/port/getrusage.c
+++ b/src/backend/port/getrusage.c
@@ -1,20 +1,21 @@
-/* $Id: getrusage.c,v 1.6 1998/02/24 03:45:06 scrappy Exp $ */
+/* $Id: getrusage.c,v 1.7 1998/02/26 04:34:00 momjian Exp $ */
-#include <math.h> /* for pow() prototype */
+#include <math.h> /* for pow() prototype */
#include <errno.h>
#include "rusagestub.h"
-#if 0 /* this is from univel port ... how does compiler define? */
- /* same for i386_solaris port ... how does compiler define? */
- /* same for sco port ... how does compiler define? */
- /* same for sparc_solaris port ... how does compiler define? */
- /* same for svr4 port ... how does compiler define? */
+#if 0 /* this is from univel port ... how does
+ * compiler define? */
+ /* same for i386_solaris port ... how does compiler define? */
+ /* same for sco port ... how does compiler define? */
+ /* same for sparc_solaris port ... how does compiler define? */
+ /* same for svr4 port ... how does compiler define? */
int
getrusage(int who, struct rusage * rusage)
{
struct tms tms;
- int tick_rate = CLK_TCK; /* ticks per second */
+ int tick_rate = CLK_TCK; /* ticks per second */
clock_t u,
s;
@@ -50,11 +51,14 @@ getrusage(int who, struct rusage * rusage)
rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate);
return (0);
}
+
#endif
-#if 0 /* this is for hpux port ... how does compiler define? */
+#if 0 /* this is for hpux port ... how does
+ * compiler define? */
getrusage(int who, struct rusage * ru)
{
- return (syscall(SYS_GETRUSAGE, who, ru));
+ return (syscall(SYS_GETRUSAGE, who, ru));
}
+
#endif
diff --git a/src/backend/port/inet_aton.c b/src/backend/port/inet_aton.c
index 239970f0afc..0cf6e15dae5 100644
--- a/src/backend/port/inet_aton.c
+++ b/src/backend/port/inet_aton.c
@@ -1,4 +1,4 @@
-/* $Id: inet_aton.c,v 1.13 1998/02/11 19:11:05 momjian Exp $
+/* $Id: inet_aton.c,v 1.14 1998/02/26 04:34:04 momjian Exp $
*
* This inet_aton() function was taken from the GNU C library and
* incorporated into Postgres for those systems which do not have this
@@ -57,11 +57,11 @@ int
inet_aton(const char *cp, struct in_addr * addr)
{
unsigned int val;
- int base,
+ int base,
n;
- char c;
+ char c;
u_int parts[4];
- u_int *pp = parts;
+ u_int *pp = parts;
for (;;)
{
diff --git a/src/backend/port/inet_aton.h b/src/backend/port/inet_aton.h
index f91f93e2c65..9908cc74015 100644
--- a/src/backend/port/inet_aton.h
+++ b/src/backend/port/inet_aton.h
@@ -1,3 +1,3 @@
-/* $Id: inet_aton.h,v 1.6 1997/12/19 13:34:29 scrappy Exp $ */
+/* $Id: inet_aton.h,v 1.7 1998/02/26 04:34:08 momjian Exp $ */
-int inet_aton(const char *cp, struct in_addr * addr);
+int inet_aton(const char *cp, struct in_addr * addr);
diff --git a/src/backend/port/isinf.c b/src/backend/port/isinf.c
index d29363b4675..d96e328d128 100644
--- a/src/backend/port/isinf.c
+++ b/src/backend/port/isinf.c
@@ -1,16 +1,16 @@
-/* $Id: isinf.c,v 1.3 1998/02/17 02:00:12 scrappy Exp $ */
+/* $Id: isinf.c,v 1.4 1998/02/26 04:34:10 momjian Exp $ */
-#include <math.h>
+#include <math.h>
#include "config.h"
#if HAVE_FPCLASS
-# if HAVE_IEEEFP_H
-# include <ieeefp.h>
-# endif
+#if HAVE_IEEEFP_H
+#include <ieeefp.h>
+#endif
int
isinf(double d)
{
- fpclass_t type = fpclass(d);
+ fpclass_t type = fpclass(d);
switch (type)
{
@@ -24,36 +24,40 @@ isinf(double d)
}
return (0);
}
+
+#else
+
+#if defined(HAVE_FP_CLASS) || defined(HAVE_FP_CLASS_D)
+#if HAVE_FP_CLASS_H
+#include <fp_class.h>
+#endif
+int
+isinf(x)
+double x;
+{
+#if HAVE_FP_CLASS
+ int fpclass = fp_class(x);
+
#else
+ int fpclass = fp_class_d(x);
+
+#endif
-# if defined(HAVE_FP_CLASS) || defined(HAVE_FP_CLASS_D)
-# if HAVE_FP_CLASS_H
-# include <fp_class.h>
-# endif
-int
-isinf(x)
-double x;
-{
-# if HAVE_FP_CLASS
- int fpclass = fp_class(x);
-# else
- int fpclass = fp_class_d(x);
-# endif
-
- if (fpclass == FP_POS_INF)
- return (1);
+ if (fpclass == FP_POS_INF)
+ return (1);
if (fpclass == FP_NEG_INF)
return (-1);
return (0);
}
-# endif
+
+#endif
#endif
#if defined(HAVE_CLASS)
int
isinf(double x)
{
- int fpclass = class(x);
+ int fpclass = class(x);
if (fpclass == FP_PLUS_INF)
return (1);
@@ -61,4 +65,5 @@ isinf(double x)
return (-1);
return (0);
}
+
#endif
diff --git a/src/backend/port/nextstep/dynloader.c b/src/backend/port/nextstep/dynloader.c
index 649454d48af..66cbba9e8ca 100644
--- a/src/backend/port/nextstep/dynloader.c
+++ b/src/backend/port/nextstep/dynloader.c
@@ -31,7 +31,7 @@ TransferError(NXStream * s)
strcpy(lastError, buffer);
}
-void *
+void *
next_dlopen(char *name)
{
int rld_success;
@@ -60,7 +60,7 @@ next_dlclose(void *handle)
return 0;
}
-void *
+void *
next_dlsym(void *handle, char *symbol)
{
NXStream *errorStream = OpenError();
@@ -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.c b/src/backend/port/nextstep/port.c
index 6bdb549cdb0..0b3db95ed06 100644
--- a/src/backend/port/nextstep/port.c
+++ b/src/backend/port/nextstep/port.c
@@ -50,7 +50,7 @@ sigemptyset(int *set)
return (*set = 0);
}
-char *
+char *
getcwd(char *buf, size_t size)
{
return getwd(buf);
diff --git a/src/backend/port/random.c b/src/backend/port/random.c
index a409803a04b..30be3a86073 100644
--- a/src/backend/port/random.c
+++ b/src/backend/port/random.c
@@ -1,6 +1,6 @@
-/* $Id: random.c,v 1.3 1998/02/24 03:45:07 scrappy Exp $ */
+/* $Id: random.c,v 1.4 1998/02/26 04:34:11 momjian Exp $ */
-#include <math.h> /* for pow() prototype */
+#include <math.h> /* for pow() prototype */
#include <errno.h>
#include "rusagestub.h"
@@ -10,4 +10,3 @@ random()
{
return (lrand48());
}
-
diff --git a/src/backend/port/srandom.c b/src/backend/port/srandom.c
index 1bc81bb2cb7..7a443acb9e3 100644
--- a/src/backend/port/srandom.c
+++ b/src/backend/port/srandom.c
@@ -1,6 +1,6 @@
-/* $Id: srandom.c,v 1.4 1998/02/24 03:45:07 scrappy Exp $ */
+/* $Id: srandom.c,v 1.5 1998/02/26 04:34:14 momjian Exp $ */
-#include <math.h> /* for pow() prototype */
+#include <math.h> /* for pow() prototype */
#include <errno.h>
#include "rusagestub.h"
@@ -10,4 +10,3 @@ srandom(unsigned int seed)
{
srand48((long int) seed);
}
-
diff --git a/src/backend/port/strtol.c b/src/backend/port/strtol.c
index 0db8dda3a74..ab2d1108106 100644
--- a/src/backend/port/strtol.c
+++ b/src/backend/port/strtol.c
@@ -53,13 +53,13 @@ long
strtol(nptr, endptr, base)
const char *nptr;
char **endptr;
-int base;
+int base;
{
const char *s = nptr;
unsigned long acc;
- int c;
+ int c;
unsigned long cutoff;
- int neg = 0,
+ int neg = 0,
any,
cutlim;
diff --git a/src/backend/port/strtoul.c b/src/backend/port/strtoul.c
index 304150a546a..550cea71331 100644
--- a/src/backend/port/strtoul.c
+++ b/src/backend/port/strtoul.c
@@ -6,22 +6,22 @@
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
+ * must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -33,7 +33,8 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
+
+#endif /* LIBC_SCCS and not lint */
#include <limits.h>
#include <ctype.h>
@@ -48,38 +49,45 @@ static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
*/
unsigned long
strtoul(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 unsigned char c;
register unsigned long cutoff;
- register int neg = 0, any, cutlim;
+ register int neg = 0,
+ any,
+ cutlim;
/*
* See strtol for comments as to the logic used.
*/
- do {
+ do
+ {
c = *s++;
} while (isspace(c));
- if (c == '-') {
+ if (c == '-')
+ {
neg = 1;
c = *s++;
- } else if (c == '+')
+ }
+ else if (c == '+')
c = *s++;
if ((base == 0 || base == 16) &&
- c == '0' && (*s == 'x' || *s == 'X')) {
+ c == '0' && (*s == 'x' || *s == 'X'))
+ {
c = s[1];
s += 2;
base = 16;
}
if (base == 0)
base = c == '0' ? 8 : 10;
- cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
- cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
- for (acc = 0, any = 0;; c = *s++) {
+ cutoff = (unsigned long) ULONG_MAX / (unsigned long) base;
+ cutlim = (unsigned long) ULONG_MAX % (unsigned long) base;
+ for (acc = 0, any = 0;; c = *s++)
+ {
if (!isascii(c))
break;
if (isdigit(c))
@@ -92,18 +100,21 @@ strtoul(nptr, endptr, base)
break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
any = -1;
- else {
+ else
+ {
any = 1;
acc *= base;
acc += c;
}
}
- if (any < 0) {
+ if (any < 0)
+ {
acc = ULONG_MAX;
errno = ERANGE;
- } else if (neg)
+ }
+ else if (neg)
acc = -acc;
if (endptr != 0)
- *endptr = (char *)(any ? s - 1 : nptr);
+ *endptr = (char *) (any ? s - 1 : nptr);
return (acc);
}
diff --git a/src/backend/port/ultrix4/dynloader.c b/src/backend/port/ultrix4/dynloader.c
index 761289233e1..55271c5e0e6 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.5 1997/09/08 02:27:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/dynloader.c,v 1.6 1998/02/26 04:34:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@
extern char pg_pathname[];
-void *
+void *
pg_dlopen(char *filename)
{
static int dl_initialized = 0;
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 255fe2df352..7ed1808f65a 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.74 1998/02/24 15:19:00 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.75 1998/02/26 04:34:43 momjian Exp $
*
* NOTES
*
@@ -88,7 +88,7 @@
#include "storage/proc.h"
#include "utils/elog.h"
#ifndef HAVE_GETHOSTNAME
-# include "port-protos.h" /* For gethostname() */
+#include "port-protos.h" /* For gethostname() */
#endif
#include "storage/fd.h"
@@ -102,8 +102,8 @@
#endif
#endif
-#define INVALID_SOCK (-1)
-#define ARGV_SIZE 64
+#define INVALID_SOCK (-1)
+#define ARGV_SIZE 64
/*
* Max time in seconds for socket to linger (close() to block) waiting
@@ -129,30 +129,35 @@ static Dllist *PortList;
static short PostPortName = -1;
static short ActiveBackends = FALSE;
- /* This is a boolean indicating that there is at least one backend
- that is accessing the current shared memory and semaphores.
- Between the time that we start up, or throw away shared memory
- segments and start over, and the time we generate the next
- backend (because we received a connection request), it is false.
- Other times, it is true.
- */
+
+ /*
+ * This is a boolean indicating that there is at least one backend that
+ * is accessing the current shared memory and semaphores. Between the
+ * time that we start up, or throw away shared memory segments and start
+ * over, and the time we generate the next backend (because we received a
+ * connection request), it is false. Other times, it is true.
+ */
static short shmem_seq = 0;
- /* This is a sequence number that indicates how many times we've had
- to throw away the shared memory and start over because we doubted
- its integrity. It starts off at zero and is incremented every
- time we start over. We use this to ensure that we use a new
- IPC shared memory key for the new shared memory segment in case
- the old segment isn't entirely gone yet.
- The sequence actually cycles back to 0 after 9, so pathologically
- there could be an IPC failure if 10 sets of backends are all stuck
- and won't release IPC resources.
- */
+ /*
+ * This is a sequence number that indicates how many times we've had to
+ * throw away the shared memory and start over because we doubted its
+ * integrity. It starts off at zero and is incremented every time we
+ * start over. We use this to ensure that we use a new IPC shared memory
+ * key for the new shared memory segment in case the old segment isn't
+ * entirely gone yet.
+ *
+ * The sequence actually cycles back to 0 after 9, so pathologically there
+ * could be an IPC failure if 10 sets of backends are all stuck and won't
+ * release IPC resources.
+ */
-static IpcMemoryKey ipc_key;
- /* This is the base IPC shared memory key. Other keys are generated by
- adding to this.
- */
+static IpcMemoryKey ipc_key;
+
+ /*
+ * This is the base IPC shared memory key. Other keys are generated by
+ * adding to this.
+ */
static int NextBackendId = MAXINT; /* XXX why? */
@@ -200,11 +205,12 @@ static void usage(const char *);
static int ServerLoop(void);
static int BackendStartup(Port *port);
static void readStartupPacket(char *arg, PacketLen len, char *pkt);
-static int initMasks(fd_set *rmask, fd_set *wmask);
-static void RandomSalt(char* salt);
+static int initMasks(fd_set *rmask, fd_set *wmask);
+static void RandomSalt(char *salt);
#ifdef CYR_RECODE
-void GetCharSetByHost(char *,int,char *);
+void GetCharSetByHost(char *, int, char *);
+
#endif
extern char *optarg;
@@ -516,9 +522,10 @@ usage(const char *progname)
static int
ServerLoop(void)
{
- fd_set readmask, writemask;
- int nSockets;
- Dlelem *curr;
+ fd_set readmask,
+ writemask;
+ int nSockets;
+ Dlelem *curr;
/*
* GH: For !HAVE_SIGPROCMASK (NEXTSTEP), TRH implemented an
@@ -542,8 +549,9 @@ ServerLoop(void)
#endif
for (;;)
{
- Port *port;
- fd_set rmask, wmask;
+ Port *port;
+ fd_set rmask,
+ wmask;
#ifdef HAVE_SIGPROCMASK
sigprocmask(SIG_SETMASK, &oldsigmask, 0);
@@ -554,7 +562,7 @@ ServerLoop(void)
memmove((char *) &rmask, (char *) &readmask, sizeof(fd_set));
memmove((char *) &wmask, (char *) &writemask, sizeof(fd_set));
if (select(nSockets, &rmask, &wmask, (fd_set *) NULL,
- (struct timeval *) NULL) < 0)
+ (struct timeval *) NULL) < 0)
{
if (errno == EINTR)
continue;
@@ -578,18 +586,18 @@ ServerLoop(void)
/* new connection pending on our well-known port's socket */
if (ServerSock_UNIX != INVALID_SOCK &&
- FD_ISSET(ServerSock_UNIX, &rmask) &&
- (port = ConnCreate(ServerSock_UNIX)) != NULL)
+ FD_ISSET(ServerSock_UNIX, &rmask) &&
+ (port = ConnCreate(ServerSock_UNIX)) != NULL)
PacketReceiveSetup(&port->pktInfo,
- readStartupPacket,
- (char *)port);
+ readStartupPacket,
+ (char *) port);
if (ServerSock_INET != INVALID_SOCK &&
- FD_ISSET(ServerSock_INET, &rmask) &&
- (port = ConnCreate(ServerSock_INET)) != NULL)
+ FD_ISSET(ServerSock_INET, &rmask) &&
+ (port = ConnCreate(ServerSock_INET)) != NULL)
PacketReceiveSetup(&port->pktInfo,
- readStartupPacket,
- (char *)port);
+ readStartupPacket,
+ (char *) port);
/* Build up new masks for select(). */
@@ -600,8 +608,8 @@ ServerLoop(void)
while (curr)
{
Port *port = (Port *) DLE_VAL(curr);
- int status = STATUS_OK;
- Dlelem *next;
+ int status = STATUS_OK;
+ Dlelem *next;
if (FD_ISSET(port->sock, &rmask))
{
@@ -628,25 +636,24 @@ ServerLoop(void)
next = DLGetSucc(curr);
/*
- * If there is no error and no outstanding data transfer
- * going on, then the authentication handshake must be
- * complete to the postmaster's satisfaction. So,
- * start the backend.
+ * If there is no error and no outstanding data transfer going
+ * on, then the authentication handshake must be complete to
+ * the postmaster's satisfaction. So, start the backend.
*/
if (status == STATUS_OK && port->pktInfo.state == Idle)
{
+
/*
- * If the backend start fails then keep the
- * connection open to report it. Otherwise,
- * pretend there is an error to close the
- * connection which will now be managed by the
- * backend.
+ * If the backend start fails then keep the connection
+ * open to report it. Otherwise, pretend there is an
+ * error to close the connection which will now be managed
+ * by the backend.
*/
if (BackendStartup(port) != STATUS_OK)
PacketSendError(&port->pktInfo,
- "Backend startup failed");
+ "Backend startup failed");
else
status = STATUS_ERROR;
}
@@ -684,9 +691,10 @@ ServerLoop(void)
* we are listening on. Return the number of sockets to listen on.
*/
-static int initMasks(fd_set *rmask, fd_set *wmask)
+static int
+initMasks(fd_set *rmask, fd_set *wmask)
{
- int nsocks = -1;
+ int nsocks = -1;
FD_ZERO(rmask);
FD_ZERO(wmask);
@@ -715,38 +723,39 @@ static int initMasks(fd_set *rmask, fd_set *wmask)
* Called when the startup packet has been read.
*/
-static void readStartupPacket(char *arg, PacketLen len, char *pkt)
+static void
+readStartupPacket(char *arg, PacketLen len, char *pkt)
{
- Port *port;
+ Port *port;
StartupPacket *si;
- port = (Port *)arg;
- si = (StartupPacket *)pkt;
+ port = (Port *) arg;
+ si = (StartupPacket *) pkt;
/*
- * Get the parameters from the startup packet as C strings. The packet
- * destination was cleared first so a short packet has zeros silently
- * added and a long packet is silently truncated.
+ * Get the parameters from the startup packet as C strings. The
+ * packet destination was cleared first so a short packet has zeros
+ * silently added and a long packet is silently truncated.
*/
- StrNCpy(port->database, si->database, sizeof (port->database) - 1);
- StrNCpy(port->user, si->user, sizeof (port->user) - 1);
- StrNCpy(port->options, si->options, sizeof (port->options) - 1);
- StrNCpy(port->tty, si->tty, sizeof (port->tty) - 1);
+ StrNCpy(port->database, si->database, sizeof(port->database) - 1);
+ StrNCpy(port->user, si->user, sizeof(port->user) - 1);
+ StrNCpy(port->options, si->options, sizeof(port->options) - 1);
+ StrNCpy(port->tty, si->tty, sizeof(port->tty) - 1);
/* The database defaults to the user name. */
if (port->database[0] == '\0')
- StrNCpy(port->database, si->user, sizeof (port->database) - 1);
+ StrNCpy(port->database, si->user, sizeof(port->database) - 1);
/* Check we can handle the protocol the frontend is using. */
port->proto = ntohl(si->protoVersion);
if (PG_PROTOCOL_MAJOR(port->proto) < PG_PROTOCOL_MAJOR(PG_PROTOCOL_EARLIEST) ||
- PG_PROTOCOL_MAJOR(port->proto) > PG_PROTOCOL_MAJOR(PG_PROTOCOL_LATEST) ||
- (PG_PROTOCOL_MAJOR(port->proto) == PG_PROTOCOL_MAJOR(PG_PROTOCOL_LATEST) &&
- PG_PROTOCOL_MINOR(port->proto) > PG_PROTOCOL_MINOR(PG_PROTOCOL_LATEST)))
+ PG_PROTOCOL_MAJOR(port->proto) > PG_PROTOCOL_MAJOR(PG_PROTOCOL_LATEST) ||
+ (PG_PROTOCOL_MAJOR(port->proto) == PG_PROTOCOL_MAJOR(PG_PROTOCOL_LATEST) &&
+ PG_PROTOCOL_MINOR(port->proto) > PG_PROTOCOL_MINOR(PG_PROTOCOL_LATEST)))
{
PacketSendError(&port->pktInfo, "Unsupported frontend protocol.");
return;
@@ -757,7 +766,7 @@ static void readStartupPacket(char *arg, PacketLen len, char *pkt)
if (port->user[0] == '\0')
{
PacketSendError(&port->pktInfo,
- "No Postgres username specified in startup packet.");
+ "No Postgres username specified in startup packet.");
return;
}
@@ -805,11 +814,12 @@ ConnCreate(int serverFd)
static void
reset_shared(short port)
{
- ipc_key = port * 1000 + shmem_seq * 100;
- CreateSharedMemoryAndSemaphores(ipc_key);
- ActiveBackends = FALSE;
- shmem_seq += 1;
- if (shmem_seq >= 10) shmem_seq -= 10;
+ ipc_key = port * 1000 + shmem_seq * 100;
+ CreateSharedMemoryAndSemaphores(ipc_key);
+ ActiveBackends = FALSE;
+ shmem_seq += 1;
+ if (shmem_seq >= 10)
+ shmem_seq -= 10;
}
/*
@@ -981,14 +991,15 @@ BackendStartup(Port *port)
#ifdef CYR_RECODE
#define NR_ENVIRONMENT_VBL 6
-char ChTable[80];
+ char ChTable[80];
+
#else
#define NR_ENVIRONMENT_VBL 5
#endif
- static char envEntry[NR_ENVIRONMENT_VBL][2 * ARGV_SIZE];
+ static char envEntry[NR_ENVIRONMENT_VBL][2 * ARGV_SIZE];
- for (i = 0; i < NR_ENVIRONMENT_VBL; ++i)
+ for (i = 0; i < NR_ENVIRONMENT_VBL; ++i)
{
MemSet(envEntry[i], 0, 2 * ARGV_SIZE);
}
@@ -1012,11 +1023,11 @@ char ChTable[80];
putenv(envEntry[4]);
#ifdef CYR_RECODE
- GetCharSetByHost(ChTable,port->raddr.in.sin_addr.s_addr,DataDir);
- if(*ChTable != '\0')
+ GetCharSetByHost(ChTable, port->raddr.in.sin_addr.s_addr, DataDir);
+ if (*ChTable != '\0')
{
- sprintf(envEntry[5], "PG_RECODETABLE=%s", ChTable);
- putenv(envEntry[5]);
+ sprintf(envEntry[5], "PG_RECODETABLE=%s", ChTable);
+ putenv(envEntry[5]);
}
#endif
@@ -1238,39 +1249,42 @@ dumpstatus(SIGNAL_ARGS)
* CharRemap
*/
static char
-CharRemap(long int ch) {
+CharRemap(long int ch)
+{
- if (ch < 0)
- ch = -ch;
+ if (ch < 0)
+ ch = -ch;
- ch = ch % 62;
- if (ch < 26)
- return ('A' + ch);
+ ch = ch % 62;
+ if (ch < 26)
+ return ('A' + ch);
- ch -= 26;
- if (ch < 26)
- return ('a' + ch);
+ ch -= 26;
+ if (ch < 26)
+ return ('a' + ch);
- ch -= 26;
- return ('0' + ch);
+ ch -= 26;
+ return ('0' + ch);
}
/*
* RandomSalt
*/
static void
-RandomSalt(char* salt) {
+RandomSalt(char *salt)
+{
- static bool initialized = false;
+ static bool initialized = false;
- if (!initialized) {
- time_t now;
+ if (!initialized)
+ {
+ time_t now;
- now = time(NULL);
- srandom((unsigned int)now);
- initialized = true;
- }
+ now = time(NULL);
+ srandom((unsigned int) now);
+ initialized = true;
+ }
- *salt = CharRemap(random());
- *(salt + 1) = CharRemap(random());
+ *salt = CharRemap(random());
+ *(salt + 1) = CharRemap(random());
}
diff --git a/src/backend/regex/engine.c b/src/backend/regex/engine.c
index 6679ba384ae..4801361f90f 100644
--- a/src/backend/regex/engine.c
+++ b/src/backend/regex/engine.c
@@ -161,12 +161,12 @@ size_t nmatch;
regmatch_t pmatch[];
int eflags;
{
- char *endp;
- int i;
+ char *endp;
+ int i;
struct match mv;
struct match *m = &mv;
- char *dp;
- const sopno gf = g->firststate + 1; /* +1 for OEND */
+ char *dp;
+ const sopno gf = g->firststate + 1; /* +1 for OEND */
const sopno gl = g->laststate;
char *start;
char *stop;
@@ -344,19 +344,19 @@ char *stop;
sopno startst;
sopno stopst;
{
- int i;
- sopno ss; /* start sop of current subRE */
- sopno es; /* end sop of current subRE */
- char *sp; /* start of string matched by it */
- char *stp; /* string matched by it cannot pass here */
- char *rest; /* start of rest of string */
- char *tail; /* string unmatched by rest of RE */
- sopno ssub; /* start sop of subsubRE */
- sopno esub; /* end sop of subsubRE */
- char *ssp; /* start of string matched by subsubRE */
- char *sep; /* end of string matched by subsubRE */
- char *oldssp; /* previous ssp */
- char *dp;
+ int i;
+ sopno ss; /* start sop of current subRE */
+ sopno es; /* end sop of current subRE */
+ char *sp; /* start of string matched by it */
+ char *stp; /* string matched by it cannot pass here */
+ char *rest; /* start of rest of string */
+ char *tail; /* string unmatched by rest of RE */
+ sopno ssub; /* start sop of subsubRE */
+ sopno esub; /* end sop of subsubRE */
+ char *ssp; /* start of string matched by subsubRE */
+ char *sep; /* end of string matched by subsubRE */
+ char *oldssp; /* previous ssp */
+ char *dp;
AT("diss", start, stop, startst, stopst);
sp = start;
@@ -545,18 +545,18 @@ sopno startst;
sopno stopst;
sopno lev; /* PLUS nesting level */
{
- int i;
- sopno ss; /* start sop of current subRE */
- char *sp; /* start of string matched by it */
- sopno ssub; /* start sop of subsubRE */
- sopno esub; /* end sop of subsubRE */
- char *ssp; /* start of string matched by subsubRE */
- char *dp;
- size_t len;
- int hard;
- sop s;
- regoff_t offsave;
- cset *cs;
+ int i;
+ sopno ss; /* start sop of current subRE */
+ char *sp; /* start of string matched by it */
+ sopno ssub; /* start sop of subsubRE */
+ sopno esub; /* end sop of subsubRE */
+ char *ssp; /* start of string matched by subsubRE */
+ char *dp;
+ size_t len;
+ int hard;
+ sop s;
+ regoff_t offsave;
+ cset *cs;
AT("back", start, stop, startst, stopst);
sp = start;
@@ -758,15 +758,15 @@ char *stop;
sopno startst;
sopno stopst;
{
- states st = m->st;
- states fresh = m->fresh;
- states tmp = m->tmp;
- char *p = start;
- int c = (start == m->beginp) ? OUT : *(start - 1);
- int lastc; /* previous c */
- int flagch;
- int i;
- char *coldp; /* last p after which no match was
+ states st = m->st;
+ states fresh = m->fresh;
+ states tmp = m->tmp;
+ char *p = start;
+ int c = (start == m->beginp) ? OUT : *(start - 1);
+ int lastc; /* previous c */
+ int flagch;
+ int i;
+ char *coldp; /* last p after which no match was
* underway */
CLEAR(st);
@@ -857,15 +857,15 @@ char *stop;
sopno startst;
sopno stopst;
{
- states st = m->st;
- states empty = m->empty;
- states tmp = m->tmp;
- char *p = start;
- int c = (start == m->beginp) ? OUT : *(start - 1);
- int lastc; /* previous c */
- int flagch;
- int i;
- char *matchp; /* last p at which a match ended */
+ states st = m->st;
+ states empty = m->empty;
+ states tmp = m->tmp;
+ char *p = start;
+ int c = (start == m->beginp) ? OUT : *(start - 1);
+ int lastc; /* previous c */
+ int flagch;
+ int i;
+ char *matchp; /* last p at which a match ended */
AT("slow", start, stop, startst, stopst);
CLEAR(st);
@@ -957,16 +957,16 @@ step(g, start, stop, bef, ch, aft)
struct re_guts *g;
sopno start; /* start state within strip */
sopno stop; /* state after stop state within strip */
-states bef; /* states reachable before */
+states bef; /* states reachable before */
int ch; /* character or NONCHAR code */
-states aft; /* states already known reachable after */
+states aft; /* states already known reachable after */
{
- cset *cs;
- sop s;
- sopno pc;
- onestate here; /* note, macros know this name */
- sopno look;
- int i;
+ cset *cs;
+ sop s;
+ sopno pc;
+ onestate here; /* note, macros know this name */
+ sopno look;
+ int i;
for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here))
{
@@ -1088,8 +1088,8 @@ int ch;
FILE *d;
{
struct re_guts *g = m->g;
- int i;
- int first = 1;
+ int i;
+ int first = 1;
if (!(m->eflags & REG_TRACE))
return;
diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c
index 74ac3acc43a..e31f8654049 100644
--- a/src/backend/regex/regcomp.c
+++ b/src/backend/regex/regcomp.c
@@ -188,8 +188,8 @@ int cflags;
struct parse pa;
struct re_guts *g;
struct parse *p = &pa;
- int i;
- size_t len;
+ int i;
+ size_t len;
#ifdef REDEBUG
#define GOODFLAGS(f) (f)
@@ -294,11 +294,11 @@ p_ere(p, stop)
struct parse *p;
int stop; /* character this ERE should end at */
{
- char c;
- sopno prevback = 0;
- sopno prevfwd = 0;
- sopno conc;
- int first = 1; /* is this the first alternative? */
+ char c;
+ sopno prevback = 0;
+ sopno prevfwd = 0;
+ sopno conc;
+ int first = 1; /* is this the first alternative? */
for (;;)
{
@@ -342,11 +342,11 @@ static void
p_ere_exp(p)
struct parse *p;
{
- char c;
- sopno pos;
- int count;
- int count2;
- sopno subno;
+ char c;
+ sopno pos;
+ int count;
+ int count2;
+ sopno subno;
int wascaret = 0;
assert(MORE()); /* caller should have ensured this */
@@ -523,12 +523,12 @@ struct parse *p;
static void
p_bre(p, end1, end2)
struct parse *p;
-int end1; /* first terminating character */
-int end2; /* second terminating character */
+int end1; /* first terminating character */
+int end2; /* second terminating character */
{
- sopno start = HERE();
- int first = 1; /* first subexpression? */
- int wasdollar = 0;
+ sopno start = HERE();
+ int first = 1; /* first subexpression? */
+ int wasdollar = 0;
if (EAT('^'))
{
@@ -561,12 +561,12 @@ p_simp_re(p, starordinary)
struct parse *p;
int starordinary; /* is a leading * an ordinary character? */
{
- int c;
- int count;
- int count2;
- sopno pos;
- int i;
- sopno subno;
+ int c;
+ int count;
+ int count2;
+ sopno pos;
+ int i;
+ sopno subno;
#define BACKSL (1<<CHAR_BIT)
@@ -695,8 +695,8 @@ static int /* the value */
p_count(p)
struct parse *p;
{
- int count = 0;
- int ndigits = 0;
+ int count = 0;
+ int ndigits = 0;
while (MORE() && isdigit(PEEK()) && count <= DUPMAX)
{
@@ -719,8 +719,8 @@ static void
p_bracket(p)
struct parse *p;
{
- cset *cs = allocset(p);
- int invert = 0;
+ cset *cs = allocset(p);
+ int invert = 0;
/* Dept of Truly Sickening Special-Case Kludges */
if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0)
@@ -753,8 +753,8 @@ struct parse *p;
if (p->g->cflags & REG_ICASE)
{
- int i;
- int ci;
+ int i;
+ int ci;
for (i = p->g->csetsize - 1; i >= 0; i--)
if (CHIN(cs, i) && isalpha(i))
@@ -768,7 +768,7 @@ struct parse *p;
}
if (invert)
{
- int i;
+ int i;
for (i = p->g->csetsize - 1; i >= 0; i--)
if (CHIN(cs, i))
@@ -799,12 +799,12 @@ struct parse *p;
static void
p_b_term(p, cs)
struct parse *p;
-cset *cs;
+cset *cs;
{
- char c;
- char start,
+ char c;
+ char start,
finish;
- int i;
+ int i;
/* classify what we've got */
switch ((MORE()) ? PEEK() : '\0')
@@ -870,13 +870,13 @@ cset *cs;
static void
p_b_cclass(p, cs)
struct parse *p;
-cset *cs;
+cset *cs;
{
- char *sp = p->next;
+ char *sp = p->next;
struct cclass *cp;
- size_t len;
- char *u;
- char c;
+ size_t len;
+ char *u;
+ char c;
while (MORE() && isalpha(PEEK()))
NEXT();
@@ -907,9 +907,9 @@ cset *cs;
static void
p_b_eclass(p, cs)
struct parse *p;
-cset *cs;
+cset *cs;
{
- char c;
+ char c;
c = p_b_coll_elem(p, '=');
CHadd(cs, c);
@@ -923,7 +923,7 @@ static char /* value of symbol */
p_b_symbol(p)
struct parse *p;
{
- char value;
+ char value;
REQUIRE(MORE(), REG_EBRACK);
if (!EATTWO('[', '.'))
@@ -944,9 +944,9 @@ p_b_coll_elem(p, endc)
struct parse *p;
int endc; /* name ended by endc,']' */
{
- char *sp = p->next;
+ char *sp = p->next;
struct cname *cp;
- int len;
+ int len;
while (MORE() && !SEETWO(endc, ']'))
NEXT();
@@ -994,8 +994,8 @@ bothcases(p, ch)
struct parse *p;
int ch;
{
- char *oldnext = p->next;
- char *oldend = p->end;
+ char *oldnext = p->next;
+ char *oldend = p->end;
char bracket[3];
assert(othercase(ch) != ch);/* p_bracket() would recurse */
@@ -1017,9 +1017,9 @@ int ch;
static void
ordinary(p, ch)
struct parse *p;
-int ch;
+int ch;
{
- cat_t *cap = p->g->categories;
+ cat_t *cap = p->g->categories;
if ((p->g->cflags & REG_ICASE) && isalpha(ch) && othercase(ch) != ch)
bothcases(p, ch);
@@ -1041,8 +1041,8 @@ static void
nonnewline(p)
struct parse *p;
{
- char *oldnext = p->next;
- char *oldend = p->end;
+ char *oldnext = p->next;
+ char *oldend = p->end;
char bracket[4];
p->next = bracket;
@@ -1069,13 +1069,13 @@ int from; /* repeated from this number */
int to; /* to this number of times (maybe
* INFINITY) */
{
- sopno finish = HERE();
+ 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)
- sopno copy;
+ sopno copy;
if (p->error != 0) /* head off possible runaway recursion */
return;
@@ -1156,12 +1156,12 @@ static cset *
allocset(p)
struct parse *p;
{
- int no = p->g->ncsets++;
- size_t nc;
- size_t nbytes;
- cset *cs;
- size_t css = (size_t) p->g->csetsize;
- int i;
+ int no = p->g->ncsets++;
+ size_t nc;
+ size_t nbytes;
+ cset *cs;
+ size_t css = (size_t) p->g->csetsize;
+ int i;
if (no >= p->ncsalloc)
{ /* need another column of space */
@@ -1213,11 +1213,11 @@ struct parse *p;
static void
freeset(p, cs)
struct parse *p;
-cset *cs;
+cset *cs;
{
- int i;
- cset *top = &p->g->sets[p->g->ncsets];
- size_t css = (size_t) p->g->csetsize;
+ int i;
+ cset *top = &p->g->sets[p->g->ncsets];
+ size_t css = (size_t) p->g->csetsize;
for (i = 0; i < css; i++)
CHsub(cs, i);
@@ -1238,13 +1238,13 @@ cset *cs;
static int /* set number */
freezeset(p, cs)
struct parse *p;
-cset *cs;
+cset *cs;
{
- uch h = cs->hash;
- int i;
- cset *top = &p->g->sets[p->g->ncsets];
- cset *cs2;
- size_t css = (size_t) p->g->csetsize;
+ uch h = cs->hash;
+ int i;
+ cset *top = &p->g->sets[p->g->ncsets];
+ cset *cs2;
+ size_t css = (size_t) p->g->csetsize;
/* look for an earlier one which is the same */
for (cs2 = &p->g->sets[0]; cs2 < top; cs2++)
@@ -1274,10 +1274,10 @@ cset *cs;
static int /* character; there is no "none" value */
firstch(p, cs)
struct parse *p;
-cset *cs;
+cset *cs;
{
- int i;
- size_t css = (size_t) p->g->csetsize;
+ int i;
+ size_t css = (size_t) p->g->csetsize;
for (i = 0; i < css; i++)
if (CHIN(cs, i))
@@ -1293,11 +1293,11 @@ cset *cs;
static int
nch(p, cs)
struct parse *p;
-cset *cs;
+cset *cs;
{
- int i;
- size_t css = (size_t) p->g->csetsize;
- int n = 0;
+ int i;
+ size_t css = (size_t) p->g->csetsize;
+ int n = 0;
for (i = 0; i < css; i++)
if (CHIN(cs, i))
@@ -1313,10 +1313,10 @@ cset *cs;
static void
mcadd(p, cs, cp)
struct parse *p;
-cset *cs;
-char *cp;
+cset *cs;
+char *cp;
{
- size_t oldend = cs->smultis;
+ size_t oldend = cs->smultis;
cs->smultis += strlen(cp) + 1;
if (cs->multis == NULL)
@@ -1406,7 +1406,7 @@ char *cp;
static void
mcinvert(p, cs)
struct parse *p;
-cset *cs;
+cset *cs;
{
assert(cs->multis == NULL); /* xxx */
}
@@ -1421,7 +1421,7 @@ cset *cs;
static void
mccase(p, cs)
struct parse *p;
-cset *cs;
+cset *cs;
{
assert(cs->multis == NULL); /* xxx */
}
@@ -1435,10 +1435,10 @@ isinsets(g, c)
struct re_guts *g;
int c;
{
- uch *col;
- int i;
- int ncols = (g->ncsets + (CHAR_BIT - 1)) / CHAR_BIT;
- unsigned uc = (unsigned char) c;
+ uch *col;
+ int i;
+ int ncols = (g->ncsets + (CHAR_BIT - 1)) / CHAR_BIT;
+ unsigned uc = (unsigned char) c;
for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
if (col[uc] != 0)
@@ -1456,11 +1456,11 @@ struct re_guts *g;
int c1;
int c2;
{
- uch *col;
- int i;
- int ncols = (g->ncsets + (CHAR_BIT - 1)) / CHAR_BIT;
- unsigned uc1 = (unsigned char) c1;
- unsigned uc2 = (unsigned char) c2;
+ uch *col;
+ int i;
+ int ncols = (g->ncsets + (CHAR_BIT - 1)) / CHAR_BIT;
+ unsigned uc1 = (unsigned char) c1;
+ unsigned uc2 = (unsigned char) c2;
for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
if (col[uc1] != col[uc2])
@@ -1477,10 +1477,10 @@ categorize(p, g)
struct parse *p;
struct re_guts *g;
{
- cat_t *cats = g->categories;
- int c;
- int c2;
- cat_t cat;
+ cat_t *cats = g->categories;
+ int c;
+ int c2;
+ cat_t cat;
/* avoid making error situations worse */
if (p->error != 0)
@@ -1507,8 +1507,8 @@ struct parse *p;
sopno start; /* from here */
sopno finish; /* to this less one */
{
- sopno ret = HERE();
- sopno len = finish - start;
+ sopno ret = HERE();
+ sopno len = finish - start;
assert(finish >= start);
if (len == 0)
@@ -1562,9 +1562,9 @@ sop op;
size_t opnd;
sopno pos;
{
- sopno sn;
- sop s;
- int i;
+ sopno sn;
+ sop s;
+ int i;
/* avoid making error situations worse */
if (p->error != 0)
@@ -1601,7 +1601,7 @@ sopno pos;
static void
dofwd(p, pos, value)
struct parse *p;
-sopno pos;
+sopno pos;
sop value;
{
/* avoid making error situations worse */
@@ -1619,9 +1619,9 @@ sop value;
static void
enlarge(p, size)
struct parse *p;
-sopno size;
+sopno size;
{
- sop *sp;
+ sop *sp;
if (p->ssize >= size)
return;
@@ -1669,13 +1669,13 @@ findmust(p, g)
struct parse *p;
struct re_guts *g;
{
- sop *scan;
+ sop *scan;
sop *start = 0;
- sop *newstart = 0;
- sopno newlen;
- sop s;
- char *cp;
- sopno i;
+ sop *newstart = 0;
+ sopno newlen;
+ sop s;
+ char *cp;
+ sopno i;
/* avoid making error situations worse */
if (p->error != 0)
@@ -1757,10 +1757,10 @@ pluscount(p, g)
struct parse *p;
struct re_guts *g;
{
- sop *scan;
- sop s;
- sopno plusnest = 0;
- sopno maxnest = 0;
+ sop *scan;
+ sop s;
+ sopno plusnest = 0;
+ sopno maxnest = 0;
if (p->error != 0)
return (0); /* there may not be an OEND */
diff --git a/src/backend/regex/regerror.c b/src/backend/regex/regerror.c
index 3125e1cc96d..a8ba2443c5f 100644
--- a/src/backend/regex/regerror.c
+++ b/src/backend/regex/regerror.c
@@ -161,9 +161,9 @@ char *errbuf;
size_t errbuf_size;
{
struct rerr *r;
- size_t len;
- int target = errcode & ~REG_ITOA;
- char *s;
+ size_t len;
+ int target = errcode & ~REG_ITOA;
+ char *s;
char convbuf[50];
if (errcode == REG_ATOI)
diff --git a/src/backend/rewrite/locks.c b/src/backend/rewrite/locks.c
index 56bd8e053b7..ac21bed8403 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.8 1998/01/21 04:24:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.9 1998/02/26 04:35:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,7 +28,7 @@
*/
static bool
nodeThisLockWasTriggered(Node *node, int varno, AttrNumber attnum,
- int sublevels_up)
+ int sublevels_up)
{
if (node == NULL)
return FALSE;
@@ -48,7 +48,7 @@ nodeThisLockWasTriggered(Node *node, int varno, AttrNumber attnum,
Expr *expr = (Expr *) node;
return nodeThisLockWasTriggered((Node *) expr->args, varno,
- attnum, sublevels_up);
+ attnum, sublevels_up);
}
break;
case T_TargetEntry:
@@ -56,15 +56,15 @@ nodeThisLockWasTriggered(Node *node, int varno, AttrNumber attnum,
TargetEntry *tle = (TargetEntry *) node;
return nodeThisLockWasTriggered(tle->expr, varno, attnum,
- sublevels_up);
+ sublevels_up);
}
break;
case T_Aggreg:
{
- Aggreg *agg = (Aggreg *) node;
+ Aggreg *agg = (Aggreg *) node;
return nodeThisLockWasTriggered(agg->target, varno, attnum,
- sublevels_up);
+ sublevels_up);
}
break;
case T_List:
@@ -74,7 +74,7 @@ nodeThisLockWasTriggered(Node *node, int varno, AttrNumber attnum,
foreach(l, (List *) node)
{
if (nodeThisLockWasTriggered(lfirst(l), varno, attnum,
- sublevels_up))
+ sublevels_up))
return TRUE;
}
return FALSE;
@@ -82,11 +82,11 @@ nodeThisLockWasTriggered(Node *node, int varno, AttrNumber attnum,
break;
case T_SubLink:
{
- SubLink *sublink = (SubLink *) node;
- Query *query = (Query *)sublink->subselect;
+ SubLink *sublink = (SubLink *) node;
+ Query *query = (Query *) sublink->subselect;
return nodeThisLockWasTriggered(query->qual, varno, attnum,
- sublevels_up + 1);
+ sublevels_up + 1);
}
break;
default:
@@ -106,7 +106,7 @@ thisLockWasTriggered(int varno,
AttrNumber attnum,
Query *parsetree)
{
-
+
if (nodeThisLockWasTriggered(parsetree->qual, varno, attnum, 0))
return true;
@@ -114,14 +114,14 @@ thisLockWasTriggered(int varno,
return true;
return false;
-
+
}
/*
* matchLocks -
* match the list of locks and returns the matching rules
*/
-List *
+List *
matchLocks(CmdType event,
RuleLock *rulelocks,
int varno,
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c
index b38949fba41..f3ccf54c23e 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.13 1998/02/25 13:07:18 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.14 1998/02/26 04:35:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,13 +34,15 @@
#include "utils/acl.h"
#include "catalog/pg_shadow.h"
-static void ApplyRetrieveRule(Query *parsetree, RewriteRule *rule,
+static void
+ApplyRetrieveRule(Query *parsetree, RewriteRule *rule,
int rt_index, int relation_level,
Relation relation, int *modified);
-static List *fireRules(Query *parsetree, int rt_index, CmdType event,
+static List *
+fireRules(Query *parsetree, int rt_index, CmdType event,
bool *instead_flag, List *locks, List **qual_products);
static void QueryRewriteSubLink(Node *node);
-static List *QueryRewriteOne(Query *parsetree);
+static List *QueryRewriteOne(Query *parsetree);
static List *deepRewriteQuery(Query *parsetree);
static void CheckViewPerms(Relation view, List *rtable);
@@ -270,34 +272,30 @@ ApplyRetrieveRule(Query *parsetree,
if (rule->actions)
{
if (length(rule->actions) > 1) /* ??? because we don't handle
- * rules with more than one
- * action? -ay */
-
- /* WARNING!!!
- * If we sometimes handle
- * rules with more than one
- * action, the view acl checks
- * might get broken.
- * viewAclOverride should only
- * become true (below) if this
- * is a relation_level, instead,
- * select query - Jan
- */
+ * rules with more than one
+ * action? -ay */
+
+ /*
+ * WARNING!!! If we sometimes handle rules with more than one
+ * action, the view acl checks might get broken.
+ * viewAclOverride should only become true (below) if this is
+ * a relation_level, instead, select query - Jan
+ */
return;
rule_action = copyObject(lfirst(rule->actions));
nothing = FALSE;
/*
- * If this rule is on the relation level, the rule action
- * is a select and the rule is instead then it must be
- * a view. Permissions for views now follow the owner of
- * the view, not the current user.
+ * If this rule is on the relation level, the rule action is a
+ * select and the rule is instead then it must be a view.
+ * Permissions for views now follow the owner of the view, not the
+ * current user.
*/
if (relation_level && rule_action->commandType == CMD_SELECT
- && rule->isInstead)
+ && rule->isInstead)
{
- CheckViewPerms(relation, rule_action->rtable);
- viewAclOverride = TRUE;
+ CheckViewPerms(relation, rule_action->rtable);
+ viewAclOverride = TRUE;
}
}
else
@@ -320,8 +318,9 @@ ApplyRetrieveRule(Query *parsetree,
if (viewAclOverride)
{
- List *rule_rtable, *rule_rt;
- RangeTblEntry *rte;
+ List *rule_rtable,
+ *rule_rt;
+ RangeTblEntry *rte;
rule_rtable = copyObject(rule_action->rtable);
foreach(rule_rt, rule_rtable)
@@ -329,8 +328,8 @@ ApplyRetrieveRule(Query *parsetree,
rte = lfirst(rule_rt);
/*
- * tell the executor that the ACL check on this
- * range table entry is already done
+ * tell the executor that the ACL check on this range table
+ * entry is already done
*/
rte->skipAcl = true;
}
@@ -655,8 +654,8 @@ RewriteQuery(Query *parsetree, bool *instead_flag, List **qual_products)
Query *other;
/*
- * ApplyRetrieveRule changes the range table
- * XXX Unions are copied again.
+ * ApplyRetrieveRule changes the range table XXX Unions are copied
+ * again.
*/
other = copyObject(parsetree);
@@ -681,7 +680,7 @@ static int numQueryRewriteInvoked = 0;
* rewrite one query via QueryRewrite system, possibly returning 0, or many
* queries
*/
-List *
+List *
QueryRewrite(Query *parsetree)
{
@@ -712,7 +711,7 @@ QueryRewriteSubLink(Node *node)
{
Expr *expr = (Expr *) node;
- QueryRewriteSubLink((Node *)expr->args);
+ QueryRewriteSubLink((Node *) expr->args);
}
break;
case T_Var:
@@ -727,15 +726,15 @@ QueryRewriteSubLink(Node *node)
break;
case T_SubLink:
{
- SubLink *sublink = (SubLink *) node;
- Query *query = (Query *)sublink->subselect;
- List *ret;
+ SubLink *sublink = (SubLink *) node;
+ Query *query = (Query *) sublink->subselect;
+ List *ret;
/*
- * Nest down first. We do this so if a rewrite adds a
- * SubLink we don't process it as part of this loop.
+ * Nest down first. We do this so if a rewrite adds a
+ * SubLink we don't process it as part of this loop.
*/
- QueryRewriteSubLink((Node *)query->qual);
+ QueryRewriteSubLink((Node *) query->qual);
ret = QueryRewriteOne(query);
if (!ret)
@@ -743,7 +742,7 @@ QueryRewriteSubLink(Node *node)
else if (lnext(ret) == NIL)
sublink->subselect = lfirst(ret);
else
- elog(ERROR,"Don't know how to process subquery that rewrites to multiple queries.");
+ elog(ERROR, "Don't know how to process subquery that rewrites to multiple queries.");
}
break;
default:
@@ -757,7 +756,7 @@ QueryRewriteSubLink(Node *node)
* QueryOneRewrite -
* rewrite one query
*/
-static List *
+static List *
QueryRewriteOne(Query *parsetree)
{
numQueryRewriteInvoked = 0;
@@ -813,8 +812,8 @@ CheckViewPerms(Relation view, List *rtable)
{
HeapTuple utup;
NameData uname;
- List *rt;
- RangeTblEntry *rte;
+ List *rt;
+ RangeTblEntry *rte;
int32 aclcheck_res;
/*
@@ -824,19 +823,19 @@ CheckViewPerms(Relation view, List *rtable)
if (!HeapTupleIsValid(utup))
{
elog(ERROR, "cache lookup for userid %d failed",
- view->rd_rel->relowner);
+ view->rd_rel->relowner);
}
StrNCpy(uname.data,
((Form_pg_shadow) GETSTRUCT(utup))->usename.data,
NAMEDATALEN);
/*
- * check that we have read access to all the
- * classes in the range table of the view
+ * check that we have read access to all the classes in the range
+ * table of the view
*/
foreach(rt, rtable)
{
- rte = (RangeTblEntry *)lfirst(rt);
+ rte = (RangeTblEntry *) lfirst(rt);
aclcheck_res = pg_aclcheck(rte->relname, uname.data, ACL_RD);
if (aclcheck_res != ACLCHECK_OK)
@@ -845,6 +844,3 @@ CheckViewPerms(Relation view, List *rtable)
}
}
}
-
-
-
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c
index be8fa5d075d..8c9bc3412a4 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.12 1998/02/10 04:02:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.13 1998/02/26 04:35:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,8 +28,9 @@
#include "nodes/plannodes.h"
#include "optimizer/clauses.h"
-static void ResolveNew(RewriteInfo *info, List *targetlist,
- Node **node, int sublevels_up);
+static void
+ResolveNew(RewriteInfo *info, List *targetlist,
+ Node **node, int sublevels_up);
@@ -49,7 +50,7 @@ OffsetVarNodes(Node *node, int offset)
break;
case T_Aggreg:
{
- Aggreg *agg = (Aggreg *) node;
+ Aggreg *agg = (Aggreg *) node;
OffsetVarNodes(agg->target, offset);
}
@@ -101,7 +102,7 @@ ChangeVarNodes(Node *node, int old_varno, int new_varno, int sublevels_up)
break;
case T_Aggreg:
{
- Aggreg *agg = (Aggreg *) node;
+ Aggreg *agg = (Aggreg *) node;
ChangeVarNodes(agg->target, old_varno, new_varno, sublevels_up);
}
@@ -135,11 +136,11 @@ ChangeVarNodes(Node *node, int old_varno, int new_varno, int sublevels_up)
break;
case T_SubLink:
{
- SubLink *sublink = (SubLink *) node;
- Query *query = (Query *)sublink->subselect;
+ SubLink *sublink = (SubLink *) node;
+ Query *query = (Query *) sublink->subselect;
- ChangeVarNodes((Node *)query->qual, old_varno, new_varno,
- sublevels_up + 1);
+ ChangeVarNodes((Node *) query->qual, old_varno, new_varno,
+ sublevels_up + 1);
}
break;
default:
@@ -247,7 +248,7 @@ FindMatchingTLEntry(List *tlist, char *e_attname)
static void
ResolveNew(RewriteInfo *info, List *targetlist, Node **nodePtr,
- int sublevels_up)
+ int sublevels_up)
{
Node *node = *nodePtr;
@@ -258,21 +259,21 @@ ResolveNew(RewriteInfo *info, List *targetlist, Node **nodePtr,
{
case T_TargetEntry:
ResolveNew(info, targetlist, &((TargetEntry *) node)->expr,
- sublevels_up);
+ sublevels_up);
break;
case T_Aggreg:
ResolveNew(info, targetlist, &((Aggreg *) node)->target,
- sublevels_up);
+ sublevels_up);
break;
case T_Expr:
ResolveNew(info, targetlist, (Node **) (&(((Expr *) node)->args)),
- sublevels_up);
+ sublevels_up);
break;
case T_Var:
{
- int this_varno = (int) ((Var *) node)->varno;
- int this_varlevelsup = (int) ((Var *) node)->varlevelsup;
- Node *n;
+ int this_varno = (int) ((Var *) node)->varno;
+ int this_varlevelsup = (int) ((Var *) node)->varlevelsup;
+ Node *n;
if (this_varno == info->new_varno &&
this_varlevelsup == sublevels_up)
@@ -304,15 +305,15 @@ ResolveNew(RewriteInfo *info, List *targetlist, Node **nodePtr,
foreach(l, (List *) node)
ResolveNew(info, targetlist, (Node **) &(lfirst(l)),
- sublevels_up);
+ sublevels_up);
break;
}
case T_SubLink:
{
- SubLink *sublink = (SubLink *) node;
- Query *query = (Query *)sublink->subselect;
+ SubLink *sublink = (SubLink *) node;
+ Query *query = (Query *) sublink->subselect;
- ResolveNew(info, targetlist, (Node **)&(query->qual), sublevels_up + 1);
+ ResolveNew(info, targetlist, (Node **) &(query->qual), sublevels_up + 1);
}
break;
default:
@@ -350,17 +351,17 @@ nodeHandleRIRAttributeRule(Node **nodePtr,
TargetEntry *tle = (TargetEntry *) node;
nodeHandleRIRAttributeRule(&tle->expr, rtable, targetlist,
- rt_index, attr_num, modified, badsql,
- sublevels_up);
+ rt_index, attr_num, modified, badsql,
+ sublevels_up);
}
break;
case T_Aggreg:
{
- Aggreg *agg = (Aggreg *) node;
+ Aggreg *agg = (Aggreg *) node;
nodeHandleRIRAttributeRule(&agg->target, rtable, targetlist,
- rt_index, attr_num, modified, badsql,
- sublevels_up);
+ rt_index, attr_num, modified, badsql,
+ sublevels_up);
}
break;
case T_Expr:
@@ -402,7 +403,7 @@ nodeHandleRIRAttributeRule(Node **nodePtr,
if (name_to_look_for.data[0])
{
Node *n;
-
+
n = FindMatchingTLEntry(targetlist, (char *) &name_to_look_for);
if (n == NULL)
*nodePtr = make_null(((Var *) node)->vartype);
@@ -422,18 +423,18 @@ nodeHandleRIRAttributeRule(Node **nodePtr,
{
nodeHandleRIRAttributeRule((Node **) (&(lfirst(i))), rtable,
targetlist, rt_index, attr_num,
- modified, badsql, sublevels_up);
+ modified, badsql, sublevels_up);
}
}
break;
case T_SubLink:
{
- SubLink *sublink = (SubLink *) node;
- Query *query = (Query *)sublink->subselect;
+ SubLink *sublink = (SubLink *) node;
+ Query *query = (Query *) sublink->subselect;
- nodeHandleRIRAttributeRule((Node **)&(query->qual), rtable, targetlist,
- rt_index, attr_num, modified, badsql,
- sublevels_up + 1);
+ nodeHandleRIRAttributeRule((Node **) &(query->qual), rtable, targetlist,
+ rt_index, attr_num, modified, badsql,
+ sublevels_up + 1);
}
break;
default:
@@ -455,7 +456,7 @@ HandleRIRAttributeRule(Query *parsetree,
int *modified,
int *badsql)
{
-
+
nodeHandleRIRAttributeRule((Node **) (&(parsetree->targetList)), rtable,
targetlist, rt_index, attr_num,
modified, badsql, 0);
@@ -470,7 +471,7 @@ nodeHandleViewRule(Node **nodePtr,
List *targetlist,
int rt_index,
int *modified,
- int sublevels_up)
+ int sublevels_up)
{
Node *node = *nodePtr;
@@ -489,7 +490,7 @@ nodeHandleViewRule(Node **nodePtr,
break;
case T_Aggreg:
{
- Aggreg *agg = (Aggreg *) node;
+ Aggreg *agg = (Aggreg *) node;
nodeHandleViewRule(&(agg->target), rtable, targetlist,
rt_index, modified, sublevels_up);
@@ -512,7 +513,7 @@ nodeHandleViewRule(Node **nodePtr,
Node *n;
if (this_varno == rt_index &&
- this_varlevelsup == sublevels_up)
+ this_varlevelsup == sublevels_up)
{
n = FindMatchingTLEntry(targetlist,
get_attname(getrelid(this_varno,
@@ -540,10 +541,10 @@ nodeHandleViewRule(Node **nodePtr,
break;
case T_SubLink:
{
- SubLink *sublink = (SubLink *) node;
- Query *query = (Query *)sublink->subselect;
+ SubLink *sublink = (SubLink *) node;
+ Query *query = (Query *) sublink->subselect;
- nodeHandleViewRule((Node **)&(query->qual), rtable, targetlist,
+ nodeHandleViewRule((Node **) &(query->qual), rtable, targetlist,
rt_index, modified, sublevels_up + 1);
}
break;
diff --git a/src/backend/rewrite/rewriteRemove.c b/src/backend/rewrite/rewriteRemove.c
index f7dea7cdf38..0f92cf19393 100644
--- a/src/backend/rewrite/rewriteRemove.c
+++ b/src/backend/rewrite/rewriteRemove.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.10 1998/01/31 04:38:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.11 1998/02/26 04:35:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,7 +30,7 @@
* RewriteGetRuleEventRel
*-----------------------------------------------------------------------
*/
-char *
+char *
RewriteGetRuleEventRel(char *rulename)
{
HeapTuple htp;
diff --git a/src/backend/rewrite/rewriteSupport.c b/src/backend/rewrite/rewriteSupport.c
index bf8d6977d19..b701fbd4157 100644
--- a/src/backend/rewrite/rewriteSupport.c
+++ b/src/backend/rewrite/rewriteSupport.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.15 1998/01/31 04:38:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.16 1998/02/26 04:35:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,13 +58,13 @@ RuleIdGetActionInfo(Oid ruleoid, bool *instead_flag, Query **parseTrees)
if (ruletuple == NULL)
elog(ERROR, "rule %u isn't in rewrite system relation", ruleoid);
- ruleaction = (char *)heap_getattr(ruletuple,
- Anum_pg_rewrite_ev_action,
- ruleTupdesc,
- &action_is_null);
- rule_evqual_string = (char *)heap_getattr(ruletuple,
- Anum_pg_rewrite_ev_qual,
- ruleTupdesc, &action_is_null);
+ ruleaction = (char *) heap_getattr(ruletuple,
+ Anum_pg_rewrite_ev_action,
+ ruleTupdesc,
+ &action_is_null);
+ rule_evqual_string = (char *) heap_getattr(ruletuple,
+ Anum_pg_rewrite_ev_qual,
+ ruleTupdesc, &action_is_null);
*instead_flag = !!heap_getattr(ruletuple,
Anum_pg_rewrite_is_instead,
ruleTupdesc, &instead_is_null);
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 2ff414bcbbd..29476547c1f 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.34 1998/02/11 19:11:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.35 1998/02/26 04:35:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -100,7 +100,7 @@ static void BufferSync(void);
static int BufferReplace(BufferDesc *bufHdr, bool bufferLockHeld);
/* not static but used by vacuum only ... */
-int BlowawayRelationBuffers(Relation rdesc, BlockNumber block);
+int BlowawayRelationBuffers(Relation rdesc, BlockNumber block);
/* ---------------------------------------------------
* RelationGetBufferWithBuffer
@@ -829,7 +829,7 @@ FlushBuffer(Buffer buffer, bool release)
status = smgrflush(DEFAULT_SMGR, bufrel, bufHdr->tag.blockNum,
(char *) MAKE_PTR(bufHdr->data));
-
+
RelationDecrementReferenceCount(bufrel);
if (status == SM_FAIL)
@@ -1197,7 +1197,7 @@ ResetBufferUsage()
void
ResetBufferPool()
{
- int i;
+ int i;
for (i = 1; i <= NBuffers; i++)
{
@@ -1225,7 +1225,7 @@ ResetBufferPool()
int
BufferPoolCheckLeak()
{
- int i;
+ int i;
int error = 0;
for (i = 1; i <= NBuffers; i++)
@@ -1384,7 +1384,7 @@ BufferReplace(BufferDesc *bufHdr, bool bufferLockHeld)
bufHdr->tag.blockNum,
(char *) MAKE_PTR(bufHdr->data));
}
-
+
if (reln != (Relation) NULL)
RelationDecrementReferenceCount(reln);
@@ -1444,7 +1444,7 @@ BufferGetBlock(Buffer buffer)
void
ReleaseRelationBuffers(Relation rdesc)
{
- int i;
+ int i;
int holding = 0;
BufferDesc *buf;
@@ -1501,7 +1501,7 @@ ReleaseRelationBuffers(Relation rdesc)
void
DropBuffers(Oid dbid)
{
- int i;
+ int i;
BufferDesc *buf;
SpinAcquire(BufMgrLock);
@@ -1587,7 +1587,7 @@ blockNum=%d, flags=0x%x, refcount=%d %d)\n",
void
BufferPoolBlowaway()
{
- int i;
+ int i;
BufferSync();
for (i = 1; i <= NBuffers; i++)
@@ -1608,9 +1608,9 @@ BufferPoolBlowaway()
*
* This function blowaway all the pages with blocknumber >= passed
* of a relation in the buffer pool. Used by vacuum before truncation...
- *
+ *
* Returns: 0 - Ok, -1 - DIRTY, -2 - PINNED
- *
+ *
* XXX currently it sequentially searches the buffer pool, should be
* changed to more clever ways of searching.
* --------------------------------------------------------------------
@@ -1618,28 +1618,28 @@ BufferPoolBlowaway()
int
BlowawayRelationBuffers(Relation rdesc, BlockNumber block)
{
- int i;
- BufferDesc *buf;
+ int i;
+ BufferDesc *buf;
if (rdesc->rd_islocal)
{
for (i = 0; i < NLocBuffer; i++)
{
buf = &LocalBufferDescriptors[i];
- if (buf->tag.relId.relId == rdesc->rd_id &&
+ if (buf->tag.relId.relId == rdesc->rd_id &&
buf->tag.blockNum >= block)
{
if (buf->flags & BM_DIRTY)
{
- elog (NOTICE, "BlowawayRelationBuffers(%s (local), %u): block %u is dirty",
- rdesc->rd_rel->relname.data, block, buf->tag.blockNum);
+ elog(NOTICE, "BlowawayRelationBuffers(%s (local), %u): block %u is dirty",
+ rdesc->rd_rel->relname.data, block, buf->tag.blockNum);
return (-1);
}
if (LocalRefCount[i] > 0)
{
- elog (NOTICE, "BlowawayRelationBuffers(%s (local), %u): block %u is referenced (%d)",
- rdesc->rd_rel->relname.data, block,
- buf->tag.blockNum, LocalRefCount[i]);
+ elog(NOTICE, "BlowawayRelationBuffers(%s (local), %u): block %u is referenced (%d)",
+ rdesc->rd_rel->relname.data, block,
+ buf->tag.blockNum, LocalRefCount[i]);
return (-2);
}
buf->tag.relId.relId = InvalidOid;
@@ -1653,22 +1653,22 @@ BlowawayRelationBuffers(Relation rdesc, BlockNumber block)
{
buf = &BufferDescriptors[i];
if (buf->tag.relId.dbId == MyDatabaseId &&
- buf->tag.relId.relId == rdesc->rd_id &&
+ buf->tag.relId.relId == rdesc->rd_id &&
buf->tag.blockNum >= block)
{
if (buf->flags & BM_DIRTY)
{
- elog (NOTICE, "BlowawayRelationBuffers(%s, %u): block %u is dirty (private %d, last %d, global %d)",
- buf->sb_relname, block, buf->tag.blockNum,
- PrivateRefCount[i], LastRefCount[i], buf->refcount);
+ elog(NOTICE, "BlowawayRelationBuffers(%s, %u): block %u is dirty (private %d, last %d, global %d)",
+ buf->sb_relname, block, buf->tag.blockNum,
+ PrivateRefCount[i], LastRefCount[i], buf->refcount);
SpinRelease(BufMgrLock);
return (-1);
}
if (!(buf->flags & BM_FREE))
{
- elog (NOTICE, "BlowawayRelationBuffers(%s, %u): block %u is referenced (private %d, last %d, global %d)",
- buf->sb_relname, block, buf->tag.blockNum,
- PrivateRefCount[i], LastRefCount[i], buf->refcount);
+ elog(NOTICE, "BlowawayRelationBuffers(%s, %u): block %u is referenced (private %d, last %d, global %d)",
+ buf->sb_relname, block, buf->tag.blockNum,
+ PrivateRefCount[i], LastRefCount[i], buf->refcount);
SpinRelease(BufMgrLock);
return (-2);
}
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index 8c13462167b..3d05dc4b855 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.17 1998/01/13 04:04:20 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.18 1998/02/26 04:35:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -205,7 +205,7 @@ FlushLocalBuffer(Buffer buffer, bool release)
(char *) MAKE_PTR(bufHdr->data));
LocalBufferFlushCount++;
RelationDecrementReferenceCount(bufrel);
-
+
Assert(LocalRefCount[bufid] > 0);
if (release)
LocalRefCount[bufid]--;
@@ -279,7 +279,7 @@ LocalBufferSync(void)
(char *) MAKE_PTR(buf->data));
LocalBufferFlushCount++;
RelationDecrementReferenceCount(bufrel);
-
+
buf->tag.relId.relId = InvalidOid;
buf->flags &= ~BM_DIRTY;
}
diff --git a/src/backend/storage/buffer/s_lock.c b/src/backend/storage/buffer/s_lock.c
index 493139ed5dc..1a194eb4a41 100644
--- a/src/backend/storage/buffer/s_lock.c
+++ b/src/backend/storage/buffer/s_lock.c
@@ -7,15 +7,15 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.2 1998/01/07 17:02:52 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.3 1998/02/26 04:35:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/*
* S_LOCK() -- Implements the S_LOCK function for the Linux/Alpha platform.
- * This function is usually an inlined macro for all other platforms,
- * but must be a seperate function for the Linux/Alpha platform, due
- * to the assembly code involved.
+ * This function is usually an inlined macro for all other platforms,
+ * but must be a seperate function for the Linux/Alpha platform, due
+ * to the assembly code involved.
*/
@@ -38,14 +38,16 @@
#include "storage/s_lock.h"
#if defined(__alpha__) && defined(linux)
-void S_LOCK(slock_t* lock)
+void
+S_LOCK(slock_t *lock)
{
- do
- {
- slock_t _res;
- do
- {
- __asm__(" ldq $0, %0 \n\
+ do
+ {
+ slock_t _res;
+
+ do
+ {
+ __asm__(" ldq $0, %0 \n\
bne $0, already_set \n\
ldq_l $0, %0 \n\
bne $0, already_set \n\
@@ -58,7 +60,8 @@ void S_LOCK(slock_t* lock)
stqc_fail: or $31, 1, $0 \n\
already_set: bis $0, $0, %1 \n\
end: nop ": "=m"(*lock), "=r"(_res): :"0");
- } while (_res != 0);
- } while (0);
+ } while (_res != 0);
+ } while (0);
}
+
#endif
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 63fe50c72b3..9f48b222b2b 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -6,7 +6,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Id: fd.c,v 1.29 1998/01/07 21:04:58 momjian Exp $
+ * $Id: fd.c,v 1.30 1998/02/26 04:35:29 momjian Exp $
*
* NOTES:
*
@@ -483,7 +483,7 @@ filepath(char *filename)
}
#ifdef FILEDEBUG
-printf("filepath: path is %s\n", buf);
+ printf("filepath: path is %s\n", buf);
#endif
return (buf);
@@ -852,7 +852,7 @@ FileNameUnlink(char *filename)
*/
static int allocatedFiles = 0;
-FILE *
+FILE *
AllocateFile(char *name, char *mode)
{
FILE *file;
diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c
index 49843807a0e..b0219b5635b 100644
--- a/src/backend/storage/ipc/ipc.c
+++ b/src/backend/storage/ipc/ipc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.18 1998/01/07 21:05:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.19 1998/02/26 04:35:38 momjian Exp $
*
* NOTES
*
@@ -561,7 +561,7 @@ IpcMemoryDetach(int status, char *shmaddr)
/* CALL IT: addr = (struct <MemoryStructure> *) IpcMemoryAttach(memId); */
/* */
/****************************************************************************/
-char *
+char *
IpcMemoryAttach(IpcMemoryId memId)
{
char *memAddress;
@@ -618,7 +618,7 @@ IpcMemoryKill(IpcMemoryKey memKey)
*/
/* used in spin.c */
-SLock *SLockArray = NULL;
+SLock *SLockArray = NULL;
static SLock **FreeSLockPP;
static int *UnusedSLockIP;
@@ -686,6 +686,7 @@ LockIsFree(int lockid)
{
return (SLockArray[lockid].flag == NOLOCK);
}
+
#endif
#endif /* HAS_TEST_AND_SET */
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index c477b7d401d..655adc9d31c 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.16 1998/01/07 21:05:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.17 1998/02/26 04:35:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -276,7 +276,7 @@ InitShmem(unsigned int key, unsigned int size)
* of space. Has to return a real pointer in order
* to be compatable with malloc().
*/
-long *
+long *
ShmemAlloc(unsigned long size)
{
unsigned long tmpFree;
@@ -338,7 +338,7 @@ ShmemIsValid(unsigned long addr)
* table at once. Use SpinAlloc() to create a spinlock
* for the structure before creating the structure itself.
*/
-HTAB *
+HTAB *
ShmemInitHash(char *name, /* table string name for binding */
long init_size, /* initial size */
long max_size, /* max size of the table */
@@ -496,7 +496,7 @@ ShmemPIDDestroy(int pid)
* the object is already in the binding table (hence, already
* initialized).
*/
-long *
+long *
ShmemInitStruct(char *name, unsigned long size, bool *foundPtr)
{
BindingEnt *result,
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 7a444a15fab..f97e2ebdfb8 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.25 1998/01/28 06:52:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.26 1998/02/26 04:36:07 momjian Exp $
*
* NOTES
* Outside modules can create a lock table and acquire/release
@@ -50,9 +50,10 @@
#include "access/xact.h"
#include "access/transam.h"
-static int WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock,
+static int
+WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock,
LOCKT lockt);
-
+
/*#define LOCK_MGR_DEBUG*/
#ifndef LOCK_MGR_DEBUG
@@ -542,7 +543,7 @@ LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
* word alignment and ensures hashing consistency).
* ------------------
*/
- MemSet(&item, 0, XID_TAGSIZE); /* must clear padding, needed */
+ MemSet(&item, 0, XID_TAGSIZE); /* must clear padding, needed */
TransactionIdStore(myXid, &item.tag.xid);
item.tag.lock = MAKE_OFFSET(lock);
#if 0
@@ -713,12 +714,12 @@ LockResolveConflicts(LOCKTAB *ltable,
{
/* ------------------------
* If someone with a greater priority is waiting for the lock,
- * do not continue and share the lock, even if we can. bjm
+ * do not continue and share the lock, even if we can. bjm
* ------------------------
*/
- int myprio = ltable->ctl->prio[lockt];
- PROC_QUEUE *waitQueue = &(lock->waitProcs);
- PROC *topproc = (PROC *) MAKE_PTR(waitQueue->links.prev);
+ int myprio = ltable->ctl->prio[lockt];
+ PROC_QUEUE *waitQueue = &(lock->waitProcs);
+ PROC *topproc = (PROC *) MAKE_PTR(waitQueue->links.prev);
if (waitQueue->size && topproc->prio > myprio)
return STATUS_FOUND;
@@ -902,7 +903,8 @@ LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt)
#endif
/*
- * let the caller print its own error message, too. Do not elog(ERROR).
+ * let the caller print its own error message, too. Do not
+ * elog(ERROR).
*/
if (!lock)
{
@@ -1430,16 +1432,16 @@ DeadLockCheck(SHM_QUEUE *lockQueue, LOCK *findlock, bool skip_check)
SHMEM_OFFSET end = MAKE_OFFSET(lockQueue);
LOCK *lock;
- LOCKTAB *ltable;
+ LOCKTAB *ltable;
XIDLookupEnt *result,
item;
HTAB *xidTable;
bool found;
- static PROC* checked_procs[MaxBackendId];
- static int nprocs;
- static bool MyNHolding;
-
+ static PROC *checked_procs[MaxBackendId];
+ static int nprocs;
+ static bool MyNHolding;
+
/* initialize at start of recursion */
if (skip_check)
{
@@ -1455,15 +1457,15 @@ DeadLockCheck(SHM_QUEUE *lockQueue, LOCK *findlock, bool skip_check)
#if 0
item.tag.pid = pid;
#endif
-
+
if (!(result = (XIDLookupEnt *)
- hash_search(xidTable, (Pointer) &item, HASH_FIND, &found)) || !found)
+ hash_search(xidTable, (Pointer) &item, HASH_FIND, &found)) || !found)
{
elog(NOTICE, "LockAcquire: xid table corrupted");
return true;
}
MyNHolding = result->nHolding;
- }
+ }
if (SHMQueueEmpty(lockQueue))
return false;
@@ -1487,19 +1489,19 @@ DeadLockCheck(SHM_QUEUE *lockQueue, LOCK *findlock, bool skip_check)
/*
* This is our only check to see if we found the lock we want.
*
- * The lock we are waiting for is already in MyProc->lockQueue
- * so we need to skip it here. We are trying to find it in
- * someone else's lockQueue.
+ * The lock we are waiting for is already in MyProc->lockQueue so we
+ * need to skip it here. We are trying to find it in someone
+ * else's lockQueue.
*/
if (lock == findlock && !skip_check)
return true;
- {
- PROC_QUEUE *waitQueue = &(lock->waitProcs);
- PROC *proc;
+ {
+ PROC_QUEUE *waitQueue = &(lock->waitProcs);
+ PROC *proc;
int i;
int j;
-
+
proc = (PROC *) MAKE_PTR(waitQueue->links.prev);
for (i = 0; i < waitQueue->size; i++)
{
@@ -1507,23 +1509,24 @@ DeadLockCheck(SHM_QUEUE *lockQueue, LOCK *findlock, bool skip_check)
lock == findlock && /* skip_check also true */
MyNHolding) /* I already hold some lock on it */
{
+
/*
- * For findlock's wait queue, we are interested in
- * procs who are blocked waiting for a write-lock on the
- * table we are waiting on, and already hold a lock on it.
- * We first check to see if there is an escalation
- * deadlock, where we hold a readlock and want a
- * writelock, and someone else holds readlock on
- * the same table, and wants a writelock.
+ * For findlock's wait queue, we are interested in
+ * procs who are blocked waiting for a write-lock on
+ * the table we are waiting on, and already hold a
+ * lock on it. We first check to see if there is an
+ * escalation deadlock, where we hold a readlock and
+ * want a writelock, and someone else holds readlock
+ * on the same table, and wants a writelock.
*
- * Basically, the test is, "Do we both hold some lock
- * on findlock, and we are both waiting in the lock
- * queue?"
+ * Basically, the test is, "Do we both hold some lock on
+ * findlock, and we are both waiting in the lock
+ * queue?"
*/
Assert(skip_check);
Assert(MyProc->prio == 2);
-
+
ltable = AllTables[1];
xidTable = ltable->xidHash;
@@ -1533,9 +1536,9 @@ DeadLockCheck(SHM_QUEUE *lockQueue, LOCK *findlock, bool skip_check)
#if 0
item.tag.pid = pid;
#endif
-
+
if (!(result = (XIDLookupEnt *)
- hash_search(xidTable, (Pointer) &item, HASH_FIND, &found)) || !found)
+ hash_search(xidTable, (Pointer) &item, HASH_FIND, &found)) || !found)
{
elog(NOTICE, "LockAcquire: xid table corrupted");
return true;
@@ -1543,11 +1546,11 @@ DeadLockCheck(SHM_QUEUE *lockQueue, LOCK *findlock, bool skip_check)
if (result->nHolding)
return true;
}
+
/*
- * No sense in looking at the wait queue of the lock we are
- * looking for.
- * If lock == findlock, and I got here, skip_check must be
- * true too.
+ * No sense in looking at the wait queue of the lock we
+ * are looking for. If lock == findlock, and I got here,
+ * skip_check must be true too.
*/
if (lock != findlock)
{
@@ -1558,13 +1561,14 @@ DeadLockCheck(SHM_QUEUE *lockQueue, LOCK *findlock, bool skip_check)
{
checked_procs[nprocs++] = proc;
Assert(nprocs <= MaxBackendId);
+
/*
- * For non-MyProc entries, we are looking only waiters,
- * not necessarily people who already hold locks and are
- * waiting.
- * Now we check for cases where we have two or more
- * tables in a deadlock. We do this by continuing
- * to search for someone holding a lock
+ * For non-MyProc entries, we are looking only
+ * waiters, not necessarily people who already
+ * hold locks and are waiting. Now we check for
+ * cases where we have two or more tables in a
+ * deadlock. We do this by continuing to search
+ * for someone holding a lock
*/
if (DeadLockCheck(&(proc->lockQueue), findlock, false))
return true;
@@ -1573,7 +1577,7 @@ DeadLockCheck(SHM_QUEUE *lockQueue, LOCK *findlock, bool skip_check)
proc = (PROC *) MAKE_PTR(proc->links.prev);
}
}
-
+
if (done)
break;
SHMQueueFirst(&xidLook->queue, (Pointer *) &tmp, &tmp->queue);
@@ -1601,7 +1605,8 @@ DumpLocks()
SPINLOCK masterLock;
int nLockTypes;
LOCK *lock;
- count;
+
+ count;
int tableId = 1;
LOCKTAB *ltable;
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index e232020597d..be91266cf6f 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.33 1998/02/25 00:31:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.34 1998/02/26 04:36:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,7 +46,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.33 1998/02/25 00:31:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.34 1998/02/26 04:36:12 momjian Exp $
*/
#include <sys/time.h>
#include <unistd.h>
@@ -457,25 +457,22 @@ ProcSleep(PROC_QUEUE *waitQueue,
dummy;
/*
- * If the first entries in the waitQueue have a greater priority than
- * we have, we must be a reader, and they must be a writers, and we
- * must be here because the current holder is a writer or a
- * reader but we don't share shared locks if a writer is waiting.
- * We put ourselves after the writers. This way, we have a FIFO, but
- * keep the readers together to give them decent priority, and no one
- * starves. Because we group all readers together, a non-empty queue
- * only has a few possible configurations:
+ * If the first entries in the waitQueue have a greater priority than
+ * we have, we must be a reader, and they must be a writers, and we
+ * must be here because the current holder is a writer or a reader but
+ * we don't share shared locks if a writer is waiting. We put
+ * ourselves after the writers. This way, we have a FIFO, but keep
+ * the readers together to give them decent priority, and no one
+ * starves. Because we group all readers together, a non-empty queue
+ * only has a few possible configurations:
*
- * [readers]
- * [writers]
- * [readers][writers]
- * [writers][readers]
- * [writers][readers][writers]
+ * [readers] [writers] [readers][writers] [writers][readers]
+ * [writers][readers][writers]
*
- * In a full queue, we would have a reader holding a lock, then a
- * writer gets the lock, then a bunch of readers, made up of readers
- * who could not share the first readlock because a writer was waiting,
- * and new readers arriving while the writer had the lock.
+ * In a full queue, we would have a reader holding a lock, then a writer
+ * gets the lock, then a bunch of readers, made up of readers who
+ * could not share the first readlock because a writer was waiting,
+ * and new readers arriving while the writer had the lock.
*
*/
proc = (PROC *) MAKE_PTR(waitQueue->links.prev);
@@ -486,13 +483,13 @@ ProcSleep(PROC_QUEUE *waitQueue,
proc = (PROC *) MAKE_PTR(proc->links.prev);
/* The rest of the queue is FIFO, with readers first, writers last */
- for ( ; i < waitQueue->size && proc->prio <= prio; i++)
+ for (; i < waitQueue->size && proc->prio <= prio; i++)
proc = (PROC *) MAKE_PTR(proc->links.prev);
MyProc->prio = prio;
MyProc->token = token;
MyProc->waitLock = lock;
-
+
/* -------------------
* currently, we only need this for the ProcWakeup routines
* -------------------
@@ -523,7 +520,7 @@ ProcSleep(PROC_QUEUE *waitQueue,
do
{
- MyProc->errType = NO_ERROR; /* reset flag after deadlock check */
+ MyProc->errType = NO_ERROR; /* reset flag after deadlock check */
if (setitimer(ITIMER_REAL, &timeval, &dummy))
elog(FATAL, "ProcSleep: Unable to set timer for process wakeup");
@@ -535,8 +532,9 @@ ProcSleep(PROC_QUEUE *waitQueue,
* --------------
*/
IpcSemaphoreLock(MyProc->sem.semId, MyProc->sem.semNum, IpcExclusiveLock);
- } while (MyProc->errType == STATUS_NOT_FOUND); /* sleep after deadlock check */
-
+ } while (MyProc->errType == STATUS_NOT_FOUND); /* sleep after deadlock
+ * check */
+
/* ---------------
* We were awoken before a timeout - now disable the timer
* ---------------
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index 5e4c493201c..e470fa34f16 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.28 1998/02/23 13:58:04 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.29 1998/02/26 04:36:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,7 +67,7 @@ static MemoryContext MdCxt;
* The number needs to be (2 ** 31) / BLCKSZ, but to be keep
* the math under MAXINT, pre-divide by 256 and use ...
*
- * (((2 ** 23) / BLCKSZ) * (2 ** 8))
+ * (((2 ** 23) / BLCKSZ) * (2 ** 8))
*
* 07 Jan 98 darrenk
*/
@@ -505,33 +505,35 @@ mdblindwrt(char *dbstr,
/* user table? then put in user database area... */
else if (dbid == MyDatabaseId)
{
- extern char *DatabasePath;
-
+ extern char *DatabasePath;
+
path = (char *) palloc(strlen(DatabasePath) + 2 * sizeof(NameData) + 2 + nchars);
if (segno == 0)
sprintf(path, "%s%c%s", DatabasePath, SEP_CHAR, relstr);
else
sprintf(path, "%s%c%s.%d", DatabasePath, SEP_CHAR, relstr, segno);
}
- else /* this is work arround only !!! */
+ else
+/* this is work arround only !!! */
{
- char dbpath[MAXPGPATH+1];
- Oid owner, id;
- char *tmpPath;
-
+ char dbpath[MAXPGPATH + 1];
+ Oid owner,
+ id;
+ char *tmpPath;
+
GetRawDatabaseInfo(dbstr, &owner, &id, dbpath);
-
+
if (id != dbid)
- elog (FATAL, "mdblindwrt: oid of db %s is not %u", dbstr, dbid);
+ elog(FATAL, "mdblindwrt: oid of db %s is not %u", dbstr, dbid);
tmpPath = ExpandDatabasePath(dbpath);
if (tmpPath == NULL)
- elog (FATAL, "mdblindwrt: can't expand path for db %s", dbstr);
+ elog(FATAL, "mdblindwrt: can't expand path for db %s", dbstr);
path = (char *) palloc(strlen(tmpPath) + 2 * sizeof(NameData) + 2 + nchars);
if (segno == 0)
sprintf(path, "%s%c%s", tmpPath, SEP_CHAR, relstr);
else
sprintf(path, "%s%c%s.%d", tmpPath, SEP_CHAR, relstr, segno);
- pfree (tmpPath);
+ pfree(tmpPath);
}
if ((fd = open(path, O_RDWR, 0600)) < 0)
@@ -635,7 +637,7 @@ mdtruncate(Relation reln, int nblocks)
return (nblocks);
-} /* mdtruncate */
+} /* mdtruncate */
/*
* mdcommit() -- Commit a transaction.
diff --git a/src/backend/storage/smgr/smgrtype.c b/src/backend/storage/smgr/smgrtype.c
index a2003c18e36..df8381cdb65 100644
--- a/src/backend/storage/smgr/smgrtype.c
+++ b/src/backend/storage/smgr/smgrtype.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgrtype.c,v 1.7 1998/01/07 21:05:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgrtype.c,v 1.8 1998/02/26 04:36:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,7 +53,7 @@ smgrin(char *s)
return 0;
}
-char *
+char *
smgrout(int2 i)
{
char *s;
diff --git a/src/backend/tcop/dest.c b/src/backend/tcop/dest.c
index 25b8ad984c3..94d9eaad627 100644
--- a/src/backend/tcop/dest.c
+++ b/src/backend/tcop/dest.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.16 1998/01/26 01:41:23 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.17 1998/02/26 04:36:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,7 +61,7 @@ void (*
{
switch (dest)
{
- case RemoteInternal:
+ case RemoteInternal:
return printtup_internal;
break;
diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c
index 1f2bd4b92f2..bf799d5025e 100644
--- a/src/backend/tcop/fastpath.c
+++ b/src/backend/tcop/fastpath.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.12 1998/01/26 01:41:28 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.13 1998/02/26 04:36:26 momjian Exp $
*
* NOTES
* This cruft is the server side of PQfn.
@@ -326,7 +326,9 @@ HandleFunctionRequest()
{ /* by-reference ... */
if (fip->arglen[i] < 0)
{ /* ... varlena */
- if (!(p = palloc(argsize + VARHDRSZ + 1))) /* Added +1 to solve memory leak - Peter 98 Jan 6 */
+ if (!(p = palloc(argsize + VARHDRSZ + 1))) /* Added +1 to solve
+ * memory leak - Peter
+ * 98 Jan 6 */
{
elog(ERROR, "HandleFunctionRequest: palloc failed");
}
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index b981dcb125a..efba35f2404 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.66 1998/02/24 15:19:23 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.67 1998/02/26 04:36:31 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -371,12 +371,13 @@ ReadCommand(char *inBuf)
return InteractiveBackend(inBuf);
}
-List *
-pg_parse_and_plan(char *query_string, /* string to execute */
- Oid *typev, /* argument types */
- int nargs, /* number of arguments */
- QueryTreeList **queryListP, /* pointer to the parse trees */
- CommandDest dest) /* where results should go */
+List *
+pg_parse_and_plan(char *query_string, /* string to execute */
+ Oid *typev, /* argument types */
+ int nargs, /* number of arguments */
+ QueryTreeList **queryListP, /* pointer to the parse
+ * trees */
+ CommandDest dest) /* where results should go */
{
QueryTreeList *querytree_list;
int i;
@@ -416,8 +417,10 @@ pg_parse_and_plan(char *query_string, /* string to execute */
* rewrites */
for (i = 0; i < querytree_list->len; i++)
{
- List *union_result, *union_list, *rewritten_list;
-
+ List *union_result,
+ *union_list,
+ *rewritten_list;
+
querytree = querytree_list->qtrees[i];
@@ -446,14 +449,15 @@ pg_parse_and_plan(char *query_string, /* string to execute */
rewritten = QueryRewrite(querytree);
/*
- * Rewrite the UNIONS.
+ * Rewrite the UNIONS.
*/
foreach(rewritten_list, rewritten)
{
- Query *qry = (Query *)lfirst(rewritten_list);
+ Query *qry = (Query *) lfirst(rewritten_list);
+
union_result = NIL;
foreach(union_list, qry->unionClause)
- union_result = nconc(union_result, QueryRewrite((Query *)lfirst(union_list)));
+ union_result = nconc(union_result, QueryRewrite((Query *) lfirst(union_list)));
qry->unionClause = union_result;
}
@@ -598,11 +602,11 @@ pg_exec_query(char *query_string, char **argv, Oid *typev, int nargs)
}
void
-pg_exec_query_dest(char *query_string,/* string to execute */
- char **argv, /* arguments */
- Oid *typev, /* argument types */
- int nargs, /* number of arguments */
- CommandDest dest) /* where results should go */
+pg_exec_query_dest(char *query_string, /* string to execute */
+ char **argv, /* arguments */
+ Oid *typev, /* argument types */
+ int nargs, /* number of arguments */
+ CommandDest dest) /* where results should go */
{
List *plan_list;
Plan *plan;
@@ -740,11 +744,11 @@ static void
quickdie(SIGNAL_ARGS)
{
elog(NOTICE, "Message from PostgreSQL backend:"
- "\n\tThe Postmaster has informed me that some other backend"
- " died abnormally and possibly corrupted shared memory."
- "\n\tI have rolled back the current transaction and am"
- " going to terminate your database system connection and exit."
- "\n\tPlease reconnect to the database system and repeat your query.");
+ "\n\tThe Postmaster has informed me that some other backend"
+ " died abnormally and possibly corrupted shared memory."
+ "\n\tI have rolled back the current transaction and am"
+ " going to terminate your database system connection and exit."
+ "\n\tPlease reconnect to the database system and repeat your query.");
/*
@@ -767,8 +771,8 @@ static void
FloatExceptionHandler(SIGNAL_ARGS)
{
elog(ERROR, "floating point exception!"
- " The last floating point operation either exceeded legal ranges"
- " or was a divide by zero");
+ " The last floating point operation either exceeded legal ranges"
+ " or was a divide by zero");
}
@@ -868,14 +872,15 @@ PostgresMain(int argc, char *argv[])
#endif
/*
- * get hostname is either the environment variable PGHOST or NULL
- * NULL means Unix-socket only
+ * get hostname is either the environment variable PGHOST or NULL NULL
+ * means Unix-socket only
*/
DataDir = getenv("PGDATA");
+
/*
- * Try to get initial values for date styles and formats.
- * Does not do a complete job, but should be good enough for backend.
- * Cannot call parse_date() since palloc/pfree memory is not set up yet.
+ * Try to get initial values for date styles and formats. Does not do
+ * a complete job, but should be good enough for backend. Cannot call
+ * parse_date() since palloc/pfree memory is not set up yet.
*/
DBDate = getenv("PGDATESTYLE");
if (DBDate != NULL)
@@ -1068,10 +1073,10 @@ PostgresMain(int argc, char *argv[])
* ----------------
*/
{
- int S;
-
+ int S;
+
S = atoi(optarg);
- if ( S >= 4*BLCKSZ/1024 )
+ if (S >= 4 * BLCKSZ / 1024)
SortMem = S;
}
break;
@@ -1117,7 +1122,7 @@ PostgresMain(int argc, char *argv[])
break;
case 'v':
- FrontendProtocol = (ProtocolVersion)atoi(optarg);
+ FrontendProtocol = (ProtocolVersion) atoi(optarg);
break;
case 'x':
@@ -1169,7 +1174,7 @@ PostgresMain(int argc, char *argv[])
userName = GetPgUserName();
#ifdef CYR_RECODE
- SetCharSet();
+ SetCharSet();
#endif
if (FindBackend(pg_pathname, argv[0]) < 0)
@@ -1297,7 +1302,7 @@ PostgresMain(int argc, char *argv[])
if (IsUnderPostmaster == false)
{
puts("\nPOSTGRES backend interactive interface");
- puts("$Revision: 1.66 $ $Date: 1998/02/24 15:19:23 $");
+ puts("$Revision: 1.67 $ $Date: 1998/02/26 04:36:31 $");
}
/* ----------------
diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c
index 6721e3f9633..d836262fdf5 100644
--- a/src/backend/tcop/pquery.c
+++ b/src/backend/tcop/pquery.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.14 1998/02/13 03:42:32 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.15 1998/02/26 04:36:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,7 +66,7 @@ CreateQueryDesc(Query *parsetree,
* Note: this may someday take parameters -cim 9/18/89
* ----------------------------------------------------------------
*/
-EState *
+EState *
CreateExecutorState(void)
{
EState *state;
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 28858cf6289..65ce9d7e035 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.37 1998/01/25 05:14:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.38 1998/02/26 04:36:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,9 +56,9 @@
#include "utils/syscache.h"
#endif
-void DefineUser(CreateUserStmt *stmt);
-void AlterUser(AlterUserStmt *stmt);
-void RemoveUser(char *username);
+void DefineUser(CreateUserStmt *stmt);
+void AlterUser(AlterUserStmt *stmt);
+void RemoveUser(char *username);
/* ----------------
* CHECK_IF_ABORTED() is used to avoid doing unnecessary
@@ -78,7 +78,7 @@ void RemoveUser(char *username);
* ----------------
*/
void
-ProcessUtility(Node * parsetree,
+ProcessUtility(Node *parsetree,
CommandDest dest)
{
char *commandTag = NULL;
@@ -242,12 +242,13 @@ ProcessUtility(Node * parsetree,
CHECK_IF_ABORTED();
/*
- * owner checking done in PerformAddAttribute (now recursive)
+ * owner checking done in PerformAddAttribute (now
+ * recursive)
*/
PerformAddAttribute(stmt->relname,
userName,
stmt->inh,
- (ColumnDef *)stmt->colDef);
+ (ColumnDef *) stmt->colDef);
}
break;
@@ -723,30 +724,30 @@ ProcessUtility(Node * parsetree,
DropProceduralLanguage((DropPLangStmt *) parsetree);
break;
- /*
- * ******************************** USER statements ****
- *
- */
- case T_CreateUserStmt:
- commandTag = "CREATE USER";
- CHECK_IF_ABORTED();
+ /*
+ * ******************************** USER statements ****
+ *
+ */
+ case T_CreateUserStmt:
+ commandTag = "CREATE USER";
+ CHECK_IF_ABORTED();
- DefineUser((CreateUserStmt*)parsetree);
- break;
+ DefineUser((CreateUserStmt *) parsetree);
+ break;
- case T_AlterUserStmt:
- commandTag = "ALTER USER";
- CHECK_IF_ABORTED();
+ case T_AlterUserStmt:
+ commandTag = "ALTER USER";
+ CHECK_IF_ABORTED();
- AlterUser((AlterUserStmt*)parsetree);
- break;
+ AlterUser((AlterUserStmt *) parsetree);
+ break;
- case T_DropUserStmt:
- commandTag = "DROP USER";
- CHECK_IF_ABORTED();
+ case T_DropUserStmt:
+ commandTag = "DROP USER";
+ CHECK_IF_ABORTED();
- RemoveUser(((DropUserStmt*)parsetree)->user);
- break;
+ RemoveUser(((DropUserStmt *) parsetree)->user);
+ break;
/*
diff --git a/src/backend/tioga/Varray.c b/src/backend/tioga/Varray.c
index 20f9b7d6e9b..d5258cb5403 100644
--- a/src/backend/tioga/Varray.c
+++ b/src/backend/tioga/Varray.c
@@ -10,7 +10,7 @@
#include <stdlib.h>
#include "Varray.h"
-Varray *
+Varray *
NewVarray(size_t nobj, size_t size)
/*
* NewVarray -- allocate a Varray to contain an array of val each of which
diff --git a/src/backend/tioga/tgRecipe.c b/src/backend/tioga/tgRecipe.c
index fd45f489f11..94caf287d40 100644
--- a/src/backend/tioga/tgRecipe.c
+++ b/src/backend/tioga/tgRecipe.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tioga/Attic/tgRecipe.c,v 1.7 1997/10/25 01:10:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tioga/Attic/tgRecipe.c,v 1.8 1998/02/26 04:36:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -147,7 +147,7 @@ findNodeInRecipe()
XXX Currently, this is done by linear search. Change to using a hash table.
-------------------------------------- */
-TgNode *
+TgNode *
findNodeInRecipe(TgRecipe * r, char *nodeName)
{
int i;
diff --git a/src/backend/tioga/tgRecipe.h b/src/backend/tioga/tgRecipe.h
index 47e1bbb8f6c..9ffbf20d339 100644
--- a/src/backend/tioga/tgRecipe.h
+++ b/src/backend/tioga/tgRecipe.h
@@ -11,7 +11,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tgRecipe.h,v 1.5 1997/09/08 21:48:03 momjian Exp $
+ * $Id: tgRecipe.h,v 1.6 1998/02/26 04:36:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,6 +32,7 @@ typedef struct
*
*
*
+ *
* geo-decls.h */
#endif /* TIOGA_FRONTEND */
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index 62a977b3fe5..aff5abb5045 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.26 1998/02/25 13:07:43 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.27 1998/02/26 04:36:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -182,7 +182,7 @@ aclparse(char *s, AclItem *aip, unsigned *modechg)
* RETURNS:
* the new Acl
*/
-Acl *
+Acl *
makeacl(int n)
{
Acl *new_acl;
@@ -240,10 +240,10 @@ aclitemin(char *s)
* RETURNS:
* the new string
*/
-char *
+char *
aclitemout(AclItem *aip)
{
- char *p;
+ char *p;
char *out;
HeapTuple htp;
unsigned i;
@@ -272,12 +272,13 @@ aclitemout(AclItem *aip)
#ifdef NOT_USED
- When this elog(NOTICE) goes to the libpq client, it crashes the
- client because the NOTICE protocol is coming right in the middle
- of a request for a field value. We skip the NOTICE for now.
+ When this elog(NOTICE) goes to the libpq client,
+ it crashes the
+ client because the NOTICE protocol is coming right in the middle
+ of a request for a field value.We skip the NOTICE for now.
- elog(NOTICE, "aclitemout: usesysid %d not found",
- aip->ai_id);
+ elog(NOTICE, "aclitemout: usesysid %d not found",
+ aip->ai_id);
#endif
@@ -342,7 +343,7 @@ aclitemgt(AclItem *a1, AclItem *a2)
(a1->ai_idtype == a2->ai_idtype && a1->ai_id > a2->ai_id));
}
-Acl *
+Acl *
aclownerdefault(char *relname, AclId ownerid)
{
Acl *acl;
@@ -359,7 +360,7 @@ aclownerdefault(char *relname, AclId ownerid)
return (acl);
}
-Acl *
+Acl *
acldefault(char *relname)
{
Acl *acl;
@@ -373,7 +374,7 @@ acldefault(char *relname)
return (acl);
}
-Acl *
+Acl *
aclinsert3(Acl *old_acl, AclItem *mod_aip, unsigned modechg)
{
Acl *new_acl;
@@ -490,13 +491,13 @@ aclinsert3(Acl *old_acl, AclItem *mod_aip, unsigned modechg)
* aclinsert
*
*/
-Acl *
+Acl *
aclinsert(Acl *old_acl, AclItem *mod_aip)
{
return (aclinsert3(old_acl, mod_aip, ACL_MODECHG_EQL));
}
-Acl *
+Acl *
aclremove(Acl *old_acl, AclItem *mod_aip)
{
Acl *new_acl;
@@ -583,7 +584,7 @@ aclcontains(Acl *acl, AclItem *aip)
*
*/
-char *
+char *
aclmakepriv(char *old_privlist, char new_priv)
{
char *priv;
@@ -636,7 +637,7 @@ aclmakepriv(char *old_privlist, char new_priv)
*
*/
-char *
+char *
aclmakeuser(char *user_type, char *user)
{
char *user_list;
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index a04a3b6174a..50c42c11207 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.26 1998/02/14 18:00:37 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.27 1998/02/26 04:36:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,7 +43,8 @@
/*-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-*/
static int _ArrayCount(char *str, int dim[], int typdelim);
-static char *_ReadArrayStr(char *arrayStr, int nitems, int ndim, int dim[],
+static char *
+_ReadArrayStr(char *arrayStr, int nitems, int ndim, int dim[],
FmgrInfo *inputproc, Oid typelem, int16 typmod,
char typdelim, int typlen, bool typbyval,
char typalign, int *nbytes);
@@ -90,7 +91,7 @@ static char *array_seek(char *ptr, int eltsize, int nitems);
* the internal representation of the input array
*--------------------------------------------------------------------
*/
-char *
+char *
array_in(char *string, /* input array in external form */
Oid element_type, /* type OID of an array element */
int16 typmod)
@@ -208,7 +209,7 @@ array_in(char *string, /* input array in external form */
/* array not a large object */
dataPtr =
(char *) _ReadArrayStr(p, nitems, ndim, dim, &inputproc, typelem,
- typmod, typdelim, typlen, typbyval, typalign,
+ typmod, typdelim, typlen, typbyval, typalign,
&nbytes);
nbytes += ARR_OVERHEAD(ndim);
retval = (ArrayType *) palloc(nbytes);
@@ -612,7 +613,7 @@ _CopyArrayEls(char **values,
* containing the array in its external format.
*-------------------------------------------------------------------------
*/
-char *
+char *
array_out(ArrayType *v, Oid element_type)
{
int typlen;
@@ -769,7 +770,7 @@ array_out(ArrayType *v, Oid element_type)
* returns the dimension of the array pointed to by "v"
*----------------------------------------------------------------------------
*/
-char *
+char *
array_dims(ArrayType *v, bool *isNull)
{
char *p,
@@ -1071,7 +1072,7 @@ array_clip(ArrayType *array,
* returns a pointer to the modified array.
*-----------------------------------------------------------------------------
*/
-char *
+char *
array_set(ArrayType *array,
int n,
int indx[],
@@ -1206,7 +1207,7 @@ array_set(ArrayType *array,
* returns a pointer to the modified array.
*----------------------------------------------------------------------------
*/
-char *
+char *
array_assgn(ArrayType *array,
int n,
int upperIndx[],
@@ -1722,7 +1723,7 @@ _LOtransfer(char **destfd,
#undef MAX_READ
}
-char *
+char *
_array_newLO(int *fd, int flag)
{
char *p;
diff --git a/src/backend/utils/adt/bool.c b/src/backend/utils/adt/bool.c
index fbfaa6973d4..e781dbe59f1 100644
--- a/src/backend/utils/adt/bool.c
+++ b/src/backend/utils/adt/bool.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.13 1998/01/05 16:39:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/bool.c,v 1.14 1998/02/26 04:36:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,10 @@
bool
boolin(char *b)
{
- switch(*b) {
- case 't':
- case 'T':
+ switch (*b)
+ {
+ case 't':
+ case 'T':
if (strncasecmp(b, "true", strlen(b)) == 0)
return (TRUE);
break;
@@ -72,10 +73,10 @@ boolin(char *b)
break;
}
- elog(ERROR,"Bad boolean external representation '%s'", b);
+ elog(ERROR, "Bad boolean external representation '%s'", b);
/* not reached */
return (FALSE);
-} /* boolin() */
+} /* boolin() */
/*
* boolout - converts 1 or 0 to "t" or "f"
@@ -88,7 +89,7 @@ boolout(bool b)
*result = (b) ? 't' : 'f';
result[1] = '\0';
return (result);
-} /* boolout() */
+} /* boolout() */
/*****************************************************************************
@@ -122,11 +123,11 @@ boolgt(bool arg1, bool arg2)
bool
istrue(bool arg1)
{
- return(arg1 == TRUE);
-} /* istrue() */
+ return (arg1 == TRUE);
+} /* istrue() */
bool
isfalse(bool arg1)
{
- return(arg1 != TRUE);
-} /* isfalse() */
+ return (arg1 != TRUE);
+} /* isfalse() */
diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c
index 7d2f7b937cf..e9e3a971b49 100644
--- a/src/backend/utils/adt/cash.c
+++ b/src/backend/utils/adt/cash.c
@@ -9,7 +9,7 @@
* workings can be found in the book "Software Solutions in C" by
* Dale Schumacher, Academic Press, ISBN: 0-12-632360-7.
*
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.21 1998/01/07 18:46:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.22 1998/02/26 04:36:53 momjian Exp $
*/
#include <stdio.h>
@@ -34,6 +34,7 @@ static const char *num_word(Cash value);
#ifdef USE_LOCALE
static struct lconv *lconvert = NULL;
+
#endif
/* cash_in()
@@ -46,7 +47,7 @@ static struct lconv *lconvert = NULL;
* monetary values returned by localeconv() can be multiple
* bytes/characters. This code assumes one byte only. - tgl 97/04/14
*/
-Cash *
+Cash *
cash_in(const char *str)
{
Cash *result;
@@ -73,7 +74,7 @@ cash_in(const char *str)
/* frac_digits in the C locale seems to return CHAR_MAX */
/* best guess is 2 in this case I think */
- fpoint = ((lconvert->frac_digits != CHAR_MAX) ? lconvert->frac_digits : 2); /* int_frac_digits? */
+ fpoint = ((lconvert->frac_digits != CHAR_MAX) ? lconvert->frac_digits : 2); /* int_frac_digits? */
dsymbol = *lconvert->mon_decimal_point;
ssymbol = *lconvert->mon_thousands_sep;
@@ -90,8 +91,8 @@ cash_in(const char *str)
#endif
#ifdef CASHDEBUG
-printf( "cashin- precision %d; decimal %c; thousands %c; currency %c; positive %c; negative %c\n",
- fpoint, dsymbol, ssymbol, csymbol, psymbol, nsymbol);
+ printf("cashin- precision %d; decimal %c; thousands %c; currency %c; positive %c; negative %c\n",
+ fpoint, dsymbol, ssymbol, csymbol, psymbol, nsymbol);
#endif
/* we need to add all sorts of checking here. For now just */
@@ -164,7 +165,7 @@ printf( "cashin- precision %d; decimal %c; thousands %c; currency %c; positive %
*result = (value * sgn);
return (result);
-} /* cash_in() */
+} /* cash_in() */
/* cash_out()
@@ -201,7 +202,7 @@ cash_out(Cash *in_value)
nsymbol = lconvert->negative_sign;
/* frac_digits in the C locale seems to return CHAR_MAX */
/* best guess is 2 in this case I think */
- points = ((lconvert->frac_digits != CHAR_MAX) ? lconvert->frac_digits : 2); /* int_frac_digits? */
+ points = ((lconvert->frac_digits != CHAR_MAX) ? lconvert->frac_digits : 2); /* int_frac_digits? */
convention = lconvert->n_sign_posn;
#else
mon_group = 3;
@@ -276,7 +277,7 @@ cash_out(Cash *in_value)
}
return (result);
-} /* cash_out() */
+} /* cash_out() */
bool
@@ -286,7 +287,7 @@ cash_eq(Cash *c1, Cash *c2)
return (FALSE);
return (*c1 == *c2);
-} /* cash_eq() */
+} /* cash_eq() */
bool
cash_ne(Cash *c1, Cash *c2)
@@ -295,7 +296,7 @@ cash_ne(Cash *c1, Cash *c2)
return (FALSE);
return (*c1 != *c2);
-} /* cash_ne() */
+} /* cash_ne() */
bool
cash_lt(Cash *c1, Cash *c2)
@@ -304,7 +305,7 @@ cash_lt(Cash *c1, Cash *c2)
return (FALSE);
return (*c1 < *c2);
-} /* cash_lt() */
+} /* cash_lt() */
bool
cash_le(Cash *c1, Cash *c2)
@@ -313,7 +314,7 @@ cash_le(Cash *c1, Cash *c2)
return (FALSE);
return (*c1 <= *c2);
-} /* cash_le() */
+} /* cash_le() */
bool
cash_gt(Cash *c1, Cash *c2)
@@ -322,7 +323,7 @@ cash_gt(Cash *c1, Cash *c2)
return (FALSE);
return (*c1 > *c2);
-} /* cash_gt() */
+} /* cash_gt() */
bool
cash_ge(Cash *c1, Cash *c2)
@@ -331,13 +332,13 @@ cash_ge(Cash *c1, Cash *c2)
return (FALSE);
return (*c1 >= *c2);
-} /* cash_ge() */
+} /* cash_ge() */
/* cash_pl()
* Add two cash values.
*/
-Cash *
+Cash *
cash_pl(Cash *c1, Cash *c2)
{
Cash *result;
@@ -351,13 +352,13 @@ cash_pl(Cash *c1, Cash *c2)
*result = (*c1 + *c2);
return (result);
-} /* cash_pl() */
+} /* cash_pl() */
/* cash_mi()
* Subtract two cash values.
*/
-Cash *
+Cash *
cash_mi(Cash *c1, Cash *c2)
{
Cash *result;
@@ -371,13 +372,13 @@ cash_mi(Cash *c1, Cash *c2)
*result = (*c1 - *c2);
return (result);
-} /* cash_mi() */
+} /* cash_mi() */
/* cash_mul_flt8()
* Multiply cash by float8.
*/
-Cash *
+Cash *
cash_mul_flt8(Cash *c, float8 *f)
{
Cash *result;
@@ -391,17 +392,17 @@ cash_mul_flt8(Cash *c, float8 *f)
*result = ((*f) * (*c));
return (result);
-} /* cash_mul_flt8() */
+} /* cash_mul_flt8() */
/* flt8_mul_cash()
* Multiply float8 by cash.
*/
-Cash *
+Cash *
flt8_mul_cash(float8 *f, Cash *c)
{
return (cash_mul_flt8(c, f));
-} /* flt8_mul_cash() */
+} /* flt8_mul_cash() */
/* cash_div_flt8()
@@ -410,7 +411,7 @@ flt8_mul_cash(float8 *f, Cash *c)
* XXX Don't know if rounding or truncating is correct behavior.
* Round for now. - tgl 97/04/15
*/
-Cash *
+Cash *
cash_div_flt8(Cash *c, float8 *f)
{
Cash *result;
@@ -427,12 +428,12 @@ cash_div_flt8(Cash *c, float8 *f)
*result = rint(*c / *f);
return (result);
-} /* cash_div_flt8() */
+} /* cash_div_flt8() */
/* cash_mul_flt4()
* Multiply cash by float4.
*/
-Cash *
+Cash *
cash_mul_flt4(Cash *c, float4 *f)
{
Cash *result;
@@ -446,17 +447,17 @@ cash_mul_flt4(Cash *c, float4 *f)
*result = ((*f) * (*c));
return (result);
-} /* cash_mul_flt4() */
+} /* cash_mul_flt4() */
/* flt4_mul_cash()
* Multiply float4 by float4.
*/
-Cash *
+Cash *
flt4_mul_cash(float4 *f, Cash *c)
{
return (cash_mul_flt4(c, f));
-} /* flt4_mul_cash() */
+} /* flt4_mul_cash() */
/* cash_div_flt4()
@@ -465,7 +466,7 @@ flt4_mul_cash(float4 *f, Cash *c)
* XXX Don't know if rounding or truncating is correct behavior.
* Round for now. - tgl 97/04/15
*/
-Cash *
+Cash *
cash_div_flt4(Cash *c, float4 *f)
{
Cash *result;
@@ -482,13 +483,13 @@ cash_div_flt4(Cash *c, float4 *f)
*result = rint(*c / *f);
return (result);
-} /* cash_div_flt4() */
+} /* cash_div_flt4() */
/* cash_mul_int4()
* Multiply cash by int4.
*/
-Cash *
+Cash *
cash_mul_int4(Cash *c, int4 i)
{
Cash *result;
@@ -502,17 +503,17 @@ cash_mul_int4(Cash *c, int4 i)
*result = ((i) * (*c));
return (result);
-} /* cash_mul_int4() */
+} /* cash_mul_int4() */
/* int4_mul_cash()
* Multiply int4 by cash.
*/
-Cash *
+Cash *
int4_mul_cash(int4 i, Cash *c)
{
return (cash_mul_int4(c, i));
-} /* int4_mul_cash() */
+} /* int4_mul_cash() */
/* cash_div_int4()
@@ -521,7 +522,7 @@ int4_mul_cash(int4 i, Cash *c)
* XXX Don't know if rounding or truncating is correct behavior.
* Round for now. - tgl 97/04/15
*/
-Cash *
+Cash *
cash_div_int4(Cash *c, int4 i)
{
Cash *result;
@@ -538,13 +539,13 @@ cash_div_int4(Cash *c, int4 i)
*result = rint(*c / i);
return (result);
-} /* cash_div_int4() */
+} /* cash_div_int4() */
/* cash_mul_int2()
* Multiply cash by int2.
*/
-Cash *
+Cash *
cash_mul_int2(Cash *c, int2 s)
{
Cash *result;
@@ -558,17 +559,17 @@ cash_mul_int2(Cash *c, int2 s)
*result = ((s) * (*c));
return (result);
-} /* cash_mul_int2() */
+} /* cash_mul_int2() */
/* int2_mul_cash()
* Multiply int2 by cash.
*/
-Cash *
+Cash *
int2_mul_cash(int2 s, Cash *c)
{
return (cash_mul_int2(c, s));
-} /* int2_mul_cash() */
+} /* int2_mul_cash() */
/* cash_div_int2()
@@ -577,7 +578,7 @@ int2_mul_cash(int2 s, Cash *c)
* XXX Don't know if rounding or truncating is correct behavior.
* Round for now. - tgl 97/04/15
*/
-Cash *
+Cash *
cash_div_int2(Cash *c, int2 s)
{
Cash *result;
@@ -594,13 +595,13 @@ cash_div_int2(Cash *c, int2 s)
*result = rint(*c / s);
return (result);
-} /* cash_div_int2() */
+} /* cash_div_int2() */
/* cashlarger()
* Return larger of two cash values.
*/
-Cash *
+Cash *
cashlarger(Cash *c1, Cash *c2)
{
Cash *result;
@@ -614,13 +615,13 @@ cashlarger(Cash *c1, Cash *c2)
*result = ((*c1 > *c2) ? *c1 : *c2);
return (result);
-} /* cashlarger() */
+} /* cashlarger() */
/* cashsmaller()
* Return smaller of two cash values.
*/
-Cash *
+Cash *
cashsmaller(Cash *c1, Cash *c2)
{
Cash *result;
@@ -634,7 +635,7 @@ cashsmaller(Cash *c1, Cash *c2)
*result = ((*c1 < *c2) ? *c1 : *c2);
return (result);
-} /* cashsmaller() */
+} /* cashsmaller() */
/* cash_words_out()
@@ -691,7 +692,7 @@ cash_words_out(Cash *value)
strcat(buf, m0 == 1 ? " cent" : " cents");
*buf = toupper(*buf);
return (buf);
-} /* cash_words_out() */
+} /* cash_words_out() */
/*************************************************************************
@@ -749,4 +750,4 @@ num_word(Cash value)
}
return (buf);
-} /* num_word() */
+} /* num_word() */
diff --git a/src/backend/utils/adt/char.c b/src/backend/utils/adt/char.c
index cb715cd7c7f..23bfd4c20b0 100644
--- a/src/backend/utils/adt/char.c
+++ b/src/backend/utils/adt/char.c
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.14 1997/11/02 15:25:57 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.15 1998/02/26 04:36:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,7 +40,7 @@ charin(char *ch)
/*
* charout - converts 'x' to "x"
*/
-char *
+char *
charout(int32 ch)
{
char *result = (char *) palloc(2);
@@ -75,7 +75,7 @@ cidin(char *s)
* NOTE: we must no use 'charout' because cid might be a non
* printable character...
*/
-char *
+char *
cidout(int32 c)
{
char *result;
@@ -93,7 +93,7 @@ cidout(int32 c)
* Note:
* Currently if strlen(s) < 14, the extra chars are nulls
*/
-char *
+char *
char16in(char *s)
{
char *result;
@@ -108,7 +108,7 @@ char16in(char *s)
/*
* char16out - converts internal reprsentation to "..."
*/
-char *
+char *
char16out(char *s)
{
char *result = (char *) palloc(17);
@@ -272,7 +272,7 @@ char2in(char *s)
return (res);
}
-char *
+char *
char2out(uint16 s)
{
char *result = (char *) palloc(3);
@@ -338,7 +338,7 @@ char4in(char *s)
return (res);
}
-char *
+char *
char4out(s)
uint32 s;
{
@@ -392,7 +392,7 @@ char4cmp(uint32 a, uint32 b)
}
/* ============================== char8 ============================== */
-char *
+char *
char8in(char *s)
{
char *result;
@@ -405,7 +405,7 @@ char8in(char *s)
return (result);
}
-char *
+char *
char8out(char *s)
{
char *result = (char *) palloc(9);
diff --git a/src/backend/utils/adt/chunk.c b/src/backend/utils/adt/chunk.c
index 9f38f5caadb..2eeebfb12d7 100644
--- a/src/backend/utils/adt/chunk.c
+++ b/src/backend/utils/adt/chunk.c
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.15 1998/02/11 19:12:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/chunk.c,v 1.16 1998/02/26 04:36:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,7 +70,7 @@ GetChunkSize(FILE *fd, int ndim, int dim[MAXDIM], int baseSize,
* information about the chunked file
*-----------------------------------------------------------------------
*/
-char *
+char *
_ChunkArray(int fd,
FILE *afd,
int ndim,
@@ -191,7 +191,7 @@ _FindBestChunk(int size,
* compute the number of page fetches for a given chunk size (d[])
* and access pattern (A[][])
*/
- int i,
+ int i,
j,
nc;
@@ -224,7 +224,7 @@ _FindBestChunk(int size,
static int
get_next(int d[], int k, int C, int dmax[])
{
- int i,
+ int i,
j,
temp;
@@ -266,7 +266,8 @@ get_next(int d[], int k, int C, int dmax[])
}
#ifdef LOARRAY
-static char a_chunk[BLCKSZ + VARHDRSZ];/* VARHDRSZ since a_chunk is in varlena format */
+static char a_chunk[BLCKSZ + VARHDRSZ]; /* VARHDRSZ since a_chunk is in
+ * varlena format */
#endif
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index e3dadad0f94..6b7c24c5488 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.23 1998/02/11 19:12:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.24 1998/02/26 04:36:57 momjian Exp $
*
* NOTES
* This code is actually (almost) unused.
@@ -155,13 +155,13 @@ reltimein(char *str)
elog(ERROR, "Bad reltime (internal coding error) '%s'", str);
return (INVALID_RELTIME);
-} /* reltimein() */
+} /* reltimein() */
/*
* reltimeout - converts the internal format to a reltime string
*/
-char *
+char *
reltimeout(int32 time)
{
char *result;
@@ -184,7 +184,7 @@ reltimeout(int32 time)
strcpy(result, buf);
return (result);
-} /* reltimeout() */
+} /* reltimeout() */
#define TMODULO(t,q,u) {q = (t / u); \
@@ -201,12 +201,12 @@ reltime2tm(int32 time, struct tm * tm)
TMODULO(time, tm->tm_sec, 1);
return;
-} /* reltime2tm() */
+} /* reltime2tm() */
#if FALSE
char *timestring;
long quantity;
-int i;
+int i;
int unitnr;
timestring = (char *) palloc(Max(strlen(INVALID_RELTIME_STR),
@@ -274,7 +274,7 @@ tintervalin(char *intervalstr)
* tintervalout - converts an internal interval format to a string
*
*/
-char *
+char *
tintervalout(TimeInterval interval)
{
char *i_str,
@@ -350,7 +350,7 @@ timespan_reltime(TimeSpan *timespan)
}
return (time);
-} /* timespan_reltime() */
+} /* timespan_reltime() */
TimeSpan *
@@ -378,7 +378,7 @@ reltime_timespan(RelativeTime reltime)
}
return (result);
-} /* reltime_timespan() */
+} /* reltime_timespan() */
/*
@@ -575,7 +575,7 @@ intervalsame(TimeInterval i1, TimeInterval i2)
return (FALSE); /* invalid interval */
return (abstimeeq(i1->data[0], i2->data[0]) &&
abstimeeq(i1->data[1], i2->data[1]));
-} /* intervalsame() */
+} /* intervalsame() */
/*
@@ -585,7 +585,10 @@ intervalsame(TimeInterval i1, TimeInterval i2)
bool
intervaleq(TimeInterval i1, TimeInterval i2)
{
- AbsoluteTime t10, t11, t20, t21;
+ AbsoluteTime t10,
+ t11,
+ t20,
+ t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
return (FALSE); /* invalid interval */
@@ -596,7 +599,7 @@ intervaleq(TimeInterval i1, TimeInterval i2)
t21 = i2->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
- || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
+ || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
return (FALSE);
if (t10 == CURRENT_ABSTIME)
@@ -608,8 +611,8 @@ intervaleq(TimeInterval i1, TimeInterval i2)
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11-t10) == (t21-t20));
-} /* intervaleq() */
+ return ((t11 - t10) == (t21 - t20));
+} /* intervaleq() */
/*
* intervalne - returns 1, iff interval i1 is not equal to interval i2
@@ -618,7 +621,10 @@ intervaleq(TimeInterval i1, TimeInterval i2)
bool
intervalne(TimeInterval i1, TimeInterval i2)
{
- AbsoluteTime t10, t11, t20, t21;
+ AbsoluteTime t10,
+ t11,
+ t20,
+ t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
return (FALSE); /* invalid interval */
@@ -629,7 +635,7 @@ intervalne(TimeInterval i1, TimeInterval i2)
t21 = i2->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
- || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
+ || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
return (FALSE);
if (t10 == CURRENT_ABSTIME)
@@ -641,8 +647,8 @@ intervalne(TimeInterval i1, TimeInterval i2)
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11-t10) != (t21-t20));
-} /* intervalne() */
+ return ((t11 - t10) != (t21 - t20));
+} /* intervalne() */
/*
* intervallt - returns TRUE, iff interval i1 is less than interval i2
@@ -651,7 +657,10 @@ intervalne(TimeInterval i1, TimeInterval i2)
bool
intervallt(TimeInterval i1, TimeInterval i2)
{
- AbsoluteTime t10, t11, t20, t21;
+ AbsoluteTime t10,
+ t11,
+ t20,
+ t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
return (FALSE); /* invalid interval */
@@ -662,7 +671,7 @@ intervallt(TimeInterval i1, TimeInterval i2)
t21 = i2->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
- || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
+ || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
return (FALSE);
if (t10 == CURRENT_ABSTIME)
@@ -674,8 +683,8 @@ intervallt(TimeInterval i1, TimeInterval i2)
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11-t10) < (t21-t20));
-} /* intervallt() */
+ return ((t11 - t10) < (t21 - t20));
+} /* intervallt() */
/*
* intervalle - returns TRUE, iff interval i1 is less than or equal to interval i2
@@ -684,7 +693,10 @@ intervallt(TimeInterval i1, TimeInterval i2)
bool
intervalle(TimeInterval i1, TimeInterval i2)
{
- AbsoluteTime t10, t11, t20, t21;
+ AbsoluteTime t10,
+ t11,
+ t20,
+ t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
return (FALSE); /* invalid interval */
@@ -695,7 +707,7 @@ intervalle(TimeInterval i1, TimeInterval i2)
t21 = i2->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
- || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
+ || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
return (FALSE);
if (t10 == CURRENT_ABSTIME)
@@ -707,8 +719,8 @@ intervalle(TimeInterval i1, TimeInterval i2)
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11-t10) <= (t21-t20));
-} /* intervalle() */
+ return ((t11 - t10) <= (t21 - t20));
+} /* intervalle() */
/*
* intervalgt - returns TRUE, iff interval i1 is less than interval i2
@@ -717,7 +729,10 @@ intervalle(TimeInterval i1, TimeInterval i2)
bool
intervalgt(TimeInterval i1, TimeInterval i2)
{
- AbsoluteTime t10, t11, t20, t21;
+ AbsoluteTime t10,
+ t11,
+ t20,
+ t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
return (FALSE); /* invalid interval */
@@ -728,7 +743,7 @@ intervalgt(TimeInterval i1, TimeInterval i2)
t21 = i2->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
- || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
+ || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
return (FALSE);
if (t10 == CURRENT_ABSTIME)
@@ -740,8 +755,8 @@ intervalgt(TimeInterval i1, TimeInterval i2)
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11-t10) > (t21-t20));
-} /* intervalgt() */
+ return ((t11 - t10) > (t21 - t20));
+} /* intervalgt() */
/*
* intervalge - returns TRUE, iff interval i1 is less than or equal to interval i2
@@ -750,7 +765,10 @@ intervalgt(TimeInterval i1, TimeInterval i2)
bool
intervalge(TimeInterval i1, TimeInterval i2)
{
- AbsoluteTime t10, t11, t20, t21;
+ AbsoluteTime t10,
+ t11,
+ t20,
+ t21;
if (i1->status == T_INTERVAL_INVAL || i2->status == T_INTERVAL_INVAL)
return (FALSE); /* invalid interval */
@@ -761,7 +779,7 @@ intervalge(TimeInterval i1, TimeInterval i2)
t21 = i2->data[1];
if ((t10 == INVALID_ABSTIME) || (t20 == INVALID_ABSTIME)
- || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
+ || (t20 == INVALID_ABSTIME) || (t21 == INVALID_ABSTIME))
return (FALSE);
if (t10 == CURRENT_ABSTIME)
@@ -773,8 +791,8 @@ intervalge(TimeInterval i1, TimeInterval i2)
if (t21 == CURRENT_ABSTIME)
t21 = GetCurrentTransactionStartTime();
- return ((t11-t10) >= (t21-t20));
-} /* intervalge() */
+ return ((t11 - t10) >= (t21 - t20));
+} /* intervalge() */
/*
@@ -963,11 +981,11 @@ isreltime(char *str)
}
return 0;
-} /* isreltime() */
+} /* isreltime() */
#if FALSE
-char *p;
-char c;
+char *p;
+char c;
int i;
char unit[UNITMAXLEN];
char direction[DIRMAXLEN];
@@ -1156,9 +1174,9 @@ istinterval(char *i_string,
AbsoluteTime *i_start,
AbsoluteTime *i_end)
{
- char *p,
+ char *p,
*p1;
- char c;
+ char c;
p = i_string;
/* skip leading blanks up to '[' */
@@ -1259,7 +1277,7 @@ istinterval(char *i_string,
* the Wisconsin benchmark with Illustra whose TimeNow() shows current
* time with precision up to microsecs.) - ay 3/95
*/
-text *
+text *
timeofday(void)
{
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 4e6cea8db5c..2acf11e50bc 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.21 1998/01/07 18:46:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.22 1998/02/26 04:36:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -110,7 +110,7 @@ date_in(char *str)
date = (date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1));
return (date);
-} /* date_in() */
+} /* date_in() */
/* date_out()
* Given internal format date, convert to text string.
@@ -133,7 +133,7 @@ date_out(DateADT date)
strcpy(result, buf);
return (result);
-} /* date_out() */
+} /* date_out() */
bool
date_eq(DateADT dateVal1, DateADT dateVal2)
@@ -151,25 +151,25 @@ bool
date_lt(DateADT dateVal1, DateADT dateVal2)
{
return (dateVal1 < dateVal2);
-} /* date_lt() */
+} /* date_lt() */
bool
date_le(DateADT dateVal1, DateADT dateVal2)
{
return (dateVal1 <= dateVal2);
-} /* date_le() */
+} /* date_le() */
bool
date_gt(DateADT dateVal1, DateADT dateVal2)
{
return (dateVal1 > dateVal2);
-} /* date_gt() */
+} /* date_gt() */
bool
date_ge(DateADT dateVal1, DateADT dateVal2)
{
return (dateVal1 >= dateVal2);
-} /* date_ge() */
+} /* date_ge() */
int
date_cmp(DateADT dateVal1, DateADT dateVal2)
@@ -183,19 +183,19 @@ date_cmp(DateADT dateVal1, DateADT dateVal2)
return 1;
}
return 0;
-} /* date_cmp() */
+} /* date_cmp() */
DateADT
date_larger(DateADT dateVal1, DateADT dateVal2)
{
return (date_gt(dateVal1, dateVal2) ? dateVal1 : dateVal2);
-} /* date_larger() */
+} /* date_larger() */
DateADT
date_smaller(DateADT dateVal1, DateADT dateVal2)
{
return (date_lt(dateVal1, dateVal2) ? dateVal1 : dateVal2);
-} /* date_smaller() */
+} /* date_smaller() */
/* Compute difference between two dates in days.
*/
@@ -203,7 +203,7 @@ int4
date_mi(DateADT dateVal1, DateADT dateVal2)
{
return (dateVal1 - dateVal2);
-} /* date_mi() */
+} /* date_mi() */
/* Add a number of days to a date, giving a new date.
* Must handle both positive and negative numbers of days.
@@ -212,7 +212,7 @@ DateADT
date_pli(DateADT dateVal, int4 days)
{
return (dateVal + days);
-} /* date_pli() */
+} /* date_pli() */
/* Subtract a number of days from a date, giving a new date.
*/
@@ -220,13 +220,13 @@ DateADT
date_mii(DateADT dateVal, int4 days)
{
return (date_pli(dateVal, -days));
-} /* date_mii() */
+} /* date_mii() */
/* date_datetime()
* Convert date to datetime data type.
*/
-DateTime *
+DateTime *
date_datetime(DateADT dateVal)
{
DateTime *result;
@@ -250,7 +250,7 @@ date_datetime(DateADT dateVal)
elog(ERROR, "Datetime out of range", NULL);
return (result);
-} /* date_datetime() */
+} /* date_datetime() */
/* datetime_date()
@@ -291,7 +291,7 @@ datetime_date(DateTime *datetime)
result = (date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - date2j(2000, 1, 1));
return (result);
-} /* datetime_date() */
+} /* datetime_date() */
/* abstime_date()
@@ -333,7 +333,7 @@ abstime_date(AbsoluteTime abstime)
}
return (result);
-} /* abstime_date() */
+} /* abstime_date() */
/* date2tm()
@@ -416,7 +416,7 @@ date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn)
}
return 0;
-} /* date2tm() */
+} /* date2tm() */
/*****************************************************************************
@@ -424,7 +424,7 @@ date2tm(DateADT dateVal, int *tzp, struct tm * tm, double *fsec, char **tzn)
*****************************************************************************/
-TimeADT *
+TimeADT *
time_in(char *str)
{
TimeADT *time;
@@ -458,7 +458,7 @@ time_in(char *str)
*time = ((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec + fsec);
return (time);
-} /* time_in() */
+} /* time_in() */
char *
@@ -487,7 +487,7 @@ time_out(TimeADT *time)
strcpy(result, buf);
return (result);
-} /* time_out() */
+} /* time_out() */
bool
@@ -497,7 +497,7 @@ time_eq(TimeADT *time1, TimeADT *time2)
return (FALSE);
return (*time1 == *time2);
-} /* time_eq() */
+} /* time_eq() */
bool
time_ne(TimeADT *time1, TimeADT *time2)
@@ -506,7 +506,7 @@ time_ne(TimeADT *time1, TimeADT *time2)
return (FALSE);
return (*time1 != *time2);
-} /* time_eq() */
+} /* time_eq() */
bool
time_lt(TimeADT *time1, TimeADT *time2)
@@ -515,7 +515,7 @@ time_lt(TimeADT *time1, TimeADT *time2)
return (FALSE);
return (*time1 < *time2);
-} /* time_eq() */
+} /* time_eq() */
bool
time_le(TimeADT *time1, TimeADT *time2)
@@ -524,7 +524,7 @@ time_le(TimeADT *time1, TimeADT *time2)
return (FALSE);
return (*time1 <= *time2);
-} /* time_eq() */
+} /* time_eq() */
bool
time_gt(TimeADT *time1, TimeADT *time2)
@@ -533,7 +533,7 @@ time_gt(TimeADT *time1, TimeADT *time2)
return (FALSE);
return (*time1 > *time2);
-} /* time_eq() */
+} /* time_eq() */
bool
time_ge(TimeADT *time1, TimeADT *time2)
@@ -542,22 +542,22 @@ time_ge(TimeADT *time1, TimeADT *time2)
return (FALSE);
return (*time1 >= *time2);
-} /* time_eq() */
+} /* time_eq() */
int
time_cmp(TimeADT *time1, TimeADT *time2)
{
return ((*time1 < *time2) ? -1 : (((*time1 > *time2) ? 1 : 0)));
-} /* time_cmp() */
+} /* time_cmp() */
/* datetime_time()
* Convert datetime to time data type.
*/
-TimeADT *
+TimeADT *
datetime_time(DateTime *datetime)
{
- TimeADT *result;
+ TimeADT *result;
struct tm tt,
*tm = &tt;
int tz;
@@ -591,13 +591,13 @@ datetime_time(DateTime *datetime)
*result = ((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec + fsec);
return (result);
-} /* datetime_time() */
+} /* datetime_time() */
/* datetime_datetime()
* Convert date and time to datetime data type.
*/
-DateTime *
+DateTime *
datetime_datetime(DateADT date, TimeADT *time)
{
DateTime *result;
@@ -606,13 +606,15 @@ datetime_datetime(DateADT date, TimeADT *time)
{
result = palloc(sizeof(DateTime));
DATETIME_INVALID(*result);
- } else {
+ }
+ else
+ {
result = date_datetime(date);
*result += *time;
}
return (result);
-} /* datetime_datetime() */
+} /* datetime_datetime() */
int32 /* RelativeTime */
diff --git a/src/backend/utils/adt/dt.c b/src/backend/utils/adt/dt.c
index b80d08ea9a7..9e30ca5bd09 100644
--- a/src/backend/utils/adt/dt.c
+++ b/src/backend/utils/adt/dt.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.51 1998/02/11 19:12:33 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.52 1998/02/26 04:37:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,24 +31,24 @@
#endif
#include "utils/builtins.h"
-static int DecodeDate(char *str, int fmask, int *tmask, struct tm * tm);
+static int DecodeDate(char *str, int fmask, int *tmask, struct tm * tm);
static int
DecodeNumber(int flen, char *field,
int fmask, int *tmask, struct tm * tm, double *fsec);
static int
DecodeNumberField(int len, char *str,
int fmask, int *tmask, struct tm * tm, double *fsec);
-static int DecodeSpecial(int field, char *lowtoken, int *val);
+static int DecodeSpecial(int field, char *lowtoken, int *val);
static int
DecodeTime(char *str, int fmask, int *tmask,
struct tm * tm, double *fsec);
-static int DecodeTimezone(char *str, int *tzp);
-static int DecodeUnits(int field, char *lowtoken, int *val);
-static int EncodeSpecialDateTime(DateTime dt, char *str);
+static int DecodeTimezone(char *str, int *tzp);
+static int DecodeUnits(int field, char *lowtoken, int *val);
+static int EncodeSpecialDateTime(DateTime dt, char *str);
static datetkn *datebsearch(char *key, datetkn *base, unsigned int nel);
static DateTime dt2local(DateTime dt, int timezone);
static void dt2time(DateTime dt, int *hour, int *min, double *sec);
-static int j2day(int jd);
+static int j2day(int jd);
#define USE_DATE_CACHE 1
#define ROUND_ALL 0
@@ -154,12 +154,12 @@ datetime_in(char *str)
}
return (result);
-} /* datetime_in() */
+} /* datetime_in() */
/* datetime_out()
* Convert a datetime to external form.
*/
-char *
+char *
datetime_out(DateTime *dt)
{
char *result;
@@ -193,7 +193,7 @@ datetime_out(DateTime *dt)
strcpy(result, buf);
return (result);
-} /* datetime_out() */
+} /* datetime_out() */
/* timespan_in()
@@ -250,12 +250,12 @@ timespan_in(char *str)
}
return (span);
-} /* timespan_in() */
+} /* timespan_in() */
/* timespan_out()
* Convert a time span to external form.
*/
-char *
+char *
timespan_out(TimeSpan *span)
{
char *result;
@@ -278,7 +278,7 @@ timespan_out(TimeSpan *span)
strcpy(result, buf);
return (result);
-} /* timespan_out() */
+} /* timespan_out() */
/*****************************************************************************
@@ -293,7 +293,7 @@ datetime_finite(DateTime *datetime)
return FALSE;
return (!DATETIME_NOT_FINITE(*datetime));
-} /* datetime_finite() */
+} /* datetime_finite() */
bool
timespan_finite(TimeSpan *timespan)
@@ -302,7 +302,7 @@ timespan_finite(TimeSpan *timespan)
return FALSE;
return (!TIMESPAN_NOT_FINITE(*timespan));
-} /* timespan_finite() */
+} /* timespan_finite() */
/*----------------------------------------------------------
@@ -334,7 +334,7 @@ GetEpochTime(struct tm * tm)
#endif
return;
-} /* GetEpochTime() */
+} /* GetEpochTime() */
DateTime
SetDateTime(DateTime dt)
@@ -361,7 +361,7 @@ SetDateTime(DateTime dt)
}
return (dt);
-} /* SetDateTime() */
+} /* SetDateTime() */
/* datetime_relop - is datetime1 relop datetime2
*/
@@ -386,7 +386,7 @@ datetime_eq(DateTime *datetime1, DateTime *datetime2)
dt2 = SetDateTime(dt2);
return (dt1 == dt2);
-} /* datetime_eq() */
+} /* datetime_eq() */
bool
datetime_ne(DateTime *datetime1, DateTime *datetime2)
@@ -409,7 +409,7 @@ datetime_ne(DateTime *datetime1, DateTime *datetime2)
dt2 = SetDateTime(dt2);
return (dt1 != dt2);
-} /* datetime_ne() */
+} /* datetime_ne() */
bool
datetime_lt(DateTime *datetime1, DateTime *datetime2)
@@ -432,7 +432,7 @@ datetime_lt(DateTime *datetime1, DateTime *datetime2)
dt2 = SetDateTime(dt2);
return (dt1 < dt2);
-} /* datetime_lt() */
+} /* datetime_lt() */
bool
datetime_gt(DateTime *datetime1, DateTime *datetime2)
@@ -458,7 +458,7 @@ datetime_gt(DateTime *datetime1, DateTime *datetime2)
printf("datetime_gt- %f %s greater than %f\n", dt1, ((dt1 > dt2) ? "is" : "is not"), dt2);
#endif
return (dt1 > dt2);
-} /* datetime_gt() */
+} /* datetime_gt() */
bool
datetime_le(DateTime *datetime1, DateTime *datetime2)
@@ -481,7 +481,7 @@ datetime_le(DateTime *datetime1, DateTime *datetime2)
dt2 = SetDateTime(dt2);
return (dt1 <= dt2);
-} /* datetime_le() */
+} /* datetime_le() */
bool
datetime_ge(DateTime *datetime1, DateTime *datetime2)
@@ -504,7 +504,7 @@ datetime_ge(DateTime *datetime1, DateTime *datetime2)
dt2 = SetDateTime(dt2);
return (dt1 >= dt2);
-} /* datetime_ge() */
+} /* datetime_ge() */
/* datetime_cmp - 3-state comparison for datetime
@@ -541,7 +541,7 @@ datetime_cmp(DateTime *datetime1, DateTime *datetime2)
}
return (((dt1 < dt2) ? -1 : ((dt1 > dt2) ? 1 : 0)));
-} /* datetime_cmp() */
+} /* datetime_cmp() */
/* timespan_relop - is timespan1 relop timespan2
@@ -557,7 +557,7 @@ timespan_eq(TimeSpan *timespan1, TimeSpan *timespan2)
return ((timespan1->time == timespan2->time)
&& (timespan1->month == timespan2->month));
-} /* timespan_eq() */
+} /* timespan_eq() */
bool
timespan_ne(TimeSpan *timespan1, TimeSpan *timespan2)
@@ -570,7 +570,7 @@ timespan_ne(TimeSpan *timespan1, TimeSpan *timespan2)
return ((timespan1->time != timespan2->time)
|| (timespan1->month != timespan2->month));
-} /* timespan_ne() */
+} /* timespan_ne() */
bool
timespan_lt(TimeSpan *timespan1, TimeSpan *timespan2)
@@ -592,7 +592,7 @@ timespan_lt(TimeSpan *timespan1, TimeSpan *timespan2)
span2 += (timespan2->month * (30.0 * 86400));
return (span1 < span2);
-} /* timespan_lt() */
+} /* timespan_lt() */
bool
timespan_gt(TimeSpan *timespan1, TimeSpan *timespan2)
@@ -614,7 +614,7 @@ timespan_gt(TimeSpan *timespan1, TimeSpan *timespan2)
span2 += (timespan2->month * (30.0 * 86400));
return (span1 > span2);
-} /* timespan_gt() */
+} /* timespan_gt() */
bool
timespan_le(TimeSpan *timespan1, TimeSpan *timespan2)
@@ -636,7 +636,7 @@ timespan_le(TimeSpan *timespan1, TimeSpan *timespan2)
span2 += (timespan2->month * (30.0 * 86400));
return (span1 <= span2);
-} /* timespan_le() */
+} /* timespan_le() */
bool
timespan_ge(TimeSpan *timespan1, TimeSpan *timespan2)
@@ -658,7 +658,7 @@ timespan_ge(TimeSpan *timespan1, TimeSpan *timespan2)
span2 += (timespan2->month * (30.0 * 86400));
return (span1 >= span2);
-} /* timespan_ge() */
+} /* timespan_ge() */
/* timespan_cmp - 3-state comparison for timespan
@@ -690,7 +690,7 @@ timespan_cmp(TimeSpan *timespan1, TimeSpan *timespan2)
span2 += (timespan2->month * (30.0 * 86400));
return ((span1 < span2) ? -1 : (span1 > span2) ? 1 : 0);
-} /* timespan_cmp() */
+} /* timespan_cmp() */
/*----------------------------------------------------------
@@ -736,7 +736,7 @@ datetime_smaller(DateTime *datetime1, DateTime *datetime2)
}
return (result);
-} /* datetime_smaller() */
+} /* datetime_smaller() */
DateTime *
datetime_larger(DateTime *datetime1, DateTime *datetime2)
@@ -773,7 +773,7 @@ datetime_larger(DateTime *datetime1, DateTime *datetime2)
}
return (result);
-} /* datetime_larger() */
+} /* datetime_larger() */
TimeSpan *
@@ -814,7 +814,7 @@ datetime_mi(DateTime *datetime1, DateTime *datetime2)
result->month = 0;
return (result);
-} /* datetime_mi() */
+} /* datetime_mi() */
/* datetime_pl_span()
@@ -917,7 +917,7 @@ datetime_pl_span(DateTime *datetime, TimeSpan *span)
}
return (result);
-} /* datetime_pl_span() */
+} /* datetime_pl_span() */
DateTime *
datetime_mi_span(DateTime *datetime, TimeSpan *span)
@@ -934,7 +934,7 @@ datetime_mi_span(DateTime *datetime, TimeSpan *span)
result = datetime_pl_span(datetime, &tspan);
return (result);
-} /* datetime_mi_span() */
+} /* datetime_mi_span() */
TimeSpan *
@@ -951,7 +951,7 @@ timespan_um(TimeSpan *timespan)
result->month = -(timespan->month);
return (result);
-} /* timespan_um() */
+} /* timespan_um() */
TimeSpan *
@@ -1007,7 +1007,7 @@ timespan_smaller(TimeSpan *timespan1, TimeSpan *timespan2)
}
return (result);
-} /* timespan_smaller() */
+} /* timespan_smaller() */
TimeSpan *
timespan_larger(TimeSpan *timespan1, TimeSpan *timespan2)
@@ -1062,7 +1062,7 @@ timespan_larger(TimeSpan *timespan1, TimeSpan *timespan2)
}
return (result);
-} /* timespan_larger() */
+} /* timespan_larger() */
TimeSpan *
@@ -1079,7 +1079,7 @@ timespan_pl(TimeSpan *span1, TimeSpan *span2)
result->time = JROUND(span1->time + span2->time);
return (result);
-} /* timespan_pl() */
+} /* timespan_pl() */
TimeSpan *
timespan_mi(TimeSpan *span1, TimeSpan *span2)
@@ -1095,7 +1095,7 @@ timespan_mi(TimeSpan *span1, TimeSpan *span2)
result->time = JROUND(span1->time - span2->time);
return (result);
-} /* timespan_mi() */
+} /* timespan_mi() */
TimeSpan *
timespan_div(TimeSpan *span1, float8 *arg2)
@@ -1115,7 +1115,7 @@ timespan_div(TimeSpan *span1, float8 *arg2)
result->time = JROUND(span1->time / *arg2);
return (result);
-} /* timespan_div() */
+} /* timespan_div() */
/* datetime_age()
* Calculate time difference while retaining year/month fields.
@@ -1259,7 +1259,7 @@ datetime_age(DateTime *datetime1, DateTime *datetime2)
}
return (result);
-} /* datetime_age() */
+} /* datetime_age() */
/*----------------------------------------------------------
@@ -1270,7 +1270,7 @@ datetime_age(DateTime *datetime1, DateTime *datetime2)
/* datetime_text()
* Convert datetime to text data type.
*/
-text *
+text *
datetime_text(DateTime *datetime)
{
text *result;
@@ -1295,7 +1295,7 @@ datetime_text(DateTime *datetime)
pfree(str);
return (result);
-} /* datetime_text() */
+} /* datetime_text() */
/* text_datetime()
@@ -1324,13 +1324,13 @@ text_datetime(text *str)
result = datetime_in(dstr);
return (result);
-} /* text_datetime() */
+} /* text_datetime() */
/* timespan_text()
* Convert timespan to text data type.
*/
-text *
+text *
timespan_text(TimeSpan *timespan)
{
text *result;
@@ -1355,7 +1355,7 @@ timespan_text(TimeSpan *timespan)
pfree(str);
return (result);
-} /* timespan_text() */
+} /* timespan_text() */
/* text_timespan()
@@ -1363,7 +1363,7 @@ timespan_text(TimeSpan *timespan)
* Text type may not be null terminated, so copy to temporary string
* then call the standard input routine.
*/
-TimeSpan *
+TimeSpan *
text_timespan(text *str)
{
TimeSpan *result;
@@ -1384,7 +1384,7 @@ text_timespan(text *str)
result = timespan_in(dstr);
return (result);
-} /* text_timespan() */
+} /* text_timespan() */
/* datetime_trunc()
* Extract specified field from datetime.
@@ -1532,7 +1532,7 @@ datetime_trunc(text *units, DateTime *datetime)
}
return (result);
-} /* datetime_trunc() */
+} /* datetime_trunc() */
/* timespan_trunc()
* Extract specified field from timespan.
@@ -1657,7 +1657,7 @@ timespan_trunc(text *units, TimeSpan *timespan)
}
return (result);
-} /* timespan_trunc() */
+} /* timespan_trunc() */
/* datetime_part()
@@ -1800,7 +1800,7 @@ datetime_part(text *units, DateTime *datetime)
elog(ERROR, "Unable to encode datetime", NULL);
*result = (date2j(tm->tm_year, tm->tm_mon, tm->tm_mday)
- - date2j(tm->tm_year, 1, 1) + 1);
+ - date2j(tm->tm_year, 1, 1) + 1);
break;
default:
@@ -1817,7 +1817,7 @@ datetime_part(text *units, DateTime *datetime)
}
return (result);
-} /* datetime_part() */
+} /* datetime_part() */
/* timespan_part()
@@ -1954,13 +1954,13 @@ timespan_part(text *units, TimeSpan *timespan)
}
return (result);
-} /* timespan_part() */
+} /* timespan_part() */
/* datetime_zone()
* Encode datetime type with specified time zone.
*/
-text *
+text *
datetime_zone(text *zone, DateTime *datetime)
{
text *result;
@@ -2044,7 +2044,7 @@ datetime_zone(text *zone, DateTime *datetime)
}
return (result);
-} /* datetime_zone() */
+} /* datetime_zone() */
/*****************************************************************************
@@ -2066,222 +2066,238 @@ datetime_zone(text *zone, DateTime *datetime)
*/
static datetkn datetktbl[] = {
/* text token lexval */
- {EARLY, RESERV, DTK_EARLY}, /* "-infinity" reserved for "early time" */
- {"acsst", DTZ, 63}, /* Cent. Australia */
- {"acst", TZ, 57}, /* Cent. Australia */
- {DA_D, ADBC, AD}, /* "ad" for years >= 0 */
- {"abstime", IGNORE, 0}, /* "abstime" for pre-v6.1 "Invalid Abstime" */
- {"adt", DTZ, NEG(18)}, /* Atlantic Daylight Time */
- {"aesst", DTZ, 66}, /* E. Australia */
- {"aest", TZ, 60}, /* Australia Eastern Std Time */
- {"ahst", TZ, 60}, /* Alaska-Hawaii Std Time */
- {"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */
- {"am", AMPM, AM},
- {"apr", MONTH, 4},
- {"april", MONTH, 4},
- {"ast", TZ, NEG(24)}, /* Atlantic Std Time (Canada) */
- {"at", IGNORE, 0}, /* "at" (throwaway) */
- {"aug", MONTH, 8},
- {"august", MONTH, 8},
- {"awsst", DTZ, 54}, /* W. Australia */
- {"awst", TZ, 48}, /* W. Australia */
- {DB_C, ADBC, BC}, /* "bc" for years < 0 */
- {"bst", TZ, 6}, /* British Summer Time */
- {"bt", TZ, 18}, /* Baghdad Time */
- {"cadt", DTZ, 63}, /* Central Australian DST */
- {"cast", TZ, 57}, /* Central Australian ST */
- {"cat", TZ, NEG(60)}, /* Central Alaska Time */
- {"cct", TZ, 48}, /* China Coast */
- {"cdt", DTZ, NEG(30)}, /* Central Daylight Time */
- {"cet", TZ, 6}, /* Central European Time */
- {"cetdst", DTZ, 12}, /* Central European Dayl.Time */
- {"cst", TZ, NEG(36)}, /* Central Standard Time */
- {DCURRENT, RESERV, DTK_CURRENT}, /* "current" is always now */
- {"dec", MONTH, 12},
- {"december", MONTH, 12},
- {"dnt", TZ, 6}, /* Dansk Normal Tid */
- {"dow", RESERV, DTK_DOW}, /* day of week */
- {"doy", RESERV, DTK_DOY}, /* day of year */
- {"dst", DTZMOD, 6},
- {"east", TZ, NEG(60)}, /* East Australian Std Time */
- {"edt", DTZ, NEG(24)}, /* Eastern Daylight Time */
- {"eet", TZ, 12}, /* East. Europe, USSR Zone 1 */
- {"eetdst", DTZ, 18}, /* Eastern Europe */
- {EPOCH, RESERV, DTK_EPOCH}, /* "epoch" reserved for system epoch time */
+ {EARLY, RESERV, DTK_EARLY}, /* "-infinity" reserved for "early time" */
+ {"acsst", DTZ, 63}, /* Cent. Australia */
+ {"acst", TZ, 57}, /* Cent. Australia */
+ {DA_D, ADBC, AD}, /* "ad" for years >= 0 */
+ {"abstime", IGNORE, 0}, /* "abstime" for pre-v6.1 "Invalid
+ * Abstime" */
+ {"adt", DTZ, NEG(18)}, /* Atlantic Daylight Time */
+ {"aesst", DTZ, 66}, /* E. Australia */
+ {"aest", TZ, 60}, /* Australia Eastern Std Time */
+ {"ahst", TZ, 60}, /* Alaska-Hawaii Std Time */
+ {"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */
+ {"am", AMPM, AM},
+ {"apr", MONTH, 4},
+ {"april", MONTH, 4},
+ {"ast", TZ, NEG(24)}, /* Atlantic Std Time (Canada) */
+ {"at", IGNORE, 0}, /* "at" (throwaway) */
+ {"aug", MONTH, 8},
+ {"august", MONTH, 8},
+ {"awsst", DTZ, 54}, /* W. Australia */
+ {"awst", TZ, 48}, /* W. Australia */
+ {DB_C, ADBC, BC}, /* "bc" for years < 0 */
+ {"bst", TZ, 6}, /* British Summer Time */
+ {"bt", TZ, 18}, /* Baghdad Time */
+ {"cadt", DTZ, 63}, /* Central Australian DST */
+ {"cast", TZ, 57}, /* Central Australian ST */
+ {"cat", TZ, NEG(60)}, /* Central Alaska Time */
+ {"cct", TZ, 48}, /* China Coast */
+ {"cdt", DTZ, NEG(30)}, /* Central Daylight Time */
+ {"cet", TZ, 6}, /* Central European Time */
+ {"cetdst", DTZ, 12}, /* Central European Dayl.Time */
+ {"cst", TZ, NEG(36)}, /* Central Standard Time */
+ {DCURRENT, RESERV, DTK_CURRENT}, /* "current" is always now */
+ {"dec", MONTH, 12},
+ {"december", MONTH, 12},
+ {"dnt", TZ, 6}, /* Dansk Normal Tid */
+ {"dow", RESERV, DTK_DOW}, /* day of week */
+ {"doy", RESERV, DTK_DOY}, /* day of year */
+ {"dst", DTZMOD, 6},
+ {"east", TZ, NEG(60)}, /* East Australian Std Time */
+ {"edt", DTZ, NEG(24)}, /* Eastern Daylight Time */
+ {"eet", TZ, 12}, /* East. Europe, USSR Zone 1 */
+ {"eetdst", DTZ, 18}, /* Eastern Europe */
+ {EPOCH, RESERV, DTK_EPOCH}, /* "epoch" reserved for system epoch time */
#if USE_AUSTRALIAN_RULES
- {"est", TZ, 60}, /* Australia Eastern Std Time */
+ {"est", TZ, 60}, /* Australia Eastern Std Time */
#else
- {"est", TZ, NEG(30)}, /* Eastern Standard Time */
+ {"est", TZ, NEG(30)}, /* Eastern Standard Time */
#endif
- {"feb", MONTH, 2},
- {"february", MONTH, 2},
- {"fri", DOW, 5},
- {"friday", DOW, 5},
- {"fst", TZ, 6}, /* French Summer Time */
- {"fwt", DTZ, 12}, /* French Winter Time */
- {"gmt", TZ, 0}, /* Greenwish Mean Time */
- {"gst", TZ, 60}, /* Guam Std Time, USSR Zone 9 */
- {"hdt", DTZ, NEG(54)}, /* Hawaii/Alaska */
- {"hmt", DTZ, 18}, /* Hellas ? ? */
- {"hst", TZ, NEG(60)}, /* Hawaii Std Time */
- {"idle", TZ, 72}, /* Intl. Date Line, East */
- {"idlw", TZ, NEG(72)}, /* Intl. Date Line,, est */
- {LATE, RESERV, DTK_LATE}, /* "infinity" reserved for "late time" */
- {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for invalid time */
- {"ist", TZ, 12}, /* Israel */
- {"it", TZ, 22}, /* Iran Time */
- {"jan", MONTH, 1},
- {"january", MONTH, 1},
- {"jst", TZ, 54}, /* Japan Std Time,USSR Zone 8 */
- {"jt", TZ, 45}, /* Java Time */
- {"jul", MONTH, 7},
- {"july", MONTH, 7},
- {"jun", MONTH, 6},
- {"june", MONTH, 6},
- {"kst", TZ, 54}, /* Korea Standard Time */
- {"ligt", TZ, 60}, /* From Melbourne, Australia */
- {"mar", MONTH, 3},
- {"march", MONTH, 3},
- {"may", MONTH, 5},
- {"mdt", DTZ, NEG(36)}, /* Mountain Daylight Time */
- {"mest", DTZ, 12}, /* Middle Europe Summer Time */
- {"met", TZ, 6}, /* Middle Europe Time */
- {"metdst", DTZ, 12}, /* Middle Europe Daylight Time */
- {"mewt", TZ, 6}, /* Middle Europe Winter Time */
- {"mez", TZ, 6}, /* Middle Europe Zone */
- {"mon", DOW, 1},
- {"monday", DOW, 1},
- {"mst", TZ, NEG(42)}, /* Mountain Standard Time */
- {"mt", TZ, 51}, /* Moluccas Time */
- {"ndt", DTZ, NEG(15)}, /* Nfld. Daylight Time */
- {"nft", TZ, NEG(21)}, /* Newfoundland Standard Time */
- {"nor", TZ, 6}, /* Norway Standard Time */
- {"nov", MONTH, 11},
- {"november", MONTH, 11},
- {NOW, RESERV, DTK_NOW}, /* current transaction time */
- {"nst", TZ, NEG(21)}, /* Nfld. Standard Time */
- {"nt", TZ, NEG(66)}, /* Nome Time */
- {"nzdt", DTZ, 78}, /* New Zealand Daylight Time */
- {"nzst", TZ, 72}, /* New Zealand Standard Time */
- {"nzt", TZ, 72}, /* New Zealand Time */
- {"oct", MONTH, 10},
- {"october", MONTH, 10},
- {"on", IGNORE, 0}, /* "on" (throwaway) */
- {"pdt", DTZ, NEG(42)}, /* Pacific Daylight Time */
- {"pm", AMPM, PM},
- {"pst", TZ, NEG(48)}, /* Pacific Standard Time */
- {"sadt", DTZ, 63}, /* S. Australian Dayl. Time */
- {"sast", TZ, 57}, /* South Australian Std Time */
- {"sat", DOW, 6},
- {"saturday", DOW, 6},
- {"sep", MONTH, 9},
- {"sept", MONTH, 9},
- {"september", MONTH, 9},
- {"set", TZ, NEG(6)}, /* Seychelles Time ?? */
- {"sst", DTZ, 12}, /* Swedish Summer Time */
- {"sun", DOW, 0},
- {"sunday", DOW, 0},
- {"swt", TZ, 6}, /* Swedish Winter Time */
- {"thu", DOW, 4},
- {"thur", DOW, 4},
- {"thurs", DOW, 4},
- {"thursday", DOW, 4},
- {TODAY, RESERV, DTK_TODAY}, /* midnight */
- {TOMORROW, RESERV, DTK_TOMORROW}, /* tomorrow midnight */
- {"tue", DOW, 2},
- {"tues", DOW, 2},
- {"tuesday", DOW, 2},
- {"undefined", RESERV, DTK_INVALID}, /* "undefined" pre-v6.1 invalid time */
- {"ut", TZ, 0},
- {"utc", TZ, 0},
- {"wadt", DTZ, 48}, /* West Australian DST */
- {"wast", TZ, 42}, /* West Australian Std Time */
- {"wat", TZ, NEG(6)}, /* West Africa Time */
- {"wdt", DTZ, 54}, /* West Australian DST */
- {"wed", DOW, 3},
- {"wednesday", DOW, 3},
- {"weds", DOW, 3},
- {"wet", TZ, 0}, /* Western Europe */
- {"wetdst", DTZ, 6}, /* Western Europe */
- {"wst", TZ, 48}, /* West Australian Std Time */
- {"ydt", DTZ, NEG(48)}, /* Yukon Daylight Time */
- {YESTERDAY, RESERV, DTK_YESTERDAY}, /* yesterday midnight */
- {"yst", TZ, NEG(54)}, /* Yukon Standard Time */
- {"zp4", TZ, NEG(24)}, /* GMT +4 hours. */
- {"zp5", TZ, NEG(30)}, /* GMT +5 hours. */
- {"zp6", TZ, NEG(36)}, /* GMT +6 hours. */
- {"z", RESERV, DTK_ZULU}, /* 00:00:00 */
- {ZULU, RESERV, DTK_ZULU}, /* 00:00:00 */
+ {"feb", MONTH, 2},
+ {"february", MONTH, 2},
+ {"fri", DOW, 5},
+ {"friday", DOW, 5},
+ {"fst", TZ, 6}, /* French Summer Time */
+ {"fwt", DTZ, 12}, /* French Winter Time */
+ {"gmt", TZ, 0}, /* Greenwish Mean Time */
+ {"gst", TZ, 60}, /* Guam Std Time, USSR Zone 9 */
+ {"hdt", DTZ, NEG(54)}, /* Hawaii/Alaska */
+ {"hmt", DTZ, 18}, /* Hellas ? ? */
+ {"hst", TZ, NEG(60)}, /* Hawaii Std Time */
+ {"idle", TZ, 72}, /* Intl. Date Line, East */
+ {"idlw", TZ, NEG(72)}, /* Intl. Date Line,, est */
+ {LATE, RESERV, DTK_LATE}, /* "infinity" reserved for "late time" */
+ {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for invalid
+ * time */
+ {"ist", TZ, 12}, /* Israel */
+ {"it", TZ, 22}, /* Iran Time */
+ {"jan", MONTH, 1},
+ {"january", MONTH, 1},
+ {"jst", TZ, 54}, /* Japan Std Time,USSR Zone 8 */
+ {"jt", TZ, 45}, /* Java Time */
+ {"jul", MONTH, 7},
+ {"july", MONTH, 7},
+ {"jun", MONTH, 6},
+ {"june", MONTH, 6},
+ {"kst", TZ, 54}, /* Korea Standard Time */
+ {"ligt", TZ, 60}, /* From Melbourne, Australia */
+ {"mar", MONTH, 3},
+ {"march", MONTH, 3},
+ {"may", MONTH, 5},
+ {"mdt", DTZ, NEG(36)}, /* Mountain Daylight Time */
+ {"mest", DTZ, 12}, /* Middle Europe Summer Time */
+ {"met", TZ, 6}, /* Middle Europe Time */
+ {"metdst", DTZ, 12}, /* Middle Europe Daylight Time */
+ {"mewt", TZ, 6}, /* Middle Europe Winter Time */
+ {"mez", TZ, 6}, /* Middle Europe Zone */
+ {"mon", DOW, 1},
+ {"monday", DOW, 1},
+ {"mst", TZ, NEG(42)}, /* Mountain Standard Time */
+ {"mt", TZ, 51}, /* Moluccas Time */
+ {"ndt", DTZ, NEG(15)}, /* Nfld. Daylight Time */
+ {"nft", TZ, NEG(21)}, /* Newfoundland Standard Time */
+ {"nor", TZ, 6}, /* Norway Standard Time */
+ {"nov", MONTH, 11},
+ {"november", MONTH, 11},
+ {NOW, RESERV, DTK_NOW}, /* current transaction time */
+ {"nst", TZ, NEG(21)}, /* Nfld. Standard Time */
+ {"nt", TZ, NEG(66)}, /* Nome Time */
+ {"nzdt", DTZ, 78}, /* New Zealand Daylight Time */
+ {"nzst", TZ, 72}, /* New Zealand Standard Time */
+ {"nzt", TZ, 72}, /* New Zealand Time */
+ {"oct", MONTH, 10},
+ {"october", MONTH, 10},
+ {"on", IGNORE, 0}, /* "on" (throwaway) */
+ {"pdt", DTZ, NEG(42)}, /* Pacific Daylight Time */
+ {"pm", AMPM, PM},
+ {"pst", TZ, NEG(48)}, /* Pacific Standard Time */
+ {"sadt", DTZ, 63}, /* S. Australian Dayl. Time */
+ {"sast", TZ, 57}, /* South Australian Std Time */
+ {"sat", DOW, 6},
+ {"saturday", DOW, 6},
+ {"sep", MONTH, 9},
+ {"sept", MONTH, 9},
+ {"september", MONTH, 9},
+ {"set", TZ, NEG(6)}, /* Seychelles Time ?? */
+ {"sst", DTZ, 12}, /* Swedish Summer Time */
+ {"sun", DOW, 0},
+ {"sunday", DOW, 0},
+ {"swt", TZ, 6}, /* Swedish Winter Time */
+ {"thu", DOW, 4},
+ {"thur", DOW, 4},
+ {"thurs", DOW, 4},
+ {"thursday", DOW, 4},
+ {TODAY, RESERV, DTK_TODAY}, /* midnight */
+ {TOMORROW, RESERV, DTK_TOMORROW}, /* tomorrow midnight */
+ {"tue", DOW, 2},
+ {"tues", DOW, 2},
+ {"tuesday", DOW, 2},
+ {"undefined", RESERV, DTK_INVALID}, /* "undefined" pre-v6.1 invalid
+ * time */
+ {"ut", TZ, 0},
+ {"utc", TZ, 0},
+ {"wadt", DTZ, 48}, /* West Australian DST */
+ {"wast", TZ, 42}, /* West Australian Std Time */
+ {"wat", TZ, NEG(6)}, /* West Africa Time */
+ {"wdt", DTZ, 54}, /* West Australian DST */
+ {"wed", DOW, 3},
+ {"wednesday", DOW, 3},
+ {"weds", DOW, 3},
+ {"wet", TZ, 0}, /* Western Europe */
+ {"wetdst", DTZ, 6}, /* Western Europe */
+ {"wst", TZ, 48}, /* West Australian Std Time */
+ {"ydt", DTZ, NEG(48)}, /* Yukon Daylight Time */
+ {YESTERDAY, RESERV, DTK_YESTERDAY}, /* yesterday midnight */
+ {"yst", TZ, NEG(54)}, /* Yukon Standard Time */
+ {"zp4", TZ, NEG(24)}, /* GMT +4 hours. */
+ {"zp5", TZ, NEG(30)}, /* GMT +5 hours. */
+ {"zp6", TZ, NEG(36)}, /* GMT +6 hours. */
+ {"z", RESERV, DTK_ZULU}, /* 00:00:00 */
+ {ZULU, RESERV, DTK_ZULU}, /* 00:00:00 */
};
static unsigned int szdatetktbl = sizeof datetktbl / sizeof datetktbl[0];
static datetkn deltatktbl[] = {
/* text token lexval */
- {"@", IGNORE, 0}, /* postgres relative time prefix */
- {DAGO, AGO, 0}, /* "ago" indicates negative time offset */
- {"c", UNITS, DTK_CENTURY}, /* "century" relative time units */
- {"cent", UNITS, DTK_CENTURY}, /* "century" relative time units */
- {"centuries", UNITS, DTK_CENTURY}, /* "centuries" relative time units */
- {DCENTURY, UNITS, DTK_CENTURY}, /* "century" relative time units */
- {"d", UNITS, DTK_DAY}, /* "day" relative time units */
- {DDAY, UNITS, DTK_DAY}, /* "day" relative time units */
- {"days", UNITS, DTK_DAY}, /* "days" relative time units */
- {"dec", UNITS, DTK_DECADE}, /* "decade" relative time units */
- {"decs", UNITS, DTK_DECADE}, /* "decades" relative time units */
- {DDECADE, UNITS, DTK_DECADE}, /* "decade" relative time units */
- {"decades", UNITS, DTK_DECADE}, /* "decades" relative time units */
- {"h", UNITS, DTK_HOUR}, /* "hour" relative time units */
- {DHOUR, UNITS, DTK_HOUR}, /* "hour" relative time units */
- {"hours", UNITS, DTK_HOUR}, /* "hours" relative time units */
- {"hr", UNITS, DTK_HOUR}, /* "hour" relative time units */
- {"hrs", UNITS, DTK_HOUR}, /* "hours" relative time units */
- {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for invalid time */
- {"m", UNITS, DTK_MINUTE}, /* "minute" relative time units */
- {"microsecon", UNITS, DTK_MILLISEC}, /* "microsecond" relative time units */
- {"mil", UNITS, DTK_MILLENIUM}, /* "millenium" relative time units */
- {"mils", UNITS, DTK_MILLENIUM}, /* "millenia" relative time units */
- {"millenia", UNITS, DTK_MILLENIUM}, /* "millenia" relative time units */
- {DMILLENIUM, UNITS, DTK_MILLENIUM}, /* "millenium" relative time units */
- {"millisecon", UNITS, DTK_MILLISEC}, /* "millisecond" relative time units */
- {"min", UNITS, DTK_MINUTE}, /* "minute" relative time units */
- {"mins", UNITS, DTK_MINUTE}, /* "minutes" relative time units */
- {"mins", UNITS, DTK_MINUTE}, /* "minutes" relative time units */
- {DMINUTE, UNITS, DTK_MINUTE}, /* "minute" relative time units */
- {"minutes", UNITS, DTK_MINUTE}, /* "minutes" relative time units */
- {"mon", UNITS, DTK_MONTH}, /* "months" relative time units */
- {"mons", UNITS, DTK_MONTH}, /* "months" relative time units */
- {DMONTH, UNITS, DTK_MONTH}, /* "month" relative time units */
- {"months", UNITS, DTK_MONTH}, /* "months" relative time units */
- {"ms", UNITS, DTK_MILLISEC}, /* "millisecond" relative time units */
- {"msec", UNITS, DTK_MILLISEC}, /* "millisecond" relative time units */
- {DMILLISEC, UNITS, DTK_MILLISEC}, /* "millisecond" relative time units */
- {"mseconds", UNITS, DTK_MILLISEC}, /* "milliseconds" relative time units */
- {"msecs", UNITS, DTK_MILLISEC}, /* "milliseconds" relative time units */
- {"qtr", UNITS, DTK_QUARTER}, /* "quarter" relative time units */
- {DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative time units */
- {"reltime", IGNORE, 0}, /* "reltime" for pre-v6.1 "Undefined Reltime" */
- {"s", UNITS, DTK_SECOND}, /* "second" relative time units */
- {"sec", UNITS, DTK_SECOND}, /* "second" relative time units */
- {DSECOND, UNITS, DTK_SECOND}, /* "second" relative time units */
- {"seconds", UNITS, DTK_SECOND}, /* "seconds" relative time units */
- {"secs", UNITS, DTK_SECOND}, /* "seconds" relative time units */
- {DTIMEZONE, UNITS, DTK_TZ}, /* "timezone" time offset */
- {"tz", UNITS, DTK_TZ}, /* "timezone" time offset */
- {"undefined", RESERV, DTK_INVALID}, /* "undefined" pre-v6.1 invalid time */
- {"us", UNITS, DTK_MICROSEC}, /* "microsecond" relative time units */
- {"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative time units */
- {DMICROSEC, UNITS, DTK_MICROSEC}, /* "microsecond" relative time units */
- {"useconds", UNITS, DTK_MICROSEC}, /* "microseconds" relative time units */
- {"usecs", UNITS, DTK_MICROSEC}, /* "microseconds" relative time units */
- {"w", UNITS, DTK_WEEK}, /* "week" relative time units */
- {DWEEK, UNITS, DTK_WEEK}, /* "week" relative time units */
- {"weeks", UNITS, DTK_WEEK}, /* "weeks" relative time units */
- {"y", UNITS, DTK_YEAR}, /* "year" relative time units */
- {DYEAR, UNITS, DTK_YEAR}, /* "year" relative time units */
- {"years", UNITS, DTK_YEAR}, /* "years" relative time units */
- {"yr", UNITS, DTK_YEAR}, /* "year" relative time units */
- {"yrs", UNITS, DTK_YEAR}, /* "years" relative time units */
+ {"@", IGNORE, 0}, /* postgres relative time prefix */
+ {DAGO, AGO, 0}, /* "ago" indicates negative time offset */
+ {"c", UNITS, DTK_CENTURY}, /* "century" relative time units */
+ {"cent", UNITS, DTK_CENTURY}, /* "century" relative time units */
+ {"centuries", UNITS, DTK_CENTURY}, /* "centuries" relative time units */
+ {DCENTURY, UNITS, DTK_CENTURY}, /* "century" relative time units */
+ {"d", UNITS, DTK_DAY}, /* "day" relative time units */
+ {DDAY, UNITS, DTK_DAY}, /* "day" relative time units */
+ {"days", UNITS, DTK_DAY}, /* "days" relative time units */
+ {"dec", UNITS, DTK_DECADE}, /* "decade" relative time units */
+ {"decs", UNITS, DTK_DECADE},/* "decades" relative time units */
+ {DDECADE, UNITS, DTK_DECADE}, /* "decade" relative time units */
+ {"decades", UNITS, DTK_DECADE}, /* "decades" relative time units */
+ {"h", UNITS, DTK_HOUR}, /* "hour" relative time units */
+ {DHOUR, UNITS, DTK_HOUR}, /* "hour" relative time units */
+ {"hours", UNITS, DTK_HOUR}, /* "hours" relative time units */
+ {"hr", UNITS, DTK_HOUR}, /* "hour" relative time units */
+ {"hrs", UNITS, DTK_HOUR}, /* "hours" relative time units */
+ {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for invalid
+ * time */
+ {"m", UNITS, DTK_MINUTE}, /* "minute" relative time units */
+ {"microsecon", UNITS, DTK_MILLISEC}, /* "microsecond" relative
+ * time units */
+ {"mil", UNITS, DTK_MILLENIUM}, /* "millenium" relative time units */
+ {"mils", UNITS, DTK_MILLENIUM}, /* "millenia" relative time units */
+ {"millenia", UNITS, DTK_MILLENIUM}, /* "millenia" relative time units */
+ {DMILLENIUM, UNITS, DTK_MILLENIUM}, /* "millenium" relative time units */
+ {"millisecon", UNITS, DTK_MILLISEC}, /* "millisecond" relative
+ * time units */
+ {"min", UNITS, DTK_MINUTE}, /* "minute" relative time units */
+ {"mins", UNITS, DTK_MINUTE},/* "minutes" relative time units */
+ {"mins", UNITS, DTK_MINUTE},/* "minutes" relative time units */
+ {DMINUTE, UNITS, DTK_MINUTE}, /* "minute" relative time units */
+ {"minutes", UNITS, DTK_MINUTE}, /* "minutes" relative time units */
+ {"mon", UNITS, DTK_MONTH}, /* "months" relative time units */
+ {"mons", UNITS, DTK_MONTH}, /* "months" relative time units */
+ {DMONTH, UNITS, DTK_MONTH}, /* "month" relative time units */
+ {"months", UNITS, DTK_MONTH}, /* "months" relative time units */
+ {"ms", UNITS, DTK_MILLISEC},/* "millisecond" relative time units */
+ {"msec", UNITS, DTK_MILLISEC}, /* "millisecond" relative time
+ * units */
+ {DMILLISEC, UNITS, DTK_MILLISEC}, /* "millisecond" relative time
+ * units */
+ {"mseconds", UNITS, DTK_MILLISEC}, /* "milliseconds" relative time
+ * units */
+ {"msecs", UNITS, DTK_MILLISEC}, /* "milliseconds" relative time
+ * units */
+ {"qtr", UNITS, DTK_QUARTER},/* "quarter" relative time units */
+ {DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative time units */
+ {"reltime", IGNORE, 0}, /* "reltime" for pre-v6.1 "Undefined
+ * Reltime" */
+ {"s", UNITS, DTK_SECOND}, /* "second" relative time units */
+ {"sec", UNITS, DTK_SECOND}, /* "second" relative time units */
+ {DSECOND, UNITS, DTK_SECOND}, /* "second" relative time units */
+ {"seconds", UNITS, DTK_SECOND}, /* "seconds" relative time units */
+ {"secs", UNITS, DTK_SECOND},/* "seconds" relative time units */
+ {DTIMEZONE, UNITS, DTK_TZ}, /* "timezone" time offset */
+ {"tz", UNITS, DTK_TZ}, /* "timezone" time offset */
+ {"undefined", RESERV, DTK_INVALID}, /* "undefined" pre-v6.1 invalid
+ * time */
+ {"us", UNITS, DTK_MICROSEC},/* "microsecond" relative time units */
+ {"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative time
+ * units */
+ {DMICROSEC, UNITS, DTK_MICROSEC}, /* "microsecond" relative time
+ * units */
+ {"useconds", UNITS, DTK_MICROSEC}, /* "microseconds" relative time
+ * units */
+ {"usecs", UNITS, DTK_MICROSEC}, /* "microseconds" relative time
+ * units */
+ {"w", UNITS, DTK_WEEK}, /* "week" relative time units */
+ {DWEEK, UNITS, DTK_WEEK}, /* "week" relative time units */
+ {"weeks", UNITS, DTK_WEEK}, /* "weeks" relative time units */
+ {"y", UNITS, DTK_YEAR}, /* "year" relative time units */
+ {DYEAR, UNITS, DTK_YEAR}, /* "year" relative time units */
+ {"years", UNITS, DTK_YEAR}, /* "years" relative time units */
+ {"yr", UNITS, DTK_YEAR}, /* "year" relative time units */
+ {"yrs", UNITS, DTK_YEAR}, /* "years" relative time units */
};
static unsigned int szdeltatktbl = sizeof deltatktbl / sizeof deltatktbl[0];
@@ -2330,7 +2346,7 @@ date2j(int y, int m, int d)
return ((1461 * (y + 4800 + m12)) / 4 + (367 * (m - 2 - 12 * (m12))) / 12
- (3 * ((y + 4900 + m12) / 100)) / 4 + d - 32075);
-} /* date2j() */
+} /* date2j() */
void
j2date(int jd, int *year, int *month, int *day)
@@ -2359,7 +2375,7 @@ j2date(int jd, int *year, int *month, int *day)
*month = m;
*day = d;
return;
-} /* j2date() */
+} /* j2date() */
static int
j2day(int date)
@@ -2369,7 +2385,7 @@ j2day(int date)
day = (date + 1) % 7;
return (day);
-} /* j2day() */
+} /* j2day() */
/* datetime2tm()
@@ -2529,7 +2545,7 @@ datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
#endif
return 0;
-} /* datetime2tm() */
+} /* datetime2tm() */
/* tm2datetime()
@@ -2559,7 +2575,7 @@ tm2datetime(struct tm * tm, double fsec, int *tzp, DateTime *result)
*result = dt2local(*result, -(*tzp));
return 0;
-} /* tm2datetime() */
+} /* tm2datetime() */
/* timespan2tm()
@@ -2600,7 +2616,7 @@ timespan2tm(TimeSpan span, struct tm * tm, float8 *fsec)
#endif
return 0;
-} /* timespan2tm() */
+} /* timespan2tm() */
int
tm2timespan(struct tm * tm, double fsec, TimeSpan *span)
@@ -2615,7 +2631,7 @@ tm2timespan(struct tm * tm, double fsec, TimeSpan *span)
#endif
return 0;
-} /* tm2timespan() */
+} /* tm2timespan() */
static DateTime
@@ -2624,13 +2640,13 @@ dt2local(DateTime dt, int tz)
dt -= tz;
dt = JROUND(dt);
return (dt);
-} /* dt2local() */
+} /* dt2local() */
double
time2t(const int hour, const int min, const double sec)
{
return ((((hour * 60) + min) * 60) + sec);
-} /* time2t() */
+} /* time2t() */
static void
dt2time(DateTime jd, int *hour, int *min, double *sec)
@@ -2646,7 +2662,7 @@ dt2time(DateTime jd, int *hour, int *min, double *sec)
*sec = JROUND(time);
return;
-} /* dt2time() */
+} /* dt2time() */
/*
@@ -2696,14 +2712,22 @@ ParseDateTime(char *timestr, char *lowstr,
*lp++ = tolower(*cp++);
}
- /* otherwise, number only and will determine year, month, or day later */
+
+ /*
+ * otherwise, number only and will determine year, month, or
+ * day later
+ */
else
{
ftype[nf] = DTK_NUMBER;
}
}
- /* text? then date string, month, day of week, special, or timezone */
+
+ /*
+ * text? then date string, month, day of week, special, or
+ * timezone
+ */
else if (isalpha(*cp))
{
ftype[nf] = DTK_STRING;
@@ -2786,7 +2810,7 @@ ParseDateTime(char *timestr, char *lowstr,
*numfields = nf;
return 0;
-} /* ParseDateTime() */
+} /* ParseDateTime() */
/* DecodeDateTime()
@@ -3086,7 +3110,7 @@ DecodeDateTime(char *field[], int ftype[], int nf,
}
return 0;
-} /* DecodeDateTime() */
+} /* DecodeDateTime() */
/* DecodeTimeOnly()
@@ -3107,7 +3131,8 @@ DecodeTimeOnly(char *field[], int ftype[], int nf, int *dtype, struct tm * tm, d
tm->tm_hour = 0;
tm->tm_min = 0;
tm->tm_sec = 0;
- tm->tm_isdst = -1; /* don't know daylight savings time status apriori */
+ tm->tm_isdst = -1; /* don't know daylight savings time status
+ * apriori */
*fsec = 0;
fmask = DTK_DATE_M;
@@ -3211,7 +3236,7 @@ DecodeTimeOnly(char *field[], int ftype[], int nf, int *dtype, struct tm * tm, d
return -1;
return 0;
-} /* DecodeTimeOnly() */
+} /* DecodeTimeOnly() */
/* DecodeDate()
@@ -3317,7 +3342,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm)
}
return 0;
-} /* DecodeDate() */
+} /* DecodeDate() */
/* DecodeTime()
@@ -3376,7 +3401,7 @@ DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, double *fsec)
return -1;
return 0;
-} /* DecodeTime() */
+} /* DecodeTime() */
/* DecodeNumber()
@@ -3505,7 +3530,7 @@ DecodeNumber(int flen, char *str, int fmask, int *tmask, struct tm * tm, double
}
return 0;
-} /* DecodeNumber() */
+} /* DecodeNumber() */
/* DecodeNumberField()
@@ -3590,7 +3615,7 @@ DecodeNumberField(int len, char *str, int fmask, int *tmask, struct tm * tm, dou
}
return 0;
-} /* DecodeNumberField() */
+} /* DecodeNumberField() */
/* DecodeTimezone()
@@ -3633,7 +3658,7 @@ DecodeTimezone(char *str, int *tzp)
*tzp = -tz;
return (*cp != '\0');
-} /* DecodeTimezone() */
+} /* DecodeTimezone() */
/* DecodeSpecial()
@@ -3684,7 +3709,7 @@ DecodeSpecial(int field, char *lowtoken, int *val)
}
return (type);
-} /* DecodeSpecial() */
+} /* DecodeSpecial() */
/* DecodeDateDelta()
@@ -3692,7 +3717,7 @@ DecodeSpecial(int field, char *lowtoken, int *val)
* Return 0 if decoded and -1 if problems.
*
* Allow "date" field DTK_DATE since this could be just
- * an unsigned floating point number. - thomas 1997-11-16
+ * an unsigned floating point number. - thomas 1997-11-16
*
* If code is changed to read fields from first to last,
* then use READ_FORWARD-bracketed code to allow sign
@@ -3705,6 +3730,7 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
#if READ_FORWARD
int is_neg = FALSE;
+
#endif
char *cp;
@@ -3749,7 +3775,8 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
}
/*
- * read through remaining list backwards to pick up units before values
+ * read through remaining list backwards to pick up units before
+ * values
*/
for (i = nf - 1; i >= ii; i--)
{
@@ -3809,7 +3836,7 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
break;
case DTK_MILLISEC:
- *fsec += ((val +fval) * 1e-3);
+ *fsec += ((val + fval) * 1e-3);
break;
case DTK_SECOND:
@@ -3842,14 +3869,14 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
case DTK_WEEK:
tm->tm_mday += val * 7;
if (fval != 0)
- tm->tm_sec += (fval * (7*86400));
+ tm->tm_sec += (fval * (7 * 86400));
tmask = ((fmask & DTK_M(DAY)) ? 0 : DTK_M(DAY));
break;
case DTK_MONTH:
tm->tm_mon += val;
if (fval != 0)
- tm->tm_sec += (fval * (30*86400));
+ tm->tm_sec += (fval * (30 * 86400));
tmask = DTK_M(MONTH);
break;
@@ -3959,7 +3986,7 @@ DecodeDateDelta(char *field[], int ftype[], int nf, int *dtype, struct tm * tm,
/* ensure that at least one time field has been found */
return ((fmask != 0) ? 0 : -1);
-} /* DecodeDateDelta() */
+} /* DecodeDateDelta() */
/* DecodeUnits()
@@ -4005,7 +4032,7 @@ DecodeUnits(int field, char *lowtoken, int *val)
}
return (type);
-} /* DecodeUnits() */
+} /* DecodeUnits() */
/* datebsearch()
@@ -4015,9 +4042,9 @@ DecodeUnits(int field, char *lowtoken, int *val)
static datetkn *
datebsearch(char *key, datetkn *base, unsigned int nel)
{
- datetkn *last = base + nel - 1,
+ datetkn *last = base + nel - 1,
*position;
- int result;
+ int result;
while (last >= base)
{
@@ -4082,7 +4109,7 @@ EncodeSpecialDateTime(DateTime dt, char *str)
}
return (FALSE);
-} /* EncodeSpecialDateTime() */
+} /* EncodeSpecialDateTime() */
/* EncodeDateOnly()
@@ -4096,17 +4123,17 @@ EncodeDateOnly(struct tm * tm, int style, char *str)
switch (style)
{
- /* compatible with ISO date formats */
+ /* compatible with ISO date formats */
case USE_ISO_DATES:
if (tm->tm_year > 0)
sprintf(str, "%04d-%02d-%02d",
- tm->tm_year, tm->tm_mon, tm->tm_mday);
+ tm->tm_year, tm->tm_mon, tm->tm_mday);
else
sprintf(str, "%04d-%02d-%02d %s",
- -(tm->tm_year - 1), tm->tm_mon, tm->tm_mday, "BC");
+ -(tm->tm_year - 1), tm->tm_mon, tm->tm_mday, "BC");
break;
- /* compatible with Oracle/Ingres date formats */
+ /* compatible with Oracle/Ingres date formats */
case USE_SQL_DATES:
if (EuroDates)
sprintf(str, "%02d/%02d", tm->tm_mday, tm->tm_mon);
@@ -4118,7 +4145,7 @@ EncodeDateOnly(struct tm * tm, int style, char *str)
sprintf((str + 5), "/%04d %s", -(tm->tm_year - 1), "BC");
break;
- /* German-style date format */
+ /* German-style date format */
case USE_GERMAN_DATES:
sprintf(str, "%02d.%02d", tm->tm_mday, tm->tm_mon);
if (tm->tm_year > 0)
@@ -4127,7 +4154,7 @@ EncodeDateOnly(struct tm * tm, int style, char *str)
sprintf((str + 5), ".%04d %s", -(tm->tm_year - 1), "BC");
break;
- /* traditional date-only style for Postgres */
+ /* traditional date-only style for Postgres */
case USE_POSTGRES_DATES:
default:
if (EuroDates)
@@ -4146,7 +4173,7 @@ EncodeDateOnly(struct tm * tm, int style, char *str)
#endif
return (TRUE);
-} /* EncodeDateOnly() */
+} /* EncodeDateOnly() */
/* EncodeTimeOnly()
@@ -4170,19 +4197,19 @@ EncodeTimeOnly(struct tm * tm, double fsec, int style, char *str)
#endif
return (TRUE);
-} /* EncodeTimeOnly() */
+} /* EncodeTimeOnly() */
/* EncodeDateTime()
* Encode date and time interpreted as local time.
* Support several date styles:
- * Postgres - day mon hh:mm:ss yyyy tz
- * SQL - mm/dd/yyyy hh:mm:ss.ss tz
- * ISO - yyyy-mm-dd hh:mm:ss+/-tz
- * German - dd.mm/yyyy hh:mm:ss tz
+ * Postgres - day mon hh:mm:ss yyyy tz
+ * SQL - mm/dd/yyyy hh:mm:ss.ss tz
+ * ISO - yyyy-mm-dd hh:mm:ss+/-tz
+ * German - dd.mm/yyyy hh:mm:ss tz
* Variants (affects order of month and day for Postgres and SQL styles):
- * US - mm/dd/yyyy
- * European - dd/mm/yyyy
+ * US - mm/dd/yyyy
+ * European - dd/mm/yyyy
*/
int
EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, char *str)
@@ -4214,13 +4241,13 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
switch (style)
{
- /* compatible with ISO date formats */
+ /* compatible with ISO date formats */
case USE_ISO_DATES:
if (tm->tm_year > 0)
{
sprintf(str, "%04d-%02d-%02d %02d:%02d:",
- tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min);
+ tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min);
sprintf((str + 17), ((fsec != 0) ? "%05.2f" : "%02.0f"), sec);
if ((*tzn != NULL) && (tm->tm_isdst >= 0))
@@ -4243,14 +4270,14 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
{
if (tm->tm_hour || tm->tm_min)
sprintf(str, "%04d-%02d-%02d %02d:%02d %s",
- -(tm->tm_year - 1), tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, "BC");
+ -(tm->tm_year - 1), tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, "BC");
else
sprintf(str, "%04d-%02d-%02d %s",
- -(tm->tm_year - 1), tm->tm_mon, tm->tm_mday, "BC");
+ -(tm->tm_year - 1), tm->tm_mon, tm->tm_mday, "BC");
}
break;
- /* compatible with Oracle/Ingres date formats */
+ /* compatible with Oracle/Ingres date formats */
case USE_SQL_DATES:
if (EuroDates)
sprintf(str, "%02d/%02d", tm->tm_mday, tm->tm_mon);
@@ -4260,7 +4287,7 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
if (tm->tm_year > 0)
{
sprintf((str + 5), "/%04d %02d:%02d:%05.2f",
- tm->tm_year, tm->tm_hour, tm->tm_min, sec);
+ tm->tm_year, tm->tm_hour, tm->tm_min, sec);
if ((*tzn != NULL) && (tm->tm_isdst >= 0))
{
@@ -4271,16 +4298,16 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
}
else
sprintf((str + 5), "/%04d %02d:%02d %s",
- -(tm->tm_year - 1), tm->tm_hour, tm->tm_min, "BC");
+ -(tm->tm_year - 1), tm->tm_hour, tm->tm_min, "BC");
break;
- /* German variant on European style */
+ /* German variant on European style */
case USE_GERMAN_DATES:
sprintf(str, "%02d.%02d", tm->tm_mday, tm->tm_mon);
if (tm->tm_year > 0)
{
sprintf((str + 5), ".%04d %02d:%02d:%05.2f",
- tm->tm_year, tm->tm_hour, tm->tm_min, sec);
+ tm->tm_year, tm->tm_hour, tm->tm_min, sec);
if ((*tzn != NULL) && (tm->tm_isdst >= 0))
{
@@ -4291,10 +4318,10 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
}
else
sprintf((str + 5), ".%04d %02d:%02d %s",
- -(tm->tm_year - 1), tm->tm_hour, tm->tm_min, "BC");
+ -(tm->tm_year - 1), tm->tm_hour, tm->tm_min, "BC");
break;
- /* backward-compatible with traditional Postgres abstime dates */
+ /* backward-compatible with traditional Postgres abstime dates */
case USE_POSTGRES_DATES:
default:
day = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday);
@@ -4337,7 +4364,7 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
else
{
sprintf((str + 10), " %02d:%02d %04d %s",
- tm->tm_hour, tm->tm_min, -(tm->tm_year - 1), "BC");
+ tm->tm_hour, tm->tm_min, -(tm->tm_year - 1), "BC");
}
break;
}
@@ -4347,7 +4374,7 @@ EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, cha
#endif
return (TRUE);
-} /* EncodeDateTime() */
+} /* EncodeDateTime() */
/* EncodeTimeSpan()
@@ -4365,9 +4392,9 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
switch (style)
{
- /* compatible with ISO date formats */
+ /* compatible with ISO date formats */
case USE_ISO_DATES:
- break;
+ break;
default:
strcpy(cp, "@");
@@ -4401,7 +4428,7 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
switch (style)
{
- /* compatible with ISO date formats */
+ /* compatible with ISO date formats */
case USE_ISO_DATES:
if ((tm->tm_hour != 0) || (tm->tm_min != 0))
is_nonzero = TRUE;
@@ -4486,7 +4513,7 @@ EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str)
#endif
return 0;
-} /* EncodeTimeSpan() */
+} /* EncodeTimeSpan() */
#if defined(linux) && defined(PPC)
diff --git a/src/backend/utils/adt/filename.c b/src/backend/utils/adt/filename.c
index 1039de0b3c7..77bfa4df4e1 100644
--- a/src/backend/utils/adt/filename.c
+++ b/src/backend/utils/adt/filename.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.13 1998/01/05 16:39:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.14 1998/02/26 04:37:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,7 +22,7 @@
#include <miscadmin.h>
#include "utils/builtins.h" /* where function declarations go */
-char *
+char *
filename_in(char *file)
{
char *str;
@@ -72,7 +72,7 @@ filename_in(char *file)
else
{
len = (p - file) - 1;
- StrNCpy(name, file + 1, len+1);
+ StrNCpy(name, file + 1, len + 1);
}
/* printf("name: %s\n"); */
if ((pw = getpwnam(name)) == NULL)
@@ -102,7 +102,7 @@ filename_in(char *file)
else
{
len = (p - file) - 1;
- StrNCpy(environment, file + 1, len+1);
+ StrNCpy(environment, file + 1, len + 1);
}
envirp = getenv(environment);
if (envirp)
@@ -123,7 +123,7 @@ filename_in(char *file)
return (str);
}
-char *
+char *
filename_out(char *s)
{
char *ret;
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index 71b324a5c37..532e0dc30b9 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.28 1998/02/02 00:03:54 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.29 1998/02/26 04:37:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -220,7 +220,7 @@ float4in(char *num)
* float4out - converts a float4 number to a string
* using a standard output format
*/
-char *
+char *
float4out(float32 num)
{
char *ascii = (char *) palloc(MAXFLOATWIDTH + 1);
@@ -262,7 +262,7 @@ float8in(char *num)
* float8out - converts float8 number to a string
* using a standard output format
*/
-char *
+char *
float8out(float64 num)
{
char *ascii = (char *) palloc(MAXDOUBLEWIDTH + 1);
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c
index c3845fdcc4f..83d3ce90b8f 100644
--- a/src/backend/utils/adt/geo_ops.c
+++ b/src/backend/utils/adt/geo_ops.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.30 1998/02/03 15:55:58 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.31 1998/02/26 04:37:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -135,14 +135,14 @@ single_decode(char *str, float8 *x, char **s)
*s = cp;
return (TRUE);
-} /* single_decode() */
+} /* single_decode() */
static int
single_encode(float8 x, char *str)
{
sprintf(str, "%.*g", digits8, x);
return (TRUE);
-} /* single_encode() */
+} /* single_encode() */
static int
pair_decode(char *str, float8 *x, float8 *y, char **s)
@@ -267,7 +267,7 @@ path_decode(int opentype, int npts, char *str, int *isopen, char **ss, Point *p)
*ss = s;
return (TRUE);
-} /* path_decode() */
+} /* path_decode() */
static char *
path_encode(bool closed, int npts, Point *pt)
@@ -315,7 +315,7 @@ path_encode(bool closed, int npts, Point *pt)
*cp = '\0';
return (result);
-} /* path_encode() */
+} /* path_encode() */
/*-------------------------------------------------------------
* pair_count - count the number of points
@@ -385,7 +385,7 @@ box_in(char *str)
}
return (box);
-} /* box_in() */
+} /* box_in() */
/* box_out - convert a box to external form.
*/
@@ -396,7 +396,7 @@ box_out(BOX *box)
return (NULL);
return (path_encode(-1, 2, (Point *) &(box->high)));
-} /* box_out() */
+} /* box_out() */
/* box_construct - fill in a new box.
@@ -620,7 +620,7 @@ box_width(BOX *box)
*result = box->high.x - box->low.x;
return (result);
-} /* box_width() */
+} /* box_width() */
/* box_height - returns the height of the box
@@ -796,7 +796,7 @@ line_construct_pm(Point *pt, double m)
#endif
return (result);
-} /* line_construct_pm() */
+} /* line_construct_pm() */
static LINE * /* two points */
@@ -850,7 +850,7 @@ line_construct_pp(Point *pt1, Point *pt2)
#endif
}
return (result);
-} /* line_construct_pp() */
+} /* line_construct_pp() */
/*----------------------------------------------------------
@@ -875,7 +875,7 @@ line_parallel(LINE *l1, LINE *l2)
}
return (FPeq(l2->A, l1->A * (l2->B / l1->B)));
-} /* line_parallel() */
+} /* line_parallel() */
#ifdef NOT_USED
bool
@@ -897,7 +897,7 @@ line_perp(LINE *l1, LINE *l2)
}
return (FPeq(((l1->A * l2->B) / (l1->B * l2->A)), -1.0));
-} /* line_perp() */
+} /* line_perp() */
#endif
@@ -908,7 +908,7 @@ line_vertical(LINE *line)
return (FPeq(line->A, -1.0) && FPzero(line->B));
#endif
return (FPzero(line->B));
-} /* line_vertical() */
+} /* line_vertical() */
static bool
line_horizontal(LINE *line)
@@ -917,7 +917,7 @@ line_horizontal(LINE *line)
return (FPzero(line->m));
#endif
return (FPzero(line->A));
-} /* line_horizontal() */
+} /* line_horizontal() */
#ifdef NOT_USED
bool
@@ -1028,7 +1028,7 @@ line_interpt(LINE *l1, LINE *l2)
printf("line_interpt- lines intersect at (%.*g,%.*g)\n", digits8, x, digits8, y);
#endif
return (result);
-} /* line_interpt() */
+} /* line_interpt() */
/***********************************************************************
@@ -1094,7 +1094,7 @@ path_in(char *str)
path->closed = (!isopen);
return (path);
-} /* path_in() */
+} /* path_in() */
char *
@@ -1104,7 +1104,7 @@ path_out(PATH *path)
return NULL;
return (path_encode(path->closed, path->npts, (Point *) &(path->p[0])));
-} /* path_out() */
+} /* path_out() */
/*----------------------------------------------------------
@@ -1157,7 +1157,7 @@ path_isclosed(PATH *path)
return FALSE;
return (path->closed);
-} /* path_isclosed() */
+} /* path_isclosed() */
bool
path_isopen(PATH *path)
@@ -1166,7 +1166,7 @@ path_isopen(PATH *path)
return FALSE;
return (!path->closed);
-} /* path_isopen() */
+} /* path_isopen() */
int4
@@ -1176,7 +1176,7 @@ path_npoints(PATH *path)
return 0;
return (path->npts);
-} /* path_npoints() */
+} /* path_npoints() */
PATH *
path_close(PATH *path)
@@ -1190,7 +1190,7 @@ path_close(PATH *path)
result->closed = TRUE;
return (result);
-} /* path_close() */
+} /* path_close() */
PATH *
@@ -1205,7 +1205,7 @@ path_open(PATH *path)
result->closed = FALSE;
return (result);
-} /* path_open() */
+} /* path_open() */
PATH *
@@ -1219,7 +1219,7 @@ path_copy(PATH *path)
memmove((char *) result, (char *) path, size);
return (result);
-} /* path_copy() */
+} /* path_copy() */
/* path_inter -
@@ -1272,11 +1272,11 @@ path_inter(PATH *p1, PATH *p2)
/* if we dropped through, no two segs intersected */
return (FALSE);
-} /* path_inter() */
+} /* path_inter() */
/* path_distance()
* This essentially does a cartesian product of the lsegs in the
- * two paths, and finds the min distance between any two lsegs
+ * two paths, and finds the min distance between any two lsegs
*/
double *
path_distance(PATH *p1, PATH *p2)
@@ -1314,7 +1314,7 @@ path_distance(PATH *p1, PATH *p2)
}
return (min);
-} /* path_distance() */
+} /* path_distance() */
/*----------------------------------------------------------
@@ -1334,7 +1334,7 @@ path_length(PATH *path)
*result += point_dt(&path->p[i], &path->p[i + 1]);
return (result);
-} /* path_length() */
+} /* path_length() */
#ifdef NOT_USED
@@ -1349,7 +1349,7 @@ path_ln(PATH *path)
result += point_dt(&path->p[i], &path->p[i + 1]);
return (result);
-} /* path_ln() */
+} /* path_ln() */
#endif
@@ -1387,7 +1387,7 @@ point_in(char *str)
point->y = y;
return (point);
-} /* point_in() */
+} /* point_in() */
char *
point_out(Point *pt)
@@ -1396,7 +1396,7 @@ point_out(Point *pt)
return (NULL);
return (path_encode(-1, 1, pt));
-} /* point_out() */
+} /* point_out() */
static Point *
@@ -1480,7 +1480,7 @@ point_eq(Point *pt1, Point *pt2)
bool
point_ne(Point *pt1, Point *pt2)
{
- return (! point_eq(pt1, pt2));
+ return (!point_eq(pt1, pt2));
}
/*----------------------------------------------------------
@@ -1510,8 +1510,8 @@ double
point_dt(Point *pt1, Point *pt2)
{
#ifdef GEODEBUG
-printf("point_dt- segment (%f,%f),(%f,%f) length is %f\n",
- pt1->x, pt1->y, pt2->x, pt2->y, HYPOT(pt1->x - pt2->x, pt1->y - pt2->y));
+ printf("point_dt- segment (%f,%f),(%f,%f) length is %f\n",
+ pt1->x, pt1->y, pt2->x, pt2->y, HYPOT(pt1->x - pt2->x, pt1->y - pt2->y));
#endif
return (HYPOT(pt1->x - pt2->x, pt1->y - pt2->y));
}
@@ -1575,7 +1575,7 @@ lseg_in(char *str)
#endif
return (lseg);
-} /* lseg_in() */
+} /* lseg_in() */
char *
@@ -1585,7 +1585,7 @@ lseg_out(LSEG *ls)
return (NULL);
return (path_encode(FALSE, 2, (Point *) &(ls->p[0])));
-} /* lseg_out() */
+} /* lseg_out() */
/* lseg_construct -
@@ -1633,7 +1633,7 @@ lseg_length(LSEG *lseg)
result = point_distance(&lseg->p[0], &lseg->p[1]);
return (result);
-} /* lseg_length() */
+} /* lseg_length() */
/*----------------------------------------------------------
* Relative position routines.
@@ -1671,15 +1671,15 @@ lseg_parallel(LSEG *l1, LSEG *l2)
#endif
return (FPeq(point_sl(&(l1->p[0]), &(l1->p[1])),
point_sl(&(l2->p[0]), &(l2->p[1]))));
-} /* lseg_parallel() */
+} /* lseg_parallel() */
/* lseg_perp()
* Determine if two line segments are perpendicular.
*
* This code did not get the correct answer for
- * '((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg
+ * '((0,0),(0,1))'::lseg ?-| '((0,0),(1,0))'::lseg
* So, modified it to check explicitly for slope of vertical line
- * returned by point_sl() and the results seem better.
+ * returned by point_sl() and the results seem better.
* - thomas 1998-01-31
*/
bool
@@ -1692,15 +1692,15 @@ lseg_perp(LSEG *l1, LSEG *l2)
m2 = point_sl(&(l2->p[0]), &(l2->p[1]));
#ifdef GEODEBUG
-printf("lseg_perp- slopes are %g and %g\n", m1, m2);
+ printf("lseg_perp- slopes are %g and %g\n", m1, m2);
#endif
if (FPzero(m1))
- return(FPeq(m2, DBL_MAX));
+ return (FPeq(m2, DBL_MAX));
else if (FPzero(m2))
- return(FPeq(m1, DBL_MAX));
+ return (FPeq(m1, DBL_MAX));
return (FPeq(m1 / m2, -1.0));
-} /* lseg_perp() */
+} /* lseg_perp() */
bool
lseg_vertical(LSEG *lseg)
@@ -1722,7 +1722,7 @@ lseg_eq(LSEG *l1, LSEG *l2)
FPeq(l1->p[1].y, l2->p[1].y) &&
FPeq(l1->p[0].x, l2->p[0].x) &&
FPeq(l1->p[1].y, l2->p[1].y));
-} /* lseg_eq() */
+} /* lseg_eq() */
bool
lseg_ne(LSEG *l1, LSEG *l2)
@@ -1731,31 +1731,31 @@ lseg_ne(LSEG *l1, LSEG *l2)
!FPeq(l1->p[1].y, l2->p[1].y) ||
!FPeq(l1->p[0].x, l2->p[0].x) ||
!FPeq(l1->p[1].y, l2->p[1].y));
-} /* lseg_ne() */
+} /* lseg_ne() */
bool
lseg_lt(LSEG *l1, LSEG *l2)
{
return (FPlt(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1])));
-} /* lseg_lt() */
+} /* lseg_lt() */
bool
lseg_le(LSEG *l1, LSEG *l2)
{
return (FPle(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1])));
-} /* lseg_le() */
+} /* lseg_le() */
bool
lseg_gt(LSEG *l1, LSEG *l2)
{
return (FPgt(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1])));
-} /* lseg_gt() */
+} /* lseg_gt() */
bool
lseg_ge(LSEG *l1, LSEG *l2)
{
return (FPge(point_dt(&l1->p[0], &l1->p[1]), point_dt(&l2->p[0], &l2->p[1])));
-} /* lseg_ge() */
+} /* lseg_ge() */
/*----------------------------------------------------------
@@ -1805,7 +1805,7 @@ lseg_dt(LSEG *l1, LSEG *l2)
pfree(d);
return (result);
-} /* lseg_dt() */
+} /* lseg_dt() */
Point *
@@ -1822,7 +1822,7 @@ lseg_center(LSEG *lseg)
result->y = (lseg->p[0].y - lseg->p[1].y) / 2;
return (result);
-} /* lseg_center() */
+} /* lseg_center() */
/* lseg_interpt -
@@ -1875,7 +1875,7 @@ lseg_interpt(LSEG *l1, LSEG *l2)
pfree(tmp2);
return (result);
-} /* lseg_interpt() */
+} /* lseg_interpt() */
/***********************************************************************
**
@@ -2158,7 +2158,7 @@ dist_cpoly(CIRCLE *circle, POLYGON *poly)
*result = 0;
return (result);
-} /* dist_cpoly() */
+} /* dist_cpoly() */
/*---------------------------------------------------------------------
@@ -2255,17 +2255,17 @@ close_pl(Point *pt, LINE *line)
tmp = line_construct_pm(pt, invm);
result = line_interpt(tmp, line);
return (result);
-} /* close_pl() */
+} /* close_pl() */
/* close_ps()
* Closest point on line segment to specified point.
* Take the closest endpoint if the point is left, right,
- * above, or below the segment, otherwise find the intersection
- * point of the segment and its perpendicular through the point.
+ * above, or below the segment, otherwise find the intersection
+ * point of the segment and its perpendicular through the point.
*
* Some tricky code here, relying on boolean expressions
- * evaluating to only zero or one to use as an array index.
+ * evaluating to only zero or one to use as an array index.
*/
Point *
close_ps(Point *pt, LSEG *lseg)
@@ -2294,7 +2294,7 @@ close_ps(Point *pt, LSEG *lseg)
if (lseg_vertical(lseg))
{
#ifdef GEODEBUG
-printf("close_ps- segment is vertical\n");
+ printf("close_ps- segment is vertical\n");
#endif
result = palloc(sizeof(*result));
result->x = lseg->p[0].x;
@@ -2304,7 +2304,7 @@ printf("close_ps- segment is vertical\n");
else if (lseg_horizontal(lseg))
{
#ifdef GEODEBUG
-printf("close_ps- segment is horizontal\n");
+ printf("close_ps- segment is horizontal\n");
#endif
result = palloc(sizeof(*result));
result->x = pt->x;
@@ -2316,7 +2316,7 @@ printf("close_ps- segment is horizontal\n");
tmp = line_construct_pm(pt, invm);
result = interpt_sl(lseg, tmp);
return (result);
-} /* close_ps() */
+} /* close_ps() */
/* close_lseg()
* Closest point to l1 on l2.
@@ -2352,7 +2352,8 @@ close_lseg(LSEG *l1, LSEG *l2)
if (*(d = dist_ps(&l2->p[1], l1)) < dist)
{
- if (result != NULL) pfree(result);
+ if (result != NULL)
+ pfree(result);
result = close_ps(&l2->p[1], l1);
memcpy(&point, result, sizeof(point));
@@ -2368,7 +2369,7 @@ close_lseg(LSEG *l1, LSEG *l2)
}
return (result);
-} /* close_lseg() */
+} /* close_lseg() */
/* close_pb()
* Closest point on or in box to specified point.
@@ -2396,7 +2397,7 @@ close_pb(Point *pt, BOX *box)
if (*(d = dist_ps(pt, &seg)) < dist)
{
dist = *d;
- memcpy(&lseg,&seg,sizeof(lseg));
+ memcpy(&lseg, &seg, sizeof(lseg));
}
pfree(d);
@@ -2406,7 +2407,7 @@ close_pb(Point *pt, BOX *box)
if (*(d = dist_ps(pt, &seg)) < dist)
{
dist = *d;
- memcpy(&lseg,&seg,sizeof(lseg));
+ memcpy(&lseg, &seg, sizeof(lseg));
}
pfree(d);
@@ -2414,19 +2415,19 @@ close_pb(Point *pt, BOX *box)
if (*(d = dist_ps(pt, &seg)) < dist)
{
dist = *d;
- memcpy(&lseg,&seg,sizeof(lseg));
+ memcpy(&lseg, &seg, sizeof(lseg));
}
pfree(d);
return (close_ps(pt, &lseg));
-} /* close_pb() */
+} /* close_pb() */
/* close_sl()
* Closest point on line to line segment.
*
* XXX THIS CODE IS WRONG
* The code is actually calculating the point on the line segment
- * which is backwards from the routine naming convention.
+ * which is backwards from the routine naming convention.
* Copied code to new routine close_ls() but haven't fixed this one yet.
* - thomas 1998-01-31
*/
@@ -2477,7 +2478,7 @@ close_ls(LINE *line, LSEG *lseg)
pfree(d1);
pfree(d2);
return (result);
-} /* close_ls() */
+} /* close_ls() */
/* close_sb()
* Closest point on or in box to line segment.
@@ -2534,7 +2535,7 @@ close_sb(LSEG *lseg, BOX *box)
/* OK, we now have the closest line segment on the box boundary */
return (close_lseg(lseg, &bseg));
-} /* close_sb() */
+} /* close_sb() */
Point *
close_lb(LINE *line, BOX *box)
@@ -2662,7 +2663,7 @@ on_ppath(Point *pt, PATH *path)
if (FPeq(yh, yl)) /* horizontal seg? */
if (FPge(pt->x, xl) && FPle(pt->x, xh) &&
FPeq(pt->y, yh))
- return (TRUE); /* pt lies on seg */
+ return (TRUE); /* pt lies on seg */
else
continue; /* skip other hz segs */
if (FPlt(yh, pt->y) || /* pt is strictly below seg */
@@ -2690,7 +2691,7 @@ on_ppath(Point *pt, PATH *path)
return (above == UNDEF || /* path is horizontal */
inter % 2); /* odd # of intersections */
#endif
-} /* on_ppath() */
+} /* on_ppath() */
bool
@@ -2700,7 +2701,7 @@ on_sl(LSEG *lseg, LINE *line)
return (FALSE);
return (on_pl(&lseg->p[0], line) && on_pl(&lseg->p[1], line));
-} /* on_sl() */
+} /* on_sl() */
bool
on_sb(LSEG *lseg, BOX *box)
@@ -2709,7 +2710,7 @@ on_sb(LSEG *lseg, BOX *box)
return (FALSE);
return (on_pb(&lseg->p[0], box) && on_pb(&lseg->p[1], box));
-} /* on_sb() */
+} /* on_sb() */
/*---------------------------------------------------------------------
* inter_
@@ -2738,7 +2739,7 @@ inter_sl(LSEG *lseg, LINE *line)
*
* Segment completely inside box counts as intersection.
* If you want only segments crossing box boundaries,
- * try converting box to path first.
+ * try converting box to path first.
*
* Optimize for non-intersection by checking for box intersection first.
* - thomas 1998-01-30
@@ -2789,7 +2790,7 @@ inter_sb(LSEG *lseg, BOX *box)
/* if we dropped through, no two segs intersected */
return (FALSE);
-} /* inter_sb() */
+} /* inter_sb() */
/* inter_lb()
* Do line and box intersect?
@@ -2884,7 +2885,7 @@ make_bound_box(POLYGON *poly)
* "x0,y0,...,xn,yn"
* also supports the older style "(x1,...,xn,y1,...yn)"
*------------------------------------------------------------------*/
-POLYGON *
+POLYGON *
poly_in(char *str)
{
POLYGON *poly;
@@ -2913,7 +2914,7 @@ poly_in(char *str)
make_bound_box(poly);
return (poly);
-} /* poly_in() */
+} /* poly_in() */
/*---------------------------------------------------------------
* poly_out - convert internal POLYGON representation to the
@@ -2927,7 +2928,7 @@ poly_out(POLYGON *poly)
return NULL;
return (path_encode(TRUE, poly->npts, &(poly->p[0])));
-} /* poly_out() */
+} /* poly_out() */
/*-------------------------------------------------------
@@ -3001,7 +3002,7 @@ poly_same(POLYGON *polya, POLYGON *polyb)
}
return TRUE;
#endif
-} /* poly_same() */
+} /* poly_same() */
/*-----------------------------------------------------------------
* Determine if polygon A overlaps polygon B by determining if
@@ -3065,7 +3066,7 @@ poly_contain(POLYGON *polya, POLYGON *polyb)
polya->boundbox.low.x, polya->boundbox.low.y, polya->boundbox.high.x, polya->boundbox.high.y);
#endif
return (FALSE);
-} /* poly_contain() */
+} /* poly_contain() */
/*-----------------------------------------------------------------
@@ -3085,7 +3086,7 @@ bool
poly_contained(POLYGON *polya, POLYGON *polyb)
{
return (poly_contain(polyb, polya));
-} /* poly_contained() */
+} /* poly_contained() */
/* poly_contain_pt()
@@ -3105,7 +3106,7 @@ poly_contain_pt(POLYGON *poly, Point *p)
return (FALSE);
return (point_inside(p, poly->npts, &(poly->p[0])) != 0);
-} /* poly_contain_pt() */
+} /* poly_contain_pt() */
bool
pt_contained_poly(Point *p, POLYGON *poly)
@@ -3114,7 +3115,7 @@ pt_contained_poly(Point *p, POLYGON *poly)
return (FALSE);
return (poly_contain_pt(poly, p));
-} /* pt_contained_poly() */
+} /* pt_contained_poly() */
double *
@@ -3130,7 +3131,7 @@ poly_distance(POLYGON *polya, POLYGON *polyb)
*result = 0;
return (result);
-} /* poly_distance() */
+} /* poly_distance() */
/***********************************************************************
@@ -3146,7 +3147,7 @@ point(float8 *x, float8 *y)
return (NULL);
return (point_construct(*x, *y));
-} /* point() */
+} /* point() */
Point *
@@ -3163,7 +3164,7 @@ point_add(Point *p1, Point *p2)
result->y = (p1->y + p2->y);
return (result);
-} /* point_add() */
+} /* point_add() */
Point *
point_sub(Point *p1, Point *p2)
@@ -3179,7 +3180,7 @@ point_sub(Point *p1, Point *p2)
result->y = (p1->y - p2->y);
return (result);
-} /* point_sub() */
+} /* point_sub() */
Point *
point_mul(Point *p1, Point *p2)
@@ -3195,7 +3196,7 @@ point_mul(Point *p1, Point *p2)
result->y = (p1->x * p2->y) + (p1->y * p2->x);
return (result);
-} /* point_mul() */
+} /* point_mul() */
Point *
point_div(Point *p1, Point *p2)
@@ -3217,7 +3218,7 @@ point_div(Point *p1, Point *p2)
result->y = ((p2->x * p1->y) - (p2->y * p1->x)) / div;
return (result);
-} /* point_div() */
+} /* point_div() */
/***********************************************************************
@@ -3237,7 +3238,7 @@ box(Point *p1, Point *p2)
result = box_construct(p1->x, p2->x, p1->y, p2->y);
return (result);
-} /* box() */
+} /* box() */
BOX *
box_add(BOX *box, Point *p)
@@ -3251,7 +3252,7 @@ box_add(BOX *box, Point *p)
(box->high.y + p->y), (box->low.y + p->y));
return (result);
-} /* box_add() */
+} /* box_add() */
BOX *
box_sub(BOX *box, Point *p)
@@ -3265,7 +3266,7 @@ box_sub(BOX *box, Point *p)
(box->high.y - p->y), (box->low.y - p->y));
return (result);
-} /* box_sub() */
+} /* box_sub() */
BOX *
box_mul(BOX *box, Point *p)
@@ -3285,7 +3286,7 @@ box_mul(BOX *box, Point *p)
pfree(low);
return (result);
-} /* box_mul() */
+} /* box_mul() */
BOX *
box_div(BOX *box, Point *p)
@@ -3305,7 +3306,7 @@ box_div(BOX *box, Point *p)
pfree(low);
return (result);
-} /* box_div() */
+} /* box_div() */
/***********************************************************************
@@ -3357,7 +3358,7 @@ path_add(PATH *p1, PATH *p2)
}
return (result);
-} /* path_add() */
+} /* path_add() */
/* path_add_pt()
* Translation operator.
@@ -3380,7 +3381,7 @@ path_add_pt(PATH *path, Point *point)
}
return (result);
-} /* path_add_pt() */
+} /* path_add_pt() */
PATH *
path_sub_pt(PATH *path, Point *point)
@@ -3400,7 +3401,7 @@ path_sub_pt(PATH *path, Point *point)
}
return (result);
-} /* path_sub_pt() */
+} /* path_sub_pt() */
/* path_mul_pt()
@@ -3427,7 +3428,7 @@ path_mul_pt(PATH *path, Point *point)
}
return (result);
-} /* path_mul_pt() */
+} /* path_mul_pt() */
PATH *
path_div_pt(PATH *path, Point *point)
@@ -3450,7 +3451,7 @@ path_div_pt(PATH *path, Point *point)
}
return (result);
-} /* path_div_pt() */
+} /* path_div_pt() */
bool
@@ -3460,7 +3461,7 @@ path_contain_pt(PATH *path, Point *p)
return (FALSE);
return ((path->closed ? (point_inside(p, path->npts, &(path->p[0])) != 0) : FALSE));
-} /* path_contain_pt() */
+} /* path_contain_pt() */
bool
pt_contained_path(Point *p, PATH *path)
@@ -3469,7 +3470,7 @@ pt_contained_path(Point *p, PATH *path)
return (FALSE);
return (path_contain_pt(path, p));
-} /* pt_contained_path() */
+} /* pt_contained_path() */
Point *
@@ -3486,9 +3487,9 @@ path_center(PATH *path)
result = NULL;
return (result);
-} /* path_center() */
+} /* path_center() */
-POLYGON *
+POLYGON *
path_poly(PATH *path)
{
POLYGON *poly;
@@ -3516,7 +3517,7 @@ path_poly(PATH *path)
make_bound_box(poly);
return (poly);
-} /* path_polygon() */
+} /* path_polygon() */
/* upgradepath()
@@ -3556,7 +3557,7 @@ upgradepath(PATH *path)
}
return (result);
-} /* upgradepath() */
+} /* upgradepath() */
bool
isoldpath(PATH *path)
@@ -3565,7 +3566,7 @@ isoldpath(PATH *path)
return (FALSE);
return (path->npts == (path->p[0].y + 1));
-} /* isoldpath() */
+} /* isoldpath() */
/***********************************************************************
@@ -3581,7 +3582,7 @@ poly_npoints(POLYGON *poly)
return (FALSE);
return (poly->npts);
-} /* poly_npoints() */
+} /* poly_npoints() */
Point *
@@ -3605,7 +3606,7 @@ poly_center(POLYGON *poly)
}
return (result);
-} /* poly_center() */
+} /* poly_center() */
BOX *
@@ -3619,13 +3620,13 @@ poly_box(POLYGON *poly)
box = box_copy(&poly->boundbox);
return (box);
-} /* poly_box() */
+} /* poly_box() */
/* box_poly()
* Convert a box to a polygon.
*/
-POLYGON *
+POLYGON *
box_poly(BOX *box)
{
POLYGON *poly;
@@ -3653,7 +3654,7 @@ box_poly(BOX *box)
box_fill(&poly->boundbox, box->high.x, box->low.x, box->high.y, box->low.y);
return (poly);
-} /* box_poly() */
+} /* box_poly() */
PATH *
@@ -3680,7 +3681,7 @@ poly_path(POLYGON *poly)
}
return (path);
-} /* poly_path() */
+} /* poly_path() */
/* upgradepoly()
@@ -3688,7 +3689,7 @@ poly_path(POLYGON *poly)
* Old-style: '(x1,x2,...,y1,y2,...)'
* New-style: '(x1,y1,x2,y2,...)'
*/
-POLYGON *
+POLYGON *
upgradepoly(POLYGON *poly)
{
POLYGON *result;
@@ -3729,12 +3730,12 @@ upgradepoly(POLYGON *poly)
}
return (result);
-} /* upgradepoly() */
+} /* upgradepoly() */
/* revertpoly()
* Reverse effect of upgradepoly().
*/
-POLYGON *
+POLYGON *
revertpoly(POLYGON *poly)
{
POLYGON *result;
@@ -3775,7 +3776,7 @@ revertpoly(POLYGON *poly)
}
return (result);
-} /* revertpoly() */
+} /* revertpoly() */
/***********************************************************************
@@ -3854,7 +3855,7 @@ circle_in(char *str)
elog(ERROR, "Bad circle external representation '%s'", str);
return (circle);
-} /* circle_in() */
+} /* circle_in() */
/* circle_out - convert a circle to external form.
*/
@@ -3886,7 +3887,7 @@ circle_out(CIRCLE *circle)
*cp = '\0';
return (result);
-} /* circle_out() */
+} /* circle_out() */
/*----------------------------------------------------------
@@ -3902,7 +3903,7 @@ circle_same(CIRCLE *circle1, CIRCLE *circle2)
return (FPeq(circle1->radius, circle2->radius)
&& FPeq(circle1->center.x, circle2->center.x)
&& FPeq(circle1->center.y, circle2->center.y));
-} /* circle_same() */
+} /* circle_same() */
/* circle_overlap - does circle1 overlap circle2?
*/
@@ -3986,37 +3987,37 @@ bool
circle_eq(CIRCLE *circle1, CIRCLE *circle2)
{
return (FPeq(circle_ar(circle1), circle_ar(circle2)));
-} /* circle_eq() */
+} /* circle_eq() */
bool
circle_ne(CIRCLE *circle1, CIRCLE *circle2)
{
return (!circle_eq(circle1, circle2));
-} /* circle_ne() */
+} /* circle_ne() */
bool
circle_lt(CIRCLE *circle1, CIRCLE *circle2)
{
return (FPlt(circle_ar(circle1), circle_ar(circle2)));
-} /* circle_lt() */
+} /* circle_lt() */
bool
circle_gt(CIRCLE *circle1, CIRCLE *circle2)
{
return (FPgt(circle_ar(circle1), circle_ar(circle2)));
-} /* circle_gt() */
+} /* circle_gt() */
bool
circle_le(CIRCLE *circle1, CIRCLE *circle2)
{
return (FPle(circle_ar(circle1), circle_ar(circle2)));
-} /* circle_le() */
+} /* circle_le() */
bool
circle_ge(CIRCLE *circle1, CIRCLE *circle2)
{
return (FPge(circle_ar(circle1), circle_ar(circle2)));
-} /* circle_ge() */
+} /* circle_ge() */
/*----------------------------------------------------------
@@ -4039,7 +4040,7 @@ circle_copy(CIRCLE *circle)
memmove((char *) result, (char *) circle, sizeof(CIRCLE));
return (result);
-} /* circle_copy() */
+} /* circle_copy() */
/* circle_add_pt()
@@ -4059,7 +4060,7 @@ circle_add_pt(CIRCLE *circle, Point *point)
result->center.y += point->y;
return (result);
-} /* circle_add_pt() */
+} /* circle_add_pt() */
CIRCLE *
circle_sub_pt(CIRCLE *circle, Point *point)
@@ -4075,7 +4076,7 @@ circle_sub_pt(CIRCLE *circle, Point *point)
result->center.y -= point->y;
return (result);
-} /* circle_sub_pt() */
+} /* circle_sub_pt() */
/* circle_mul_pt()
@@ -4099,7 +4100,7 @@ circle_mul_pt(CIRCLE *circle, Point *point)
result->radius *= HYPOT(point->x, point->y);
return (result);
-} /* circle_mul_pt() */
+} /* circle_mul_pt() */
CIRCLE *
circle_div_pt(CIRCLE *circle, Point *point)
@@ -4119,7 +4120,7 @@ circle_div_pt(CIRCLE *circle, Point *point)
result->radius /= HYPOT(point->x, point->y);
return (result);
-} /* circle_div_pt() */
+} /* circle_div_pt() */
/* circle_area - returns the area of the circle.
@@ -4179,7 +4180,7 @@ circle_distance(CIRCLE *circle1, CIRCLE *circle2)
*result = 0;
return (result);
-} /* circle_distance() */
+} /* circle_distance() */
bool
@@ -4196,14 +4197,14 @@ circle_contain_pt(CIRCLE *circle, Point *point)
pfree(d);
return (within);
-} /* circle_contain_pt() */
+} /* circle_contain_pt() */
bool
pt_contained_circle(Point *point, CIRCLE *circle)
{
return (circle_contain_pt(circle, point));
-} /* circle_contain_pt() */
+} /* circle_contain_pt() */
/* dist_pc - returns the distance between
@@ -4221,7 +4222,7 @@ dist_pc(Point *point, CIRCLE *circle)
*result = 0;
return (result);
-} /* dist_pc() */
+} /* dist_pc() */
/* circle_center - returns the center point of the circle.
@@ -4286,7 +4287,7 @@ circle(Point *center, float8 *radius)
}
-BOX *
+BOX *
circle_box(CIRCLE *circle)
{
BOX *box;
@@ -4305,7 +4306,7 @@ circle_box(CIRCLE *circle)
box->low.y = circle->center.y - delta;
return (box);
-} /* circle_box() */
+} /* circle_box() */
/* box_circle()
* Convert a box to a circle.
@@ -4326,10 +4327,10 @@ box_circle(BOX *box)
circle->radius = point_dt(&circle->center, &box->high);
return (circle);
-} /* box_circle() */
+} /* box_circle() */
-POLYGON *
+POLYGON *
circle_poly(int npts, CIRCLE *circle)
{
POLYGON *poly;
@@ -4403,7 +4404,7 @@ poly_circle(POLYGON *poly)
elog(ERROR, "Unable to convert polygon to circle", NULL);
return (circle);
-} /* poly_circle() */
+} /* poly_circle() */
/***********************************************************************
@@ -4471,7 +4472,7 @@ point_inside(Point *p, int npts, Point plist[])
return 1;
}
return 0;
-} /* point_inside() */
+} /* point_inside() */
/* lseg_crossing()
@@ -4534,7 +4535,7 @@ lseg_crossing(double x, double y, double px, double py)
return (HIT_IT);
return (FPgt((sgn * z), 0) ? 0 : 2 * sgn);
}
-} /* lseg_crossing() */
+} /* lseg_crossing() */
static bool
@@ -4594,4 +4595,4 @@ plist_same(int npts, Point p1[], Point p2[])
}
return (FALSE);
-} /* plist_same() */
+} /* plist_same() */
diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c
index e7767e4cdbd..2bf1fdf80f3 100644
--- a/src/backend/utils/adt/int.c
+++ b/src/backend/utils/adt/int.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.14 1998/02/11 19:12:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.15 1998/02/26 04:37:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -80,7 +80,7 @@ int2out(int16 sh)
int16 *
int28in(char *shs)
{
- int16 (*result)[];
+ int16 (*result)[];
int nums;
if (shs == NULL)
@@ -109,9 +109,9 @@ int28in(char *shs)
char *
int28out(int16 (*shs)[])
{
- int num;
- int16 *sp;
- char *rp;
+ int num;
+ int16 *sp;
+ char *rp;
char *result;
if (shs == NULL)
@@ -145,7 +145,7 @@ int32 *
int44in(char *input_string)
{
int32 *foo = (int32 *) palloc(4 * sizeof(int32));
- int i = 0;
+ int i = 0;
i = sscanf(input_string,
"%d, %d, %d, %d",
@@ -242,10 +242,10 @@ i4toi2(int32 arg1)
text *
int2_text(int16 arg1)
{
- text *result;
+ text *result;
- int len;
- char *str;
+ int len;
+ char *str;
str = int2out(arg1);
len = (strlen(str) + VARHDRSZ);
@@ -257,36 +257,36 @@ int2_text(int16 arg1)
pfree(str);
- return(result);
-} /* int2_text() */
+ return (result);
+} /* int2_text() */
int16
text_int2(text *string)
{
- int16 result;
+ int16 result;
- int len;
- char *str;
+ int len;
+ char *str;
len = (VARSIZE(string) - VARHDRSZ);
- str = palloc(len+1);
+ str = palloc(len + 1);
memmove(str, VARDATA(string), len);
- *(str+len) = '\0';
+ *(str + len) = '\0';
result = int2in(str);
pfree(str);
-
- return(result);
-} /* text_int2() */
+
+ return (result);
+} /* text_int2() */
text *
int4_text(int32 arg1)
{
- text *result;
+ text *result;
- int len;
- char *str;
+ int len;
+ char *str;
str = int4out(arg1);
len = (strlen(str) + VARHDRSZ);
@@ -298,28 +298,28 @@ int4_text(int32 arg1)
pfree(str);
- return(result);
-} /* int4_text() */
+ return (result);
+} /* int4_text() */
int32
text_int4(text *string)
{
- int32 result;
+ int32 result;
- int len;
- char *str;
+ int len;
+ char *str;
len = (VARSIZE(string) - VARHDRSZ);
- str = palloc(len+1);
+ str = palloc(len + 1);
memmove(str, VARDATA(string), len);
- *(str+len) = '\0';
+ *(str + len) = '\0';
result = int4in(str);
pfree(str);
-
- return(result);
-} /* text_int4() */
+
+ return (result);
+} /* text_int4() */
/*
diff --git a/src/backend/utils/adt/like.c b/src/backend/utils/adt/like.c
index 35446cd7da7..7d4681262d5 100644
--- a/src/backend/utils/adt/like.c
+++ b/src/backend/utils/adt/like.c
@@ -48,7 +48,7 @@ fixedlen_like(char *s, struct varlena * p, int charlen)
/* be sure sterm is null-terminated */
sterm = (char *) palloc(charlen + 1);
- StrNCpy(sterm, s, charlen+1);
+ StrNCpy(sterm, s, charlen + 1);
/*
* p is a text = varlena, not a string so we have to make a string
@@ -150,7 +150,7 @@ textnlike(struct varlena * s, struct varlena * p)
}
-/* $Revision: 1.11 $
+/* $Revision: 1.12 $
** "like.c" A first attempt at a LIKE operator for Postgres95.
**
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
@@ -187,7 +187,7 @@ textnlike(struct varlena * s, struct varlena * p)
static int
DoMatch(char *text, char *p)
{
- int matched;
+ int matched;
for (; *p; text ++, p++)
{
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c
index 7c4d1364a76..c186ea15908 100644
--- a/src/backend/utils/adt/nabstime.c
+++ b/src/backend/utils/adt/nabstime.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.41 1998/02/02 01:28:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.42 1998/02/26 04:37:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -103,7 +103,7 @@ GetCurrentAbsoluteTime(void)
#endif
return ((AbsoluteTime) now);
-} /* GetCurrentAbsoluteTime() */
+} /* GetCurrentAbsoluteTime() */
void
@@ -114,7 +114,7 @@ GetCurrentTime(struct tm * tm)
abstime2tm(GetCurrentTransactionStartTime(), &tz, tm, NULL);
return;
-} /* GetCurrentTime() */
+} /* GetCurrentTime() */
void
@@ -190,7 +190,7 @@ abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn)
#endif
return;
-} /* abstime2tm() */
+} /* abstime2tm() */
/* tm2abstime()
@@ -231,7 +231,7 @@ tm2abstime(struct tm * tm, int tz)
return (INVALID_ABSTIME);
return (sec);
-} /* tm2abstime() */
+} /* tm2abstime() */
/* nabstimein()
@@ -300,13 +300,13 @@ nabstimein(char *str)
};
return result;
-} /* nabstimein() */
+} /* nabstimein() */
/* nabstimeout()
* Given an AbsoluteTime return the English text version of the date
*/
-char *
+char *
nabstimeout(AbsoluteTime time)
{
char *result;
@@ -347,7 +347,7 @@ nabstimeout(AbsoluteTime time)
strcpy(result, buf);
return (result);
-} /* nabstimeout() */
+} /* nabstimeout() */
/*
@@ -392,7 +392,7 @@ abstime_finite(AbsoluteTime abstime)
{
return ((abstime != INVALID_ABSTIME)
&& (abstime != NOSTART_ABSTIME) && (abstime != NOEND_ABSTIME));
-} /* abstime_finite() */
+} /* abstime_finite() */
/*
@@ -534,7 +534,7 @@ datetime_abstime(DateTime *datetime)
};
return (result);
-} /* datetime_abstime() */
+} /* datetime_abstime() */
/* abstime_datetime()
* Convert abstime to datetime.
@@ -575,4 +575,4 @@ abstime_datetime(AbsoluteTime abstime)
};
return (result);
-} /* abstime_datetime() */
+} /* abstime_datetime() */
diff --git a/src/backend/utils/adt/name.c b/src/backend/utils/adt/name.c
index fb281a3e4e3..3cabfaf8b42 100644
--- a/src/backend/utils/adt/name.c
+++ b/src/backend/utils/adt/name.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.10 1997/10/25 01:10:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.11 1998/02/26 04:37:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,7 +48,7 @@ namein(char *s)
/*
* nameout - converts internal reprsentation to "..."
*/
-char *
+char *
nameout(NameData *s)
{
if (s == NULL)
diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c
index f3c9fb07adc..6797253b9b0 100644
--- a/src/backend/utils/adt/numutils.c
+++ b/src/backend/utils/adt/numutils.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.22 1998/02/11 19:12:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.23 1998/02/26 04:37:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -184,9 +184,9 @@ ftoa(double value, char *ascii, int width, int prec1, char format)
#else
auto int expon;
auto int sign;
- int avail = 0;
- char *a = NULL;
- char *p = NULL;
+ int avail = 0;
+ char *a = NULL;
+ char *p = NULL;
char mode;
int lowercase;
int prec;
@@ -333,7 +333,7 @@ frac_out:
*a = 0;
avail = a - ascii;
return (avail);
-#endif
+#endif
}
#endif
@@ -370,13 +370,13 @@ frac_out:
int
atof1(char *str, double *val)
{
- char *p;
+ char *p;
double v;
double fact;
int minus;
- char c;
+ char c;
int expon;
- int gotmant;
+ int gotmant;
v = 0.0;
p = str;
diff --git a/src/backend/utils/adt/oid.c b/src/backend/utils/adt/oid.c
index c7224a04e18..e6d66d126ed 100644
--- a/src/backend/utils/adt/oid.c
+++ b/src/backend/utils/adt/oid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.14 1998/02/11 19:12:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.15 1998/02/26 04:37:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,10 +28,10 @@
* Note:
* Fills any nonexistent digits with NULL oids.
*/
-Oid *
+Oid *
oid8in(char *oidString)
{
- Oid (*result)[];
+ Oid (*result)[];
int nums;
if (oidString == NULL)
@@ -60,9 +60,9 @@ oid8in(char *oidString)
char *
oid8out(Oid (*oidArray)[])
{
- int num;
- Oid *sp;
- char *rp;
+ int num;
+ Oid *sp;
+ char *rp;
char *result;
if (oidArray == NULL)
@@ -142,10 +142,10 @@ int4eqoid(int32 arg1, Oid arg2)
text *
oid_text(Oid oid)
{
- text *result;
+ text *result;
- int len;
- char *str;
+ int len;
+ char *str;
str = oidout(oid);
len = (strlen(str) + VARHDRSZ);
@@ -153,28 +153,28 @@ oid_text(Oid oid)
result = palloc(len);
VARSIZE(result) = len;
- memmove(VARDATA(result), str, (len-VARHDRSZ));
+ memmove(VARDATA(result), str, (len - VARHDRSZ));
pfree(str);
- return(result);
-} /* oid_text() */
+ return (result);
+} /* oid_text() */
Oid
text_oid(text *string)
{
- Oid result;
+ Oid result;
- int len;
- char *str;
+ int len;
+ char *str;
- len = (VARSIZE(string) - VARHDRSZ);
+ len = (VARSIZE(string) - VARHDRSZ);
- str = palloc(len+1);
+ str = palloc(len + 1);
memmove(str, VARDATA(string), len);
- *(str+len) = '\0';
+ *(str + len) = '\0';
result = oidin(str);
pfree(str);
- return(result);
-} /* oid_text() */
+ return (result);
+} /* oid_text() */
diff --git a/src/backend/utils/adt/oidint2.c b/src/backend/utils/adt/oidint2.c
index 25e034aaecb..38dcfe7f9fc 100644
--- a/src/backend/utils/adt/oidint2.c
+++ b/src/backend/utils/adt/oidint2.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint2.c,v 1.4 1997/09/08 21:48:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint2.c,v 1.5 1998/02/26 04:37:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,7 +42,7 @@ oidint2in(char *o)
return (oi);
}
-char *
+char *
oidint2out(OidInt2 o)
{
char *r;
diff --git a/src/backend/utils/adt/oidint4.c b/src/backend/utils/adt/oidint4.c
index c8c7c3de4bd..2c45edb1ec8 100644
--- a/src/backend/utils/adt/oidint4.c
+++ b/src/backend/utils/adt/oidint4.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint4.c,v 1.4 1997/09/08 21:48:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidint4.c,v 1.5 1998/02/26 04:37:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,7 +41,7 @@ oidint4in(char *o)
return (oi);
}
-char *
+char *
oidint4out(OidInt4 o)
{
char *r;
diff --git a/src/backend/utils/adt/oidname.c b/src/backend/utils/adt/oidname.c
index 6cfa44e36a3..ff61681984a 100644
--- a/src/backend/utils/adt/oidname.c
+++ b/src/backend/utils/adt/oidname.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidname.c,v 1.11 1998/01/05 16:40:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidname.c,v 1.12 1998/02/26 04:37:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@ oidnamein(char *inStr)
return oc;
}
-char *
+char *
oidnameout(OidName oidname)
{
char buf[30 + NAMEDATALEN]; /* oidname length + oid length +
diff --git a/src/backend/utils/adt/oracle_compat.c b/src/backend/utils/adt/oracle_compat.c
index e39c83aa26f..3680b1e2194 100644
--- a/src/backend/utils/adt/oracle_compat.c
+++ b/src/backend/utils/adt/oracle_compat.c
@@ -1,7 +1,7 @@
/*
* Edmund Mergl <E.Mergl@bawue.de>
*
- * $Id: oracle_compat.c,v 1.11 1998/01/13 03:49:51 scrappy Exp $
+ * $Id: oracle_compat.c,v 1.12 1998/02/26 04:37:19 momjian Exp $
*
*/
@@ -36,7 +36,7 @@ text *translate(text *string, char from, char to);
*
********************************************************************/
-text *
+text *
lower(text *string)
{
text *ret;
@@ -76,7 +76,7 @@ lower(text *string)
*
********************************************************************/
-text *
+text *
upper(text *string)
{
text *ret;
@@ -118,7 +118,7 @@ upper(text *string)
*
********************************************************************/
-text *
+text *
initcap(text *string)
{
text *ret;
@@ -169,7 +169,7 @@ initcap(text *string)
*
********************************************************************/
-text *
+text *
lpad(text *string1, int4 len, text *string2)
{
text *ret;
@@ -225,7 +225,7 @@ lpad(text *string1, int4 len, text *string2)
*
********************************************************************/
-text *
+text *
rpad(text *string1, int4 len, text *string2)
{
text *ret;
@@ -281,7 +281,7 @@ rpad(text *string1, int4 len, text *string2)
*
********************************************************************/
-text *
+text *
btrim(text *string, text *set)
{
text *ret;
@@ -349,7 +349,7 @@ btrim(text *string, text *set)
memcpy(VARDATA(ret), ptr, m);
return ret;
-} /* btrim() */
+} /* btrim() */
/********************************************************************
@@ -367,7 +367,7 @@ btrim(text *string, text *set)
*
********************************************************************/
-text *
+text *
ltrim(text *string, text *set)
{
text *ret;
@@ -430,7 +430,7 @@ ltrim(text *string, text *set)
*
********************************************************************/
-text *
+text *
rtrim(text *string, text *set)
{
text *ret;
@@ -502,7 +502,7 @@ rtrim(text *string, text *set)
*
********************************************************************/
-text *
+text *
substr(text *string, int4 m, int4 n)
{
text *ret;
@@ -548,7 +548,7 @@ substr(text *string, int4 m, int4 n)
*
********************************************************************/
-text *
+text *
translate(text *string, char from, char to)
{
text *ret;
diff --git a/src/backend/utils/adt/regexp.c b/src/backend/utils/adt/regexp.c
index 024e46b5cac..7efc0e47e6b 100644
--- a/src/backend/utils/adt/regexp.c
+++ b/src/backend/utils/adt/regexp.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.13 1998/01/05 16:40:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.14 1998/02/26 04:37:20 momjian Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
@@ -189,7 +189,7 @@ fixedlen_regexeq(char *s, struct varlena * p, int charlen, int cflags)
/* be sure sterm is null-terminated */
sterm = (char *) palloc(charlen + 1);
- StrNCpy(sterm, s, charlen+1);
+ StrNCpy(sterm, s, charlen + 1);
result = RE_compile_and_execute(p, sterm, cflags);
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index 10b64a16b19..30c9b682602 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.14 1998/02/11 19:12:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.15 1998/02/26 04:37:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -90,7 +90,7 @@ regprocin(char *proname)
/*
* regprocout - converts proid to "proname"
*/
-char *
+char *
regprocout(RegProcedure proid)
{
Relation proc;
@@ -152,7 +152,7 @@ regprocout(RegProcedure proid)
/*
* int8typeout - converts int8 type oids to "typname" list
*/
-text *
+text *
oid8types(Oid (*oidArray)[])
{
Relation type;
@@ -160,18 +160,18 @@ oid8types(Oid (*oidArray)[])
HeapTuple typetup;
text *result;
ScanKeyData key;
- int num;
- Oid *sp;
+ int num;
+ Oid *sp;
if (oidArray == NULL)
{
- result = (text *) palloc(VARHDRSZ);
+ result = (text *) palloc(VARHDRSZ);
VARSIZE(result) = 0;
return (result);
}
- result = (text *) palloc(NAMEDATALEN * 8 + 8 + VARHDRSZ);
- *VARDATA(result) = '\0';
+ result = (text *) palloc(NAMEDATALEN * 8 + 8 + VARHDRSZ);
+ *VARDATA(result) = '\0';
type = heap_openr(TypeRelationName);
if (!RelationIsValid(type))
{
@@ -190,7 +190,7 @@ oid8types(Oid (*oidArray)[])
(AttrNumber) ObjectIdAttributeNumber,
(RegProcedure) F_INT4EQ,
(Datum) *sp);
-
+
typescan = heap_beginscan(type, 0, false, 1, &key);
if (!HeapScanIsValid(typescan))
{
@@ -204,17 +204,17 @@ oid8types(Oid (*oidArray)[])
{
char *s;
bool isnull;
-
+
s = (char *) heap_getattr(typetup, 1,
- RelationGetTupleDescriptor(type), &isnull);
+ RelationGetTupleDescriptor(type), &isnull);
if (!isnull)
{
- StrNCpy(VARDATA(result)+strlen(VARDATA(result)),s,16);
- strcat(VARDATA(result)," ");
+ StrNCpy(VARDATA(result) + strlen(VARDATA(result)), s, 16);
+ strcat(VARDATA(result), " ");
}
else
elog(FATAL, "int8typeout: null procedure %d", *sp);
- /* FALLTHROUGH */
+ /* FALLTHROUGH */
}
heap_endscan(typescan);
}
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 94d31aa95a6..695d4b1d525 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.17 1998/02/11 19:12:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.18 1998/02/26 04:37:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -334,7 +334,7 @@ gethilokey(Oid relid,
char **high,
char **low)
{
- Relation rdesc;
+ Relation rdesc;
HeapScanDesc sdesc;
static ScanKeyData key[3] = {
{0, Anum_pg_statistic_starelid, F_OIDEQ, {0, 0, F_OIDEQ}},
diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c
index f394f081622..82a192db8e5 100644
--- a/src/backend/utils/adt/tid.c
+++ b/src/backend/utils/adt/tid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.4 1997/09/08 02:31:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.5 1998/02/26 04:37:22 momjian Exp $
*
* NOTES
* input routine largely stolen from boxin().
@@ -67,7 +67,7 @@ tidin(char *str)
* tidout
* ----------------------------------------------------------------
*/
-char *
+char *
tidout(ItemPointer itemPtr)
{
BlockNumber blockNumber;
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index f7ddf6199d2..8d468765866 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -51,11 +51,11 @@ timestamp_out(time_t timestamp)
EncodeDateTime(tm, fsec, &tz, &tzn, USE_ISO_DATES, buf);
break;
}
-
+
result = palloc(strlen(buf) + 1);
strcpy(result, buf);
return result;
-} /* timestamp_out() */
+} /* timestamp_out() */
time_t
now(void)
@@ -69,47 +69,47 @@ now(void)
bool
timestampeq(time_t t1, time_t t2)
{
- return(abstimeeq(t1,t2));
+ return (abstimeeq(t1, t2));
}
bool
timestampne(time_t t1, time_t t2)
{
- return(abstimene(t1,t2));
+ return (abstimene(t1, t2));
}
bool
timestamplt(time_t t1, time_t t2)
{
- return(abstimelt(t1,t2));
+ return (abstimelt(t1, t2));
}
bool
timestampgt(time_t t1, time_t t2)
{
- return(abstimegt(t1,t2));
+ return (abstimegt(t1, t2));
}
bool
timestample(time_t t1, time_t t2)
{
- return(abstimele(t1,t2));
+ return (abstimele(t1, t2));
}
bool
timestampge(time_t t1, time_t t2)
{
- return(abstimege(t1,t2));
+ return (abstimege(t1, t2));
}
-DateTime *
+DateTime *
timestamp_datetime(time_t timestamp)
{
- return(abstime_datetime((AbsoluteTime) timestamp));
-} /* timestamp_datetime() */
+ return (abstime_datetime((AbsoluteTime) timestamp));
+} /* timestamp_datetime() */
time_t
datetime_timestamp(DateTime *datetime)
{
- return((AbsoluteTime) datetime_abstime(datetime));
-} /* datetime_timestamp() */
+ return ((AbsoluteTime) datetime_abstime(datetime));
+} /* datetime_timestamp() */
diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c
index f3a2df7b94d..796cc3099ac 100644
--- a/src/backend/utils/adt/varchar.c
+++ b/src/backend/utils/adt/varchar.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.28 1998/02/24 15:19:44 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.29 1998/02/26 04:37:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,7 +17,8 @@
#include "utils/builtins.h"
#ifdef CYR_RECODE
-char *convertstr(char *,int,int);
+char *convertstr(char *, int, int);
+
#endif
/*
@@ -90,7 +91,7 @@ bpcharin(char *s, int dummy, int16 atttypmod)
}
#ifdef CYR_RECODE
- convertstr(result + VARHDRSZ,len,0);
+ convertstr(result + VARHDRSZ, len, 0);
#endif
/* blank pad the string if necessary */
@@ -117,11 +118,11 @@ bpcharout(char *s)
{
len = VARSIZE(s) - VARHDRSZ;
result = (char *) palloc(len + 1);
- StrNCpy(result, VARDATA(s), len+1); /* these are blank-padded */
+ StrNCpy(result, VARDATA(s), len + 1); /* these are blank-padded */
}
#ifdef CYR_RECODE
- convertstr(result,len,1);
+ convertstr(result, len, 1);
#endif
return (result);
@@ -148,7 +149,7 @@ varcharin(char *s, int dummy, int16 atttypmod)
len = strlen(s) + VARHDRSZ;
if (atttypmod != -1 && len > atttypmod)
- len = atttypmod; /* clip the string at max length */
+ len = atttypmod; /* clip the string at max length */
if (len > 4096)
elog(ERROR, "varcharin: length of char() must be less than 4096");
@@ -158,7 +159,7 @@ varcharin(char *s, int dummy, int16 atttypmod)
strncpy(VARDATA(result), s, len - VARHDRSZ);
#ifdef CYR_RECODE
- convertstr(result + VARHDRSZ,len,0);
+ convertstr(result + VARHDRSZ, len, 0);
#endif
return (result);
@@ -180,11 +181,11 @@ varcharout(char *s)
{
len = VARSIZE(s) - VARHDRSZ;
result = (char *) palloc(len + 1);
- StrNCpy(result, VARDATA(s), len+1);
+ StrNCpy(result, VARDATA(s), len + 1);
}
#ifdef CYR_RECODE
- convertstr(result,len,1);
+ convertstr(result, len, 1);
#endif
return (result);
@@ -216,7 +217,7 @@ bpcharlen(char *arg)
if (!PointerIsValid(arg))
elog(ERROR, "Bad (null) char() external representation", NULL);
- return(bcTruelen(arg));
+ return (bcTruelen(arg));
}
bool
@@ -356,7 +357,7 @@ varcharlen(char *arg)
if (!PointerIsValid(arg))
elog(ERROR, "Bad (null) varchar() external representation", NULL);
- return(VARSIZE(arg) - VARHDRSZ);
+ return (VARSIZE(arg) - VARHDRSZ);
}
bool
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 8d334a2ffd9..a6b45d20938 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.30 1998/02/24 15:19:45 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.31 1998/02/26 04:37:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -159,7 +159,7 @@ textin(char *inputText)
memmove(VARDATA(result), inputText, len - VARHDRSZ);
#ifdef CYR_RECODE
- convertstr(VARDATA(result),len-VARHDRSZ,0);
+ convertstr(VARDATA(result), len - VARHDRSZ, 0);
#endif
return (result);
@@ -187,7 +187,7 @@ textout(text *vlena)
result[len] = '\0';
#ifdef CYR_RECODE
- convertstr(result,len,1);
+ convertstr(result, len, 1);
#endif
return (result);
@@ -199,16 +199,16 @@ textout(text *vlena)
/*
* textlen -
* returns the actual length of a text*
- * (which is less than the VARSIZE of the text*)
+ * (which is less than the VARSIZE of the text*)
*/
int32
textlen(text *t)
{
if (!PointerIsValid(t))
- elog(ERROR,"Null input to textlen");
+ elog(ERROR, "Null input to textlen");
return (VARSIZE(t) - VARHDRSZ);
-} /* textlen() */
+} /* textlen() */
/*
* textcat -
@@ -259,7 +259,7 @@ textcat(text *t1, text *t2)
VARSIZE(result) = len;
return (result);
-} /* textcat() */
+} /* textcat() */
/*
* text_substr()
@@ -267,17 +267,17 @@ textcat(text *t1, text *t2)
* - thomas 1997-12-31
*
* Input:
- * - string
- * - starting position (is one-based)
- * - string length
+ * - string
+ * - starting position (is one-based)
+ * - string length
*
* If the starting position is zero or less, then return the entire string.
* XXX Note that this may not be the right behavior:
- * if we are calculating the starting position we might want it to start at one.
+ * if we are calculating the starting position we might want it to start at one.
* If the length is less than zero, return the remaining string.
*
* Note that the arguments operate on octet length,
- * so not aware of multi-byte character sets.
+ * so not aware of multi-byte character sets.
*/
text *
text_substr(text *string, int32 m, int32 n)
@@ -299,17 +299,17 @@ text_substr(text *string, int32 m, int32 n)
else
{
m--;
- if (((m+n) > len) || (n < 0))
- n = (len-m);
+ if (((m + n) > len) || (n < 0))
+ n = (len - m);
}
ret = (text *) palloc(VARHDRSZ + n);
VARSIZE(ret) = VARHDRSZ + n;
- memcpy(VARDATA(ret), VARDATA(string)+m, n);
+ memcpy(VARDATA(ret), VARDATA(string) + m, n);
return ret;
-} /* text_substr() */
+} /* text_substr() */
/*
* textpos -
@@ -351,7 +351,7 @@ textpos(text *t1, text *t2)
p1++;
};
return (pos);
-} /* textpos() */
+} /* textpos() */
/*
* texteq - returns 1 iff arguments are equal
@@ -381,7 +381,7 @@ texteq(text *arg1, text *arg2)
if (*a1p++ != *a2p++)
return ((bool) 0);
return ((bool) 1);
-} /* texteq() */
+} /* texteq() */
bool
textne(text *arg1, text *arg2)
@@ -443,7 +443,7 @@ text_lt(text *arg1, text *arg2)
#endif
return (result);
-} /* text_lt() */
+} /* text_lt() */
/* text_le()
* Comparison function for text strings.
@@ -499,7 +499,7 @@ text_le(text *arg1, text *arg2)
#endif
return (result);
-} /* text_le() */
+} /* text_le() */
bool
text_gt(text *arg1, text *arg2)
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 36a617d8ae0..ef9593b2b13 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.23 1998/02/23 17:43:19 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.24 1998/02/26 04:37:27 momjian Exp $
*
* Notes:
* XXX This needs to use exception.h to handle recovery when
@@ -677,7 +677,7 @@ InitSysCache(char *relname,
HeapTuple (*iScanfuncP) ())
{
CatCache *cp;
- int i;
+ int i;
MemoryContext oldcxt;
char *indname;
@@ -862,8 +862,8 @@ SearchSysCache(struct catcache * cache,
elt;
elt = DLGetSucc(elt))
{
- bool res;
-
+ bool res;
+
ct = (CatCTup *) DLE_VAL(elt);
/* ----------------
* see if the cached tuple matches our key.
@@ -871,10 +871,10 @@ SearchSysCache(struct catcache * cache,
* ----------------
*/
HeapKeyTest(ct->ct_tup,
- cache->cc_tupdesc,
- cache->cc_nkeys,
- cache->cc_skey,
- res);
+ cache->cc_tupdesc,
+ cache->cc_nkeys,
+ cache->cc_skey,
+ res);
if (res)
break;
}
diff --git a/src/backend/utils/cache/fcache.c b/src/backend/utils/cache/fcache.c
index 485a1d01bae..2a8df51c6a1 100644
--- a/src/backend/utils/cache/fcache.c
+++ b/src/backend/utils/cache/fcache.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.10 1998/01/15 19:45:29 pgsql Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/fcache.c,v 1.11 1998/02/26 04:37:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -282,10 +282,13 @@ init_fcache(Oid foid,
- if (retval->language != SQLlanguageId) {
+ if (retval->language != SQLlanguageId)
+ {
fmgr_info(foid, &(retval->func));
retval->nargs = retval->func.fn_nargs;
- } else {
+ }
+ else
+ {
retval->func.fn_addr = (func_ptr) NULL;
}
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index c5f325a2fdb..b56c25e94de 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.12 1998/02/10 16:03:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.13 1998/02/26 04:37:30 momjian Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -67,7 +67,7 @@ op_class(Oid opno, int32 opclass, Oid amopid)
* return the "attname" field from the attribute relation.
*
*/
-char *
+char *
get_attname(Oid relid, AttrNumber attnum)
{
FormData_pg_attribute att_tup;
@@ -161,7 +161,7 @@ get_attisset(Oid relid, char *attname)
* return the "atttypmod" field from the attribute relation.
*
*/
-int16
+int16
get_atttypmod(Oid relid, AttrNumber attnum)
{
FormData_pg_attribute att_tup;
@@ -209,7 +209,7 @@ get_opcode(Oid opno)
*
* Note: return the struct so that it gets copied.
*/
-char *
+char *
get_opname(Oid opno)
{
FormData_pg_operator optup;
@@ -395,7 +395,7 @@ get_relnatts(Oid relid)
* Returns the name of a given relation.
*
*/
-char *
+char *
get_rel_name(Oid relid)
{
FormData_pg_class reltup;
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index f40d5a3fdbc..79056f34d46 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.36 1998/02/23 17:43:25 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.37 1998/02/26 04:37:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -258,11 +258,14 @@ static HeapTuple ScanPgRelation(RelationBuildDescInfo buildinfo);
static HeapTuple scan_pg_rel_seq(RelationBuildDescInfo buildinfo);
static HeapTuple scan_pg_rel_ind(RelationBuildDescInfo buildinfo);
static Relation AllocateRelationDesc(u_int natts, Form_pg_class relp);
-static void RelationBuildTupleDesc(RelationBuildDescInfo buildinfo,
+static void
+RelationBuildTupleDesc(RelationBuildDescInfo buildinfo,
Relation relation, u_int natts);
-static void build_tupdesc_seq(RelationBuildDescInfo buildinfo,
+static void
+build_tupdesc_seq(RelationBuildDescInfo buildinfo,
Relation relation, u_int natts);
-static void build_tupdesc_ind(RelationBuildDescInfo buildinfo,
+static void
+build_tupdesc_ind(RelationBuildDescInfo buildinfo,
Relation relation, u_int natts);
static Relation RelationBuildDesc(RelationBuildDescInfo buildinfo);
static void IndexedAccessMethodInitialize(Relation relation);
@@ -766,11 +769,11 @@ RelationBuildRuleLock(Relation relation)
Anum_pg_rewrite_ev_qual, pg_rewrite_tupdesc,
&isnull);
- ruleaction = PointerGetDatum (textout((struct varlena *) DatumGetPointer (ruleaction)));
- rule_evqual_string = PointerGetDatum (textout((struct varlena *) DatumGetPointer (rule_evqual_string)));
+ ruleaction = PointerGetDatum(textout((struct varlena *) DatumGetPointer(ruleaction)));
+ rule_evqual_string = PointerGetDatum(textout((struct varlena *) DatumGetPointer(rule_evqual_string)));
- rule->actions = (List *) stringToNode(DatumGetPointer (ruleaction));
- rule->qual = (Node *) stringToNode(DatumGetPointer (rule_evqual_string));
+ rule->actions = (List *) stringToNode(DatumGetPointer(ruleaction));
+ rule->qual = (Node *) stringToNode(DatumGetPointer(rule_evqual_string));
rules[numlocks++] = rule;
if (numlocks == maxlocks)
@@ -2017,7 +2020,7 @@ init_irels(void)
for (i = 0; i < am->amstrategies; i++)
fmgr_info(SMD(i).sk_procedure,
&(SMD(i).sk_func));
- SMD(i).sk_nargs = SMD(i).sk_func.fn_nargs;
+ SMD(i).sk_nargs = SMD(i).sk_func.fn_nargs;
/*
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 6f028de93ac..490a6417c9f 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.15 1998/02/25 13:07:50 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.16 1998/02/26 04:37:33 momjian Exp $
*
* NOTES
* These routines allow the parser/planner/executor to perform
@@ -57,7 +57,7 @@ extern bool AMI_OVERRIDE; /* XXX style */
#include "utils/syscache.h"
#include "catalog/indexing.h"
-typedef HeapTuple(*ScanFunc) ();
+typedef HeapTuple (*ScanFunc) ();
/* ----------------
* Warning: cacheinfo[] below is changed, then be sure and
@@ -179,7 +179,7 @@ static struct cachedesc cacheinfo[] = {
0,
0,
0},
- offsetof(TypeTupleFormData, typalign) + sizeof(char),
+ offsetof(TypeTupleFormData, typalign) +sizeof(char),
TypeNameIndex,
TypeNameIndexScan},
{TypeRelationName, /* TYPOID */
@@ -254,7 +254,7 @@ static struct cachedesc cacheinfo[] = {
sizeof(FormData_pg_listener),
NULL,
(ScanFunc) NULL},
- {ShadowRelationName, /* USENAME */
+ {ShadowRelationName, /* USENAME */
1,
{Anum_pg_shadow_usename,
0,
@@ -263,7 +263,7 @@ static struct cachedesc cacheinfo[] = {
sizeof(FormData_pg_shadow),
NULL,
(ScanFunc) NULL},
- {ShadowRelationName, /* USESYSID */
+ {ShadowRelationName, /* USESYSID */
1,
{Anum_pg_shadow_usesysid,
0,
@@ -392,13 +392,13 @@ InitCatalogCache()
* XXX The tuple that is returned is NOT supposed to be pfree'd!
*/
HeapTuple
-SearchSysCacheTuple(int cacheId, /* cache selection code */
+SearchSysCacheTuple(int cacheId,/* cache selection code */
Datum key1,
Datum key2,
Datum key3,
Datum key4)
{
- HeapTuple tp;
+ HeapTuple tp;
if (cacheId < 0 || cacheId >= SysCacheSize)
{
@@ -489,7 +489,7 @@ SearchSysCacheStruct(int cacheId, /* cache selection code */
*
* [callers all assume this returns a (struct varlena *). -ay 10/94]
*/
-void *
+void *
SearchSysCacheGetAttribute(int cacheId,
AttrNumber attributeNumber,
Datum key1,
@@ -591,7 +591,7 @@ SearchSysCacheGetAttribute(int cacheId,
* [identical to get_typdefault, expecting a (struct varlena *) as ret val.
* some day, either of the functions should be removed -ay 10/94]
*/
-void *
+void *
TypeDefaultRetrieve(Oid typId)
{
HeapTuple typeTuple;
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 36855ce6eb6..63fd69b10af 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.26 1998/02/11 19:12:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.27 1998/02/26 04:37:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@ elog(int lev, const char *fmt,...)
va_list ap;
char buf[ELOG_MAXLEN],
line[ELOG_MAXLEN];
- char *bp;
+ char *bp;
const char *cp;
extern int errno,
sys_nerr;
@@ -162,10 +162,13 @@ elog(int lev, const char *fmt,...)
pq_putstr(line);
pq_flush();
}
- if (Pfout == NULL) {
- /* There is no socket. One explanation for this is we are running
- as the Postmaster. So we'll write the message to stderr.
- */
+ if (Pfout == NULL)
+ {
+
+ /*
+ * There is no socket. One explanation for this is we are running
+ * as the Postmaster. So we'll write the message to stderr.
+ */
fputs(line, stderr);
}
#endif /* !PG_STANDALONE */
@@ -177,7 +180,7 @@ elog(int lev, const char *fmt,...)
ProcReleaseSpins(NULL); /* get rid of spinlocks we hold */
if (!InError)
{
- kill(MyProcPid, 1); /* abort to traffic cop */
+ kill(MyProcPid, 1); /* abort to traffic cop */
pause();
}
diff --git a/src/backend/utils/error/exc.c b/src/backend/utils/error/exc.c
index 0851a92a5d7..ee79fa98142 100644
--- a/src/backend/utils/error/exc.c
+++ b/src/backend/utils/error/exc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.19 1998/02/11 19:12:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/exc.c,v 1.20 1998/02/26 04:37:35 momjian Exp $
*
* NOTE
* XXX this code needs improvement--check for state violations and
@@ -179,7 +179,7 @@ ExcRaise(Exception *excP,
ExcData data,
ExcMessage message)
{
- ExcFrame *efp;
+ ExcFrame *efp;
efp = ExcCurFrameP;
if (efp == NULL)
diff --git a/src/backend/utils/error/format.c b/src/backend/utils/error/format.c
index 384da49a6f5..e76f78cbca9 100644
--- a/src/backend/utils/error/format.c
+++ b/src/backend/utils/error/format.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/format.c,v 1.5 1997/09/08 02:31:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/error/Attic/format.c,v 1.6 1998/02/26 04:37:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,7 +25,7 @@ static char FormBuf[FormMaxSize];
* form
* ----------------
*/
-char *
+char *
form(const char *fmt,...)
{
va_list args;
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c
index 0eb45503bb9..de248c02058 100644
--- a/src/backend/utils/fmgr/fmgr.c
+++ b/src/backend/utils/fmgr/fmgr.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.14 1998/02/11 19:12:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.15 1998/02/26 04:37:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,21 +33,24 @@
#include "commands/trigger.h"
-static char *
-fmgr_pl(char *arg0, ...)
+static char *
+fmgr_pl(char *arg0,...)
{
- va_list pvar;
- FmgrValues values;
- bool isNull = false;
- int i;
+ va_list pvar;
+ FmgrValues values;
+ bool isNull = false;
+ int i;
memset(&values, 0, sizeof(values));
- if (fmgr_pl_finfo->fn_nargs > 0) {
+ if (fmgr_pl_finfo->fn_nargs > 0)
+ {
values.data[0] = arg0;
- if (fmgr_pl_finfo->fn_nargs > 1) {
+ if (fmgr_pl_finfo->fn_nargs > 1)
+ {
va_start(pvar, arg0);
- for (i = 1; i < fmgr_pl_finfo->fn_nargs; i++) {
+ for (i = 1; i < fmgr_pl_finfo->fn_nargs; i++)
+ {
values.data[i] = va_arg(pvar, char *);
}
va_end(pvar);
@@ -57,21 +60,21 @@ fmgr_pl(char *arg0, ...)
/* Call the PL handler */
CurrentTriggerData = NULL;
return (*(fmgr_pl_finfo->fn_plhandler)) (fmgr_pl_finfo,
- &values,
- &isNull);
-}
+ &values,
+ &isNull);
+}
-char *
+char *
fmgr_c(FmgrInfo *finfo,
- FmgrValues * values,
- bool * isNull)
-{
- char *returnValue = (char *) NULL;
- int n_arguments = finfo->fn_nargs;
- func_ptr user_fn = fmgr_faddr(finfo);
-
-
+ FmgrValues *values,
+ bool *isNull)
+{
+ char *returnValue = (char *) NULL;
+ int n_arguments = finfo->fn_nargs;
+ func_ptr user_fn = fmgr_faddr(finfo);
+
+
if (user_fn == (func_ptr) NULL)
{
@@ -84,11 +87,12 @@ fmgr_c(FmgrInfo *finfo,
}
/*
- * If finfo contains a PL handler for this function,
- * call that instead.
+ * If finfo contains a PL handler for this function, call that
+ * instead.
*/
- if (finfo->fn_plhandler != NULL) {
- return (*(finfo->fn_plhandler))(finfo, values, isNull);
+ if (finfo->fn_plhandler != NULL)
+ {
+ return (*(finfo->fn_plhandler)) (finfo, values, isNull);
}
switch (n_arguments)
@@ -190,11 +194,11 @@ fmgr_info(Oid procedureId, FmgrInfo *finfo)
switch (language)
{
case INTERNALlanguageId:
- finfo->fn_addr =
- fmgr_lookupByName(procedureStruct->proname.data);
+ finfo->fn_addr =
+ fmgr_lookupByName(procedureStruct->proname.data);
if (!finfo->fn_addr)
elog(ERROR, "fmgr_info: function %s: not in internal table",
- procedureStruct->proname.data);
+ procedureStruct->proname.data);
break;
case ClanguageId:
finfo->fn_addr = fmgr_dynamic(procedureId, &(finfo->fn_nargs));
@@ -226,7 +230,7 @@ fmgr_info(Oid procedureId, FmgrInfo *finfo)
{
FmgrInfo plfinfo;
- fmgr_info(((Form_pg_language)GETSTRUCT(languageTuple))->lanplcallfoid, &plfinfo);
+ fmgr_info(((Form_pg_language) GETSTRUCT(languageTuple))->lanplcallfoid, &plfinfo);
finfo->fn_addr = (func_ptr) fmgr_pl;
finfo->fn_plhandler = plfinfo.fn_addr;
finfo->fn_nargs = procedureStruct->pronargs;
@@ -257,7 +261,7 @@ fmgr_info(Oid procedureId, FmgrInfo *finfo)
* Returns the return value of the invoked function if succesful,
* 0 if unsuccessful.
*/
-char *
+char *
fmgr(Oid procedureId,...)
{
va_list pvar;
@@ -295,8 +299,8 @@ fmgr(Oid procedureId,...)
* funcinfo, n_arguments, args...
*/
#ifdef NOT_USED
-char *
-fmgr_ptr(FmgrInfo *finfo, ...)
+char *
+fmgr_ptr(FmgrInfo *finfo,...)
{
va_list pvar;
int i;
@@ -305,7 +309,7 @@ fmgr_ptr(FmgrInfo *finfo, ...)
FmgrValues values;
bool isNull = false;
- local_finfo->fn_addr = finfo->fn_addr;
+ local_finfo->fn_addr = finfo->fn_addr;
local_finfo->fn_plhandler = finfo->fn_plhandler;
local_finfo->fn_oid = finfo->fn_oid;
@@ -332,8 +336,8 @@ fmgr_ptr(FmgrInfo *finfo, ...)
* function pointer field to FuncIndexInfo, it will be replace by calls
* to fmgr_c().
*/
-char *
-fmgr_array_args(Oid procedureId, int nargs, char *args[], bool * isNull)
+char *
+fmgr_array_args(Oid procedureId, int nargs, char *args[], bool *isNull)
{
FmgrInfo finfo;
diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
index 9a722a004c4..23f4f43d9bd 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.12 1998/02/11 19:13:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/hash/dynahash.c,v 1.13 1998/02/26 04:37:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -154,10 +154,10 @@ static long hash_accesses,
/************************** CREATE ROUTINES **********************/
-HTAB *
+HTAB *
hash_create(int nelem, HASHCTL *info, int flags)
{
- HHDR *hctl;
+ HHDR *hctl;
HTAB *hashp;
@@ -303,8 +303,8 @@ static int
init_htab(HTAB *hashp, int nelem)
{
SEG_OFFSET *segp;
- int nbuckets;
- int nsegs;
+ int nbuckets;
+ int nsegs;
int l2;
HHDR *hctl;
@@ -387,7 +387,7 @@ hash_destroy(HTAB *hashp)
if (hashp != NULL)
{
- SEG_OFFSET segNum;
+ SEG_OFFSET segNum;
SEGMENT segp;
int nsegs = hashp->hctl->nsegs;
int j;
@@ -469,7 +469,7 @@ call_hash(HTAB *hashp, char *k, int len)
* foundPtr is TRUE if we found an element in the table
* (FALSE if we entered one).
*/
-long *
+long *
hash_search(HTAB *hashp,
char *keyPtr,
HASHACTION action, /* HASH_FIND / HASH_ENTER / HASH_REMOVE
@@ -480,7 +480,7 @@ hash_search(HTAB *hashp,
long segment_num;
long segment_ndx;
SEGMENT segp;
- ELEMENT *curr;
+ ELEMENT *curr;
HHDR *hctl;
BUCKET_INDEX currIndex;
BUCKET_INDEX *prevIndexPtr;
@@ -653,7 +653,7 @@ hash_search(HTAB *hashp,
* return TRUE in the end.
*
*/
-long *
+long *
hash_seq(HTAB *hashp)
{
static uint32 curBucket = 0;
@@ -811,7 +811,7 @@ expand_table(HTAB *hashp)
static int
dir_realloc(HTAB *hashp)
{
- char *p;
+ char *p;
char **p_ptr;
long old_dirsize;
long new_dirsize;
diff --git a/src/backend/utils/hash/hashfn.c b/src/backend/utils/hash/hashfn.c
index 609ca80d813..6cf11d22bf6 100644
--- a/src/backend/utils/hash/hashfn.c
+++ b/src/backend/utils/hash/hashfn.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/hash/hashfn.c,v 1.6 1998/02/11 19:13:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/hash/hashfn.c,v 1.7 1998/02/26 04:37:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,7 +43,7 @@ string_hash(char *key, int keysize)
long
tag_hash(int *key, int keysize)
{
- long h = 0;
+ long h = 0;
/*
* Convert tag to integer; Use four byte chunks in a "jump table" to
@@ -130,10 +130,10 @@ tag_hash(int *key, int keysize)
long
disk_hash(char *key)
{
- int n = 0;
- char *str = key;
- int len = strlen(key);
- int loop;
+ int n = 0;
+ char *str = key;
+ int len = strlen(key);
+ int loop;
#define HASHC n = *str++ + 65599 * n
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index 7d118676887..55ec93cc75d 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.20 1998/02/25 13:08:00 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.21 1998/02/26 04:37:56 momjian Exp $
*
* NOTES
* Globals used all over the place should be declared here and not
@@ -35,7 +35,7 @@
#include "libpq/pqcomm.h"
#include "catalog/catname.h"
-ProtocolVersion FrontendProtocol = PG_PROTOCOL_LATEST;
+ProtocolVersion FrontendProtocol = PG_PROTOCOL_LATEST;
int Portfd = -1;
int Noversion = 0;
int Quiet = 1;
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index 359adfb25b6..abd6aa8b2a2 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.11 1998/02/25 13:08:09 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.12 1998/02/26 04:38:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -54,6 +54,7 @@ extern char *DatabasePath;
#ifdef CYR_RECODE
unsigned char RecodeForwTable[128];
unsigned char RecodeBackTable[128];
+
#endif
@@ -228,7 +229,7 @@ GetProcessingMode()
* Returns path to database.
*
*/
-char *
+char *
GetDatabasePath()
{
return strdup(DatabasePath);
@@ -238,7 +239,7 @@ GetDatabasePath()
* GetDatabaseName --
* Returns name of database.
*/
-char *
+char *
GetDatabaseName()
{
return strdup(DatabaseName);
@@ -264,7 +265,7 @@ SetDatabaseName(char *name)
}
#ifdef CYR_RECODE
-#define MAX_TOKEN 80
+#define MAX_TOKEN 80
/* Some standard C libraries, including GNU, have an isblank() function.
Others, including Solaris, do not. So we have our own.
@@ -326,80 +327,87 @@ read_through_eol(FILE *file)
while (c != '\n' && c != EOF);
}
-void SetCharSet()
+void
+SetCharSet()
{
- FILE *file;
- char *p,c,eof=false;
- char *map_file;
- char buf[MAX_TOKEN];
- int i;
- unsigned char FromChar,ToChar;
-
- for(i=0; i<128; i++)
- {
- RecodeForwTable[i] = i+128;
- RecodeBackTable[i] = i+128;
- }
-
- p = getenv("PG_RECODETABLE");
- if (p && *p != '\0')
- {
- map_file = (char *) malloc((strlen(DataDir) +
- strlen(p)+2)*sizeof(char));
- sprintf(map_file, "%s/%s", DataDir, p);
- file = fopen(map_file, "r");
- if (file == NULL)
- return;
- eof=false;
- while (!eof)
- {
- c = getc(file);
- ungetc(c, file);
- if (c == EOF)
- eof = true;
- else
- {
- if (c == '#')
- read_through_eol(file);
- else
- {
- /* Read the FromChar */
- next_token(file, buf, sizeof(buf));
- if (buf[0] != '\0')
- {
- FromChar = strtoul(buf,0,0);
- /* Read the ToChar */
- next_token(file, buf, sizeof(buf));
- if (buf[0] != '\0')
- {
- ToChar = strtoul(buf,0,0);
- RecodeForwTable[FromChar-128] = ToChar;
- RecodeBackTable[ToChar-128] = FromChar;
- }
- read_through_eol(file);
- }
- }
- }
- }
- fclose(file);
- free(map_file);
- }
+ FILE *file;
+ char *p,
+ c,
+ eof = false;
+ char *map_file;
+ char buf[MAX_TOKEN];
+ int i;
+ unsigned char FromChar,
+ ToChar;
+
+ for (i = 0; i < 128; i++)
+ {
+ RecodeForwTable[i] = i + 128;
+ RecodeBackTable[i] = i + 128;
+ }
+
+ p = getenv("PG_RECODETABLE");
+ if (p && *p != '\0')
+ {
+ map_file = (char *) malloc((strlen(DataDir) +
+ strlen(p) + 2) * sizeof(char));
+ sprintf(map_file, "%s/%s", DataDir, p);
+ file = fopen(map_file, "r");
+ if (file == NULL)
+ return;
+ eof = false;
+ while (!eof)
+ {
+ c = getc(file);
+ ungetc(c, file);
+ if (c == EOF)
+ eof = true;
+ else
+ {
+ if (c == '#')
+ read_through_eol(file);
+ else
+ {
+ /* Read the FromChar */
+ next_token(file, buf, sizeof(buf));
+ if (buf[0] != '\0')
+ {
+ FromChar = strtoul(buf, 0, 0);
+ /* Read the ToChar */
+ next_token(file, buf, sizeof(buf));
+ if (buf[0] != '\0')
+ {
+ ToChar = strtoul(buf, 0, 0);
+ RecodeForwTable[FromChar - 128] = ToChar;
+ RecodeBackTable[ToChar - 128] = FromChar;
+ }
+ read_through_eol(file);
+ }
+ }
+ }
+ }
+ fclose(file);
+ free(map_file);
+ }
}
-char* convertstr(unsigned char *buff,int len,int dest)
+char *
+convertstr(unsigned char *buff, int len, int dest)
{
- int i;
- char *ch=buff;
- for (i = 0; i < len; i++,buff++)
- {
- if (*buff >127)
- if (dest)
- *buff = RecodeForwTable[*buff-128];
- else
- *buff = RecodeBackTable[*buff-128];
- }
- return ch;
+ int i;
+ char *ch = buff;
+
+ for (i = 0; i < len; i++, buff++)
+ {
+ if (*buff > 127)
+ if (dest)
+ *buff = RecodeForwTable[*buff - 128];
+ else
+ *buff = RecodeBackTable[*buff - 128];
+ }
+ return ch;
}
+
#endif
/* ----------------
@@ -413,7 +421,7 @@ char* convertstr(unsigned char *buff,int len,int dest)
* in pg_proc.h). Define GetPgUserName() as a macro - tgl 97/04/26
* ----------------
*/
-char *
+char *
getpgusername()
{
return UserName;
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 5c367013858..baac25cfbee 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.24 1998/02/23 18:43:06 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.25 1998/02/26 04:38:12 momjian Exp $
*
* NOTES
* InitPostgres() is the function called from PostgresMain
@@ -49,7 +49,8 @@
#include "storage/bufmgr.h"
#include "access/transam.h" /* XXX dependency problem */
#include "utils/syscache.h"
-#include "storage/bufpage.h" /* for page layout, for InitMyDatabaseInfo() */
+#include "storage/bufpage.h" /* for page layout, for
+ * InitMyDatabaseInfo() */
#include "storage/sinval.h"
#include "storage/sinvaladt.h"
#include "storage/lmgr.h"
@@ -117,7 +118,7 @@ InitMyDatabaseInfo(char *name)
{
Oid owner;
char *path,
- myPath[MAXPGPATH+1];
+ myPath[MAXPGPATH + 1];
SetDatabaseName(name);
GetRawDatabaseInfo(name, &owner, &MyDatabaseId, myPath);
@@ -132,7 +133,7 @@ InitMyDatabaseInfo(char *name)
SetDatabasePath(path);
return;
-} /* InitMyDatabaseInfo() */
+} /* InitMyDatabaseInfo() */
/*
@@ -180,15 +181,15 @@ VerifySystemDatabase()
ValidatePgVersion(DataDir, &reason);
if (reason != NULL)
sprintf(errormsg,
- "InitPostgres could not validate that the database"
- " system version is compatible with this level of"
- " Postgres.\n\tYou may need to run initdb to create"
- " a new database system.\n\t%s", reason);
+ "InitPostgres could not validate that the database"
+ " system version is compatible with this level of"
+ " Postgres.\n\tYou may need to run initdb to create"
+ " a new database system.\n\t%s", reason);
}
if (errormsg[0] != '\0')
elog(FATAL, errormsg);
/* Above does not return */
-} /* VerifySystemDatabase() */
+} /* VerifySystemDatabase() */
static void
@@ -207,42 +208,43 @@ VerifyMyDatabase()
if ((fd = open(myPath, O_RDONLY, 0)) == -1)
sprintf(errormsg,
- "Database '%s' does not exist."
+ "Database '%s' does not exist."
"\n\tWe know this because the directory '%s' does not exist."
- "\n\tYou can create a database with the SQL command"
- " CREATE DATABASE.\n\tTo see what databases exist,"
- " look at the subdirectories of '%s/base/'.",
- name, myPath, DataDir);
+ "\n\tYou can create a database with the SQL command"
+ " CREATE DATABASE.\n\tTo see what databases exist,"
+ " look at the subdirectories of '%s/base/'.",
+ name, myPath, DataDir);
else
{
close(fd);
ValidatePgVersion(myPath, &reason);
if (reason != NULL)
sprintf(errormsg,
- "InitPostgres could not validate that the database"
- " version is compatible with this level of Postgres"
- "\n\teven though the database system as a whole"
- " appears to be at a compatible level."
- "\n\tYou may need to recreate the database with SQL"
- " commands DROP DATABASE and CREATE DATABASE."
- "\n\t%s", reason);
+ "InitPostgres could not validate that the database"
+ " version is compatible with this level of Postgres"
+ "\n\teven though the database system as a whole"
+ " appears to be at a compatible level."
+ "\n\tYou may need to recreate the database with SQL"
+ " commands DROP DATABASE and CREATE DATABASE."
+ "\n\t%s", reason);
else
{
+
/*
* The directories and PG_VERSION files are in order.
*/
- int rc; /* return code from some function we call */
+ int rc; /* return code from some function we call */
#ifdef FILEDEBUG
-printf("Try changing directory for database %s to %s\n", name, myPath);
+ printf("Try changing directory for database %s to %s\n", name, myPath);
#endif
rc = chdir(myPath);
if (rc < 0)
sprintf(errormsg,
- "InitPostgres unable to change "
- "current directory to '%s', errno = %s (%d).",
- myPath, strerror(errno), errno);
+ "InitPostgres unable to change "
+ "current directory to '%s', errno = %s (%d).",
+ myPath, strerror(errno), errno);
else
errormsg[0] = '\0';
}
@@ -251,7 +253,7 @@ printf("Try changing directory for database %s to %s\n", name, myPath);
if (errormsg[0] != '\0')
elog(FATAL, errormsg);
/* Above does not return */
-} /* VerifyMyDatabase() */
+} /* VerifyMyDatabase() */
/* --------------------------------
@@ -280,9 +282,9 @@ InitUserid()
static void
InitCommunication()
{
- char *postid; /* value of environment variable */
- char *postport; /* value of environment variable */
- char *ipc_key; /* value of environemnt variable */
+ char *postid; /* value of environment variable */
+ char *postport; /* value of environment variable */
+ char *ipc_key; /* value of environemnt variable */
IPCKey key = 0;
/* ----------------
@@ -303,14 +305,17 @@ InitCommunication()
}
- ipc_key = getenv("IPC_KEY");
- if (!PointerIsValid(ipc_key)) {
- key = -1;
- } else {
- key = atoi(ipc_key);
- Assert(MyBackendTag >= 0);
- }
-
+ ipc_key = getenv("IPC_KEY");
+ if (!PointerIsValid(ipc_key))
+ {
+ key = -1;
+ }
+ else
+ {
+ key = atoi(ipc_key);
+ Assert(MyBackendTag >= 0);
+ }
+
postport = getenv("POSTPORT");
if (PointerIsValid(postport))
@@ -329,11 +334,8 @@ InitCommunication()
* To enable emulation, run the following shell commands (in addition
* to enabling this goto)
*
- * % setenv POSTID 1
- * % setenv POSTPORT 4321
- * % setenv IPC_KEY 4321000
- * % postmaster &
- * % kill -9 %1
+ * % setenv POSTID 1 % setenv POSTPORT 4321 % setenv IPC_KEY 4321000
+ * % postmaster & % kill -9 %1
*
* Upon doing this, Postmaster will have allocated the shared memory
* resources that Postgres will attach to if you enable
@@ -503,19 +505,19 @@ InitPostgres(char *name) /* database name */
/*
* ********************************
+ *
* code after this point assumes we are in the proper directory!
*
- * So, how do we implement alternate locations for databases?
- * There are two possible locations for tables and we need to look
- * in DataDir/pg_database to find the true location of an
- * individual database. We can brute-force it as done in
- * InitMyDatabaseInfo(), or we can be patient and wait until we
- * open pg_database gracefully. Will try that, but may not work...
- * - thomas 1997-11-01
- * ********************************
+ * So, how do we implement alternate locations for databases? There are
+ * two possible locations for tables and we need to look in
+ * DataDir/pg_database to find the true location of an individual
+ * database. We can brute-force it as done in InitMyDatabaseInfo(), or
+ * we can be patient and wait until we open pg_database gracefully.
+ * Will try that, but may not work... - thomas 1997-11-01 ********************************
+ *
*/
- /* Does not touch files (?) - thomas 1997-11-01 */
+ /* Does not touch files (?) - thomas 1997-11-01 */
smgrinit();
/* ----------------
@@ -534,7 +536,8 @@ InitPostgres(char *name) /* database name */
* after initdb is done. -mer 15 June 1992
*/
RelationInitialize(); /* pre-allocated reldescs created here */
- InitializeTransactionSystem(); /* pg_log,etc init/crash recovery here */
+ InitializeTransactionSystem(); /* pg_log,etc init/crash recovery
+ * here */
LockDisable(false);
@@ -564,7 +567,7 @@ InitPostgres(char *name) /* database name */
/* ----------------
* initialize the access methods.
- * Does not touch files (?) - thomas 1997-11-01
+ * Does not touch files (?) - thomas 1997-11-01
* ----------------
*/
initam();
@@ -574,8 +577,10 @@ InitPostgres(char *name) /* database name */
* ----------------
*/
zerocaches();
- /* Does not touch files since all routines are builtins (?)
- * - thomas 1997-11-01
+
+ /*
+ * Does not touch files since all routines are builtins (?) - thomas
+ * 1997-11-01
*/
InitCatalogCache();
diff --git a/src/backend/utils/misc/database.c b/src/backend/utils/misc/database.c
index 24087cdafa6..cec5b306671 100644
--- a/src/backend/utils/misc/database.c
+++ b/src/backend/utils/misc/database.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.6 1998/01/31 04:39:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.7 1998/02/26 04:38:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,23 +41,23 @@ GetDatabaseInfo(char *name, Oid *owner, char *path)
{
Oid dbowner,
dbid;
- char dbpath[MAXPGPATH+1];
+ char dbpath[MAXPGPATH + 1];
text *dbtext;
Relation dbrel;
- HeapTuple dbtup;
- HeapTuple tup;
- Buffer buf;
+ HeapTuple dbtup;
+ HeapTuple tup;
+ Buffer buf;
HeapScanDesc scan;
ScanKeyData scanKey;
dbrel = heap_openr(DatabaseRelationName);
if (!RelationIsValid(dbrel))
- elog(FATAL,"GetDatabaseInfo: cannot open relation \"%-.*s\"",
- DatabaseRelationName);
+ elog(FATAL, "GetDatabaseInfo: cannot open relation \"%-.*s\"",
+ DatabaseRelationName);
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
- NameEqualRegProcedure, NameGetDatum(name));
+ NameEqualRegProcedure, NameGetDatum(name));
scan = heap_beginscan(dbrel, 0, false, 1, &scanKey);
if (!HeapScanIsValid(scan))
@@ -80,61 +80,65 @@ GetDatabaseInfo(char *name, Oid *owner, char *path)
if (!HeapTupleIsValid(dbtup))
{
- elog(NOTICE,"GetDatabaseInfo: %s entry not found %s",
- DatabaseRelationName,name);
+ elog(NOTICE, "GetDatabaseInfo: %s entry not found %s",
+ DatabaseRelationName, name);
return TRUE;
}
dbowner = (Oid) heap_getattr(dbtup,
- Anum_pg_database_datdba,
- RelationGetTupleDescriptor(dbrel),
- (char *) NULL);
+ Anum_pg_database_datdba,
+ RelationGetTupleDescriptor(dbrel),
+ (char *) NULL);
dbid = dbtup->t_oid;
-
+
dbtext = (text *) heap_getattr(dbtup,
- Anum_pg_database_datpath,
- RelationGetTupleDescriptor(dbrel),
- (char *) NULL);
+ Anum_pg_database_datpath,
+ RelationGetTupleDescriptor(dbrel),
+ (char *) NULL);
- memcpy(dbpath, VARDATA(dbtext), (VARSIZE(dbtext)-VARHDRSZ));
- *(dbpath+(VARSIZE(dbtext)-VARHDRSZ)) = '\0';
+ memcpy(dbpath, VARDATA(dbtext), (VARSIZE(dbtext) - VARHDRSZ));
+ *(dbpath + (VARSIZE(dbtext) - VARHDRSZ)) = '\0';
heap_close(dbrel);
owner = palloc(sizeof(Oid));
*owner = dbowner;
- path = palloc(strlen(dbpath)+1);
+ path = palloc(strlen(dbpath) + 1);
strcpy(path, dbpath);
return FALSE;
-} /* GetDatabaseInfo() */
+} /* GetDatabaseInfo() */
char *
ExpandDatabasePath(char *dbpath)
{
char *path;
char *cp;
- char buf[MAXPGPATH+1];
+ char buf[MAXPGPATH + 1];
/* leading path delimiter? then already absolute path */
if (*dbpath == SEP_CHAR)
{
cp = strrchr(dbpath, SEP_CHAR);
- strncpy(buf,dbpath,(cp-dbpath));
- sprintf(&buf[cp-dbpath], "%cbase%c%s", SEP_CHAR, SEP_CHAR, (cp+1));
+ strncpy(buf, dbpath, (cp - dbpath));
+ sprintf(&buf[cp - dbpath], "%cbase%c%s", SEP_CHAR, SEP_CHAR, (cp + 1));
}
/* path delimiter somewhere? then has leading environment variable */
else if (strchr(dbpath, SEP_CHAR) != NULL)
{
cp = strchr(dbpath, SEP_CHAR);
- strncpy(buf,dbpath,(cp-dbpath));
- buf[cp-dbpath] = '\0';
+ strncpy(buf, dbpath, (cp - dbpath));
+ buf[cp - dbpath] = '\0';
path = getenv(buf);
- /* problem getting environment variable? let calling routine handle it */
+
+ /*
+ * problem getting environment variable? let calling routine
+ * handle it
+ */
if (path == NULL)
return path;
- sprintf(buf, "%s%cbase%c%s", path, SEP_CHAR, SEP_CHAR, (cp+1));
+ sprintf(buf, "%s%cbase%c%s", path, SEP_CHAR, SEP_CHAR, (cp + 1));
}
/* no path delimiter? then add the default path prefixes */
else
@@ -142,11 +146,11 @@ ExpandDatabasePath(char *dbpath)
sprintf(buf, "%s%cbase%c%s", DataDir, SEP_CHAR, SEP_CHAR, dbpath);
}
- path = palloc(strlen(buf)+1);
- strcpy(path,buf);
+ path = palloc(strlen(buf) + 1);
+ strcpy(path, buf);
return path;
-} /* ExpandDatabasePath() */
+} /* ExpandDatabasePath() */
/* --------------------------------
@@ -269,8 +273,8 @@ GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path)
{
*db_id = tup->t_oid;
strncpy(path, VARDATA(&(tup_db->datpath)),
- (VARSIZE(&(tup_db->datpath))-VARHDRSZ));
- *(path+VARSIZE(&(tup_db->datpath))-VARHDRSZ) = '\0';
+ (VARSIZE(&(tup_db->datpath)) - VARHDRSZ));
+ *(path + VARSIZE(&(tup_db->datpath)) - VARHDRSZ) = '\0';
goto done;
}
@@ -280,4 +284,4 @@ GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path)
done:
close(dbfd);
pfree(pg);
-} /* GetRawDatabaseInfo() */
+} /* GetRawDatabaseInfo() */
diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c
index b2fc83e5f71..880b8cddc72 100644
--- a/src/backend/utils/mmgr/mcxt.c
+++ b/src/backend/utils/mmgr/mcxt.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.6 1997/09/08 21:49:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/mcxt.c,v 1.7 1998/02/26 04:38:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -293,7 +293,7 @@ MemoryContextRealloc(MemoryContext context,
* BadArgumentsErr if firstTime is true for subsequent calls.
*/
#ifdef NOT_USED
-char *
+char *
MemoryContextGetName(MemoryContext context)
{
AssertState(MemoryContextEnabled);
diff --git a/src/backend/utils/mmgr/palloc.c b/src/backend/utils/mmgr/palloc.c
index bd680464b93..e4d822156f2 100644
--- a/src/backend/utils/mmgr/palloc.c
+++ b/src/backend/utils/mmgr/palloc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/palloc.c,v 1.5 1997/09/08 02:32:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/palloc.c,v 1.6 1998/02/26 04:38:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -60,7 +60,7 @@
* NonallocatedPointer if pointer was not returned by palloc or repalloc
* or may have been subsequently freed.
*/
-void *
+void *
palloc(Size size)
{
#ifdef PALLOC_IS_MALLOC
@@ -94,7 +94,7 @@ pfree(void *pointer)
* NonallocatedPointer if pointer was not returned by palloc or repalloc
* or may have been freed already.
*/
-void *
+void *
repalloc(void *pointer, Size size)
{
#ifdef PALLOC_IS_MALLOC
@@ -107,7 +107,7 @@ repalloc(void *pointer, Size size)
/* pstrdup
allocates space for and copies a string
just like strdup except it uses palloc instead of malloc */
-char *
+char *
pstrdup(char *string)
{
char *nstr;
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c
index 10f619e5ce0..f56bc4cf0ae 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.9 1997/09/18 20:22:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v 1.10 1998/02/26 04:38:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -704,7 +704,7 @@ PortalGetQueryDesc(Portal portal)
* BadState if called when disabled.
* BadArg if portal is invalid.
*/
-EState *
+EState *
PortalGetState(Portal portal)
{
AssertState(PortalManagerEnabled);
diff --git a/src/backend/utils/sort/lselect.c b/src/backend/utils/sort/lselect.c
index 80b9fce42a5..527ecd198f9 100644
--- a/src/backend/utils/sort/lselect.c
+++ b/src/backend/utils/sort/lselect.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.12 1998/02/11 19:13:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/lselect.c,v 1.13 1998/02/26 04:38:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -140,7 +140,7 @@ gettuple(struct leftist ** treep,
else
*treep = lmerge(tp->lt_left, tp->lt_right, context);
- pfree (tp);
+ pfree(tp);
return (tup);
}
@@ -186,7 +186,7 @@ puttuple(struct leftist ** treep,
int
tuplecmp(HeapTuple ltup, HeapTuple rtup, LeftistContext context)
{
- Datum lattr,
+ Datum lattr,
rattr;
int nkey = 0;
int result = 0;
@@ -212,12 +212,12 @@ tuplecmp(HeapTuple ltup, HeapTuple rtup, LeftistContext context)
if (context->scanKeys[nkey].sk_flags & SK_COMMUTE)
{
if (!(result =
- (long) (*fmgr_faddr(&context->scanKeys[nkey].sk_func)) (rattr, lattr)))
+ (long) (*fmgr_faddr(&context->scanKeys[nkey].sk_func)) (rattr, lattr)))
result =
-(long) (*fmgr_faddr(&context->scanKeys[nkey].sk_func)) (lattr, rattr);
}
else if (!(result =
- (long) (*fmgr_faddr(&context->scanKeys[nkey].sk_func)) (lattr, rattr)))
+ (long) (*fmgr_faddr(&context->scanKeys[nkey].sk_func)) (lattr, rattr)))
result =
-(long) (*fmgr_faddr(&context->scanKeys[nkey].sk_func)) (rattr, lattr);
nkey++;
diff --git a/src/backend/utils/sort/psort.c b/src/backend/utils/sort/psort.c
index 9bb7de5b68b..fa439f520ed 100644
--- a/src/backend/utils/sort/psort.c
+++ b/src/backend/utils/sort/psort.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.38 1998/02/23 06:27:39 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.39 1998/02/26 04:38:29 momjian Exp $
*
* NOTES
* Sorts the first relation into the second relation.
@@ -57,32 +57,32 @@
#include "utils/psort.h"
#include "utils/rel.h"
-static bool createfirstrun(Sort * node);
-static bool createrun(Sort * node, FILE * file);
-static void destroytape(FILE * file);
-static void dumptuples(FILE * file, Sort * node);
+static bool createfirstrun(Sort *node);
+static bool createrun(Sort *node, FILE *file);
+static void destroytape(FILE *file);
+static void dumptuples(FILE *file, Sort *node);
static FILE *gettape(void);
-static void initialrun(Sort * node);
-static void inittapes(Sort * node);
-static void merge(Sort * node, struct tape * dest);
-static FILE *mergeruns(Sort * node);
+static void initialrun(Sort *node);
+static void inittapes(Sort *node);
+static void merge(Sort *node, struct tape * dest);
+static FILE *mergeruns(Sort *node);
static HeapTuple tuplecopy(HeapTuple tup);
-static int _psort_cmp (HeapTuple *ltup, HeapTuple *rtup);
+static int _psort_cmp(HeapTuple *ltup, HeapTuple *rtup);
#define TEMPDIR "./"
-/*
+/*
* tlenzero used to delimit runs; both vars below must have
* the same size as HeapTuple->t_len
*/
static unsigned int tlenzero = 0;
static unsigned int tlendummy;
-static TupleDesc PsortTupDesc;
-static ScanKey PsortKeys; /* used by _psort_cmp */
-static int PsortNkeys;
+static TupleDesc PsortTupDesc;
+static ScanKey PsortKeys; /* used by _psort_cmp */
+static int PsortNkeys;
/*
* old psort global variables
@@ -127,7 +127,7 @@ static int PsortNkeys;
* Allocates and initializes sort node's psort state.
*/
bool
-psort_begin(Sort * node, int nkeys, ScanKey key)
+psort_begin(Sort *node, int nkeys, ScanKey key)
{
node->psortstate = (struct Psortstate *) palloc(sizeof(struct Psortstate));
@@ -173,9 +173,9 @@ psort_begin(Sort * node, int nkeys, ScanKey key)
* number of allocated tapes
*/
static void
-inittapes(Sort * node)
+inittapes(Sort *node)
{
- int i;
+ int i;
struct tape *tp;
Assert(node != (Sort *) NULL);
@@ -245,7 +245,7 @@ inittapes(Sort * node)
#define USEMEM(NODE,AMT) PS(node)->treeContext.sortMem -= (AMT)
#define FREEMEM(NODE,AMT) PS(node)->treeContext.sortMem += (AMT)
-#define LACKMEM(NODE) (PS(node)->treeContext.sortMem <= BLCKSZ) /* not accurate */
+#define LACKMEM(NODE) (PS(node)->treeContext.sortMem <= BLCKSZ) /* not accurate */
#define TRACEMEM(FUNC)
#define TRACEOUT(FUNC, TUP)
@@ -274,7 +274,7 @@ inittapes(Sort * node)
* Also, perhaps allocate tapes when needed. Split into 2 funcs.
*/
static void
-initialrun(Sort * node)
+initialrun(Sort *node)
{
/* struct tuple *tup; */
struct tape *tp;
@@ -288,22 +288,25 @@ initialrun(Sort * node)
if (createfirstrun(node))
{
- Assert (PS(node)->using_tape_files);
+ Assert(PS(node)->using_tape_files);
extrapasses = 0;
}
- else /* all tuples fetched */
+ else
+/* all tuples fetched */
{
- if ( !PS(node)->using_tape_files ) /* empty or sorted in memory */
+ if (!PS(node)->using_tape_files) /* empty or sorted in
+ * memory */
return;
- /*
+
+ /*
* if PS(node)->Tuples == NULL then we have single (sorted) run
- * which can be used as result grab file! So, we may avoid
+ * which can be used as result grab file! So, we may avoid
* mergeruns - it will just copy this run to new file.
*/
- if ( PS(node)->Tuples == NULL )
+ if (PS(node)->Tuples == NULL)
{
PS(node)->psort_grab_file = PS(node)->Tape->tp_file;
- rewind (PS(node)->psort_grab_file);
+ rewind(PS(node)->psort_grab_file);
return;
}
extrapasses = 2;
@@ -352,7 +355,7 @@ initialrun(Sort * node)
}
/*
- * createfirstrun - tries to sort tuples in memory using qsort
+ * createfirstrun - tries to sort tuples in memory using qsort
* until LACKMEM; if not enough memory then switches
* to tape method
*
@@ -363,12 +366,12 @@ initialrun(Sort * node)
static bool
createfirstrun(Sort *node)
{
- HeapTuple tup;
- bool foundeor = false;
- HeapTuple *memtuples;
- int t_last = -1;
- int t_free = 1000;
- TupleTableSlot *cr_slot;
+ HeapTuple tup;
+ bool foundeor = false;
+ HeapTuple *memtuples;
+ int t_last = -1;
+ int t_free = 1000;
+ TupleTableSlot *cr_slot;
Assert(node != (Sort *) NULL);
Assert(PS(node) != (Psortstate *) NULL);
@@ -376,15 +379,15 @@ createfirstrun(Sort *node)
Assert(PS(node)->memtuples == NULL);
Assert(PS(node)->tupcount == 0);
if (LACKMEM(node))
- elog (FATAL, "psort: LACKMEM in createfirstrun");
-
+ elog(FATAL, "psort: LACKMEM in createfirstrun");
+
memtuples = palloc(t_free * sizeof(HeapTuple));
-
+
for (;;)
{
- if ( LACKMEM (node) )
+ if (LACKMEM(node))
break;
-
+
/*
* About to call ExecProcNode, it can mess up the state if it
* eventually calls another Sort node. So must stow it away here
@@ -399,28 +402,28 @@ createfirstrun(Sort *node)
foundeor = true;
break;
}
-
+
tup = tuplecopy(cr_slot->val);
ExecClearTuple(cr_slot);
IncrProcessed();
USEMEM(node, tup->t_len);
TRACEMEM(createfirstrun);
- if ( t_free <= 0 )
+ if (t_free <= 0)
{
- t_free = 1000;
- memtuples = repalloc (memtuples,
- (t_last + t_free + 1) * sizeof (HeapTuple));
+ t_free = 1000;
+ memtuples = repalloc(memtuples,
+ (t_last + t_free + 1) * sizeof(HeapTuple));
}
t_last++;
t_free--;
memtuples[t_last] = tup;
}
-
- if ( t_last < 0 ) /* empty */
+
+ if (t_last < 0) /* empty */
{
- Assert (foundeor);
- pfree (memtuples);
+ Assert(foundeor);
+ pfree(memtuples);
return (false);
}
t_last++;
@@ -428,27 +431,27 @@ createfirstrun(Sort *node)
PsortTupDesc = PS(node)->treeContext.tupDesc;
PsortKeys = PS(node)->treeContext.scanKeys;
PsortNkeys = PS(node)->treeContext.nKeys;
- qsort (memtuples, t_last, sizeof (HeapTuple),
- (int (*)(const void *,const void *))_psort_cmp);
-
- if ( LACKMEM (node) ) /* in-memory sort is impossible */
+ qsort(memtuples, t_last, sizeof(HeapTuple),
+ (int (*) (const void *, const void *)) _psort_cmp);
+
+ if (LACKMEM(node)) /* in-memory sort is impossible */
{
- int t;
-
- Assert (!foundeor);
+ int t;
+
+ Assert(!foundeor);
inittapes(node);
/* put tuples into leftist tree for createrun */
- for (t = t_last - 1 ; t >= 0; t--)
+ for (t = t_last - 1; t >= 0; t--)
puttuple(&PS(node)->Tuples, memtuples[t], 0, &PS(node)->treeContext);
- pfree (memtuples);
- foundeor = !createrun (node, PS(node)->Tape->tp_file);
+ pfree(memtuples);
+ foundeor = !createrun(node, PS(node)->Tape->tp_file);
}
else
{
- Assert (foundeor);
+ Assert(foundeor);
PS(node)->memtuples = memtuples;
}
-
+
return (!foundeor);
}
@@ -464,24 +467,24 @@ createfirstrun(Sort *node)
* Tuples contains the tuples for the following run upon exit
*/
static bool
-createrun(Sort * node, FILE * file)
+createrun(Sort *node, FILE *file)
{
HeapTuple lasttuple;
HeapTuple tup;
- TupleTableSlot *cr_slot;
- HeapTuple *memtuples;
- int t_last = -1;
- int t_free = 1000;
- bool foundeor = false;
- short junk;
+ TupleTableSlot *cr_slot;
+ HeapTuple *memtuples;
+ int t_last = -1;
+ int t_free = 1000;
+ bool foundeor = false;
+ short junk;
Assert(node != (Sort *) NULL);
Assert(PS(node) != (Psortstate *) NULL);
- Assert (PS(node)->using_tape_files);
+ Assert(PS(node)->using_tape_files);
lasttuple = NULL;
memtuples = palloc(t_free * sizeof(HeapTuple));
-
+
for (;;)
{
while (LACKMEM(node) && PS(node)->Tuples != NULL)
@@ -493,14 +496,14 @@ createrun(Sort * node, FILE * file)
TRACEMEM(createrun);
}
lasttuple = gettuple(&PS(node)->Tuples, &junk,
- &PS(node)->treeContext);
+ &PS(node)->treeContext);
PUTTUP(node, lasttuple, file);
TRACEOUT(createrun, lasttuple);
}
-
+
if (LACKMEM(node))
break;
-
+
/*
* About to call ExecProcNode, it can mess up the state if it
* eventually calls another Sort node. So must stow it away here
@@ -528,11 +531,11 @@ createrun(Sort * node, FILE * file)
if (lasttuple != NULL && tuplecmp(tup, lasttuple,
&PS(node)->treeContext))
{
- if ( t_free <= 0 )
+ if (t_free <= 0)
{
- t_free = 1000;
- memtuples = repalloc (memtuples,
- (t_last + t_free + 1) * sizeof (HeapTuple));
+ t_free = 1000;
+ memtuples = repalloc(memtuples,
+ (t_last + t_free + 1) * sizeof(HeapTuple));
}
t_last++;
t_free--;
@@ -549,23 +552,23 @@ createrun(Sort * node, FILE * file)
}
dumptuples(file, node);
ENDRUN(file); /* delimit the end of the run */
-
+
t_last++;
/* put tuples for the next run into leftist tree */
- if ( t_last >= 1 )
+ if (t_last >= 1)
{
- int t;
-
+ int t;
+
PsortTupDesc = PS(node)->treeContext.tupDesc;
PsortKeys = PS(node)->treeContext.scanKeys;
PsortNkeys = PS(node)->treeContext.nKeys;
- qsort (memtuples, t_last, sizeof (HeapTuple),
- (int (*)(const void *,const void *))_psort_cmp);
- for (t = t_last - 1 ; t >= 0; t--)
+ qsort(memtuples, t_last, sizeof(HeapTuple),
+ (int (*) (const void *, const void *)) _psort_cmp);
+ for (t = t_last - 1; t >= 0; t--)
puttuple(&PS(node)->Tuples, memtuples[t], 0, &PS(node)->treeContext);
}
-
- pfree (memtuples);
+
+ pfree(memtuples);
return (!foundeor);
}
@@ -598,7 +601,7 @@ tuplecopy(HeapTuple tup)
* file of tuples in order
*/
static FILE *
-mergeruns(Sort * node)
+mergeruns(Sort *node)
{
struct tape *tp;
@@ -625,17 +628,17 @@ mergeruns(Sort * node)
* (polyphase merge Alg.D(D5)--Knuth, Vol.3, p271)
*/
static void
-merge(Sort * node, struct tape * dest)
+merge(Sort *node, struct tape * dest)
{
- HeapTuple tup;
+ HeapTuple tup;
struct tape *lasttp; /* (TAPE[P]) */
struct tape *tp;
struct leftist *tuples;
- FILE *destfile;
- int times; /* runs left to merge */
- int outdummy; /* complete dummy runs */
- short fromtape;
- unsigned int tuplen;
+ FILE *destfile;
+ int times; /* runs left to merge */
+ int outdummy; /* complete dummy runs */
+ short fromtape;
+ unsigned int tuplen;
Assert(node != (Sort *) NULL);
Assert(PS(node) != (Psortstate *) NULL);
@@ -732,7 +735,7 @@ merge(Sort * node, struct tape * dest)
* dumptuples - stores all the tuples in tree into file
*/
static void
-dumptuples(FILE * file, Sort * node)
+dumptuples(FILE *file, Sort *node)
{
struct leftist *tp;
struct leftist *newp;
@@ -740,7 +743,7 @@ dumptuples(FILE * file, Sort * node)
LeftistContext context = &PS(node)->treeContext;
HeapTuple tup;
- Assert (PS(node)->using_tape_files);
+ Assert(PS(node)->using_tape_files);
tp = *treep;
while (tp != NULL)
@@ -767,7 +770,7 @@ dumptuples(FILE * file, Sort * node)
* a NULL indicating the last tuple has been processed.
*/
HeapTuple
-psort_grabtuple(Sort * node, bool * should_free)
+psort_grabtuple(Sort *node, bool *should_free)
{
HeapTuple tup;
@@ -776,10 +779,10 @@ psort_grabtuple(Sort * node, bool * should_free)
if (PS(node)->using_tape_files == true)
{
- unsigned int tuplen;
-
+ unsigned int tuplen;
+
*should_free = true;
- if (ScanDirectionIsForward (node->plan.state->es_direction))
+ if (ScanDirectionIsForward(node->plan.state->es_direction))
{
if (PS(node)->all_fetched)
return NULL;
@@ -790,7 +793,7 @@ psort_grabtuple(Sort * node, bool * should_free)
GETTUP(node, tup, tuplen, PS(node)->psort_grab_file);
/* Update current merged sort file position */
- PS(node)->psort_current += tuplen + sizeof (tlendummy);
+ PS(node)->psort_current += tuplen + sizeof(tlendummy);
return tup;
}
else
@@ -800,64 +803,72 @@ psort_grabtuple(Sort * node, bool * should_free)
}
}
/* Backward */
- if (PS(node)->psort_current <= sizeof (tlendummy))
+ if (PS(node)->psort_current <= sizeof(tlendummy))
return NULL;
- /*
- * if all tuples are fetched already then we return last tuple,
+
+ /*
+ * if all tuples are fetched already then we return last tuple,
* else - tuple before last returned.
*/
if (PS(node)->all_fetched)
{
- /* psort_current is pointing to the zero tuplen at the end of file */
- fseek(PS(node)->psort_grab_file,
- PS(node)->psort_current - sizeof (tlendummy), SEEK_SET);
+
+ /*
+ * psort_current is pointing to the zero tuplen at the end of
+ * file
+ */
+ fseek(PS(node)->psort_grab_file,
+ PS(node)->psort_current - sizeof(tlendummy), SEEK_SET);
GETLEN(tuplen, PS(node)->psort_grab_file);
if (PS(node)->psort_current < tuplen)
- elog (FATAL, "psort_grabtuple: too big last tuple len in backward scan");
+ elog(FATAL, "psort_grabtuple: too big last tuple len in backward scan");
PS(node)->all_fetched = false;
}
else
{
/* move to position of end tlen of prev tuple */
- PS(node)->psort_current -= sizeof (tlendummy);
+ PS(node)->psort_current -= sizeof(tlendummy);
fseek(PS(node)->psort_grab_file, PS(node)->psort_current, SEEK_SET);
- GETLEN(tuplen, PS(node)->psort_grab_file); /* get tlen of prev tuple */
+ GETLEN(tuplen, PS(node)->psort_grab_file); /* get tlen of prev
+ * tuple */
if (tuplen == 0)
- elog (FATAL, "psort_grabtuple: tuplen is 0 in backward scan");
- if (PS(node)->psort_current <= tuplen + sizeof (tlendummy))
- { /* prev tuple should be first one */
+ elog(FATAL, "psort_grabtuple: tuplen is 0 in backward scan");
+ if (PS(node)->psort_current <= tuplen + sizeof(tlendummy))
+ { /* prev tuple should be first one */
if (PS(node)->psort_current != tuplen)
- elog (FATAL, "psort_grabtuple: first tuple expected in backward scan");
+ elog(FATAL, "psort_grabtuple: first tuple expected in backward scan");
PS(node)->psort_current = 0;
fseek(PS(node)->psort_grab_file, PS(node)->psort_current, SEEK_SET);
return NULL;
}
- /*
- * Get position of prev tuple. This tuple becomes current tuple
- * now and we have to return previous one.
+
+ /*
+ * Get position of prev tuple. This tuple becomes current
+ * tuple now and we have to return previous one.
*/
PS(node)->psort_current -= tuplen;
/* move to position of end tlen of prev tuple */
- fseek(PS(node)->psort_grab_file,
- PS(node)->psort_current - sizeof (tlendummy), SEEK_SET);
+ fseek(PS(node)->psort_grab_file,
+ PS(node)->psort_current - sizeof(tlendummy), SEEK_SET);
GETLEN(tuplen, PS(node)->psort_grab_file);
- if (PS(node)->psort_current < tuplen + sizeof (tlendummy))
- elog (FATAL, "psort_grabtuple: too big tuple len in backward scan");
+ if (PS(node)->psort_current < tuplen + sizeof(tlendummy))
+ elog(FATAL, "psort_grabtuple: too big tuple len in backward scan");
}
- /*
- * move to prev (or last) tuple start position + sizeof(t_len)
+
+ /*
+ * move to prev (or last) tuple start position + sizeof(t_len)
*/
fseek(PS(node)->psort_grab_file,
- PS(node)->psort_current - tuplen, SEEK_SET);
+ PS(node)->psort_current - tuplen, SEEK_SET);
tup = (HeapTuple) palloc((unsigned) tuplen);
SETTUPLEN(tup, tuplen);
GETTUP(node, tup, tuplen, PS(node)->psort_grab_file);
- return tup; /* file position is equal to psort_current */
+ return tup; /* file position is equal to psort_current */
}
else
{
*should_free = false;
- if (ScanDirectionIsForward (node->plan.state->es_direction))
+ if (ScanDirectionIsForward(node->plan.state->es_direction))
{
if (PS(node)->psort_current < PS(node)->tupcount)
return (PS(node)->memtuples[PS(node)->psort_current++]);
@@ -870,15 +881,16 @@ psort_grabtuple(Sort * node, bool * should_free)
/* Backward */
if (PS(node)->psort_current <= 0)
return NULL;
- /*
- * if all tuples are fetched already then we return last tuple,
+
+ /*
+ * if all tuples are fetched already then we return last tuple,
* else - tuple before last returned.
*/
- if (PS(node)->all_fetched)
+ if (PS(node)->all_fetched)
PS(node)->all_fetched = false;
else
{
- PS(node)->psort_current--; /* last returned tuple */
+ PS(node)->psort_current--; /* last returned tuple */
if (PS(node)->psort_current <= 0)
return NULL;
}
@@ -890,7 +902,7 @@ psort_grabtuple(Sort * node, bool * should_free)
* psort_markpos - saves current position in the merged sort file
*/
void
-psort_markpos(Sort * node)
+psort_markpos(Sort *node)
{
Assert(node != (Sort *) NULL);
Assert(PS(node) != (Psortstate *) NULL);
@@ -903,7 +915,7 @@ psort_markpos(Sort * node)
* last saved position
*/
void
-psort_restorepos(Sort * node)
+psort_restorepos(Sort *node)
{
Assert(node != (Sort *) NULL);
Assert(PS(node) != (Psortstate *) NULL);
@@ -918,12 +930,13 @@ psort_restorepos(Sort * node)
* called unless psort_grabtuple has returned a NULL.
*/
void
-psort_end(Sort * node)
+psort_end(Sort *node)
{
struct tape *tp;
if (!node->cleaned)
{
+
/*
* I'm changing this because if we are sorting a relation with no
* tuples, psortstate is NULL.
@@ -950,14 +963,15 @@ psort_end(Sort * node)
}
void
-psort_rescan (Sort *node)
+psort_rescan(Sort *node)
{
+
/*
* If subnode is to be rescanned then free our previous results
*/
- if (((Plan*) node)->lefttree->chgParam != NULL)
+ if (((Plan *) node)->lefttree->chgParam != NULL)
{
- psort_end (node);
+ psort_end(node);
node->cleaned = false;
}
else if (PS(node) != (Psortstate *) NULL)
@@ -966,7 +980,7 @@ psort_rescan (Sort *node)
PS(node)->psort_current = 0;
PS(node)->psort_saved = 0;
if (PS(node)->using_tape_files == true)
- rewind (PS(node)->psort_grab_file);
+ rewind(PS(node)->psort_grab_file);
}
}
@@ -1039,10 +1053,10 @@ gettape()
*/
#ifdef NOT_USED
static void
-resettape(FILE * file)
+resettape(FILE *file)
{
struct tapelst *tp;
- int fd;
+ int fd;
Assert(PointerIsValid(file));
@@ -1071,11 +1085,11 @@ resettape(FILE * file)
* Exits instead of returning status, if given invalid tape.
*/
static void
-destroytape(FILE * file)
+destroytape(FILE *file)
{
struct tapelst *tp,
*tq;
- int fd;
+ int fd;
if ((tp = Tapes) == NULL)
elog(FATAL, "destroytape: tape not found");
@@ -1108,38 +1122,40 @@ destroytape(FILE * file)
}
static int
-_psort_cmp (HeapTuple *ltup, HeapTuple *rtup)
+_psort_cmp(HeapTuple *ltup, HeapTuple *rtup)
{
- Datum lattr, rattr;
- int nkey;
- int result = 0;
- bool isnull1, isnull2;
-
- for (nkey = 0; nkey < PsortNkeys && !result; nkey++ )
- {
+ Datum lattr,
+ rattr;
+ int nkey;
+ int result = 0;
+ bool isnull1,
+ isnull2;
+
+ for (nkey = 0; nkey < PsortNkeys && !result; nkey++)
+ {
lattr = heap_getattr(*ltup,
- PsortKeys[nkey].sk_attno,
- PsortTupDesc,
- &isnull1);
+ PsortKeys[nkey].sk_attno,
+ PsortTupDesc,
+ &isnull1);
rattr = heap_getattr(*rtup,
- PsortKeys[nkey].sk_attno,
- PsortTupDesc,
- &isnull2);
- if ( isnull1 )
+ PsortKeys[nkey].sk_attno,
+ PsortTupDesc,
+ &isnull2);
+ if (isnull1)
{
- if ( !isnull2 )
+ if (!isnull2)
result = 1;
}
- else if ( isnull2 )
- result = -1;
-
+ else if (isnull2)
+ result = -1;
+
else if (PsortKeys[nkey].sk_flags & SK_COMMUTE)
{
- if (!(result = -(long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (rattr, lattr)))
- result = (long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (lattr, rattr);
+ if (!(result = -(long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (rattr, lattr)))
+ result = (long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (lattr, rattr);
}
else if (!(result = -(long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (lattr, rattr)))
- result = (long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (rattr, lattr);
- }
- return (result);
+ result = (long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (rattr, lattr);
+ }
+ return (result);
}
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index dea288da584..bb0538eb79a 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.13 1997/11/26 03:54:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.14 1998/02/26 04:38:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -125,9 +125,10 @@ HeapTupleSatisfiesItself(HeapTuple tuple)
if (!(tuple->t_infomask & HEAP_XMIN_COMMITTED))
{
- if (tuple->t_infomask & HEAP_XMIN_INVALID) /* xid invalid or aborted */
+ if (tuple->t_infomask & HEAP_XMIN_INVALID) /* xid invalid or
+ * aborted */
return (false);
-
+
if (TransactionIdIsCurrentTransactionId(tuple->t_xmin))
{
if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid */
@@ -139,7 +140,7 @@ HeapTupleSatisfiesItself(HeapTuple tuple)
if (!TransactionIdDidCommit(tuple->t_xmin))
{
if (TransactionIdDidAbort(tuple->t_xmin))
- tuple->t_infomask |= HEAP_XMIN_INVALID; /* aborted */
+ tuple->t_infomask |= HEAP_XMIN_INVALID; /* aborted */
return (false);
}
@@ -229,17 +230,18 @@ HeapTupleSatisfiesNow(HeapTuple tuple)
if (!PostgresIsInitialized)
return ((bool) (TransactionIdIsValid(tuple->t_xmin) &&
- !TransactionIdIsValid(tuple->t_xmax)));
+ !TransactionIdIsValid(tuple->t_xmax)));
if (!(tuple->t_infomask & HEAP_XMIN_COMMITTED))
{
- if (tuple->t_infomask & HEAP_XMIN_INVALID) /* xid invalid or aborted */
+ if (tuple->t_infomask & HEAP_XMIN_INVALID) /* xid invalid or
+ * aborted */
return (false);
if (TransactionIdIsCurrentTransactionId(tuple->t_xmin))
{
if (CommandIdGEScanCommandId(tuple->t_cmin))
- return (false); /* inserted after scan started */
+ return (false); /* inserted after scan started */
if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid */
return (true);
@@ -249,7 +251,7 @@ HeapTupleSatisfiesNow(HeapTuple tuple)
if (CommandIdGEScanCommandId(tuple->t_cmax))
return (true); /* deleted after scan started */
else
- return (false); /* deleted before scan started */
+ return (false); /* deleted before scan started */
}
/*
@@ -259,7 +261,7 @@ HeapTupleSatisfiesNow(HeapTuple tuple)
if (!TransactionIdDidCommit(tuple->t_xmin))
{
if (TransactionIdDidAbort(tuple->t_xmin))
- tuple->t_infomask |= HEAP_XMIN_INVALID; /* aborted */
+ tuple->t_infomask |= HEAP_XMIN_INVALID; /* aborted */
return (false);
}
@@ -277,9 +279,9 @@ HeapTupleSatisfiesNow(HeapTuple tuple)
if (TransactionIdIsCurrentTransactionId(tuple->t_xmax))
{
if (CommandIdGEScanCommandId(tuple->t_cmax))
- return (true); /* deleted after scan started */
+ return (true); /* deleted after scan started */
else
- return (false); /* deleted before scan started */
+ return (false); /* deleted before scan started */
}
if (!TransactionIdDidCommit(tuple->t_xmax))
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c
index e4a17d3654c..dddc211ea82 100644
--- a/src/bin/pg_dump/common.c
+++ b/src/bin/pg_dump/common.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.19 1997/11/21 19:02:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.20 1998/02/26 04:38:41 momjian Exp $
*
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
*
@@ -56,7 +56,7 @@ static int strInArray(const char *pattern, char **arr, int arr_size);
* NOTE: should hash this, but just do linear search for now
*/
-char *
+char *
findTypeByOid(TypeInfo *tinfo, int numTypes, const char *oid)
{
int i;
@@ -84,7 +84,7 @@ findTypeByOid(TypeInfo *tinfo, int numTypes, const char *oid)
* NOTE: should hash this, but just do linear search for now
*
*/
-char *
+char *
findOprByOid(OprInfo *oprinfo, int numOprs, const char *oid)
{
int i;
@@ -482,15 +482,19 @@ fmtId(const char *rawid)
static char id[MAXQUERYLEN];
for (cp = rawid; *cp != '\0'; cp++)
- if (! (islower(*cp) || isdigit(*cp) || (*cp == '_'))) break;
+ if (!(islower(*cp) || isdigit(*cp) || (*cp == '_')))
+ break;
- if (*cp != '\0') {
+ if (*cp != '\0')
+ {
strcpy(id, "\"");
strcat(id, rawid);
strcat(id, "\"");
cp = id;
- } else {
+ }
+ else
+ {
cp = rawid;
}
- return(cp);
-} /* fmtId() */
+ return (cp);
+} /* fmtId() */
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 16cc6797380..9e1b78a60f5 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -21,7 +21,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.63 1998/02/18 15:33:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.64 1998/02/26 04:38:54 momjian Exp $
*
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
*
@@ -47,7 +47,7 @@
*
*
* Modifications - 1/26/98 - pjlobo@euitt.upm.es
- * - Added support for password authentication
+ * - Added support for password authentication
*-------------------------------------------------------------------------
*/
@@ -79,8 +79,9 @@
#include "pg_dump.h"
static void dumpSequence(FILE *fout, TableInfo tbinfo);
-static void dumpTriggers(FILE *fout, const char *tablename,
- TableInfo *tblinfo, int numTables);
+static void
+dumpTriggers(FILE *fout, const char *tablename,
+ TableInfo *tblinfo, int numTables);
static char *checkForQuote(const char *s);
static void clearTableInfo(TableInfo *, int);
static void
@@ -92,7 +93,7 @@ static void setMaxOid(FILE *fout);
static char *AddAcl(char *s, const char *add);
static char *GetPrivledges(char *s);
-static ACL *ParseACL(const char *acls,int *count);
+static ACL *ParseACL(const char *acls, int *count);
extern char *optarg;
extern int optind,
@@ -126,7 +127,7 @@ usage(const char *progname)
fprintf(stderr,
"\t -d \t\t dump data as proper insert strings\n");
fprintf(stderr,
- "\t -D \t\t dump data as inserts with attribute names\n");
+ "\t -D \t\t dump data as inserts with attribute names\n");
fprintf(stderr,
"\t -f filename \t\t script output filename\n");
fprintf(stderr,
@@ -421,7 +422,7 @@ dumpClasses(const TableInfo tblinfo[], const int numTables, FILE *fout,
if (g_verbose)
fprintf(stderr, "%s dumping out the contents of %s of %d tables %s\n",
g_comment_start, all_only, numTables, g_comment_end);
-
+
/* Dump SEQUENCEs first (if dataOnly) */
if (dataOnly)
{
@@ -433,7 +434,7 @@ dumpClasses(const TableInfo tblinfo[], const int numTables, FILE *fout,
{
if (g_verbose)
fprintf(stderr, "%s dumping out schema of sequence %s %s\n",
- g_comment_start, tblinfo[i].relname, g_comment_end);
+ g_comment_start, tblinfo[i].relname, g_comment_end);
fprintf(fout, "\\connect - %s\n", tblinfo[i].usename);
dumpSequence(fout, tblinfo[i]);
}
@@ -447,8 +448,8 @@ dumpClasses(const TableInfo tblinfo[], const int numTables, FILE *fout,
/* Skip VIEW relations */
if (isViewRule(tblinfo[i].relname))
continue;
-
- if (tblinfo[i].sequence) /* already dumped */
+
+ if (tblinfo[i].sequence)/* already dumped */
continue;
if (!onlytable || (!strcmp(classname, onlytable)))
@@ -532,16 +533,16 @@ main(int argc, char **argv)
const char *dbname = NULL;
const char *pghost = NULL;
const char *pgport = NULL;
- char *tablename = NULL;
+ char *tablename = NULL;
int oids = 0,
acls = 0;
TableInfo *tblinfo;
int numTables;
- char connect_string[512] = "";
- char tmp_string[128];
- char username[64];
- char password[64];
- int use_password = 0;
+ char connect_string[512] = "";
+ char tmp_string[128];
+ char username[64];
+ char password[64];
+ int use_password = 0;
g_verbose = false;
@@ -585,7 +586,7 @@ main(int argc, char **argv)
break;
case 't': /* Dump data for this table only */
{
- int i;
+ int i;
tablename = strdup(optarg);
for (i = 0; tablename[i]; i++)
@@ -633,28 +634,32 @@ main(int argc, char **argv)
exit(2);
}
- /*g_conn = PQsetdb(pghost, pgport, NULL, NULL, dbname);*/
- if (pghost != NULL) {
- sprintf(tmp_string, "host=%s ", pghost);
- strcat(connect_string, tmp_string);
+ /* g_conn = PQsetdb(pghost, pgport, NULL, NULL, dbname); */
+ if (pghost != NULL)
+ {
+ sprintf(tmp_string, "host=%s ", pghost);
+ strcat(connect_string, tmp_string);
}
- if (pgport != NULL) {
- sprintf(tmp_string, "port=%s ", pgport);
- strcat(connect_string, tmp_string);
+ if (pgport != NULL)
+ {
+ sprintf(tmp_string, "port=%s ", pgport);
+ strcat(connect_string, tmp_string);
}
- if (dbname != NULL) {
- sprintf(tmp_string, "dbname=%s ", dbname);
- strcat(connect_string, tmp_string);
+ if (dbname != NULL)
+ {
+ sprintf(tmp_string, "dbname=%s ", dbname);
+ strcat(connect_string, tmp_string);
}
- if (use_password) {
- prompt_for_password(username, password);
- strcat(connect_string, "authtype=password ");
- sprintf(tmp_string, "user=%s ", username);
- strcat(connect_string, tmp_string);
- sprintf(tmp_string, "password=%s ", password);
- strcat(connect_string, tmp_string);
- bzero(tmp_string, sizeof(tmp_string));
- bzero(password, sizeof(password));
+ if (use_password)
+ {
+ prompt_for_password(username, password);
+ strcat(connect_string, "authtype=password ");
+ sprintf(tmp_string, "user=%s ", username);
+ strcat(connect_string, tmp_string);
+ sprintf(tmp_string, "password=%s ", password);
+ strcat(connect_string, tmp_string);
+ bzero(tmp_string, sizeof(tmp_string));
+ bzero(password, sizeof(password));
}
g_conn = PQconnectdb(connect_string);
bzero(connect_string, sizeof(connect_string));
@@ -685,7 +690,8 @@ main(int argc, char **argv)
dumpClasses(tblinfo, numTables, g_fout, tablename, oids);
}
- if (!dataOnly) /* dump indexes and triggers at the end for performance */
+ if (!dataOnly) /* dump indexes and triggers at the end
+ * for performance */
{
dumpSchemaIdx(g_fout, tablename, tblinfo, numTables);
dumpTriggers(g_fout, tablename, tblinfo, numTables);
@@ -1407,8 +1413,8 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
PQclear(res);
sprintf(query,
- "SELECT pg_class.oid, relname, relkind, relacl, usename, "
- "relchecks, reltriggers "
+ "SELECT pg_class.oid, relname, relkind, relacl, usename, "
+ "relchecks, reltriggers "
"from pg_class, pg_user "
"where relowner = usesysid and "
"(relkind = 'r' or relkind = 'S') and relname !~ '^pg_' "
@@ -1445,27 +1451,28 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
tblinfo[i].usename = strdup(PQgetvalue(res, i, i_usename));
tblinfo[i].ncheck = atoi(PQgetvalue(res, i, i_relchecks));
tblinfo[i].ntrig = atoi(PQgetvalue(res, i, i_reltriggers));
-
+
/* Get CHECK constraints */
if (tblinfo[i].ncheck > 0)
{
PGresult *res2;
- int i_rcname, i_rcsrc;
+ int i_rcname,
+ i_rcsrc;
int ntups2;
int i2;
-
+
if (g_verbose)
fprintf(stderr, "%s finding CHECK constraints for relation: %s %s\n",
g_comment_start,
tblinfo[i].relname,
g_comment_end);
-
+
sprintf(query, "SELECT rcname, rcsrc from pg_relcheck "
"where rcrelid = '%s'::oid ",
tblinfo[i].oid);
res2 = PQexec(g_conn, query);
if (!res2 ||
- PQresultStatus(res2) != PGRES_TUPLES_OK)
+ PQresultStatus(res2) != PGRES_TUPLES_OK)
{
fprintf(stderr, "getTables(): SELECT (for CHECK) failed\n");
exit_nicely(g_conn);
@@ -1474,49 +1481,53 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
if (ntups2 != tblinfo[i].ncheck)
{
fprintf(stderr, "getTables(): relation %s: %d CHECKs were expected, but got %d\n",
- tblinfo[i].relname, tblinfo[i].ncheck, ntups2);
+ tblinfo[i].relname, tblinfo[i].ncheck, ntups2);
exit_nicely(g_conn);
}
i_rcname = PQfnumber(res2, "rcname");
i_rcsrc = PQfnumber(res2, "rcsrc");
- tblinfo[i].check_expr = (char **) malloc (ntups2 * sizeof (char *));
+ tblinfo[i].check_expr = (char **) malloc(ntups2 * sizeof(char *));
for (i2 = 0; i2 < ntups2; i2++)
{
- char *name = PQgetvalue(res2, i2, i_rcname);
- char *expr = PQgetvalue(res2, i2, i_rcsrc);
-
+ char *name = PQgetvalue(res2, i2, i_rcname);
+ char *expr = PQgetvalue(res2, i2, i_rcsrc);
+
query[0] = 0;
- if ( name[0] != '$' )
- sprintf (query, "CONSTRAINT %s ", name);
- sprintf (query, "%sCHECK %s", query, expr);
- tblinfo[i].check_expr[i2] = strdup (query);
+ if (name[0] != '$')
+ sprintf(query, "CONSTRAINT %s ", name);
+ sprintf(query, "%sCHECK %s", query, expr);
+ tblinfo[i].check_expr[i2] = strdup(query);
}
PQclear(res2);
}
else
tblinfo[i].check_expr = NULL;
-
+
/* Get Triggers */
if (tblinfo[i].ntrig > 0)
{
PGresult *res2;
- int i_tgname, i_tgfoid, i_tgtype, i_tgnargs, i_tgargs;
+ int i_tgname,
+ i_tgfoid,
+ i_tgtype,
+ i_tgnargs,
+ i_tgargs;
int ntups2;
int i2;
-
+
if (g_verbose)
fprintf(stderr, "%s finding Triggers for relation: %s %s\n",
g_comment_start,
tblinfo[i].relname,
g_comment_end);
-
+
sprintf(query, "SELECT tgname, tgfoid, tgtype, tgnargs, tgargs "
"from pg_trigger "
"where tgrelid = '%s'::oid ",
tblinfo[i].oid);
res2 = PQexec(g_conn, query);
if (!res2 ||
- PQresultStatus(res2) != PGRES_TUPLES_OK)
+ PQresultStatus(res2) != PGRES_TUPLES_OK)
{
fprintf(stderr, "getTables(): SELECT (for TRIGGER) failed\n");
exit_nicely(g_conn);
@@ -1525,7 +1536,7 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
if (ntups2 != tblinfo[i].ntrig)
{
fprintf(stderr, "getTables(): relation %s: %d Triggers were expected, but got %d\n",
- tblinfo[i].relname, tblinfo[i].ntrig, ntups2);
+ tblinfo[i].relname, tblinfo[i].ntrig, ntups2);
exit_nicely(g_conn);
}
i_tgname = PQfnumber(res2, "tgname");
@@ -1533,72 +1544,73 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
i_tgtype = PQfnumber(res2, "tgtype");
i_tgnargs = PQfnumber(res2, "tgnargs");
i_tgargs = PQfnumber(res2, "tgargs");
- tblinfo[i].triggers = (char **) malloc (ntups2 * sizeof (char *));
+ tblinfo[i].triggers = (char **) malloc(ntups2 * sizeof(char *));
for (i2 = 0, query[0] = 0; i2 < ntups2; i2++)
{
- char *tgfunc = PQgetvalue(res2, i2, i_tgfoid);
- int2 tgtype = atoi(PQgetvalue(res2, i2, i_tgtype));
- int tgnargs = atoi(PQgetvalue(res2, i2, i_tgnargs));
- char *tgargs = PQgetvalue(res2, i2, i_tgargs);
- char *p;
- char farg[MAXQUERYLEN];
- int findx;
-
+ char *tgfunc = PQgetvalue(res2, i2, i_tgfoid);
+ int2 tgtype = atoi(PQgetvalue(res2, i2, i_tgtype));
+ int tgnargs = atoi(PQgetvalue(res2, i2, i_tgnargs));
+ char *tgargs = PQgetvalue(res2, i2, i_tgargs);
+ char *p;
+ char farg[MAXQUERYLEN];
+ int findx;
+
for (findx = 0; findx < numFuncs; findx++)
{
if (strcmp(finfo[findx].oid, tgfunc) == 0 &&
- finfo[findx].lang == ClanguageId &&
- finfo[findx].nargs == 0 &&
+ finfo[findx].lang == ClanguageId &&
+ finfo[findx].nargs == 0 &&
strcmp(finfo[findx].prorettype, "0") == 0)
break;
}
if (findx == numFuncs)
{
fprintf(stderr, "getTables(): relation %s: cannot find function with oid %s for trigger %s\n",
- tblinfo[i].relname, tgfunc, PQgetvalue(res2, i2, i_tgname));
+ tblinfo[i].relname, tgfunc, PQgetvalue(res2, i2, i_tgname));
exit_nicely(g_conn);
}
tgfunc = finfo[findx].proname;
- sprintf (query, "CREATE TRIGGER %s ", PQgetvalue(res2, i2, i_tgname));
+ sprintf(query, "CREATE TRIGGER %s ", PQgetvalue(res2, i2, i_tgname));
/* Trigger type */
findx = 0;
if (TRIGGER_FOR_BEFORE(tgtype))
- strcat (query, "BEFORE");
+ strcat(query, "BEFORE");
else
- strcat (query, "AFTER");
+ strcat(query, "AFTER");
if (TRIGGER_FOR_INSERT(tgtype))
{
- strcat (query, " INSERT");
+ strcat(query, " INSERT");
findx++;
}
if (TRIGGER_FOR_DELETE(tgtype))
{
if (findx > 0)
- strcat (query, " OR DELETE");
+ strcat(query, " OR DELETE");
else
- strcat (query, " DELETE");
+ strcat(query, " DELETE");
findx++;
}
if (TRIGGER_FOR_UPDATE(tgtype))
if (findx > 0)
- strcat (query, " OR UPDATE");
+ strcat(query, " OR UPDATE");
else
- strcat (query, " UPDATE");
- sprintf (query, "%s ON %s FOR EACH ROW EXECUTE PROCEDURE %s (",
- query, tblinfo[i].relname, tgfunc);
+ strcat(query, " UPDATE");
+ sprintf(query, "%s ON %s FOR EACH ROW EXECUTE PROCEDURE %s (",
+ query, tblinfo[i].relname, tgfunc);
for (findx = 0; findx < tgnargs; findx++)
{
- char *s, *d;
-
- for (p = tgargs; ; )
+ char *s,
+ *d;
+
+ for (p = tgargs;;)
{
- p = strchr (p, '\\');
+ p = strchr(p, '\\');
if (p == NULL)
{
fprintf(stderr, "getTables(): relation %s: bad argument string (%s) for trigger %s\n",
- tblinfo[i].relname,
- PQgetvalue(res2, i2, i_tgargs),
- PQgetvalue(res2, i2, i_tgname));
+ tblinfo[i].relname,
+ PQgetvalue(res2, i2, i_tgargs),
+ PQgetvalue(res2, i2, i_tgname));
exit_nicely(g_conn);
}
p++;
@@ -1607,23 +1619,23 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs)
p++;
continue;
}
- if ( p[0] == '0' && p[1] == '0' && p[2] == '0')
+ if (p[0] == '0' && p[1] == '0' && p[2] == '0')
break;
}
p--;
- for (s = tgargs, d = &(farg[0]); s < p; )
+ for (s = tgargs, d = &(farg[0]); s < p;)
{
if (*s == '\'')
*d++ = '\\';
*d++ = *s++;
}
*d = 0;
- sprintf (query, "%s'%s'%s", query, farg,
- (findx < tgnargs - 1) ? ", " : "");
+ sprintf(query, "%s'%s'%s", query, farg,
+ (findx < tgnargs - 1) ? ", " : "");
tgargs = p + 4;
}
- strcat (query, ");\n");
- tblinfo[i].triggers[i2] = strdup (query);
+ strcat(query, ");\n");
+ tblinfo[i].triggers[i2] = strdup(query);
}
PQclear(res2);
}
@@ -1786,19 +1798,19 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
if (PQgetvalue(res, j, i_atthasdef)[0] == 't')
{
PGresult *res2;
-
+
if (g_verbose)
fprintf(stderr, "%s finding DEFAULT expression for attr: %s %s\n",
g_comment_start,
tblinfo[i].attnames[j],
g_comment_end);
-
+
sprintf(q, "SELECT adsrc from pg_attrdef "
"where adrelid = '%s'::oid and adnum = %d ",
tblinfo[i].oid, j + 1);
res2 = PQexec(g_conn, q);
if (!res2 ||
- PQresultStatus(res2) != PGRES_TUPLES_OK)
+ PQresultStatus(res2) != PGRES_TUPLES_OK)
{
fprintf(stderr, "getTableAttrs(): SELECT (for DEFAULT) failed\n");
exit_nicely(g_conn);
@@ -2037,11 +2049,11 @@ dumpOneFunc(FILE *fout, FuncInfo *finfo, int i,
(finfo[i].retset) ? " SETOF " : "",
fmtId(findTypeByOid(tinfo, numTypes, finfo[i].prorettype)),
(finfo[i].lang == INTERNALlanguageId) ? finfo[i].prosrc :
- (finfo[i].lang == ClanguageId) ? finfo[i].probin :
- (finfo[i].lang == SQLlanguageId) ? finfo[i].prosrc : "unknown",
+ (finfo[i].lang == ClanguageId) ? finfo[i].probin :
+ (finfo[i].lang == SQLlanguageId) ? finfo[i].prosrc : "unknown",
(finfo[i].lang == INTERNALlanguageId) ? "INTERNAL" :
- (finfo[i].lang == ClanguageId) ? "C" :
- (finfo[i].lang == SQLlanguageId) ? "SQL" : "unknown");
+ (finfo[i].lang == ClanguageId) ? "C" :
+ (finfo[i].lang == SQLlanguageId) ? "SQL" : "unknown");
fputs(q, fout);
@@ -2091,13 +2103,13 @@ dumpOprs(FILE *fout, OprInfo *oprinfo, int numOperators,
strcmp(oprinfo[i].oprkind, "b") == 0)
{
sprintf(leftarg, ", LEFTARG = %s ",
- fmtId(findTypeByOid(tinfo, numTypes, oprinfo[i].oprleft)));
+ fmtId(findTypeByOid(tinfo, numTypes, oprinfo[i].oprleft)));
}
if (strcmp(oprinfo[i].oprkind, "l") == 0 ||
strcmp(oprinfo[i].oprkind, "b") == 0)
{
sprintf(rightarg, ", RIGHTARG = %s ",
- fmtId(findTypeByOid(tinfo, numTypes, oprinfo[i].oprright)));
+ fmtId(findTypeByOid(tinfo, numTypes, oprinfo[i].oprright)));
}
if (strcmp(oprinfo[i].oprcom, "0") == 0)
commutator[0] = '\0';
@@ -2177,10 +2189,10 @@ dumpAggs(FILE *fout, AggInfo *agginfo, int numAggs,
/* skip all the builtin oids */
if (atoi(agginfo[i].oid) < g_last_builtin_oid)
continue;
-
+
sprintf(basetype,
"BASETYPE = %s, ",
- fmtId(findTypeByOid(tinfo, numTypes, agginfo[i].aggbasetype)));
+ fmtId(findTypeByOid(tinfo, numTypes, agginfo[i].aggbasetype)));
if (strcmp(agginfo[i].aggtransfn1, "-") == 0)
sfunc1[0] = '\0';
@@ -2203,7 +2215,7 @@ dumpAggs(FILE *fout, AggInfo *agginfo, int numAggs,
sprintf(sfunc2,
"SFUNC2 = %s, STYPE2 = %s",
agginfo[i].aggtransfn2,
- fmtId(findTypeByOid(tinfo, numTypes, agginfo[i].aggtranstype2)));
+ fmtId(findTypeByOid(tinfo, numTypes, agginfo[i].aggtranstype2)));
if (agginfo[i].agginitval2)
sprintf(sfunc2, "%s, INITCOND2 = '%s'",
sfunc2, agginfo[i].agginitval2);
@@ -2257,16 +2269,17 @@ dumpAggs(FILE *fout, AggInfo *agginfo, int numAggs,
static char *
AddAcl(char *s, const char *add)
{
- char *t;
+ char *t;
- if (s == (char *)NULL)
+ if (s == (char *) NULL)
return (strdup(add));
- t=(char *)calloc((strlen(s) + strlen(add)+1),sizeof(char));
- sprintf(t,"%s,%s",s,add);
+ t = (char *) calloc((strlen(s) + strlen(add) + 1), sizeof(char));
+ sprintf(t, "%s,%s", s, add);
- return(t);
+ return (t);
}
+
/*
* This will take a string of 'arwR' and return a
* comma delimited string of SELECT,INSERT,UPDATE,DELETE,RULE
@@ -2274,92 +2287,96 @@ AddAcl(char *s, const char *add)
static char *
GetPrivledges(char *s)
{
- char *acls=NULL;
+ char *acls = NULL;
- /*Grant All == arwR */
- /* INSERT == ar */
- /* UPDATE/DELETE == rw */
- /* SELECT == r */
- /* RULE == R */
+ /* Grant All == arwR */
+ /* INSERT == ar */
+ /* UPDATE/DELETE == rw */
+ /* SELECT == r */
+ /* RULE == R */
- if (strstr(s,"arwR"))
- return(strdup("ALL"));
+ if (strstr(s, "arwR"))
+ return (strdup("ALL"));
- if (strstr(s,"ar"))
- acls=AddAcl(acls,"INSERT");
+ if (strstr(s, "ar"))
+ acls = AddAcl(acls, "INSERT");
- if (strstr(s,"rw"))
- acls=AddAcl(acls,"UPDATE,DELETE");
- else
- if (strchr(s,'r'))
- acls=AddAcl(acls,"SELECT");
+ if (strstr(s, "rw"))
+ acls = AddAcl(acls, "UPDATE,DELETE");
+ else if (strchr(s, 'r'))
+ acls = AddAcl(acls, "SELECT");
- if (strchr(s,'R'))
- acls=AddAcl(acls,"RULES");
+ if (strchr(s, 'R'))
+ acls = AddAcl(acls, "RULES");
- return(acls);
+ return (acls);
}
+
/* This will parse the acl string of TableInfo
* into a two deminsional aray:
- * user | Privledges
+ * user | Privledges
* So to reset the acls I need to grant these priviledges
* to user
*/
static ACL *
-ParseACL(const char *acls,int *count)
+ParseACL(const char *acls, int *count)
{
- ACL *ParsedAcl=NULL;
- int i,
- len,
- NumAcls=1, /*There is always public*/
- AclLen=0;
- char *s=NULL,
- *user=NULL,
- *priv=NULL,
- *tok;
-
- AclLen=strlen(acls);
-
- if (AclLen == 0) {
- *count=0;
+ ACL *ParsedAcl = NULL;
+ int i,
+ len,
+ NumAcls = 1, /* There is always public */
+ AclLen = 0;
+ char *s = NULL,
+ *user = NULL,
+ *priv = NULL,
+ *tok;
+
+ AclLen = strlen(acls);
+
+ if (AclLen == 0)
+ {
+ *count = 0;
return (ACL *) NULL;
}
- for (i=0;i<AclLen;i++)
+ for (i = 0; i < AclLen; i++)
if (acls[i] == ',')
NumAcls++;
- ParsedAcl=(ACL *)calloc(AclLen,sizeof(ACL));
- if (!ParsedAcl) {
- fprintf(stderr,"Could not allocate space for ACLS!\n");
+ ParsedAcl = (ACL *) calloc(AclLen, sizeof(ACL));
+ if (!ParsedAcl)
+ {
+ fprintf(stderr, "Could not allocate space for ACLS!\n");
exit_nicely(g_conn);
}
- s=strdup(acls);
-
- /* Setup up public*/
- ParsedAcl[0].user=strdup("Public");
- tok=strtok(s,",");
- ParsedAcl[0].privledges=GetPrivledges(strchr(tok,'='));
-
- /*Do the rest of the users*/
- i=1;
- while ((i < NumAcls) && ((tok=strtok(NULL,",")) != (char *)NULL)) {
- /*User name is string up to = in tok*/
- len=strchr(tok,'=') - tok -1 ;
- user=(char*)calloc(len+1,sizeof(char));
- strncpy(user,tok+1,len);
- if (user[len-1] == '\"')
- user[len-1]=(char)NULL;
- priv=GetPrivledges(tok+len+2);
- ParsedAcl[i].user=user;
- ParsedAcl[i].privledges=priv;
+ s = strdup(acls);
+
+ /* Setup up public */
+ ParsedAcl[0].user = strdup("Public");
+ tok = strtok(s, ",");
+ ParsedAcl[0].privledges = GetPrivledges(strchr(tok, '='));
+
+ /* Do the rest of the users */
+ i = 1;
+ while ((i < NumAcls) && ((tok = strtok(NULL, ",")) != (char *) NULL))
+ {
+ /* User name is string up to = in tok */
+ len = strchr(tok, '=') - tok - 1;
+ user = (char *) calloc(len + 1, sizeof(char));
+ strncpy(user, tok + 1, len);
+ if (user[len - 1] == '\"')
+ user[len - 1] = (char) NULL;
+ priv = GetPrivledges(tok + len + 2);
+ ParsedAcl[i].user = user;
+ ParsedAcl[i].privledges = priv;
i++;
}
- *count=NumAcls;
+ *count = NumAcls;
return (ParsedAcl);
}
+
/*
* dumpTables:
* write out to fout all the user-define tables
@@ -2379,8 +2396,8 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
char **parentRels; /* list of names of parent relations */
int numParents;
int actual_atts; /* number of attrs in this CREATE statment */
- ACL *ACLlist;
-
+ ACL *ACLlist;
+
/* First - dump SEQUENCEs */
for (i = 0; i < numTables; i++)
{
@@ -2392,10 +2409,10 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
dumpSequence(fout, tblinfo[i]);
}
}
-
+
for (i = 0; i < numTables; i++)
{
- if (tblinfo[i].sequence) /* already dumped */
+ if (tblinfo[i].sequence)/* already dumped */
continue;
if (!tablename || (!strcmp(tblinfo[i].relname, tablename)))
@@ -2427,7 +2444,7 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
sprintf(q, "%s(%d)",
q,
- tblinfo[i].atttypmod[j]-VARHDRSZ);
+ tblinfo[i].atttypmod[j] - VARHDRSZ);
actual_atts++;
}
else if (!strcmp(tblinfo[i].typnames[j], "varchar"))
@@ -2440,7 +2457,7 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
sprintf(q, "%s(%d)",
q,
- tblinfo[i].atttypmod[j]-VARHDRSZ);
+ tblinfo[i].atttypmod[j] - VARHDRSZ);
actual_atts++;
}
else
@@ -2486,25 +2503,28 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
}
strcat(q, ";\n");
fputs(q, fout);
-
- if (acls) {
+
+ if (acls)
+ {
ACLlist = ParseACL(tblinfo[i].relacl, &l);
- if (ACLlist == (ACL *)NULL)
+ if (ACLlist == (ACL *) NULL)
if (l == 0)
continue;
- else {
- fprintf(stderr,"Could not parse ACL list for %s...Exiting!\n",
- tblinfo[i].relname);
+ else
+ {
+ fprintf(stderr, "Could not parse ACL list for %s...Exiting!\n",
+ tblinfo[i].relname);
exit_nicely(g_conn);
- }
+ }
/* Revoke Default permissions for PUBLIC */
fprintf(fout,
- "REVOKE ALL on %s from PUBLIC;\n",
+ "REVOKE ALL on %s from PUBLIC;\n",
tblinfo[i].relname);
- for(k = 0; k < l; k++) {
- if (ACLlist[k].privledges != (char *)NULL)
+ for (k = 0; k < l; k++)
+ {
+ if (ACLlist[k].privledges != (char *) NULL)
fprintf(fout,
"GRANT %s on %s to %s;\n",
ACLlist[k].privledges, tblinfo[i].relname,
@@ -2913,16 +2933,17 @@ dumpSequence(FILE *fout, TableInfo tbinfo)
}
-static void
-dumpTriggers(FILE *fout, const char *tablename,
- TableInfo *tblinfo, int numTables)
+static void
+dumpTriggers(FILE *fout, const char *tablename,
+ TableInfo *tblinfo, int numTables)
{
- int i, j;
-
+ int i,
+ j;
+
if (g_verbose)
fprintf(stderr, "%s dumping out triggers %s\n",
g_comment_start, g_comment_end);
-
+
for (i = 0; i < numTables; i++)
{
if (tablename && strcmp(tblinfo[i].relname, tablename))
@@ -2934,4 +2955,3 @@ dumpTriggers(FILE *fout, const char *tablename,
}
}
}
-
diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h
index 9aed251ce92..38da913d98e 100644
--- a/src/bin/pg_dump/pg_dump.h
+++ b/src/bin/pg_dump/pg_dump.h
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_dump.h,v 1.29 1998/01/16 23:20:43 momjian Exp $
+ * $Id: pg_dump.h,v 1.30 1998/02/26 04:39:01 momjian Exp $
*
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
*
@@ -156,9 +156,10 @@ typedef struct _oprInfo
*
* Matthew C. Aycock 12/02/97
*/
-typedef struct _AclType {
- char *user;
- char *privledges;
+typedef struct _AclType
+{
+ char *user;
+ char *privledges;
} ACL;
@@ -242,7 +243,7 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
TableInfo *tbinfo, int numTables, const char *tablename);
extern const char *
-fmtId(const char *identifier);
+ fmtId(const char *identifier);
/* largest query string size */
#define MAXQUERYLEN 5000
diff --git a/src/bin/pg_passwd/pg_passwd.c b/src/bin/pg_passwd/pg_passwd.c
index 0973698ad62..de9ffd65a7c 100644
--- a/src/bin/pg_passwd/pg_passwd.c
+++ b/src/bin/pg_passwd/pg_passwd.c
@@ -6,9 +6,9 @@
#include <stdio.h>
#include <stdlib.h>
#if defined(HAVE_STRING_H)
-# include <string.h>
+#include <string.h>
#else
-# include <strings.h>
+#include <strings.h>
#endif
#include <unistd.h>
#include <errno.h>
diff --git a/src/bin/psql/psql.c b/src/bin/psql/psql.c
index 0e3fb520af5..2ec07c89d97 100644
--- a/src/bin/psql/psql.c
+++ b/src/bin/psql/psql.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.135 1998/02/25 14:50:36 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.136 1998/02/26 04:39:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -99,12 +99,14 @@ typedef struct _psqlSettings
#ifdef TIOCGWINSZ
struct winsize screen_size;
+
#else
struct winsize
{
int ws_row;
int ws_col;
} screen_size;
+
#endif
/* declarations for functions in this file */
@@ -114,8 +116,9 @@ static void handleCopyOut(PGresult *res, FILE *copystream);
static void
handleCopyIn(PGresult *res, const bool mustprompt,
FILE *copystream);
-static int tableList(PsqlSettings *pset, bool deep_tablelist,
- char info_type, bool system_tables);
+static int
+tableList(PsqlSettings *pset, bool deep_tablelist,
+ char info_type, bool system_tables);
static int tableDesc(PsqlSettings *pset, char *table, FILE *fout);
static int objectDescription(PsqlSettings *pset, char *object, FILE *fout);
static int rightsList(PsqlSettings *pset);
@@ -211,7 +214,7 @@ slashUsage(PsqlSettings *pset)
else
fout = stdout;
- /* if you add/remove a line here, change the row test above */
+ /* if you add/remove a line here, change the row test above */
fprintf(fout, " \\? -- help\n");
fprintf(fout, " \\a -- toggle field-alignment (currenty %s)\n", on(pset->opt.align));
fprintf(fout, " \\C [<captn>] -- set html3 caption (currently '%s')\n", pset->opt.caption ? pset->opt.caption : "");
@@ -306,7 +309,7 @@ listAllDbs(PsqlSettings *pset)
*/
int
tableList(PsqlSettings *pset, bool deep_tablelist, char info_type,
- bool system_tables)
+ bool system_tables)
{
char listbuf[512];
int nColumns;
@@ -330,7 +333,7 @@ tableList(PsqlSettings *pset, bool deep_tablelist, char info_type,
#ifdef TIOCGWINSZ
}
#endif
-
+
listbuf[0] = '\0';
strcat(listbuf, "SELECT usename, relname, relkind, relhasrules ");
strcat(listbuf, "FROM pg_class, pg_user ");
@@ -408,27 +411,27 @@ tableList(PsqlSettings *pset, bool deep_tablelist, char info_type,
{
/* Display the information */
- fprintf(fout,"\nDatabase = %s\n", PQdb(pset->db));
- fprintf(fout," +------------------+----------------------------------+----------+\n");
- fprintf(fout," | Owner | Relation | Type |\n");
- fprintf(fout," +------------------+----------------------------------+----------+\n");
+ fprintf(fout, "\nDatabase = %s\n", PQdb(pset->db));
+ fprintf(fout, " +------------------+----------------------------------+----------+\n");
+ fprintf(fout, " | Owner | Relation | Type |\n");
+ fprintf(fout, " +------------------+----------------------------------+----------+\n");
/* next, print out the instances */
for (i = 0; i < PQntuples(res); i++)
{
- fprintf(fout," | %-16.16s", PQgetvalue(res, i, 0));
- fprintf(fout," | %-32.32s | ", PQgetvalue(res, i, 1));
+ fprintf(fout, " | %-16.16s", PQgetvalue(res, i, 0));
+ fprintf(fout, " | %-32.32s | ", PQgetvalue(res, i, 1));
rk = PQgetvalue(res, i, 2);
rr = PQgetvalue(res, i, 3);
if (strcmp(rk, "r") == 0)
- fprintf(fout,"%-8.8s |", (rr[0] == 't') ? "view?" : "table");
+ fprintf(fout, "%-8.8s |", (rr[0] == 't') ? "view?" : "table");
else if (strcmp(rk, "i") == 0)
- fprintf(fout,"%-8.8s |", "index");
+ fprintf(fout, "%-8.8s |", "index");
else
- fprintf(fout,"%-8.8s |", "sequence");
- fprintf(fout,"\n");
+ fprintf(fout, "%-8.8s |", "sequence");
+ fprintf(fout, "\n");
}
- fprintf(fout," +------------------+----------------------------------+----------+\n");
+ fprintf(fout, " +------------------+----------------------------------+----------+\n");
PQclear(res);
}
if (usePipe)
@@ -518,19 +521,19 @@ rightsList(PsqlSettings *pset)
/* Display the information */
- fprintf(fout,"\nDatabase = %s\n", PQdb(pset->db));
- fprintf(fout," +------------------+----------------------------------------------------+\n");
- fprintf(fout," | Relation | Grant/Revoke Permissions |\n");
- fprintf(fout," +------------------+----------------------------------------------------+\n");
+ fprintf(fout, "\nDatabase = %s\n", PQdb(pset->db));
+ fprintf(fout, " +------------------+----------------------------------------------------+\n");
+ fprintf(fout, " | Relation | Grant/Revoke Permissions |\n");
+ fprintf(fout, " +------------------+----------------------------------------------------+\n");
/* next, print out the instances */
for (i = 0; i < PQntuples(res); i++)
{
- fprintf(fout," | %-16.16s", PQgetvalue(res, i, 0));
- fprintf(fout," | %-50.50s | ", PQgetvalue(res, i, 1));
- fprintf(fout,"\n");
+ fprintf(fout, " | %-16.16s", PQgetvalue(res, i, 0));
+ fprintf(fout, " | %-50.50s | ", PQgetvalue(res, i, 1));
+ fprintf(fout, "\n");
}
- fprintf(fout," +------------------+----------------------------------------------------+\n");
+ fprintf(fout, " +------------------+----------------------------------------------------+\n");
PQclear(res);
if (usePipe)
{
@@ -562,8 +565,10 @@ tableDesc(PsqlSettings *pset, char *table, FILE *fout)
char *rnotnull;
char *rhasdef;
int i;
- int attlen, atttypmod;
- PGresult *res, *res2;
+ int attlen,
+ atttypmod;
+ PGresult *res,
+ *res2;
int usePipe = 0;
char *pagerenv;
@@ -580,15 +585,18 @@ tableDesc(PsqlSettings *pset, char *table, FILE *fout)
#ifdef TIOCGWINSZ
}
#endif
-
+
/* Build the query */
- /* if the table name is surrounded by double-quotes, then don't convert case */
+ /*
+ * if the table name is surrounded by double-quotes, then don't
+ * convert case
+ */
if (*table == '"')
{
table++;
- if (*(table+strlen(table)-1) == '"')
- *(table+strlen(table)-1) = '\0';
+ if (*(table + strlen(table) - 1) == '"')
+ *(table + strlen(table) - 1) = '\0';
}
else
{
@@ -628,21 +636,22 @@ tableDesc(PsqlSettings *pset, char *table, FILE *fout)
else
fout = stdout;
}
+
/*
- * Display the information
+ * Display the information
*/
- fprintf(fout,"\nTable = %s\n", table);
- fprintf(fout,"+----------------------------------+----------------------------------+-------+\n");
- fprintf(fout,"| Field | Type | Length|\n");
- fprintf(fout,"+----------------------------------+----------------------------------+-------+\n");
+ fprintf(fout, "\nTable = %s\n", table);
+ fprintf(fout, "+----------------------------------+----------------------------------+-------+\n");
+ fprintf(fout, "| Field | Type | Length|\n");
+ fprintf(fout, "+----------------------------------+----------------------------------+-------+\n");
/* next, print out the instances */
for (i = 0; i < PQntuples(res); i++)
{
- char type_str[33];
-
- fprintf(fout,"| %-32.32s | ", PQgetvalue(res, i, 1));
+ char type_str[33];
+
+ fprintf(fout, "| %-32.32s | ", PQgetvalue(res, i, 1));
rtype = PQgetvalue(res, i, 2);
attlen = atoi(PQgetvalue(res, i, 3));
atttypmod = atoi(PQgetvalue(res, i, 4));
@@ -660,10 +669,10 @@ tableDesc(PsqlSettings *pset, char *table, FILE *fout)
strncat(type_str, "[]", 32 - strlen(type_str));
type_str[32] = '\0';
}
-
+
if (rnotnull[0] == 't')
{
- strncat(type_str," not null", 32 - strlen(type_str));
+ strncat(type_str, " not null", 32 - strlen(type_str));
type_str[32] = '\0';
}
if (rhasdef[0] == 't')
@@ -679,27 +688,27 @@ tableDesc(PsqlSettings *pset, char *table, FILE *fout)
strcat(descbuf, PQgetvalue(res, i, 0));
if (!(res2 = PSQLexec(pset, descbuf)))
return -1;
- strcat(type_str," default ");
- strncat(type_str, PQgetvalue(res2, 0, 0), 32-strlen(type_str));
+ strcat(type_str, " default ");
+ strncat(type_str, PQgetvalue(res2, 0, 0), 32 - strlen(type_str));
type_str[32] = '\0';
}
- fprintf(fout,"%-32.32s |", type_str);
+ fprintf(fout, "%-32.32s |", type_str);
if (strcmp(rtype, "text") == 0)
- fprintf(fout,"%6s |", "var");
+ fprintf(fout, "%6s |", "var");
else if (strcmp(rtype, "bpchar") == 0 ||
strcmp(rtype, "varchar") == 0)
- fprintf(fout,"%6i |", atttypmod != -1 ? atttypmod - VARHDRSZ : 0);
+ fprintf(fout, "%6i |", atttypmod != -1 ? atttypmod - VARHDRSZ : 0);
else
{
if (attlen > 0)
- fprintf(fout,"%6i |", attlen);
+ fprintf(fout, "%6i |", attlen);
else
- fprintf(fout,"%6s |", "var");
+ fprintf(fout, "%6s |", "var");
}
- fprintf(fout,"\n");
+ fprintf(fout, "\n");
}
- fprintf(fout,"+----------------------------------+----------------------------------+-------+\n");
+ fprintf(fout, "+----------------------------------+----------------------------------+-------+\n");
PQclear(res);
if (usePipe)
{
@@ -745,18 +754,21 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
#ifdef TIOCGWINSZ
}
#endif
-
+
/* Build the query */
while (isspace(*object))
object++;
-
- /* if the object name is surrounded by double-quotes, then don't convert case */
+
+ /*
+ * if the object name is surrounded by double-quotes, then don't
+ * convert case
+ */
if (*object == '"')
{
object++;
- if (*(object+strlen(object)-1) == '"')
- *(object+strlen(object)-1) = '\0';
+ if (*(object + strlen(object) - 1) == '"')
+ *(object + strlen(object) - 1) = '\0';
}
else
{
@@ -766,14 +778,15 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
}
descbuf[0] = '\0';
- if (strchr(object,'.') != NULL)
+ if (strchr(object, '.') != NULL)
{
- char table[NAMEDATALEN],column[NAMEDATALEN];
+ char table[NAMEDATALEN],
+ column[NAMEDATALEN];
- StrNCpy(table,object,
- ((strchr(object,'.')-object+1) < NAMEDATALEN) ?
- (strchr(object,'.')-object+1) : NAMEDATALEN);
- StrNCpy(column,strchr(object,'.')+1,NAMEDATALEN);
+ StrNCpy(table, object,
+ ((strchr(object, '.') - object + 1) < NAMEDATALEN) ?
+ (strchr(object, '.') - object + 1) : NAMEDATALEN);
+ StrNCpy(column, strchr(object, '.') + 1, NAMEDATALEN);
strcat(descbuf, "SELECT DISTINCT description ");
strcat(descbuf, "FROM pg_class, pg_attribute, pg_description ");
strcat(descbuf, "WHERE pg_class.relname = '");
@@ -783,18 +796,18 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat(descbuf, "pg_attribute.attname = '");
strcat(descbuf, column);
strcat(descbuf, "' and ");
- strcat(descbuf, " pg_attribute.oid = pg_description.objoid " );
+ strcat(descbuf, " pg_attribute.oid = pg_description.objoid ");
if (!(res = PSQLexec(pset, descbuf)))
return -1;
}
else
- {
+ {
strcat(descbuf, "SELECT DISTINCT description ");
strcat(descbuf, "FROM pg_class, pg_description ");
strcat(descbuf, "WHERE pg_class.relname = '");
strcat(descbuf, object);
- strcat(descbuf, "'" );
- strcat(descbuf, " and pg_class.oid = pg_description.objoid " );
+ strcat(descbuf, "'");
+ strcat(descbuf, " and pg_class.oid = pg_description.objoid ");
if (!(res = PSQLexec(pset, descbuf)))
return -1;
else if (PQntuples(res) <= 0)
@@ -806,7 +819,7 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat(descbuf, "WHERE pg_type.typname = '");
strcat(descbuf, object);
strcat(descbuf, "' and ");
- strcat(descbuf, " pg_type.oid = pg_description.objoid " );
+ strcat(descbuf, " pg_type.oid = pg_description.objoid ");
if (!(res = PSQLexec(pset, descbuf)))
return -1;
else if (PQntuples(res) <= 0)
@@ -817,8 +830,8 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat(descbuf, "FROM pg_proc, pg_description ");
strcat(descbuf, "WHERE pg_proc.proname = '");
strcat(descbuf, object);
- strcat(descbuf, "'" );
- strcat(descbuf, " and pg_proc.oid = pg_description.objoid " );
+ strcat(descbuf, "'");
+ strcat(descbuf, " and pg_proc.oid = pg_description.objoid ");
if (!(res = PSQLexec(pset, descbuf)))
return -1;
else if (PQntuples(res) <= 0)
@@ -829,9 +842,9 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat(descbuf, "FROM pg_operator, pg_description ");
strcat(descbuf, "WHERE pg_operator.oprname = '");
strcat(descbuf, object);
- strcat(descbuf, "'" );
+ strcat(descbuf, "'");
/* operator descriptions are attached to the proc */
- strcat(descbuf, " and RegprocToOid(pg_operator.oprcode) = pg_description.objoid " );
+ strcat(descbuf, " and RegprocToOid(pg_operator.oprcode) = pg_description.objoid ");
if (!(res = PSQLexec(pset, descbuf)))
return -1;
else if (PQntuples(res) <= 0)
@@ -842,8 +855,8 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
strcat(descbuf, "FROM pg_aggregate, pg_description ");
strcat(descbuf, "WHERE pg_aggregate.aggname = '");
strcat(descbuf, object);
- strcat(descbuf, "'" );
- strcat(descbuf, " and pg_aggregate.oid = pg_description.objoid " );
+ strcat(descbuf, "'");
+ strcat(descbuf, " and pg_aggregate.oid = pg_description.objoid ");
if (!(res = PSQLexec(pset, descbuf)))
return -1;
}
@@ -868,15 +881,16 @@ objectDescription(PsqlSettings *pset, char *object, FILE *fout)
else
fout = stdout;
}
+
/*
* * Display the information
*/
- fprintf(fout,"\nObject = %s\n", object);
+ fprintf(fout, "\nObject = %s\n", object);
/* next, print out the instances */
for (i = 0; i < PQntuples(res); i++)
- fprintf(fout,"%s\n",PQgetvalue(res, i, 0));
+ fprintf(fout, "%s\n", PQgetvalue(res, i, 0));
PQclear(res);
if (usePipe)
@@ -1376,7 +1390,7 @@ do_connect(const char *new_dbname,
dbparam = PQdb(olddb);
pset->db = PQsetdb(PQhost(olddb), PQport(olddb),
- NULL, NULL, dbparam);
+ NULL, NULL, dbparam);
if (!pset->quiet)
{
if (!new_user)
@@ -1625,6 +1639,7 @@ HandleSlashCmds(PsqlSettings *pset,
int status = CMD_SKIP_LINE;
char *optarg;
bool success;
+
/*
* Pointer inside the <cmd> string to the argument of the slash
* command, assuming it is a one-character slash command. If it's not
@@ -1736,36 +1751,40 @@ HandleSlashCmds(PsqlSettings *pset,
}
}
break;
- case 'd': /* \d describe database information */
+ case 'd': /* \d describe database information */
if (strncmp(cmd, "da", 2) == 0)
{
- /* aggregates */
- SendQuery(&success, pset,"\
+ /* aggregates */
+ SendQuery(&success, pset, "\
SELECT a.aggname AS aggname, \
t.typname AS typname, \
obj_description(a.oid) as description \
FROM pg_aggregate a, pg_type t \
WHERE a.aggbasetype = t.oid \
ORDER BY aggname, typname;",
- false, false, 0);
- SendQuery(&success, pset,"\
+ false, false, 0);
+ SendQuery(&success, pset, "\
SELECT a.aggname AS aggname, \
'all types' as all_types, \
obj_description(a.oid) as description \
FROM pg_aggregate a \
WHERE a.aggbasetype = 0 \
ORDER BY aggname;",
- false, false, 0);
+ false, false, 0);
}
else if (strncmp(cmd, "dd", 2) == 0)
- /* descriptions */
- objectDescription(pset, optarg+1, NULL);
+ /* descriptions */
+ objectDescription(pset, optarg + 1, NULL);
else if (strncmp(cmd, "df", 2) == 0)
{
- /* functions/procedures */
- /* we skip in/out funcs by excluding functions that take
- some arguments, but have no types defined for those arguments */
- SendQuery(&success, pset,"\
+ /* functions/procedures */
+
+ /*
+ * we skip in/out funcs by excluding functions that take
+ * some arguments, but have no types defined for those
+ * arguments
+ */
+ SendQuery(&success, pset, "\
SELECT t.typname as return_type, \
p.proname as function, \
substr(oid8types(p.proargtypes),1,20) as arguments, \
@@ -1775,8 +1794,8 @@ HandleSlashCmds(PsqlSettings *pset,
(pronargs = 0 or oid8types(p.proargtypes) != '') and \
t.typname != 'bool' \
ORDER BY return_type, function;",
- false, false, 0);
- SendQuery(&success, pset,"\
+ false, false, 0);
+ SendQuery(&success, pset, "\
SELECT t.typname as rtns, \
p.proname as function, \
oid8types(p.proargtypes) as arguments, \
@@ -1786,15 +1805,15 @@ HandleSlashCmds(PsqlSettings *pset,
(pronargs = 0 or oid8types(p.proargtypes) != '') and \
t.typname = 'bool' \
ORDER BY rtns, function;",
- false, false, 0);
+ false, false, 0);
}
else if (strncmp(cmd, "di", 2) == 0)
- /* only indices */
+ /* only indices */
tableList(pset, false, 'i', false);
else if (strncmp(cmd, "do", 2) == 0)
{
- /* operators */
- SendQuery(&success, pset,"\
+ /* operators */
+ SendQuery(&success, pset, "\
SELECT o.oprname AS op, \
t0.typname AS result, \
t1.typname AS left_type, \
@@ -1809,8 +1828,8 @@ HandleSlashCmds(PsqlSettings *pset,
o.oprleft = t1.oid AND \
o.oprright = t2.oid \
ORDER BY op, result, left_type, right_type;",
- false, false, 0);
- SendQuery(&success, pset,"\
+ false, false, 0);
+ SendQuery(&success, pset, "\
SELECT o.oprname AS left_unary, \
t0.typname AS return_type, \
t1.typname AS operand, \
@@ -1821,8 +1840,8 @@ HandleSlashCmds(PsqlSettings *pset,
o.oprkind = 'l' AND \
o.oprright = t1.oid \
ORDER BY left_unary, return_type, operand;",
- false, false, 0);
- SendQuery(&success, pset,"\
+ false, false, 0);
+ SendQuery(&success, pset, "\
SELECT o.oprname AS right_unary, \
t0.typname AS return_type, \
t1.typname AS operand, \
@@ -1833,29 +1852,29 @@ HandleSlashCmds(PsqlSettings *pset,
o.oprkind = 'r' AND \
o.oprleft = t1.oid \
ORDER BY right_unary, return_type, operand;",
- false, false, 0);
+ false, false, 0);
}
else if (strncmp(cmd, "ds", 2) == 0)
- /* only sequences */
+ /* only sequences */
tableList(pset, false, 'S', false);
else if (strncmp(cmd, "dS", 2) == 0)
- /* system tables */
+ /* system tables */
tableList(pset, false, 'b', true);
else if (strncmp(cmd, "dt", 2) == 0)
- /* only tables */
+ /* only tables */
tableList(pset, false, 't', false);
else if (strncmp(cmd, "dT", 2) == 0)
- /* types */
- SendQuery(&success, pset,"\
+ /* types */
+ SendQuery(&success, pset, "\
SELECT typname AS type, \
obj_description(oid) as description \
FROM pg_type \
WHERE typrelid = 0 AND \
typname !~ '^_.*' \
ORDER BY type;",
- false, false, 0);
+ false, false, 0);
else if (!optarg)
- /* show tables, sequences and indices */
+ /* show tables, sequences and indices */
tableList(pset, false, 'b', false);
else if (strcmp(optarg, "*") == 0)
{ /* show everything */
@@ -1863,11 +1882,11 @@ HandleSlashCmds(PsqlSettings *pset,
tableList(pset, true, 'b', false);
}
else if (strncmp(cmd, "d ", 2) == 0)
- /* describe the specified table */
+ /* describe the specified table */
tableDesc(pset, optarg, NULL);
else
slashUsage(pset);
-
+
break;
case 'e': /* edit */
{
@@ -2049,7 +2068,7 @@ HandleSlashCmds(PsqlSettings *pset,
}
free(cmd);
return status;
-} /* HandleSlashCmds() */
+} /* HandleSlashCmds() */
/* MainLoop()
* Main processing loop for reading lines of input
@@ -2087,17 +2106,20 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
/* We've reached the end of our command input. */
bool success;
bool in_quote;
- bool was_bslash; /* backslash */
+ bool was_bslash; /* backslash */
int paren_level;
char *query_start;
if (query_alloced == false)
{
- if((query = malloc(MAX_QUERY_BUFFER)) == NULL) {
-
+ if ((query = malloc(MAX_QUERY_BUFFER)) == NULL)
+ {
+
perror("Memory Allocation Failed");
- } else {
+ }
+ else
+ {
query_alloced = true;
}
}
@@ -2177,7 +2199,8 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
*/
if (line == NULL || (!interactive && *line == '\0'))
- { /* No more input. Time to quit, or \i done */
+ { /* No more input. Time to quit, or \i
+ * done */
if (!pset->quiet)
printf("EOF\n");/* Goes on prompt line */
eof = true;
@@ -2247,7 +2270,7 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
}
line[i] = hold_char;
query_start = line + i;
- break; /* handle command */
+ break; /* handle command */
/* start an extended comment? */
}
@@ -2260,15 +2283,16 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
if (was_bslash)
was_bslash = false;
- else if (i > 0 && line[i-1] == '\\')
+ else if (i > 0 && line[i - 1] == '\\')
was_bslash = true;
/* inside a quote? */
if (in_quote && (line[i] != '\'' || was_bslash))
{
- /* do nothing */;
+ /* do nothing */ ;
}
- else if (xcomment != NULL) /*inside an extended comment?*/
+ else if (xcomment != NULL) /* inside an extended
+ * comment? */
{
if (line[i] == '*' && line[i + 1] == '/')
{
@@ -2276,28 +2300,28 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
i++;
}
}
- /* possible backslash command? */
+ /* possible backslash command? */
else if (line[i] == '/' && line[i + 1] == '*')
{
xcomment = line + i;
i++;
}
- /* single-line comment? truncate line */
+ /* single-line comment? truncate line */
else if ((line[i] == '-' && line[i + 1] == '-') ||
(line[i] == '/' && line[i + 1] == '/'))
{
/* print comment at top of query */
if (pset->singleStep)
fprintf(stdout, "%s\n", line + i);
- line[i] = '\0'; /* remove comment */
+ line[i] = '\0'; /* remove comment */
break;
}
else if (line[i] == '\'')
{
in_quote ^= 1;
}
- /* semi-colon? then send query now */
+ /* semi-colon? then send query now */
else if (!paren_level && line[i] == ';')
{
char hold_char = line[i + 1];
@@ -2317,10 +2341,10 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
successResult &= success;
line[i + 1] = hold_char;
query_start = line + i + 1;
- /* sometimes, people do ';\g', don't execute twice */
+ /* sometimes, people do ';\g', don't execute twice */
if (*query_start && /* keeps us from going off the end */
*query_start == '\\' &&
- *(query_start+1) == 'g')
+ *(query_start + 1) == 'g')
query_start += 2;
querySent = true;
}
@@ -2397,7 +2421,7 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
free(query);
return successResult;
-} /* MainLoop() */
+} /* MainLoop() */
int
main(int argc, char **argv)
@@ -2416,11 +2440,11 @@ main(int argc, char **argv)
char *singleQuery = NULL;
bool listDatabases = 0;
- int successResult = 1;
+ int successResult = 1;
bool singleSlashCmd = 0;
- int c;
+ int c;
- char *home = NULL; /* Used to store $HOME */
+ char *home = NULL; /* Used to store $HOME */
MemSet(&settings, 0, sizeof settings);
settings.opt.align = 1;
@@ -2565,16 +2589,20 @@ main(int argc, char **argv)
/*
* 20.06.97 ACRM See if we've got a /etc/psqlrc or .psqlrc file
*/
- if(!access("/etc/psqlrc",R_OK))
+ if (!access("/etc/psqlrc", R_OK))
HandleSlashCmds(&settings, "\\i /etc/psqlrc", "");
- if((home = getenv("HOME"))!=NULL) {
- char *psqlrc = NULL,
- *line = NULL;
+ if ((home = getenv("HOME")) != NULL)
+ {
+ char *psqlrc = NULL,
+ *line = NULL;
- if((psqlrc = (char *)malloc(strlen(home) + 10))!=NULL) {
+ if ((psqlrc = (char *) malloc(strlen(home) + 10)) != NULL)
+ {
sprintf(psqlrc, "%s/.psqlrc", home);
- if(!access(psqlrc, R_OK)) {
- if((line = (char *)malloc(strlen(psqlrc) + 5))!=NULL) {
+ if (!access(psqlrc, R_OK))
+ {
+ if ((line = (char *) malloc(strlen(psqlrc) + 5)) != NULL)
+ {
sprintf(line, "\\i %s", psqlrc);
HandleSlashCmds(&settings, line, "");
free(line);
diff --git a/src/bin/psql/stringutils.c b/src/bin/psql/stringutils.c
index a868be9ddd6..62d8fef5747 100644
--- a/src/bin/psql/stringutils.c
+++ b/src/bin/psql/stringutils.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.12 1997/09/08 02:33:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/stringutils.c,v 1.13 1998/02/26 04:39:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,7 +53,7 @@ leftTrim(char *s)
#endif
-char *
+char *
rightTrim(char *s)
{
char *sEnd;
diff --git a/src/data/charset.conf b/src/data/charset.conf
index f1be4c57fc9..13d56c349a6 100644
--- a/src/data/charset.conf
+++ b/src/data/charset.conf
@@ -38,3 +38,43 @@ HostCharset 192.168.2.3-192.168.2.7 alt
# This is exeption from previous rule!
HostCharset 192.168.2.4 win
+#
+# Example PostgreSQL charsets control file.
+#
+# Should be placed in $PG_DATA directory.
+#
+# On the fly recoding charsets, based on client's IP address.
+# For example: koi8-u (koi) <-> cp1251 (win) <-> cp866 (alt)
+#
+
+# Base charset for backend
+# Most Unices use koi8-r(u) as base charset. But Solaris
+# use iso8859-5 and some networkless workstations use cp866.
+BaseCharset koi
+
+# There are recode table definitions from base charset to
+# other. Table names are relative to $PG_DATA directory.
+# Tables are taken from Russian Apache <http://apache.lexa.ru>.
+RecodeTable koi alt koi-alt.tab
+RecodeTable koi win koi-win.tab
+RecodeTable koi iso koi-iso.tab
+RecodeTable koi koi koi-koi.tab
+RecodeTable alt win othertabs/alt-win.tab
+RecodeTable alt koi othertabs/alt-koi.tab
+RecodeTable iso koi othertabs/iso-koi.tab
+
+# Local loopback
+HostCharset 127.0.0.1 koi
+
+# Yet another Unix (maybe ;)
+HostCharset 192.168.0.1 koi
+
+# There are Windows on 192.168.1.64 through 192.168.1.95
+HostCharset 192.168.1.64/27 win
+
+# There are cp866 (alt) systems on 192.168.2.3 through
+# 192.168.2.7 (exept 192.168.2.4 - see below)
+HostCharset 192.168.2.3-192.168.2.7 alt
+
+# This is exeption from previous rule!
+HostCharset 192.168.2.4 win
diff --git a/src/data/charset.conf.orig b/src/data/charset.conf.orig
index e69de29bb2d..f1be4c57fc9 100644
--- a/src/data/charset.conf.orig
+++ b/src/data/charset.conf.orig
@@ -0,0 +1,40 @@
+#
+# Example PostgreSQL charsets control file.
+#
+# Should be placed in $PG_DATA directory.
+#
+# On the fly recoding charsets, based on client's IP address.
+# For example: koi8-u (koi) <-> cp1251 (win) <-> cp866 (alt)
+#
+
+# Base charset for backend
+# Most Unices use koi8-r(u) as base charset. But Solaris
+# use iso8859-5 and some networkless workstations use cp866.
+BaseCharset koi
+
+# There are recode table definitions from base charset to
+# other. Table names are relative to $PG_DATA directory.
+# Tables are taken from Russian Apache <http://apache.lexa.ru>.
+RecodeTable koi alt koi-alt.tab
+RecodeTable koi win koi-win.tab
+RecodeTable koi iso koi-iso.tab
+RecodeTable koi koi koi-koi.tab
+RecodeTable alt win othertabs/alt-win.tab
+RecodeTable alt koi othertabs/alt-koi.tab
+RecodeTable iso koi othertabs/iso-koi.tab
+
+# Local loopback
+HostCharset 127.0.0.1 koi
+
+# Yet another Unix (maybe ;)
+HostCharset 192.168.0.1 koi
+
+# There are Windows on 192.168.1.64 through 192.168.1.95
+HostCharset 192.168.1.64/27 win
+
+# There are cp866 (alt) systems on 192.168.2.3 through
+# 192.168.2.7 (exept 192.168.2.4 - see below)
+HostCharset 192.168.2.3-192.168.2.7 alt
+
+# This is exeption from previous rule!
+HostCharset 192.168.2.4 win
diff --git a/src/data/koi-alt.tab b/src/data/koi-alt.tab
index 2f70efdda86..b90fe0b242c 100644
--- a/src/data/koi-alt.tab
+++ b/src/data/koi-alt.tab
@@ -83,3 +83,88 @@
253 153
254 151
255 154
+# Line with '#' at the begin is comment
+# table file may contain number of line as you wana
+# first - code of symbol, second translate code of symbol
+# codes may be in two forms: decimal and hex
+# examples:
+# 192 225
+# 0x81 226
+# 226 0x81
+# 0x90 0xfe
+# patch for Russia by Dm.Kryukov (dvk@stack.serpukhov.su)
+#
+163 241
+164 243
+166 249
+167 245
+173 173
+179 240
+180 242
+182 248
+183 244
+189 189
+192 238
+193 160
+194 161
+195 230
+196 164
+197 165
+198 228
+199 163
+200 229
+201 168
+202 169
+203 170
+204 171
+205 172
+206 173
+207 174
+208 175
+209 239
+210 224
+211 225
+212 226
+213 227
+214 166
+215 162
+216 236
+217 235
+218 167
+219 232
+220 237
+221 233
+222 231
+223 234
+224 158
+225 128
+226 129
+227 150
+228 132
+229 133
+230 148
+231 131
+232 149
+233 136
+234 137
+235 138
+236 139
+237 140
+238 141
+239 142
+240 143
+241 159
+242 144
+243 145
+244 146
+245 147
+246 134
+247 130
+248 156
+249 155
+250 135
+251 152
+252 157
+253 153
+254 151
+255 154
diff --git a/src/data/koi-alt.tab.orig b/src/data/koi-alt.tab.orig
index e69de29bb2d..2f70efdda86 100644
--- a/src/data/koi-alt.tab.orig
+++ b/src/data/koi-alt.tab.orig
@@ -0,0 +1,85 @@
+# Line with '#' at the begin is comment
+# table file may contain number of line as you wana
+# first - code of symbol, second translate code of symbol
+# codes may be in two forms: decimal and hex
+# examples:
+# 192 225
+# 0x81 226
+# 226 0x81
+# 0x90 0xfe
+# patch for Russia by Dm.Kryukov (dvk@stack.serpukhov.su)
+#
+163 241
+164 243
+166 249
+167 245
+173 173
+179 240
+180 242
+182 248
+183 244
+189 189
+192 238
+193 160
+194 161
+195 230
+196 164
+197 165
+198 228
+199 163
+200 229
+201 168
+202 169
+203 170
+204 171
+205 172
+206 173
+207 174
+208 175
+209 239
+210 224
+211 225
+212 226
+213 227
+214 166
+215 162
+216 236
+217 235
+218 167
+219 232
+220 237
+221 233
+222 231
+223 234
+224 158
+225 128
+226 129
+227 150
+228 132
+229 133
+230 148
+231 131
+232 149
+233 136
+234 137
+235 138
+236 139
+237 140
+238 141
+239 142
+240 143
+241 159
+242 144
+243 145
+244 146
+245 147
+246 134
+247 130
+248 156
+249 155
+250 135
+251 152
+252 157
+253 153
+254 151
+255 154
diff --git a/src/data/koi-iso.tab b/src/data/koi-iso.tab
index 98dd1d9d092..c78c0011359 100644
--- a/src/data/koi-iso.tab
+++ b/src/data/koi-iso.tab
@@ -73,3 +73,78 @@
253 0xc9
254 0xc7
255 0xca
+# Line with '#' at the begin is comment
+# table file may contain number of line as you wana
+# first - code of symbol, second translate code of symbol
+# codes may be in two forms: decimal and hex
+# examples:
+# 192 225
+# 0x81 226
+# 226 0x81
+# 0x90 0xfe
+# patch for Russia by Dm.Kryukov (dvk@stack.serpukhov.su)
+#
+192 0xee
+193 0xd0
+194 0xd1
+195 0xe6
+196 0xd4
+197 0xd5
+198 0xe4
+199 0xd3
+200 0xe5
+201 0xd8
+202 0xd9
+203 0xda
+204 0xdb
+205 0xdc
+206 0xdd
+207 0xde
+208 0xdf
+209 0xef
+210 0xe0
+211 0xe1
+212 0xe2
+213 0xe3
+214 0xd6
+215 0xd2
+216 0xec
+217 0xeb
+218 0xd7
+219 0xe8
+220 0xed
+221 0xe9
+222 0xe7
+223 0xea
+224 0xce
+225 0xb0
+226 0xb1
+227 0xc6
+228 0xb4
+229 0xb5
+230 0xc4
+231 0xb3
+232 0xc5
+233 0xb8
+234 0xb9
+235 0xba
+236 0xbb
+237 0xbc
+238 0xbd
+239 0xbe
+240 0xbf
+241 0xcf
+242 0xc0
+243 0xc1
+244 0xc2
+245 0xc3
+246 0xb6
+247 0xb2
+248 0xcc
+249 0xcb
+250 0xb7
+251 0xc8
+252 0xcd
+253 0xc9
+254 0xc7
+255 0xca
diff --git a/src/data/koi-iso.tab.orig b/src/data/koi-iso.tab.orig
index e69de29bb2d..98dd1d9d092 100644
--- a/src/data/koi-iso.tab.orig
+++ b/src/data/koi-iso.tab.orig
@@ -0,0 +1,75 @@
+# Line with '#' at the begin is comment
+# table file may contain number of line as you wana
+# first - code of symbol, second translate code of symbol
+# codes may be in two forms: decimal and hex
+# examples:
+# 192 225
+# 0x81 226
+# 226 0x81
+# 0x90 0xfe
+# patch for Russia by Dm.Kryukov (dvk@stack.serpukhov.su)
+#
+192 0xee
+193 0xd0
+194 0xd1
+195 0xe6
+196 0xd4
+197 0xd5
+198 0xe4
+199 0xd3
+200 0xe5
+201 0xd8
+202 0xd9
+203 0xda
+204 0xdb
+205 0xdc
+206 0xdd
+207 0xde
+208 0xdf
+209 0xef
+210 0xe0
+211 0xe1
+212 0xe2
+213 0xe3
+214 0xd6
+215 0xd2
+216 0xec
+217 0xeb
+218 0xd7
+219 0xe8
+220 0xed
+221 0xe9
+222 0xe7
+223 0xea
+224 0xce
+225 0xb0
+226 0xb1
+227 0xc6
+228 0xb4
+229 0xb5
+230 0xc4
+231 0xb3
+232 0xc5
+233 0xb8
+234 0xb9
+235 0xba
+236 0xbb
+237 0xbc
+238 0xbd
+239 0xbe
+240 0xbf
+241 0xcf
+242 0xc0
+243 0xc1
+244 0xc2
+245 0xc3
+246 0xb6
+247 0xb2
+248 0xcc
+249 0xcb
+250 0xb7
+251 0xc8
+252 0xcd
+253 0xc9
+254 0xc7
+255 0xca
diff --git a/src/data/koi-koi.tab b/src/data/koi-koi.tab
index 91a9389ee97..2a7400521cd 100644
--- a/src/data/koi-koi.tab
+++ b/src/data/koi-koi.tab
@@ -1,2 +1,4 @@
# Hmm ...
#
+# Hmm ...
+#
diff --git a/src/data/koi-koi.tab.orig b/src/data/koi-koi.tab.orig
index e69de29bb2d..91a9389ee97 100644
--- a/src/data/koi-koi.tab.orig
+++ b/src/data/koi-koi.tab.orig
@@ -0,0 +1,2 @@
+# Hmm ...
+#
diff --git a/src/data/koi-mac.tab b/src/data/koi-mac.tab
index c697c0cee12..2e592e07cf4 100644
--- a/src/data/koi-mac.tab
+++ b/src/data/koi-mac.tab
@@ -128,3 +128,133 @@
253 0x99
254 0x97
255 0x9a
+# Hmm ...
+#
+128 0xc0
+129 0xc1
+130 0xc2
+131 0xc3
+132 0xc4
+133 0xc5
+134 0xc6
+135 0xc7
+136 0xc8
+137 0xc9
+138 0xca
+139 0xcb
+140 0xcc
+141 0xcd
+142 0xce
+143 0xcf
+144 0xd0
+145 0xd1
+146 0xd2
+147 0xd3
+148 0xd4
+149 0xd5
+150 0xd6
+151 0xd7
+152 0xd8
+153 0xd9
+154 0xda
+155 0xdb
+156 0xdc
+157 0xdd
+158 0xde
+159 0xdf
+160 0xa0
+161 0xa1
+162 0xa2
+163 0xa3
+164 0xa4
+165 0xa5
+166 0xa6
+167 0xa7
+168 0xa8
+169 0xa9
+170 0xaa
+171 0xab
+172 0xac
+173 0xad
+174 0xae
+175 0xaf
+176 0xb0
+177 0xb1
+178 0xb2
+179 0xb3
+180 0xb4
+181 0xb5
+182 0xb6
+183 0xb7
+184 0xb8
+185 0xb9
+186 0xba
+187 0xbb
+188 0xbc
+189 0xbd
+190 0xbe
+191 0xbf
+192 0xfe
+193 0xe0
+194 0xe1
+195 0xf6
+196 0xe4
+197 0xe5
+198 0xf4
+199 0xe3
+200 0xf5
+201 0xe8
+202 0xe9
+203 0xea
+204 0xeb
+205 0xec
+206 0xed
+207 0xee
+208 0xef
+209 0xdf
+210 0xf0
+211 0xf1
+212 0xf2
+213 0xf3
+214 0xe6
+215 0xe2
+216 0xfc
+217 0xfb
+218 0xe7
+219 0xf8
+220 0xfd
+221 0xf9
+222 0xf7
+223 0xfa
+224 0x9e
+225 0x80
+226 0x81
+227 0x96
+228 0x84
+229 0x85
+230 0x94
+231 0x83
+232 0x95
+233 0x88
+234 0x89
+235 0x8a
+236 0x8b
+237 0x8c
+238 0x8d
+239 0x8e
+240 0x8f
+241 0x9f
+242 0x90
+243 0x91
+244 0x92
+245 0x93
+246 0x86
+247 0x82
+248 0x9c
+249 0x9b
+250 0x87
+251 0x98
+252 0x9d
+253 0x99
+254 0x97
+255 0x9a
diff --git a/src/data/koi-mac.tab.orig b/src/data/koi-mac.tab.orig
index e69de29bb2d..c697c0cee12 100644
--- a/src/data/koi-mac.tab.orig
+++ b/src/data/koi-mac.tab.orig
@@ -0,0 +1,130 @@
+# Hmm ...
+#
+128 0xc0
+129 0xc1
+130 0xc2
+131 0xc3
+132 0xc4
+133 0xc5
+134 0xc6
+135 0xc7
+136 0xc8
+137 0xc9
+138 0xca
+139 0xcb
+140 0xcc
+141 0xcd
+142 0xce
+143 0xcf
+144 0xd0
+145 0xd1
+146 0xd2
+147 0xd3
+148 0xd4
+149 0xd5
+150 0xd6
+151 0xd7
+152 0xd8
+153 0xd9
+154 0xda
+155 0xdb
+156 0xdc
+157 0xdd
+158 0xde
+159 0xdf
+160 0xa0
+161 0xa1
+162 0xa2
+163 0xa3
+164 0xa4
+165 0xa5
+166 0xa6
+167 0xa7
+168 0xa8
+169 0xa9
+170 0xaa
+171 0xab
+172 0xac
+173 0xad
+174 0xae
+175 0xaf
+176 0xb0
+177 0xb1
+178 0xb2
+179 0xb3
+180 0xb4
+181 0xb5
+182 0xb6
+183 0xb7
+184 0xb8
+185 0xb9
+186 0xba
+187 0xbb
+188 0xbc
+189 0xbd
+190 0xbe
+191 0xbf
+192 0xfe
+193 0xe0
+194 0xe1
+195 0xf6
+196 0xe4
+197 0xe5
+198 0xf4
+199 0xe3
+200 0xf5
+201 0xe8
+202 0xe9
+203 0xea
+204 0xeb
+205 0xec
+206 0xed
+207 0xee
+208 0xef
+209 0xdf
+210 0xf0
+211 0xf1
+212 0xf2
+213 0xf3
+214 0xe6
+215 0xe2
+216 0xfc
+217 0xfb
+218 0xe7
+219 0xf8
+220 0xfd
+221 0xf9
+222 0xf7
+223 0xfa
+224 0x9e
+225 0x80
+226 0x81
+227 0x96
+228 0x84
+229 0x85
+230 0x94
+231 0x83
+232 0x95
+233 0x88
+234 0x89
+235 0x8a
+236 0x8b
+237 0x8c
+238 0x8d
+239 0x8e
+240 0x8f
+241 0x9f
+242 0x90
+243 0x91
+244 0x92
+245 0x93
+246 0x86
+247 0x82
+248 0x9c
+249 0x9b
+250 0x87
+251 0x98
+252 0x9d
+253 0x99
+254 0x97
+255 0x9a
diff --git a/src/data/koi-win.tab b/src/data/koi-win.tab
index 4c390bc4eb3..1ac5511d2ce 100644
--- a/src/data/koi-win.tab
+++ b/src/data/koi-win.tab
@@ -83,3 +83,88 @@
253 217
254 215
255 218
+# Line with '#' at the begin is comment
+# table file may contain number of line as you wana
+# first - code of symbol, second translate code of symbol
+# codes may be in two forms: decimal and hex
+# examples:
+# 192 225
+# 0x81 226
+# 226 0x81
+# 0x90 0xfe
+# patch for Russia by Dm.Kryukov (dvk@stack.serpukhov.su)
+#
+163 184
+164 186
+166 179
+167 191
+173 180
+179 168
+180 170
+182 178
+183 175
+189 165
+192 254
+193 224
+194 225
+195 246
+196 228
+197 229
+198 244
+199 227
+200 245
+201 232
+202 233
+203 234
+204 235
+205 236
+206 237
+207 238
+208 239
+209 255
+210 240
+211 241
+212 242
+213 243
+214 230
+215 226
+216 252
+217 251
+218 231
+219 248
+220 253
+221 249
+222 247
+223 250
+224 222
+225 192
+226 193
+227 214
+228 196
+229 197
+230 212
+231 195
+232 213
+233 200
+234 201
+235 202
+236 203
+237 204
+238 205
+239 206
+240 207
+241 223
+242 208
+243 209
+244 210
+245 211
+246 198
+247 194
+248 220
+249 219
+250 199
+251 216
+252 221
+253 217
+254 215
+255 218
diff --git a/src/data/koi-win.tab.orig b/src/data/koi-win.tab.orig
index e69de29bb2d..4c390bc4eb3 100644
--- a/src/data/koi-win.tab.orig
+++ b/src/data/koi-win.tab.orig
@@ -0,0 +1,85 @@
+# Line with '#' at the begin is comment
+# table file may contain number of line as you wana
+# first - code of symbol, second translate code of symbol
+# codes may be in two forms: decimal and hex
+# examples:
+# 192 225
+# 0x81 226
+# 226 0x81
+# 0x90 0xfe
+# patch for Russia by Dm.Kryukov (dvk@stack.serpukhov.su)
+#
+163 184
+164 186
+166 179
+167 191
+173 180
+179 168
+180 170
+182 178
+183 175
+189 165
+192 254
+193 224
+194 225
+195 246
+196 228
+197 229
+198 244
+199 227
+200 245
+201 232
+202 233
+203 234
+204 235
+205 236
+206 237
+207 238
+208 239
+209 255
+210 240
+211 241
+212 242
+213 243
+214 230
+215 226
+216 252
+217 251
+218 231
+219 248
+220 253
+221 249
+222 247
+223 250
+224 222
+225 192
+226 193
+227 214
+228 196
+229 197
+230 212
+231 195
+232 213
+233 200
+234 201
+235 202
+236 203
+237 204
+238 205
+239 206
+240 207
+241 223
+242 208
+243 209
+244 210
+245 211
+246 198
+247 194
+248 220
+249 219
+250 199
+251 216
+252 221
+253 217
+254 215
+255 218
diff --git a/src/include/access/genam.h b/src/include/access/genam.h
index 79aa1fc89f7..b92e38379bd 100644
--- a/src/include/access/genam.h
+++ b/src/include/access/genam.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: genam.h,v 1.11 1998/01/24 22:47:48 momjian Exp $
+ * $Id: genam.h,v 1.12 1998/02/26 04:39:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,25 +25,31 @@
extern Relation index_open(Oid relationId);
extern Relation index_openr(char *relationName);
extern void index_close(Relation relation);
-extern InsertIndexResult index_insert(Relation relation,
+extern InsertIndexResult
+index_insert(Relation relation,
Datum *datum, char *nulls,
ItemPointer heap_t_ctid,
Relation heapRel);
extern void index_delete(Relation relation, ItemPointer indexItem);
-extern IndexScanDesc index_beginscan(Relation relation, bool scanFromEnd,
+extern IndexScanDesc
+index_beginscan(Relation relation, bool scanFromEnd,
uint16 numberOfKeys, ScanKey key);
extern void index_rescan(IndexScanDesc scan, bool scanFromEnd, ScanKey key);
extern void index_endscan(IndexScanDesc scan);
-extern RetrieveIndexResult index_getnext(IndexScanDesc scan,
+extern RetrieveIndexResult
+index_getnext(IndexScanDesc scan,
ScanDirection direction);
-extern RegProcedure index_getprocid(Relation irel, AttrNumber attnum,
+extern RegProcedure
+index_getprocid(Relation irel, AttrNumber attnum,
uint16 procnum);
-extern Datum GetIndexValue(HeapTuple tuple, TupleDesc hTupDesc,
+extern Datum
+GetIndexValue(HeapTuple tuple, TupleDesc hTupDesc,
int attOff, AttrNumber attrNums[], FuncIndexInfo *fInfo,
bool *attNull, Buffer buffer);
/* in genam.c */
-extern IndexScanDesc RelationGetIndexScan(Relation relation, bool scanFromEnd,
+extern IndexScanDesc
+RelationGetIndexScan(Relation relation, bool scanFromEnd,
uint16 numberOfKeys, ScanKey key);
extern void IndexScanMarkPosition(IndexScanDesc scan);
extern void IndexScanRestorePosition(IndexScanDesc scan);
diff --git a/src/include/access/gist.h b/src/include/access/gist.h
index 4c665aeaecc..15294ce06cc 100644
--- a/src/include/access/gist.h
+++ b/src/include/access/gist.h
@@ -188,18 +188,21 @@ typedef struct intrange
int flag;
} INTRANGE;
-extern void gistbuild(Relation heap,
+extern void
+gistbuild(Relation heap,
Relation index, int natts,
AttrNumber *attnum, IndexStrategy istrat,
uint16 pint, Datum *params,
FuncIndexInfo *finfo,
PredInfo *predInfo);
-extern InsertIndexResult gistinsert(Relation r, Datum *datum,
+extern InsertIndexResult
+gistinsert(Relation r, Datum *datum,
char *nulls, ItemPointer ht_ctid, Relation heapRel);
extern void _gistdump(Relation r);
extern void gistfreestack(GISTSTACK *s);
extern void initGISTstate(GISTSTATE *giststate, Relation index);
-extern void gistdentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr,
+extern void
+gistdentryinit(GISTSTATE *giststate, GISTENTRY *e, char *pr,
Relation r, Page pg, OffsetNumber o, int b, bool l);
extern StrategyNumber RelationGetGISTStrategy(Relation, AttrNumber, RegProcedure);
diff --git a/src/include/access/gistscan.h b/src/include/access/gistscan.h
index e38b26d9904..071238bd173 100644
--- a/src/include/access/gistscan.h
+++ b/src/include/access/gistscan.h
@@ -16,7 +16,8 @@
#include <storage/block.h>
#include <utils/rel.h>
-extern IndexScanDesc gistbeginscan(Relation r, bool fromEnd,
+extern IndexScanDesc
+gistbeginscan(Relation r, bool fromEnd,
uint16 nkeys, ScanKey key);
extern void gistrescan(IndexScanDesc s, bool fromEnd, ScanKey key);
extern void gistmarkpos(IndexScanDesc s);
diff --git a/src/include/access/giststrat.h b/src/include/access/giststrat.h
index f5e6e45d777..1007dd3ec26 100644
--- a/src/include/access/giststrat.h
+++ b/src/include/access/giststrat.h
@@ -15,7 +15,8 @@
#include <access/strat.h>
#include <utils/rel.h>
-extern StrategyNumber RelationGetGISTStrategy(Relation r,
+extern StrategyNumber
+RelationGetGISTStrategy(Relation r,
AttrNumber attnum, RegProcedure proc);
#endif /* GISTSTRAT_H */
diff --git a/src/include/access/hash.h b/src/include/access/hash.h
index 268edd82eaf..b74b074e81e 100644
--- a/src/include/access/hash.h
+++ b/src/include/access/hash.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: hash.h,v 1.12 1998/01/24 22:47:55 momjian Exp $
+ * $Id: hash.h,v 1.13 1998/02/26 04:39:59 momjian Exp $
*
* NOTES
* modeled after Margo Seltzer's hash implementation for unix.
@@ -248,13 +248,16 @@ typedef HashItemData *HashItem;
/* public routines */
-extern void hashbuild(Relation heap, Relation index, int natts,
+extern void
+hashbuild(Relation heap, Relation index, int natts,
AttrNumber *attnum, IndexStrategy istrat, uint16 pcount,
Datum *params, FuncIndexInfo *finfo, PredInfo *predInfo);
-extern InsertIndexResult hashinsert(Relation rel, Datum *datum, char *nulls,
+extern InsertIndexResult
+hashinsert(Relation rel, Datum *datum, char *nulls,
ItemPointer ht_ctid, Relation heapRel);
extern char *hashgettuple(IndexScanDesc scan, ScanDirection dir);
-extern char * hashbeginscan(Relation rel, bool fromEnd, uint16 keysz,
+extern char *
+hashbeginscan(Relation rel, bool fromEnd, uint16 keysz,
ScanKey scankey);
extern void hashrescan(IndexScanDesc scan, bool fromEnd, ScanKey scankey);
extern void hashendscan(IndexScanDesc scan);
@@ -285,9 +288,11 @@ extern InsertIndexResult _hash_doinsert(Relation rel, HashItem hitem);
/* hashovfl.c */
extern Buffer _hash_addovflpage(Relation rel, Buffer *metabufp, Buffer buf);
extern Buffer _hash_freeovflpage(Relation rel, Buffer ovflbuf);
-extern int32 _hash_initbitmap(Relation rel, HashMetaPage metap, int32 pnum,
+extern int32
+_hash_initbitmap(Relation rel, HashMetaPage metap, int32 pnum,
int32 nbits, int32 ndx);
-extern void _hash_squeezebucket(Relation rel, HashMetaPage metap,
+extern void
+_hash_squeezebucket(Relation rel, HashMetaPage metap,
Bucket bucket);
@@ -297,7 +302,8 @@ extern Buffer _hash_getbuf(Relation rel, BlockNumber blkno, int access);
extern void _hash_relbuf(Relation rel, Buffer buf, int access);
extern void _hash_wrtbuf(Relation rel, Buffer buf);
extern void _hash_wrtnorelbuf(Relation rel, Buffer buf);
-extern Page _hash_chgbufaccess(Relation rel, Buffer *bufp, int from_access,
+extern Page
+_hash_chgbufaccess(Relation rel, Buffer *bufp, int from_access,
int to_access);
extern void _hash_pageinit(Page page, Size size);
extern void _hash_pagedel(Relation rel, ItemPointer tid);
@@ -311,16 +317,19 @@ extern void _hash_adjscans(Relation rel, ItemPointer tid);
/* hashsearch.c */
-extern void _hash_search(Relation rel, int keysz, ScanKey scankey,
+extern void
+_hash_search(Relation rel, int keysz, ScanKey scankey,
Buffer *bufP, HashMetaPage metap);
extern RetrieveIndexResult _hash_next(IndexScanDesc scan, ScanDirection dir);
extern RetrieveIndexResult _hash_first(IndexScanDesc scan, ScanDirection dir);
-extern bool _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir,
+extern bool
+_hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir,
Buffer metabuf);
/* hashutil.c */
-extern ScanKey _hash_mkscankey(Relation rel, IndexTuple itup,
+extern ScanKey
+_hash_mkscankey(Relation rel, IndexTuple itup,
HashMetaPage metap);
extern void _hash_freeskey(ScanKey skey);
extern bool _hash_checkqual(IndexScanDesc scan, IndexTuple itup);
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index ad1114c5bf0..7dc25337357 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: heapam.h,v 1.29 1998/02/06 20:18:00 momjian Exp $
+ * $Id: heapam.h,v 1.30 1998/02/26 04:40:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -99,7 +99,7 @@ typedef HeapAccessStatisticsData *HeapAccessStatistics;
(attnum) == 1) ? \
( \
(Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \
- (char *) (tup) + (tup)->t_hoff + \
+ (char *) (tup) + (tup)->t_hoff + \
( \
((attnum) != 1) ? \
(tupleDesc)->attrs[(attnum)-1]->attcacheoff \
@@ -131,7 +131,7 @@ typedef HeapAccessStatisticsData *HeapAccessStatistics;
)
-
+
/* ----------------
* heap_getattr
*
@@ -205,7 +205,8 @@ extern void doinsert(Relation relation, HeapTuple tup);
extern Relation heap_open(Oid relationId);
extern Relation heap_openr(char *relationName);
extern void heap_close(Relation relation);
-extern HeapScanDesc heap_beginscan(Relation relation, int atend,
+extern HeapScanDesc
+heap_beginscan(Relation relation, int atend,
bool seeself, unsigned nkeys, ScanKey key);
extern void heap_rescan(HeapScanDesc sdesc, bool scanFromEnd, ScanKey key);
extern void heap_endscan(HeapScanDesc sdesc);
@@ -213,26 +214,31 @@ extern HeapTuple heap_getnext(HeapScanDesc scandesc, int backw, Buffer *b);
extern HeapTuple heap_fetch(Relation relation, bool seeself, ItemPointer tid, Buffer *b);
extern Oid heap_insert(Relation relation, HeapTuple tup);
extern int heap_delete(Relation relation, ItemPointer tid);
-extern int heap_replace(Relation relation, ItemPointer otid,
+extern int
+heap_replace(Relation relation, ItemPointer otid,
HeapTuple tup);
extern void heap_markpos(HeapScanDesc sdesc);
extern void heap_restrpos(HeapScanDesc sdesc);
/* in common/heaptuple.c */
extern Size ComputeDataSize(TupleDesc tupleDesc, Datum value[], char nulls[]);
-extern void DataFill(char *data, TupleDesc tupleDesc,
+extern void
+DataFill(char *data, TupleDesc tupleDesc,
Datum value[], char nulls[], uint16 *infomask,
bits8 *bit);
extern int heap_attisnull(HeapTuple tup, int attnum);
extern int heap_sysattrlen(AttrNumber attno);
extern bool heap_sysattrbyval(AttrNumber attno);
extern Datum heap_getsysattr(HeapTuple tup, Buffer b, int attnum);
-extern Datum nocachegetattr(HeapTuple tup, int attnum,
- TupleDesc att, bool *isnull);
+extern Datum
+nocachegetattr(HeapTuple tup, int attnum,
+ TupleDesc att, bool *isnull);
extern HeapTuple heap_copytuple(HeapTuple tuple);
-extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
+extern HeapTuple
+heap_formtuple(TupleDesc tupleDescriptor,
Datum value[], char nulls[]);
-extern HeapTuple heap_modifytuple(HeapTuple tuple, Buffer buffer,
+extern HeapTuple
+heap_modifytuple(HeapTuple tuple, Buffer buffer,
Relation relation, Datum replValue[], char replNull[], char repl[]);
HeapTuple heap_addheader(uint32 natts, int structlen, char *structure);
@@ -241,7 +247,8 @@ extern void PrintHeapAccessStatistics(HeapAccessStatistics stats);
extern void initam(void);
/* hio.c */
-extern void RelationPutHeapTuple(Relation relation, BlockNumber blockIndex,
+extern void
+RelationPutHeapTuple(Relation relation, BlockNumber blockIndex,
HeapTuple tuple);
extern void RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple);
diff --git a/src/include/access/hio.h b/src/include/access/hio.h
index 0f7c40e1ed2..5b38a42d634 100644
--- a/src/include/access/hio.h
+++ b/src/include/access/hio.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: hio.h,v 1.6 1998/01/24 22:48:01 momjian Exp $
+ * $Id: hio.h,v 1.7 1998/02/26 04:40:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,7 +17,8 @@
#include <utils/rel.h>
-extern void RelationPutHeapTuple(Relation relation, BlockNumber blockIndex,
+extern void
+RelationPutHeapTuple(Relation relation, BlockNumber blockIndex,
HeapTuple tuple);
extern void RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple);
diff --git a/src/include/access/htup.h b/src/include/access/htup.h
index 6e7674ea7c8..2479fe9d4b5 100644
--- a/src/include/access/htup.h
+++ b/src/include/access/htup.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: htup.h,v 1.8 1998/01/31 04:39:22 momjian Exp $
+ * $Id: htup.h,v 1.9 1998/02/26 04:40:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,25 +28,25 @@
*/
typedef struct HeapTupleData
{
- unsigned int t_len; /* length of entire tuple */
+ unsigned int t_len; /* length of entire tuple */
- Oid t_oid; /* OID of this tuple -- 4 bytes */
+ Oid t_oid; /* OID of this tuple -- 4 bytes */
- CommandId t_cmin; /* insert CID stamp -- 4 bytes each */
- CommandId t_cmax; /* delete CommandId stamp */
+ CommandId t_cmin; /* insert CID stamp -- 4 bytes each */
+ CommandId t_cmax; /* delete CommandId stamp */
- TransactionId t_xmin; /* insert XID stamp -- 4 bytes each */
- TransactionId t_xmax; /* delete XID stamp */
+ TransactionId t_xmin; /* insert XID stamp -- 4 bytes each */
+ TransactionId t_xmax; /* delete XID stamp */
- ItemPointerData t_ctid; /* current TID of this tuple */
-
- int16 t_natts; /* number of attributes */
+ ItemPointerData t_ctid; /* current TID of this tuple */
- uint16 t_infomask; /* various infos */
+ int16 t_natts; /* number of attributes */
- uint8 t_hoff; /* sizeof tuple header */
+ uint16 t_infomask; /* various infos */
- bits8 t_bits[MinHeapTupleBitmapSize / 8];
+ uint8 t_hoff; /* sizeof tuple header */
+
+ bits8 t_bits[MinHeapTupleBitmapSize / 8];
/* bit map of domains */
/* MORE DATA FOLLOWS AT END OF STRUCT */
diff --git a/src/include/access/iqual.h b/src/include/access/iqual.h
index 3cc1700f9c2..977045f0dc3 100644
--- a/src/include/access/iqual.h
+++ b/src/include/access/iqual.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: iqual.h,v 1.8 1998/01/24 22:48:05 momjian Exp $
+ * $Id: iqual.h,v 1.9 1998/02/26 04:40:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,8 @@
extern int NIndexTupleProcessed;
-extern bool index_keytest(IndexTuple tuple, TupleDesc tupdesc,
+extern bool
+index_keytest(IndexTuple tuple, TupleDesc tupdesc,
int scanKeySize, ScanKey key);
#endif /* IQUAL_H */
diff --git a/src/include/access/istrat.h b/src/include/access/istrat.h
index f2dcf2f554d..f1d202a7788 100644
--- a/src/include/access/istrat.h
+++ b/src/include/access/istrat.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: istrat.h,v 1.9 1998/01/24 22:48:05 momjian Exp $
+ * $Id: istrat.h,v 1.10 1998/02/26 04:40:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,18 +47,23 @@
*/
#define IndexStrategyIsValid(s) PointerIsValid(s)
-extern StrategyMap IndexStrategyGetStrategyMap(IndexStrategy indexStrategy,
+extern StrategyMap
+IndexStrategyGetStrategyMap(IndexStrategy indexStrategy,
StrategyNumber maxStrategyNum, AttrNumber attrNum);
-extern Size AttributeNumberGetIndexStrategySize(AttrNumber maxAttributeNumber,
+extern Size
+AttributeNumberGetIndexStrategySize(AttrNumber maxAttributeNumber,
StrategyNumber maxStrategyNumber);
-extern StrategyNumber RelationGetStrategy(Relation relation,
+extern StrategyNumber
+RelationGetStrategy(Relation relation,
AttrNumber attributeNumber, StrategyEvaluation evaluation,
RegProcedure procedure);
-extern bool RelationInvokeStrategy(Relation relation,
+extern bool
+RelationInvokeStrategy(Relation relation,
StrategyEvaluation evaluation, AttrNumber attributeNumber,
StrategyNumber strategy, Datum left, Datum right);
-extern void IndexSupportInitialize(IndexStrategy indexStrategy,
+extern void
+IndexSupportInitialize(IndexStrategy indexStrategy,
RegProcedure *indexSupport, Oid indexObjectId,
Oid accessMethodObjectId, StrategyNumber maxStrategyNumber,
StrategyNumber maxSupportNumber, AttrNumber maxAttributeNumber);
diff --git a/src/include/access/itup.h b/src/include/access/itup.h
index b230ab2265e..68fa5e2a7b0 100644
--- a/src/include/access/itup.h
+++ b/src/include/access/itup.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: itup.h,v 1.12 1998/02/06 20:18:01 momjian Exp $
+ * $Id: itup.h,v 1.13 1998/02/26 04:40:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -127,7 +127,7 @@ typedef struct PredInfo
(attnum) == 1) ? \
( \
(Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \
- (char *) (tup) + \
+ (char *) (tup) + \
( \
IndexTupleHasMinHeader(tup) ? \
sizeof (*(tup)) \
@@ -164,13 +164,16 @@ typedef struct PredInfo
) \
)
-
+
/* indextuple.h */
-extern IndexTuple index_formtuple(TupleDesc tupleDescriptor,
+extern IndexTuple
+index_formtuple(TupleDesc tupleDescriptor,
Datum value[], char null[]);
-extern Datum nocache_index_getattr(IndexTuple tup, int attnum,
- TupleDesc tupleDesc, bool *isnull);
-extern RetrieveIndexResult FormRetrieveIndexResult(ItemPointer indexItemPointer,
+extern Datum
+nocache_index_getattr(IndexTuple tup, int attnum,
+ TupleDesc tupleDesc, bool *isnull);
+extern RetrieveIndexResult
+FormRetrieveIndexResult(ItemPointer indexItemPointer,
ItemPointer heapItemPointer);
extern void CopyIndexTuple(IndexTuple source, IndexTuple *target);
diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h
index 8370422efc8..c7012005563 100644
--- a/src/include/access/nbtree.h
+++ b/src/include/access/nbtree.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: nbtree.h,v 1.19 1998/01/24 22:48:07 momjian Exp $
+ * $Id: nbtree.h,v 1.20 1998/02/26 04:40:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -213,11 +213,13 @@ typedef struct BTPageState
/*
* prototypes for functions in nbtinsert.c
*/
-extern InsertIndexResult _bt_doinsert(Relation rel, BTItem btitem,
+extern InsertIndexResult
+_bt_doinsert(Relation rel, BTItem btitem,
bool index_is_unique, Relation heapRel);
/* default is to allow duplicates */
-extern bool _bt_itemcmp(Relation rel, Size keysz, BTItem item1, BTItem item2,
+extern bool
+_bt_itemcmp(Relation rel, Size keysz, BTItem item1, BTItem item2,
StrategyNumber strat);
/*
@@ -239,13 +241,16 @@ extern void _bt_pagedel(Relation rel, ItemPointer tid);
*/
extern bool BuildingBtree; /* in nbtree.c */
-extern void btbuild(Relation heap, Relation index, int natts,
+extern void
+btbuild(Relation heap, Relation index, int natts,
AttrNumber *attnum, IndexStrategy istrat, uint16 pcount,
Datum *params, FuncIndexInfo *finfo, PredInfo *predInfo);
-extern InsertIndexResult btinsert(Relation rel, Datum *datum, char *nulls,
+extern InsertIndexResult
+btinsert(Relation rel, Datum *datum, char *nulls,
ItemPointer ht_ctid, Relation heapRel);
extern char *btgettuple(IndexScanDesc scan, ScanDirection dir);
-extern char * btbeginscan(Relation rel, bool fromEnd, uint16 keysz,
+extern char *
+btbeginscan(Relation rel, bool fromEnd, uint16 keysz,
ScanKey scankey);
extern void btrescan(IndexScanDesc scan, bool fromEnd, ScanKey scankey);
@@ -265,13 +270,17 @@ extern void _bt_adjscans(Relation rel, ItemPointer tid, int op);
/*
* prototypes for functions in nbtsearch.c
*/
-extern BTStack _bt_search(Relation rel, int keysz, ScanKey scankey,
+extern BTStack
+_bt_search(Relation rel, int keysz, ScanKey scankey,
Buffer *bufP);
-extern Buffer _bt_moveright(Relation rel, Buffer buf, int keysz,
+extern Buffer
+_bt_moveright(Relation rel, Buffer buf, int keysz,
ScanKey scankey, int access);
-extern bool _bt_skeycmp(Relation rel, Size keysz, ScanKey scankey,
+extern bool
+_bt_skeycmp(Relation rel, Size keysz, ScanKey scankey,
Page page, ItemId itemid, StrategyNumber strat);
-extern OffsetNumber _bt_binsrch(Relation rel, Buffer buf, int keysz,
+extern OffsetNumber
+_bt_binsrch(Relation rel, Buffer buf, int keysz,
ScanKey scankey, int srchtype);
extern RetrieveIndexResult _bt_next(IndexScanDesc scan, ScanDirection dir);
extern RetrieveIndexResult _bt_first(IndexScanDesc scan, ScanDirection dir);
@@ -280,9 +289,11 @@ extern bool _bt_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir);
/*
* prototypes for functions in nbtstrat.c
*/
-extern StrategyNumber _bt_getstrat(Relation rel, AttrNumber attno,
+extern StrategyNumber
+_bt_getstrat(Relation rel, AttrNumber attno,
RegProcedure proc);
-extern bool _bt_invokestrat(Relation rel, AttrNumber attno,
+extern bool
+_bt_invokestrat(Relation rel, AttrNumber attno,
StrategyNumber strat, Datum left, Datum right);
/*
diff --git a/src/include/access/rtree.h b/src/include/access/rtree.h
index 2af1c90a8ce..ea45c08c113 100644
--- a/src/include/access/rtree.h
+++ b/src/include/access/rtree.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rtree.h,v 1.11 1998/01/24 22:48:08 momjian Exp $
+ * $Id: rtree.h,v 1.12 1998/02/26 04:40:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -114,29 +114,34 @@ extern RetrieveIndexResult rtgettuple(IndexScanDesc s, ScanDirection dir);
* RTree code.
* Defined in access/index-rtree/
*/
-extern InsertIndexResult rtinsert(Relation r, Datum *datum, char *nulls,
+extern InsertIndexResult
+rtinsert(Relation r, Datum *datum, char *nulls,
ItemPointer ht_ctid, Relation heapRel);
extern char *rtdelete(Relation r, ItemPointer tid);
extern RetrieveIndexResult rtgettuple(IndexScanDesc s, ScanDirection dir);
-extern IndexScanDesc rtbeginscan(Relation r, bool fromEnd, uint16 nkeys,
+extern IndexScanDesc
+rtbeginscan(Relation r, bool fromEnd, uint16 nkeys,
ScanKey key);
extern void rtendscan(IndexScanDesc s);
extern void rtmarkpos(IndexScanDesc s);
extern void rtrestrpos(IndexScanDesc s);
extern void rtrescan(IndexScanDesc s, bool fromEnd, ScanKey key);
-extern void rtbuild(Relation heap, Relation index, int natts,
+extern void
+rtbuild(Relation heap, Relation index, int natts,
AttrNumber *attnum, IndexStrategy istrat, uint16 pcount,
Datum *params, FuncIndexInfo *finfo, PredInfo *predInfo);
extern void _rtdump(Relation r);
/* rtscan.c */
-extern void rtadjscans(Relation r, int op, BlockNumber blkno,
+extern void
+rtadjscans(Relation r, int op, BlockNumber blkno,
OffsetNumber offnum);
/* rtstrat.h */
-extern RegProcedure RTMapOperator(Relation r, AttrNumber attnum,
+extern RegProcedure
+RTMapOperator(Relation r, AttrNumber attnum,
RegProcedure proc);
#endif /* RTREE_H */
diff --git a/src/include/access/rtstrat.h b/src/include/access/rtstrat.h
index edb6b32db59..06236ae220a 100644
--- a/src/include/access/rtstrat.h
+++ b/src/include/access/rtstrat.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rtstrat.h,v 1.6 1998/01/24 22:48:08 momjian Exp $
+ * $Id: rtstrat.h,v 1.7 1998/02/26 04:40:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,7 +16,8 @@
#include <utils/rel.h>
#include <access/attnum.h>
-extern RegProcedure RTMapOperator(Relation r, AttrNumber attnum,
+extern RegProcedure
+RTMapOperator(Relation r, AttrNumber attnum,
RegProcedure proc);
#endif /* RTSTRAT_H */
diff --git a/src/include/access/skey.h b/src/include/access/skey.h
index e51b521518c..af60c7656ab 100644
--- a/src/include/access/skey.h
+++ b/src/include/access/skey.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: skey.h,v 1.8 1998/01/24 22:48:10 momjian Exp $
+ * $Id: skey.h,v 1.9 1998/02/26 04:40:27 momjian Exp $
*
*
* Note:
@@ -46,7 +46,8 @@ typedef ScanKeyData *ScanKey;
* prototypes for functions in access/common/scankey.c
*/
extern void ScanKeyEntrySetIllegal(ScanKey entry);
-extern void ScanKeyEntryInitialize(ScanKey entry, bits16 flags,
+extern void
+ScanKeyEntryInitialize(ScanKey entry, bits16 flags,
AttrNumber attributeNumber, RegProcedure procedure, Datum argument);
#endif /* SKEY_H */
diff --git a/src/include/access/strat.h b/src/include/access/strat.h
index 0ad737b36ce..0c3e82e9a2a 100644
--- a/src/include/access/strat.h
+++ b/src/include/access/strat.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: strat.h,v 1.8 1997/09/08 21:51:02 momjian Exp $
+ * $Id: strat.h,v 1.9 1998/02/26 04:40:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,6 +28,7 @@ typedef struct StrategyTransformMapData
*
*
*
+ *
* STRUCTURE */
typedef StrategyTransformMapData *StrategyTransformMap;
diff --git a/src/include/access/transam.h b/src/include/access/transam.h
index 7f8417ca0f7..282e0ce8479 100644
--- a/src/include/access/transam.h
+++ b/src/include/access/transam.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: transam.h,v 1.13 1998/01/24 22:48:11 momjian Exp $
+ * $Id: transam.h,v 1.14 1998/02/26 04:40:30 momjian Exp $
*
* NOTES
* Transaction System Version 101 now support proper oid
@@ -41,10 +41,10 @@
* commiting of child xactions.
* ----------------
*/
-#define XID_COMMIT 2 /* transaction commited */
-#define XID_ABORT 1 /* transaction aborted */
-#define XID_INPROGRESS 0 /* transaction in progress */
-#define XID_COMMIT_CHILD 3 /* child xact commited */
+#define XID_COMMIT 2 /* transaction commited */
+#define XID_ABORT 1 /* transaction aborted */
+#define XID_INPROGRESS 0 /* transaction in progress */
+#define XID_COMMIT_CHILD 3 /* child xact commited */
typedef unsigned char XidStatus;/* (2 bits) */
@@ -106,10 +106,10 @@ typedef LogRelationContentsData *LogRelationContents;
*/
typedef struct VariableRelationContentsData
{
- int TransSystemVersion;
- TransactionId nextXidData;
- TransactionId lastXidData; /* unused */
- Oid nextOid;
+ int TransSystemVersion;
+ TransactionId nextXidData;
+ TransactionId lastXidData; /* unused */
+ Oid nextOid;
} VariableRelationContentsData;
typedef VariableRelationContentsData *VariableRelationContents;
@@ -130,11 +130,14 @@ extern void TransactionIdAbort(TransactionId transactionId);
/* in transam/transsup.c */
extern void AmiTransactionOverride(bool flag);
-extern void TransComputeBlockNumber(Relation relation,
+extern void
+TransComputeBlockNumber(Relation relation,
TransactionId transactionId, BlockNumber *blockNumberOutP);
-extern XidStatus TransBlockNumberGetXidStatus(Relation relation,
+extern XidStatus
+TransBlockNumberGetXidStatus(Relation relation,
BlockNumber blockNumber, TransactionId xid, bool *failP);
-extern void TransBlockNumberSetXidStatus(Relation relation,
+extern void
+TransBlockNumberSetXidStatus(Relation relation,
BlockNumber blockNumber, TransactionId xid, XidStatus xstatus,
bool *failP);
diff --git a/src/include/access/tupdesc.h b/src/include/access/tupdesc.h
index 4af80270684..276a83b86b3 100644
--- a/src/include/access/tupdesc.h
+++ b/src/include/access/tupdesc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tupdesc.h,v 1.15 1998/02/10 16:03:57 momjian Exp $
+ * $Id: tupdesc.h,v 1.16 1998/02/26 04:40:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,7 +65,8 @@ extern TupleDesc CreateTupleDescCopyConstr(TupleDesc tupdesc);
extern void FreeTupleDesc(TupleDesc tupdesc);
-extern bool TupleDescInitEntry(TupleDesc desc,
+extern bool
+TupleDescInitEntry(TupleDesc desc,
AttrNumber attributeNumber,
char *attributeName,
Oid typeid,
diff --git a/src/include/access/tupmacs.h b/src/include/access/tupmacs.h
index c7711f5333a..173ac2cdcbe 100644
--- a/src/include/access/tupmacs.h
+++ b/src/include/access/tupmacs.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tupmacs.h,v 1.3 1998/02/01 05:38:40 momjian Exp $
+ * $Id: tupmacs.h,v 1.4 1998/02/26 04:40:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,7 +51,7 @@
( \
(char *) (long) *((int32 *)(T)) \
) \
- : \
+ : \
( \
(*(A))->attlen < sizeof(int16) ? \
(char *) (long) *((char *)(T)) \
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 92588e3512b..60bd8cab611 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: xact.h,v 1.11 1997/11/07 18:39:38 thomas Exp $
+ * $Id: xact.h,v 1.12 1998/02/26 04:40:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,7 +57,7 @@ typedef TransactionStateData *TransactionState;
#define TransactionIdIsValid(xid) ((bool) (xid != NullTransactionId))
#define TransactionIdStore(xid, dest) \
(*((TransactionId*)dest) = (TransactionId)xid)
-#define StoreInvalidTransactionId(dest) \
+#define StoreInvalidTransactionId(dest) \
(*((TransactionId*)dest) = NullTransactionId)
/* ----------------
diff --git a/src/include/bootstrap/bootstrap.h b/src/include/bootstrap/bootstrap.h
index e0e126e5040..f3546d3f729 100644
--- a/src/include/bootstrap/bootstrap.h
+++ b/src/include/bootstrap/bootstrap.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: bootstrap.h,v 1.10 1998/01/24 22:48:15 momjian Exp $
+ * $Id: bootstrap.h,v 1.11 1998/02/26 04:40:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,7 +33,8 @@ extern int numattr;
extern int DebugMode;
extern int BootstrapMain(int ac, char *av[]);
-extern void index_register(char *heap,
+extern void
+index_register(char *heap,
char *ind,
int natts,
AttrNumber *attnos,
diff --git a/src/include/c.h b/src/include/c.h
index fbb6dba546b..b30aefa6f8d 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: c.h,v 1.35 1998/02/24 06:04:35 scrappy Exp $
+ * $Id: c.h,v 1.36 1998/02/26 04:39:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -710,10 +710,10 @@ typedef struct Exception
/*
* This function gets call too often, so we inline it if we can.
- * Are we aligned for int32?
+ * Are we aligned for int32?
* We have to cast the pointer to int so we can do the AND
* We got the 64 number by testing this against the stock memset() on
- * BSD/OS 3.0. Larger values were slower.
+ * BSD/OS 3.0. Larger values were slower.
*/
#define MemSet(start, val, len) do \
{ \
@@ -742,7 +742,8 @@ extern Exception BadArg;
extern Exception BadState;
/* in utils/error/assert.c */
-extern int ExceptionalCondition(char *conditionName,
+extern int
+ExceptionalCondition(char *conditionName,
Exception *exceptionP, char *details,
char *fileName, int lineNumber);
diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h
index 68dc9b78090..e43ac0cd0e7 100644
--- a/src/include/catalog/heap.h
+++ b/src/include/catalog/heap.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: heap.h,v 1.11 1998/01/24 22:48:19 momjian Exp $
+ * $Id: heap.h,v 1.12 1998/02/26 04:40:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,7 +17,7 @@
extern Relation heap_create(char *relname, TupleDesc att);
-extern Oid heap_create_with_catalog(char relname[], TupleDesc tupdesc);
+extern Oid heap_create_with_catalog(char relname[], TupleDesc tupdesc);
extern void heap_destroy_with_catalog(char relname[]);
extern void heap_destroy(Relation r);
diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h
index 9f2f6826d64..1667b75091d 100644
--- a/src/include/catalog/index.h
+++ b/src/include/catalog/index.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: index.h,v 1.9 1998/01/24 22:48:22 momjian Exp $
+ * $Id: index.h,v 1.10 1998/02/26 04:40:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,15 +18,17 @@
#include <access/itup.h>
#include <access/funcindex.h>
-extern Form_pg_am AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId);
+extern Form_pg_am AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId);
extern void UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate);
-extern void InitIndexStrategy(int numatts,
+extern void
+InitIndexStrategy(int numatts,
Relation indexRelation,
Oid accessMethodObjectId);
-extern void index_create(char *heapRelationName,
+extern void
+index_create(char *heapRelationName,
char *indexRelationName,
FuncIndexInfo *funcInfo,
List *attributeList,
@@ -42,17 +44,20 @@ extern void index_create(char *heapRelationName,
extern void index_destroy(Oid indexId);
-extern void FormIndexDatum(int numberOfAttributes,
+extern void
+FormIndexDatum(int numberOfAttributes,
AttrNumber attributeNumber[], HeapTuple heapTuple,
TupleDesc heapDescriptor, Buffer buffer, Datum *datum,
char *nullv, FuncIndexInfoPtr fInfo);
extern void UpdateStats(Oid relid, long reltuples, bool hasindex);
-extern void FillDummyExprContext(ExprContext *econtext, TupleTableSlot *slot,
+extern void
+FillDummyExprContext(ExprContext *econtext, TupleTableSlot *slot,
TupleDesc tupdesc, Buffer buffer);
-extern void index_build(Relation heapRelation, Relation indexRelation,
+extern void
+index_build(Relation heapRelation, Relation indexRelation,
int numberOfAttributes, AttrNumber attributeNumber[],
uint16 parameterCount, Datum *parameter, FuncIndexInfo *funcInfo,
PredInfo *predInfo);
diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h
index b12390ceede..bd3c6127dd9 100644
--- a/src/include/catalog/indexing.h
+++ b/src/include/catalog/indexing.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: indexing.h,v 1.14 1998/01/24 22:48:27 momjian Exp $
+ * $Id: indexing.h,v 1.15 1998/02/26 04:40:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,21 +66,25 @@ extern char *IndexedCatalogNames[];
*/
extern void CatalogOpenIndices(int nIndices, char *names[], Relation idescs[]);
extern void CatalogCloseIndices(int nIndices, Relation *idescs);
-extern void CatalogIndexInsert(Relation *idescs,
+extern void
+CatalogIndexInsert(Relation *idescs,
int nIndices,
Relation heapRelation,
HeapTuple heapTuple);
extern bool CatalogHasIndex(char *catName, Oid catId);
-extern HeapTuple AttributeNameIndexScan(Relation heapRelation,
+extern HeapTuple
+AttributeNameIndexScan(Relation heapRelation,
Oid relid,
char *attname);
-extern HeapTuple AttributeNumIndexScan(Relation heapRelation,
+extern HeapTuple
+AttributeNumIndexScan(Relation heapRelation,
Oid relid,
AttrNumber attnum);
extern HeapTuple ProcedureOidIndexScan(Relation heapRelation, Oid procId);
-extern HeapTuple ProcedureNameIndexScan(Relation heapRelation,
+extern HeapTuple
+ProcedureNameIndexScan(Relation heapRelation,
char *procName, int nargs, Oid *argTypes);
extern HeapTuple ProcedureSrcIndexScan(Relation heapRelation, text *procSrc);
extern HeapTuple TypeOidIndexScan(Relation heapRelation, Oid typeId);
diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h
index 6ba8d1ee52e..5ca32d0527c 100644
--- a/src/include/catalog/pg_aggregate.h
+++ b/src/include/catalog/pg_aggregate.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_aggregate.h,v 1.13 1998/01/24 22:48:31 momjian Exp $
+ * $Id: pg_aggregate.h,v 1.14 1998/02/26 04:40:44 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -88,11 +88,11 @@ typedef FormData_pg_aggregate *Form_pg_aggregate;
* ---------------
*/
-DATA(insert OID = 0 ( avg PGUID int4pl int4inc int4div 23 23 23 23 _null_ 0 ));
-DATA(insert OID = 0 ( avg PGUID int2pl int2inc int2div 21 21 21 21 _null_ 0 ));
-DATA(insert OID = 0 ( avg PGUID float4pl float4inc float4div 700 700 700 700 _null_ 0.0 ));
-DATA(insert OID = 0 ( avg PGUID float8pl float8inc float8div 701 701 701 701 _null_ 0.0 ));
-DATA(insert OID = 0 ( avg PGUID cash_pl float8inc cash_div_flt8 790 790 701 790 _null_ 0.0 ));
+DATA(insert OID = 0 ( avg PGUID int4pl int4inc int4div 23 23 23 23 _null_ 0 ));
+DATA(insert OID = 0 ( avg PGUID int2pl int2inc int2div 21 21 21 21 _null_ 0 ));
+DATA(insert OID = 0 ( avg PGUID float4pl float4inc float4div 700 700 700 700 _null_ 0.0 ));
+DATA(insert OID = 0 ( avg PGUID float8pl float8inc float8div 701 701 701 701 _null_ 0.0 ));
+DATA(insert OID = 0 ( avg PGUID cash_pl float8inc cash_div_flt8 790 790 701 790 _null_ 0.0 ));
DATA(insert OID = 0 ( avg PGUID timespan_pl float8inc timespan_div 1186 1186 701 1186 _null_ 0.0 ));
DATA(insert OID = 0 ( sum PGUID int4pl - - 23 23 0 23 _null_ _null_ ));
@@ -129,7 +129,8 @@ DATA(insert OID = 0 ( count PGUID - int4inc - 0 0 23 23 _null_ 0 ));
/*
* prototypes for functions in pg_aggregate.c
*/
-extern void AggregateCreate(char *aggName,
+extern void
+AggregateCreate(char *aggName,
char *aggtransfn1Name,
char *aggtransfn2Name,
char *aggfinalfnName,
@@ -138,7 +139,8 @@ extern void AggregateCreate(char *aggName,
char *aggtransfn2typeName,
char *agginitval1,
char *agginitval2);
-extern char * AggNameGetInitVal(char *aggName, Oid basetype,
+extern char *
+AggNameGetInitVal(char *aggName, Oid basetype,
int xfuncno, bool *isNull);
#endif /* PG_AGGREGATE_H */
diff --git a/src/include/catalog/pg_amop.h b/src/include/catalog/pg_amop.h
index cd1193424af..76948533d47 100644
--- a/src/include/catalog/pg_amop.h
+++ b/src/include/catalog/pg_amop.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_amop.h,v 1.8 1997/11/30 23:03:28 thomas Exp $
+ * $Id: pg_amop.h,v 1.9 1998/02/26 04:40:47 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -540,29 +540,29 @@ BKI_END
*/
/* int2_ops */
-DATA(insert OID = 0 ( 405 421 94 1 hashsel hashnpage ));
+DATA(insert OID = 0 ( 405 421 94 1 hashsel hashnpage ));
/* float8_ops */
-DATA(insert OID = 0 ( 405 423 670 1 hashsel hashnpage ));
+DATA(insert OID = 0 ( 405 423 670 1 hashsel hashnpage ));
/* int4_ops */
-DATA(insert OID = 0 ( 405 426 96 1 hashsel hashnpage ));
+DATA(insert OID = 0 ( 405 426 96 1 hashsel hashnpage ));
/* oid_ops */
-DATA(insert OID = 0 ( 405 427 607 1 hashsel hashnpage ));
+DATA(insert OID = 0 ( 405 427 607 1 hashsel hashnpage ));
/* float4_ops */
-DATA(insert OID = 0 ( 405 428 620 1 hashsel hashnpage ));
+DATA(insert OID = 0 ( 405 428 620 1 hashsel hashnpage ));
/* char_ops */
-DATA(insert OID = 0 ( 405 429 92 1 hashsel hashnpage ));
+DATA(insert OID = 0 ( 405 429 92 1 hashsel hashnpage ));
/* char2_ops */
-DATA(insert OID = 0 ( 405 406 412 1 hashsel hashnpage ));
+DATA(insert OID = 0 ( 405 406 412 1 hashsel hashnpage ));
/* char4_ops */
-DATA(insert OID = 0 ( 405 407 413 1 hashsel hashnpage ));
+DATA(insert OID = 0 ( 405 407 413 1 hashsel hashnpage ));
/* char8_ops */
-DATA(insert OID = 0 ( 405 408 414 1 hashsel hashnpage ));
+DATA(insert OID = 0 ( 405 408 414 1 hashsel hashnpage ));
/* char16_ops */
-DATA(insert OID = 0 ( 405 430 1267 1 hashsel hashnpage ));
+DATA(insert OID = 0 ( 405 430 1267 1 hashsel hashnpage ));
/* name_ops */
DATA(insert OID = 0 ( 405 1181 93 1 hashsel hashnpage ));
/* text_ops */
-DATA(insert OID = 0 ( 405 431 98 1 hashsel hashnpage ));
+DATA(insert OID = 0 ( 405 431 98 1 hashsel hashnpage ));
/* bpchar_ops */
DATA(insert OID = 0 ( 405 1076 1054 1 hashsel hashnpage ));
/* varchar_ops */
diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h
index 2fc383a50c0..91ab9f46bf2 100644
--- a/src/include/catalog/pg_attribute.h
+++ b/src/include/catalog/pg_attribute.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_attribute.h,v 1.29 1998/02/25 13:09:24 scrappy Exp $
+ * $Id: pg_attribute.h,v 1.30 1998/02/26 04:40:48 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -77,6 +77,7 @@ CATALOG(pg_attribute) BOOTSTRAP
int4 attnelems;
int4 attcacheoff;
+
/*
* fastgetattr() uses attcacheoff to cache byte offsets of attributes
* in heap tuples. The data actually stored in pg_attribute (-1)
@@ -86,13 +87,15 @@ CATALOG(pg_attribute) BOOTSTRAP
*/
int2 atttypmod;
+
/*
* atttypmod records type-specific modifications supplied at table
- * creation time, and passes it to input and output functions as the
- * third argument.
+ * creation time, and passes it to input and output functions as the
+ * third argument.
*/
bool attbyval;
+
/*
* attbyval is a copy of the typbyval field from pg_type for this
* attribute. See atttypid above. See struct TypeTupleFormData for
@@ -176,21 +179,21 @@ typedef FormData_pg_attribute *AttributeTupleForm;
*/
#define Schema_pg_type \
{ 1247l, {"typname"}, 19l, 0, NAMEDATALEN, 1, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
-{ 1247l, {"typowner"}, 26l, 0, 4, 2, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247l, {"typlen"}, 21l, 0, 2, 3, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1247l, {"typprtlen"}, 21l, 0, 2, 4, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1247l, {"typbyval"}, 16l, 0, 1, 5, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1247l, {"typtype"}, 18l, 0, 1, 6, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1247l, {"typisdefined"}, 16l, 0, 1, 7, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1247l, {"typdelim"}, 18l, 0, 1, 8, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1247l, {"typrelid"}, 26l, 0, 4, 9, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247l, {"typelem"}, 26l, 0, 4, 10, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247l, {"typinput"}, 24l, 0, 4, 11, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247l, {"typoutput"}, 24l, 0, 4, 12, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247l, {"typreceive"}, 24l, 0, 4, 13, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247l, {"typsend"}, 24l, 0, 4, 14, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1247l, {"typalign"}, 18l, 0, 1, 15, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1247l, {"typdefault"}, 25l, 0, -1, 16, 0, -1, -1, '\0' , '\0', 'i', '\0', '\0' }
+{ 1247l, {"typowner"}, 26l, 0, 4, 2, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
+{ 1247l, {"typlen"}, 21l, 0, 2, 3, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
+{ 1247l, {"typprtlen"}, 21l, 0, 2, 4, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
+{ 1247l, {"typbyval"}, 16l, 0, 1, 5, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
+{ 1247l, {"typtype"}, 18l, 0, 1, 6, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
+{ 1247l, {"typisdefined"}, 16l, 0, 1, 7, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
+{ 1247l, {"typdelim"}, 18l, 0, 1, 8, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
+{ 1247l, {"typrelid"}, 26l, 0, 4, 9, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
+{ 1247l, {"typelem"}, 26l, 0, 4, 10, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
+{ 1247l, {"typinput"}, 24l, 0, 4, 11, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
+{ 1247l, {"typoutput"}, 24l, 0, 4, 12, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
+{ 1247l, {"typreceive"}, 24l, 0, 4, 13, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
+{ 1247l, {"typsend"}, 24l, 0, 4, 14, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
+{ 1247l, {"typalign"}, 18l, 0, 1, 15, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
+{ 1247l, {"typdefault"}, 25l, 0, -1, 16, 0, -1, -1, '\0' , '\0', 'i', '\0', '\0' }
DATA(insert OID = 0 ( 1247 typname 19 0 NAMEDATALEN 1 0 -1 -1 f f i f f));
DATA(insert OID = 0 ( 1247 typowner 26 0 4 2 0 -1 -1 t f i f f));
@@ -239,7 +242,7 @@ DATA(insert OID = 0 ( 1262 cmax 29 0 4 -6 0 -1 -1 t f i f f));
{ 1255l, {"prolang"}, 26l, 0, 4, 3, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
{ 1255l, {"proisinh"}, 16l, 0, 1, 4, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
{ 1255l, {"proistrusted"}, 16l, 0, 1, 5, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1255l, {"proiscachable"}, 16l, 0, 1, 6, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
+{ 1255l, {"proiscachable"}, 16l, 0, 1, 6, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
{ 1255l, {"pronargs"}, 21l, 0, 2, 7, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
{ 1255l, {"proretset"}, 16l, 0, 1, 8, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
{ 1255l, {"prorettype"}, 26l, 0, 4, 9, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
@@ -278,14 +281,14 @@ DATA(insert OID = 0 ( 1255 cmax 29 0 4 -6 0 -1 -1 t f i f f));
* pg_shadow
* ----------------
*/
-DATA(insert OID = 0 ( 1260 usename 19 0 NAMEDATALEN 1 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1260 usesysid 23 0 4 2 0 -1 -1 t f s f f));
-DATA(insert OID = 0 ( 1260 usecreatedb 16 0 1 3 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1260 usetrace 16 0 1 4 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1260 usesuper 16 0 1 5 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1260 usecatupd 16 0 1 6 0 -1 -1 t f c f f));
-DATA(insert OID = 0 ( 1260 passwd 25 0 -1 7 0 -1 -1 f f i f f));
-DATA(insert OID = 0 ( 1260 valuntil 702 0 4 8 0 -1 -1 t f i f f));
+DATA(insert OID = 0 ( 1260 usename 19 0 NAMEDATALEN 1 0 -1 -1 f f i f f));
+DATA(insert OID = 0 ( 1260 usesysid 23 0 4 2 0 -1 -1 t f s f f));
+DATA(insert OID = 0 ( 1260 usecreatedb 16 0 1 3 0 -1 -1 t f c f f));
+DATA(insert OID = 0 ( 1260 usetrace 16 0 1 4 0 -1 -1 t f c f f));
+DATA(insert OID = 0 ( 1260 usesuper 16 0 1 5 0 -1 -1 t f c f f));
+DATA(insert OID = 0 ( 1260 usecatupd 16 0 1 6 0 -1 -1 t f c f f));
+DATA(insert OID = 0 ( 1260 passwd 25 0 -1 7 0 -1 -1 f f i f f));
+DATA(insert OID = 0 ( 1260 valuntil 702 0 4 8 0 -1 -1 t f i f f));
DATA(insert OID = 0 ( 1260 ctid 27 0 6 -1 0 -1 -1 f f i f f));
DATA(insert OID = 0 ( 1260 oid 26 0 4 -2 0 -1 -1 t f i f f));
DATA(insert OID = 0 ( 1260 xmin 28 0 4 -3 0 -1 -1 f f i f f));
@@ -313,14 +316,14 @@ DATA(insert OID = 0 ( 1261 cmax 29 0 4 -6 0 -1 -1 t f i f f));
*/
#define Schema_pg_attribute \
{ 1249l, {"attrelid"}, 26l, 0, 4, 1, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1249l, {"attname"}, 19l, 0, NAMEDATALEN, 2, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
+{ 1249l, {"attname"}, 19l, 0, NAMEDATALEN, 2, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
{ 1249l, {"atttypid"}, 26l, 0, 4, 3, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1249l, {"attdisbursion"}, 700l, 0, 4, 4, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
+{ 1249l, {"attdisbursion"}, 700l, 0, 4, 4, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
{ 1249l, {"attlen"}, 21l, 0, 2, 5, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
{ 1249l, {"attnum"}, 21l, 0, 2, 6, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
{ 1249l, {"attnelems"}, 23l, 0, 4, 7, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
{ 1249l, {"attcacheoff"}, 23l, 0, 4, 8, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1249l, {"atttypmod"}, 21l, 0, 2, 9, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
+{ 1249l, {"atttypmod"}, 21l, 0, 2, 9, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
{ 1249l, {"attbyval"}, 16l, 0, 1, 10, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
{ 1249l, {"attisset"}, 16l, 0, 1, 11, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
{ 1249l, {"attalign"}, 18l, 0, 1, 12, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
@@ -354,19 +357,19 @@ DATA(insert OID = 0 ( 1249 cmax 29 0 4 -6 0 -1 -1 t f i f f));
*/
#define Schema_pg_class \
{ 1259l, {"relname"}, 19l, 0, NAMEDATALEN, 1, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }, \
-{ 1259l, {"reltype"}, 26l, 0, 4, 2, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1259l, {"relowner"}, 26l, 0, 4, 3, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
-{ 1259l, {"relam"}, 26l, 0, 4, 4, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
+{ 1259l, {"reltype"}, 26l, 0, 4, 2, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
+{ 1259l, {"relowner"}, 26l, 0, 4, 3, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
+{ 1259l, {"relam"}, 26l, 0, 4, 4, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
{ 1259l, {"relpages"}, 23, 0l, 4, 5, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
{ 1259l, {"reltuples"}, 23, 0l, 4, 6, 0, -1, -1, '\001', '\0', 'i', '\0', '\0' }, \
{ 1259l, {"relhasindex"}, 16, 0l, 1, 7, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
{ 1259l, {"relisshared"}, 16, 0l, 1, 8, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
{ 1259l, {"relkind"}, 18, 0l, 1, 9, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
{ 1259l, {"relnatts"}, 21, 0l, 2, 10, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1259l, {"relchecks"}, 21l, 0, 2, 11, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
-{ 1259l, {"reltriggers"}, 21l, 0, 2, 12, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
+{ 1259l, {"relchecks"}, 21l, 0, 2, 11, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
+{ 1259l, {"reltriggers"}, 21l, 0, 2, 12, 0, -1, -1, '\001', '\0', 's', '\0', '\0' }, \
{ 1259l, {"relhasrules"}, 16, 0l, 1, 13, 0, -1, -1, '\001', '\0', 'c', '\0', '\0' }, \
-{ 1259l, {"relacl"}, 1034l, 0, -1, 14, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }
+{ 1259l, {"relacl"}, 1034l, 0, -1, 14, 0, -1, -1, '\0', '\0', 'i', '\0', '\0' }
DATA(insert OID = 0 ( 1259 relname 19 0 NAMEDATALEN 1 0 -1 -1 f f i f f));
DATA(insert OID = 0 ( 1259 reltype 26 0 4 2 0 -1 -1 t f i f f));
diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h
index 0ff0eee91aa..223c60f8945 100644
--- a/src/include/catalog/pg_class.h
+++ b/src/include/catalog/pg_class.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_class.h,v 1.19 1998/02/25 13:09:25 scrappy Exp $
+ * $Id: pg_class.h,v 1.20 1998/02/26 04:40:52 momjian Exp $
*
* NOTES
* ``pg_relation'' is being replaced by ``pg_class''. currently
@@ -68,7 +68,8 @@ CATALOG(pg_class) BOOTSTRAP
* must be exactly this many instances in Class pg_attribute for this
* class which have attnum > 0 (= user attribute).
*/
- int2 relchecks; /* # of CHECK constraints, not stored in db? */
+ int2 relchecks; /* # of CHECK constraints, not stored in
+ * db? */
int2 reltriggers; /* # of TRIGGERs */
bool relhasrules;
aclitem relacl[1]; /* this is here for the catalog */
diff --git a/src/include/catalog/pg_description.h b/src/include/catalog/pg_description.h
index 5882eeb9b35..f2916ee3a89 100644
--- a/src/include/catalog/pg_description.h
+++ b/src/include/catalog/pg_description.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_description.h,v 1.4 1997/11/16 04:36:41 momjian Exp $
+ * $Id: pg_description.h,v 1.5 1998/02/26 04:40:53 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -28,7 +28,7 @@
*/
/* ----------------
- * pg_description definition. cpp turns this into
+ * pg_description definition. cpp turns this into
* typedef struct FormData_pg_description
* ----------------
*/
@@ -51,7 +51,7 @@ typedef FormData_pg_description *Form_pg_description;
*/
#define Natts_pg_description 2
#define Anum_pg_description_objoid 1
-#define Anum_pg_description_description 2
+#define Anum_pg_description_description 2
/* ----------------
* initial contents of pg_description
@@ -59,7 +59,7 @@ typedef FormData_pg_description *Form_pg_description;
*/
/* Because the contents of this table are taken from the other *.h files,
- there is no initialization. It is loaded from initdb using a COPY
+ there is no initialization. It is loaded from initdb using a COPY
statement.
*/
diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h
index c701dd88611..48fde89e39d 100644
--- a/src/include/catalog/pg_operator.h
+++ b/src/include/catalog/pg_operator.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_operator.h,v 1.24 1998/02/03 16:01:54 thomas Exp $
+ * $Id: pg_operator.h,v 1.25 1998/02/26 04:40:56 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -387,7 +387,7 @@ DATA(insert OID = 795 ( "<=" PGUID 0 b t f 602 602 701 794 0 0 0 path_n
DATA(insert OID = 796 ( ">=" PGUID 0 b t f 602 602 701 793 0 0 0 path_n_ge intltsel intltjoinsel ));
DATA(insert OID = 797 ( "#" PGUID 0 l t f 0 602 23 0 0 0 0 path_npoints - - ));
DATA(insert OID = 798 ( "?#" PGUID 0 b t f 602 602 16 0 0 0 0 path_inter - - ));
-DATA(insert OID = 799 ( "@-@" PGUID 0 l t f 0 602 701 0 0 0 0 path_length - - ));
+DATA(insert OID = 799 ( "@-@" PGUID 0 l t f 0 602 701 0 0 0 0 path_length - - ));
DATA(insert OID = 800 ( ">^" PGUID 0 b t f 603 603 16 0 0 0 0 box_above intltsel intltjoinsel ));
DATA(insert OID = 801 ( "<^" PGUID 0 b t f 603 603 16 0 0 0 0 box_below intltsel intltjoinsel ));
DATA(insert OID = 802 ( "?#" PGUID 0 b t f 603 603 16 0 0 0 0 box_overlap - - ));
@@ -657,12 +657,13 @@ DATA(insert OID = 1588 ( "<=" PGUID 0 b t f 601 601 16 1589 0 0 0 lseg_le
DATA(insert OID = 1589 ( ">" PGUID 0 b t f 601 601 16 1588 0 0 0 lseg_gt intltsel - ));
DATA(insert OID = 1590 ( ">=" PGUID 0 b t f 601 601 16 1587 0 0 0 lseg_ge intltsel - ));
-DATA(insert OID = 1591 ( "@-@" PGUID 0 l t f 0 601 701 0 0 0 0 lseg_length - - ));
+DATA(insert OID = 1591 ( "@-@" PGUID 0 l t f 0 601 701 0 0 0 0 lseg_length - - ));
/*
* function prototypes
*/
-extern void OperatorCreate(char *operatorName,
+extern void
+OperatorCreate(char *operatorName,
char *leftTypeName,
char *rightTypeName,
char *procedureName,
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index ffc1e05da34..3606242bcb2 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_proc.h,v 1.46 1998/02/03 16:01:59 thomas Exp $
+ * $Id: pg_proc.h,v 1.47 1998/02/26 04:40:59 momjian Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@@ -178,7 +178,7 @@ DESCR("equals");
DATA(insert OID = 66 ( int4lt PGUID 11 f t f 2 f 16 "23 23" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 67 ( texteq PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
+DATA(insert OID = 67 ( texteq PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
DESCR("equals");
#define TextEqualRegProcedure 67
@@ -209,13 +209,13 @@ DATA(insert OID = 79 ( nameregexeq PGUID 11 f t f 2 f 16 "19 25" 100 0 0 10
DESCR("matches regex., case-sensitive");
DATA(insert OID = 1252 ( nameregexne PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar ));
DESCR("does not match regex., case-sensitive");
-DATA(insert OID = 1254 ( textregexeq PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
+DATA(insert OID = 1254 ( textregexeq PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
DESCR("matches regex., case-sensitive");
-DATA(insert OID = 1256 ( textregexne PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
+DATA(insert OID = 1256 ( textregexne PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
DESCR("does not match regex., case-sensitive");
DATA(insert OID = 1257 ( textlen PGUID 11 f t f 1 f 23 "25" 100 0 1 0 foo bar ));
DESCR("length");
-DATA(insert OID = 1258 ( textcat PGUID 11 f t f 2 f 25 "25 25" 100 0 1 0 foo bar ));
+DATA(insert OID = 1258 ( textcat PGUID 11 f t f 2 f 25 "25 25" 100 0 1 0 foo bar ));
DESCR("concat");
DATA(insert OID = 84 ( boolne PGUID 11 f t f 2 f 16 "16 16" 100 0 0 100 foo bar ));
DESCR("not equal");
@@ -251,7 +251,7 @@ DATA(insert OID = 108 ( intgtjoinsel PGUID 11 f t f 5 f 701 "26 26 21 26 21"
DESCR("selectivity");
DATA(insert OID = 112 ( int4_text PGUID 11 f t f 1 f 25 "23" 100 0 0 100 foo bar ));
- DESCR("convert");
+DESCR("convert");
DATA(insert OID = 113 ( int2_text PGUID 11 f t f 1 f 25 "21" 100 0 0 100 foo bar ));
DESCR("convert");
DATA(insert OID = 114 ( oid_text PGUID 11 f t f 1 f 25 "26" 100 0 0 100 foo bar ));
@@ -278,29 +278,29 @@ DATA(insert OID = 123 ( box_in PGUID 11 f t f 1 f 603 "0" 100 0 0 100 foo
DESCR("(internal)");
DATA(insert OID = 124 ( box_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 125 ( box_overlap PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
+DATA(insert OID = 125 ( box_overlap PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
DESCR("overlaps");
-DATA(insert OID = 126 ( box_ge PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
+DATA(insert OID = 126 ( box_ge PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 127 ( box_gt PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
+DATA(insert OID = 127 ( box_gt PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 128 ( box_eq PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
+DATA(insert OID = 128 ( box_eq PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 129 ( box_lt PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
+DATA(insert OID = 129 ( box_lt PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 130 ( box_le PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
+DATA(insert OID = 130 ( box_le PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 131 ( point_above PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
+DATA(insert OID = 131 ( point_above PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
DESCR("is above");
-DATA(insert OID = 132 ( point_left PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
+DATA(insert OID = 132 ( point_left PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
DESCR("is left of");
-DATA(insert OID = 133 ( point_right PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
+DATA(insert OID = 133 ( point_right PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
DESCR("is left of");
-DATA(insert OID = 134 ( point_below PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
+DATA(insert OID = 134 ( point_below PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
DESCR("is below");
-DATA(insert OID = 135 ( point_eq PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
+DATA(insert OID = 135 ( point_eq PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
DESCR("same as");
-DATA(insert OID = 136 ( on_pb PGUID 11 f t f 2 f 16 "600 603" 100 0 0 100 foo bar ));
+DATA(insert OID = 136 ( on_pb PGUID 11 f t f 2 f 16 "600 603" 100 0 0 100 foo bar ));
DESCR("point is inside");
DATA(insert OID = 137 ( on_ppath PGUID 11 f t f 2 f 16 "600 602" 100 0 1 0 foo bar ));
DESCR("contained in");
@@ -314,7 +314,7 @@ DATA(insert OID = 141 ( int4mul PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100
DESCR("multiply");
DATA(insert OID = 142 ( int4fac PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar ));
DESCR("fraction");
-DATA(insert OID = 143 ( pointdist PGUID 11 f t f 2 f 23 "600 600" 100 0 0 100 foo bar ));
+DATA(insert OID = 143 ( pointdist PGUID 11 f t f 2 f 23 "600 600" 100 0 0 100 foo bar ));
DESCR("");
DATA(insert OID = 144 ( int4ne PGUID 11 f t f 2 f 16 "23 23" 100 0 0 100 foo bar ));
DESCR("not equal");
@@ -343,7 +343,7 @@ DATA(insert OID = 155 ( int2mod PGUID 11 f t f 2 f 21 "21 21" 100 0 0 100
DESCR("modulus");
DATA(insert OID = 156 ( int4mod PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar ));
DESCR("modulus");
-DATA(insert OID = 157 ( textne PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
+DATA(insert OID = 157 ( textne PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
DESCR("not equal");
DATA(insert OID = 158 ( int24eq PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar ));
DESCR("equals");
@@ -403,19 +403,19 @@ DESCR("equals");
DATA(insert OID = 185 ( oidne PGUID 11 f t f 2 f 16 "26 26" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 186 ( box_same PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
+DATA(insert OID = 186 ( box_same PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
DESCR("same as");
-DATA(insert OID = 187 ( box_contain PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
+DATA(insert OID = 187 ( box_contain PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
DESCR("contains");
-DATA(insert OID = 188 ( box_left PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
+DATA(insert OID = 188 ( box_left PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
DESCR("is left of");
-DATA(insert OID = 189 ( box_overleft PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
+DATA(insert OID = 189 ( box_overleft PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
DESCR("overlaps, but does not extend to right of");
-DATA(insert OID = 190 ( box_overright PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
+DATA(insert OID = 190 ( box_overright PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
DESCR("overlaps, but does not extend to left of");
-DATA(insert OID = 191 ( box_right PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
+DATA(insert OID = 191 ( box_right PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
DESCR("is left of");
-DATA(insert OID = 192 ( box_contained PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
+DATA(insert OID = 192 ( box_contained PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar ));
DESCR("contained in");
DATA(insert OID = 193 ( rt_box_union PGUID 11 f t f 2 f 603 "603 603" 100 0 0 100 foo bar ));
DESCR("r-tree");
@@ -534,53 +534,53 @@ DATA(insert OID = 246 ( tintervalin PGUID 11 f t f 1 f 704 "0" 100 0 0 100
DESCR("(internal)");
DATA(insert OID = 247 ( tintervalout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 248 ( ininterval PGUID 11 f t f 2 f 16 "702 704" 100 0 0 100 foo bar ));
+DATA(insert OID = 248 ( ininterval PGUID 11 f t f 2 f 16 "702 704" 100 0 0 100 foo bar ));
DESCR("abstime in tinterval");
DATA(insert OID = 249 ( intervalrel PGUID 11 f t f 1 f 703 "704" 100 0 0 100 foo bar ));
DESCR("");
DATA(insert OID = 250 ( timenow PGUID 11 f t f 0 f 702 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 251 ( abstimeeq PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
+DATA(insert OID = 251 ( abstimeeq PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 252 ( abstimene PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
+DATA(insert OID = 252 ( abstimene PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 253 ( abstimelt PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
+DATA(insert OID = 253 ( abstimelt PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 254 ( abstimegt PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
+DATA(insert OID = 254 ( abstimegt PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 255 ( abstimele PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
+DATA(insert OID = 255 ( abstimele PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 256 ( abstimege PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
+DATA(insert OID = 256 ( abstimege PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 257 ( reltimeeq PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 257 ( reltimeeq PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 258 ( reltimene PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 258 ( reltimene PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 259 ( reltimelt PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 259 ( reltimelt PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 260 ( reltimegt PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 260 ( reltimegt PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 261 ( reltimele PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 261 ( reltimele PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 262 ( reltimege PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 262 ( reltimege PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 263 ( intervalsame PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
+DATA(insert OID = 263 ( intervalsame PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
DESCR("same as");
-DATA(insert OID = 264 ( intervalct PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
+DATA(insert OID = 264 ( intervalct PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 265 ( intervalov PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
+DATA(insert OID = 265 ( intervalov PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
DESCR("overlaps");
-DATA(insert OID = 266 ( intervalleneq PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 266 ( intervalleneq PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
DESCR("length equals");
-DATA(insert OID = 267 ( intervallenne PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 267 ( intervallenne PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
DESCR("length not equal to");
-DATA(insert OID = 268 ( intervallenlt PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 268 ( intervallenlt PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
DESCR("length less-than");
-DATA(insert OID = 269 ( intervallengt PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 269 ( intervallengt PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
DESCR("length greater-than");
-DATA(insert OID = 270 ( intervallenle PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 270 ( intervallenle PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
DESCR("length less-than-or-equals");
-DATA(insert OID = 271 ( intervallenge PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
+DATA(insert OID = 271 ( intervallenge PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar ));
DESCR("length greater-than-or-equals");
DATA(insert OID = 272 ( intervalstart PGUID 11 f t f 1 f 702 "704" 100 0 0 100 foo bar ));
DESCR("start of interval");
@@ -588,15 +588,15 @@ DATA(insert OID = 273 ( intervalend PGUID 11 f t f 1 f 702 "704" 100 0 0 100
DESCR("");
DATA(insert OID = 274 ( timeofday PGUID 11 f t f 0 f 25 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 275 ( abstime_finite PGUID 11 f t f 1 f 16 "702" 100 0 0 100 foo bar ));
+DATA(insert OID = 275 ( abstime_finite PGUID 11 f t f 1 f 16 "702" 100 0 0 100 foo bar ));
DESCR("");
DATA(insert OID = 276 ( int2fac PGUID 11 f t f 1 f 21 "21" 100 0 0 100 foo bar ));
DESCR("");
-DATA(insert OID = 277 ( inter_sl PGUID 11 f t f 2 f 16 "601 628" 100 0 0 100 foo bar ));
+DATA(insert OID = 277 ( inter_sl PGUID 11 f t f 2 f 16 "601 628" 100 0 0 100 foo bar ));
DESCR("");
-DATA(insert OID = 278 ( inter_lb PGUID 11 f t f 2 f 16 "628 603" 100 0 0 100 foo bar ));
+DATA(insert OID = 278 ( inter_lb PGUID 11 f t f 2 f 16 "628 603" 100 0 0 100 foo bar ));
DESCR("");
DATA(insert OID = 279 ( float48mul PGUID 11 f t f 2 f 701 "700 701" 100 0 0 100 foo bar ));
@@ -616,58 +616,58 @@ DESCR("addition");
DATA(insert OID = 286 ( float84mi PGUID 11 f t f 2 f 701 "701 700" 100 0 0 100 foo bar ));
DESCR("subtract");
-DATA(insert OID = 287 ( float4eq PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 287 ( float4eq PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 288 ( float4ne PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 288 ( float4ne PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 289 ( float4lt PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 289 ( float4lt PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 290 ( float4le PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 290 ( float4le PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 291 ( float4gt PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 291 ( float4gt PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 292 ( float4ge PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 292 ( float4ge PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 293 ( float8eq PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 293 ( float8eq PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 294 ( float8ne PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 294 ( float8ne PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 295 ( float8lt PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 295 ( float8lt PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 296 ( float8le PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 296 ( float8le PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 297 ( float8gt PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 297 ( float8gt PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 298 ( float8ge PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 298 ( float8ge PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 299 ( float48eq PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 299 ( float48eq PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
DESCR("equals");
/* OIDS 300 - 399 */
-DATA(insert OID = 300 ( float48ne PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 300 ( float48ne PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 301 ( float48lt PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 301 ( float48lt PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 302 ( float48le PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 302 ( float48le PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 303 ( float48gt PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 303 ( float48gt PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 304 ( float48ge PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 304 ( float48ge PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 305 ( float84eq PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 305 ( float84eq PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 306 ( float84ne PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 306 ( float84ne PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 307 ( float84lt PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 307 ( float84lt PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 308 ( float84le PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 308 ( float84le PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 309 ( float84gt PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 309 ( float84gt PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 310 ( float84ge PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 310 ( float84ge PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
DATA(insert OID = 311 ( ftod PGUID 11 f t f 2 f 701 "700" 100 0 0 100 foo bar ));
@@ -678,7 +678,7 @@ DATA(insert OID = 313 ( i2toi4 PGUID 11 f t f 1 f 23 "21" 100 0 0 100 f
DESCR("convert");
DATA(insert OID = 314 ( i4toi2 PGUID 11 f t f 1 f 21 "23" 100 0 0 100 foo bar ));
DESCR("convert");
-DATA(insert OID = 315 ( keyfirsteq PGUID 11 f t f 2 f 16 "0 21" 100 0 0 100 foo bar ));
+DATA(insert OID = 315 ( keyfirsteq PGUID 11 f t f 2 f 16 "0 21" 100 0 0 100 foo bar ));
DESCR("");
DATA(insert OID = 316 ( i4tod PGUID 11 f t f 1 f 701 "23" 100 0 0 100 foo bar ));
DESCR("convert");
@@ -755,13 +755,13 @@ DATA(insert OID = 352 ( btint42cmp PGUID 11 f t f 2 f 23 "23 21" 100 0 0 10
DESCR("btree less-equal-greater");
DATA(insert OID = 353 ( btint24cmp PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
-DATA(insert OID = 354 ( btfloat4cmp PGUID 11 f t f 2 f 23 "700 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 354 ( btfloat4cmp PGUID 11 f t f 2 f 23 "700 700" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
-DATA(insert OID = 355 ( btfloat8cmp PGUID 11 f t f 2 f 23 "701 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 355 ( btfloat8cmp PGUID 11 f t f 2 f 23 "701 701" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
DATA(insert OID = 356 ( btoidcmp PGUID 11 f t f 2 f 23 "26 26" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
-DATA(insert OID = 357 ( btabstimecmp PGUID 11 f t f 2 f 23 "702 702" 100 0 0 100 foo bar ));
+DATA(insert OID = 357 ( btabstimecmp PGUID 11 f t f 2 f 23 "702 702" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
DATA(insert OID = 358 ( btcharcmp PGUID 11 f t f 2 f 23 "18 18" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
@@ -786,15 +786,15 @@ DATA(insert OID = 367 ( close_pb PGUID 11 f t f 2 f 600 "600 603" 100 0 0 1
DESCR("closest point on box");
DATA(insert OID = 368 ( close_sb PGUID 11 f t f 2 f 600 "601 603" 100 0 0 100 foo bar ));
DESCR("closest point to line segment on box");
-DATA(insert OID = 369 ( on_ps PGUID 11 f t f 2 f 16 "600 601" 100 0 0 100 foo bar ));
+DATA(insert OID = 369 ( on_ps PGUID 11 f t f 2 f 16 "600 601" 100 0 0 100 foo bar ));
DESCR("contained in");
DATA(insert OID = 370 ( path_distance PGUID 11 f t f 2 f 701 "602 602" 100 0 1 0 foo bar ));
DESCR("distance between");
DATA(insert OID = 371 ( dist_ppath PGUID 11 f t f 2 f 701 "600 602" 100 0 1 0 foo bar ));
DESCR("distance between");
-DATA(insert OID = 372 ( on_sb PGUID 11 f t f 2 f 16 "601 603" 100 0 0 100 foo bar ));
+DATA(insert OID = 372 ( on_sb PGUID 11 f t f 2 f 16 "601 603" 100 0 0 100 foo bar ));
DESCR("contained in");
-DATA(insert OID = 373 ( inter_sb PGUID 11 f t f 2 f 16 "601 603" 100 0 0 100 foo bar ));
+DATA(insert OID = 373 ( inter_sb PGUID 11 f t f 2 f 16 "601 603" 100 0 0 100 foo bar ));
DESCR("");
DATA(insert OID = 1274 ( btchar16cmp PGUID 11 f t f 2 f 23 "19 19" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
@@ -828,9 +828,9 @@ DATA(insert OID = 449 ( hashint2 PGUID 11 f t f 2 f 23 "21 21" 100 0 0 100
DESCR("hash");
DATA(insert OID = 450 ( hashint4 PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar ));
DESCR("hash");
-DATA(insert OID = 451 ( hashfloat4 PGUID 11 f t f 2 f 23 "700 700" 100 0 0 100 foo bar ));
+DATA(insert OID = 451 ( hashfloat4 PGUID 11 f t f 2 f 23 "700 700" 100 0 0 100 foo bar ));
DESCR("hash");
-DATA(insert OID = 452 ( hashfloat8 PGUID 11 f t f 2 f 23 "701 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 452 ( hashfloat8 PGUID 11 f t f 2 f 23 "701 701" 100 0 0 100 foo bar ));
DESCR("hash");
DATA(insert OID = 453 ( hashoid PGUID 11 f t f 2 f 23 "26 26" 100 0 0 100 foo bar ));
DESCR("hash");
@@ -852,31 +852,31 @@ DATA(insert OID = 470 ( char4out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo
DESCR("(internal)");
DATA(insert OID = 471 ( char8out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 472 ( char2eq PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
+DATA(insert OID = 472 ( char2eq PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 473 ( char4eq PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
+DATA(insert OID = 473 ( char4eq PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 474 ( char8eq PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
+DATA(insert OID = 474 ( char8eq PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 475 ( char2lt PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
+DATA(insert OID = 475 ( char2lt PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 476 ( char4lt PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
+DATA(insert OID = 476 ( char4lt PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 477 ( char8lt PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
+DATA(insert OID = 477 ( char8lt PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 478 ( char2le PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
+DATA(insert OID = 478 ( char2le PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 479 ( char4le PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
+DATA(insert OID = 479 ( char4le PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 480 ( char8le PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
+DATA(insert OID = 480 ( char8le PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 481 ( char2gt PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
+DATA(insert OID = 481 ( char2gt PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 482 ( char4gt PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
+DATA(insert OID = 482 ( char4gt PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 483 ( char8gt PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
+DATA(insert OID = 483 ( char8gt PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 484 ( char2ge PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
+DATA(insert OID = 484 ( char2ge PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
DATA(insert OID = 1275 ( char16eq PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar ));
DESCR("equals");
@@ -920,27 +920,27 @@ DATA(insert OID = 682 ( mktinterval PGUID 11 f t f 2 f 704 "702 702" 100 0 0
DESCR("convert to interval");
DATA(insert OID = 683 ( oid8eq PGUID 11 f t f 2 f 16 "30 30" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 684 ( char4ge PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
+DATA(insert OID = 684 ( char4ge PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 685 ( char8ge PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
+DATA(insert OID = 685 ( char8ge PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 686 ( char2ne PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
+DATA(insert OID = 686 ( char2ne PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 687 ( char4ne PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
+DATA(insert OID = 687 ( char4ne PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 688 ( char8ne PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
+DATA(insert OID = 688 ( char8ne PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 689 ( btchar2cmp PGUID 11 f t f 2 f 23 "409 409" 100 0 0 100 foo bar ));
+DATA(insert OID = 689 ( btchar2cmp PGUID 11 f t f 2 f 23 "409 409" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
-DATA(insert OID = 690 ( btchar4cmp PGUID 11 f t f 2 f 23 "410 410" 100 0 0 100 foo bar ));
+DATA(insert OID = 690 ( btchar4cmp PGUID 11 f t f 2 f 23 "410 410" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
-DATA(insert OID = 691 ( btchar8cmp PGUID 11 f t f 2 f 23 "411 411" 100 0 0 100 foo bar ));
+DATA(insert OID = 691 ( btchar8cmp PGUID 11 f t f 2 f 23 "411 411" 100 0 0 100 foo bar ));
DESCR("btree less-equal-greater");
-DATA(insert OID = 692 ( hashchar2 PGUID 11 f t f 2 f 23 "409 409" 100 0 0 100 foo bar ));
+DATA(insert OID = 692 ( hashchar2 PGUID 11 f t f 2 f 23 "409 409" 100 0 0 100 foo bar ));
DESCR("hash");
-DATA(insert OID = 693 ( hashchar4 PGUID 11 f t f 2 f 23 "410 410" 100 0 0 100 foo bar ));
+DATA(insert OID = 693 ( hashchar4 PGUID 11 f t f 2 f 23 "410 410" 100 0 0 100 foo bar ));
DESCR("hash");
-DATA(insert OID = 694 ( hashchar8 PGUID 11 f t f 2 f 23 "411 411" 100 0 0 100 foo bar ));
+DATA(insert OID = 694 ( hashchar8 PGUID 11 f t f 2 f 23 "411 411" 100 0 0 100 foo bar ));
DESCR("hash");
DATA(insert OID = 695 ( char8regexeq PGUID 11 f t f 2 f 16 "411 25" 100 0 0 100 foo bar ));
DESCR("matches regex., case-sensitive");
@@ -994,13 +994,13 @@ DESCR("distance between");
DATA(insert OID = 730 ( pqtest PGUID 11 f t f 1 f 23 "25" 100 0 0 100 foo bar ));
DESCR("");
-DATA(insert OID = 740 ( text_lt PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
+DATA(insert OID = 740 ( text_lt PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
DESCR("less-than");
-DATA(insert OID = 741 ( text_le PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
+DATA(insert OID = 741 ( text_le PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 742 ( text_gt PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
+DATA(insert OID = 742 ( text_gt PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 743 ( text_ge PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
+DATA(insert OID = 743 ( text_ge PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar ));
DESCR("greater-than-or-equals");
DATA(insert OID = 744 ( array_eq PGUID 11 f t f 2 f 16 "0 0" 100 0 0 100 foo bar));
@@ -1015,9 +1015,9 @@ DATA(insert OID = 748 ( array_set PGUID 11 f t f 8 f 23 "0 23 0 0 23 23 23
DESCR("array");
DATA(insert OID = 749 ( array_ref PGUID 11 f t f 7 f 23 "0 23 0 23 23 23 0" 100 0 0 100 foo bar));
DESCR("array");
-DATA(insert OID = 750 ( array_in PGUID 11 f t f 2 f 23 "0 0" 100 0 0 100 foo bar ));
+DATA(insert OID = 750 ( array_in PGUID 11 f t f 2 f 23 "0 0" 100 0 0 100 foo bar ));
DESCR("array");
-DATA(insert OID = 751 ( array_out PGUID 11 f t f 2 f 23 "0 0" 100 0 0 100 foo bar ));
+DATA(insert OID = 751 ( array_out PGUID 11 f t f 2 f 23 "0 0" 100 0 0 100 foo bar ));
DESCR("array");
DATA(insert OID = 752 ( filename_in PGUID 11 f t f 2 f 605 "0" 100 0 0 100 foo bar ));
@@ -1029,9 +1029,9 @@ DATA(insert OID = 760 ( smgrin PGUID 11 f t f 1 f 210 "0" 100 0 0 100 foo
DESCR("storage manager(internal)");
DATA(insert OID = 761 ( smgrout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("storage manager(internal)");
-DATA(insert OID = 762 ( smgreq PGUID 11 f t f 2 f 16 "210 210" 100 0 0 100 foo bar ));
+DATA(insert OID = 762 ( smgreq PGUID 11 f t f 2 f 16 "210 210" 100 0 0 100 foo bar ));
DESCR("storage manager");
-DATA(insert OID = 763 ( smgrne PGUID 11 f t f 2 f 16 "210 210" 100 0 0 100 foo bar ));
+DATA(insert OID = 763 ( smgrne PGUID 11 f t f 2 f 16 "210 210" 100 0 0 100 foo bar ));
DESCR("storage manager");
DATA(insert OID = 764 ( lo_import PGUID 11 f t f 1 f 26 "25" 100 0 0 100 foo bar ));
@@ -1074,17 +1074,17 @@ DESCR("gist(internal)");
DATA(insert OID = 782 ( gistbuild PGUID 11 f t f 9 f 23 "0" 100 0 0 100 foo bar ));
DESCR("gist(internal)");
-DATA(insert OID = 784 ( intervaleq PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
+DATA(insert OID = 784 ( intervaleq PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 785 ( intervalne PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
+DATA(insert OID = 785 ( intervalne PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 786 ( intervallt PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
+DATA(insert OID = 786 ( intervallt PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 787 ( intervalgt PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
+DATA(insert OID = 787 ( intervalgt PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 788 ( intervalle PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
+DATA(insert OID = 788 ( intervalle PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 789 ( intervalge PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
+DATA(insert OID = 789 ( intervalge PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
/* OIDS 800 - 899 */
@@ -1100,22 +1100,22 @@ DATA(insert OID = 820 ( oidint2in PGUID 11 f t f 1 f 810 "0" 100 0 0 100 f
DESCR("(internal)");
DATA(insert OID = 821 ( oidint2out PGUID 11 f t f 1 f 19 "0" 100 0 0 100 foo bar));
DESCR("(internal)");
-DATA(insert OID = 822 ( oidint2lt PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
+DATA(insert OID = 822 ( oidint2lt PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
DESCR("less-than");
-DATA(insert OID = 823 ( oidint2le PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
+DATA(insert OID = 823 ( oidint2le PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
DESCR("less-than-or-equals");
-DATA(insert OID = 824 ( oidint2eq PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
+DATA(insert OID = 824 ( oidint2eq PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
DESCR("equals");
#define OidInt2EqRegProcedure 824
-DATA(insert OID = 825 ( oidint2ge PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
+DATA(insert OID = 825 ( oidint2ge PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
DESCR("greater-than-or-equals");
-DATA(insert OID = 826 ( oidint2gt PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
+DATA(insert OID = 826 ( oidint2gt PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
DESCR("greater-than");
-DATA(insert OID = 827 ( oidint2ne PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
+DATA(insert OID = 827 ( oidint2ne PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar));
DESCR("not equal");
-DATA(insert OID = 828 ( oidint2cmp PGUID 11 f t f 2 f 21 "810 810" 100 0 0 100 foo bar));
+DATA(insert OID = 828 ( oidint2cmp PGUID 11 f t f 2 f 21 "810 810" 100 0 0 100 foo bar));
DESCR("less-equal-greater");
DATA(insert OID = 829 ( mkoidint2 PGUID 11 f t f 2 f 810 "26 21" 100 0 0 100 foo bar));
DESCR("");
@@ -1161,17 +1161,17 @@ DESCR("divide");
DATA(insert OID = 848 ( flt4_mul_cash PGUID 11 f t f 2 f 790 "700 790" 100 0 0 100 foo bar ));
DESCR("multiply");
-DATA(insert OID = 862 ( int4_mul_cash PGUID 11 f t f 2 f 790 "23 790" 100 0 0 100 foo bar ));
+DATA(insert OID = 862 ( int4_mul_cash PGUID 11 f t f 2 f 790 "23 790" 100 0 0 100 foo bar ));
DESCR("multiply");
-DATA(insert OID = 863 ( int2_mul_cash PGUID 11 f t f 2 f 790 "21 790" 100 0 0 100 foo bar ));
+DATA(insert OID = 863 ( int2_mul_cash PGUID 11 f t f 2 f 790 "21 790" 100 0 0 100 foo bar ));
DESCR("multiply");
-DATA(insert OID = 864 ( cash_mul_int4 PGUID 11 f t f 2 f 790 "790 23" 100 0 0 100 foo bar ));
+DATA(insert OID = 864 ( cash_mul_int4 PGUID 11 f t f 2 f 790 "790 23" 100 0 0 100 foo bar ));
DESCR("multiply");
-DATA(insert OID = 865 ( cash_div_int4 PGUID 11 f t f 2 f 790 "790 23" 100 0 0 100 foo bar ));
+DATA(insert OID = 865 ( cash_div_int4 PGUID 11 f t f 2 f 790 "790 23" 100 0 0 100 foo bar ));
DESCR("divide");
-DATA(insert OID = 866 ( cash_mul_int2 PGUID 11 f t f 2 f 790 "790 21" 100 0 0 100 foo bar ));
+DATA(insert OID = 866 ( cash_mul_int2 PGUID 11 f t f 2 f 790 "790 21" 100 0 0 100 foo bar ));
DESCR("multiply");
-DATA(insert OID = 867 ( cash_div_int2 PGUID 11 f t f 2 f 790 "790 21" 100 0 0 100 foo bar ));
+DATA(insert OID = 867 ( cash_div_int2 PGUID 11 f t f 2 f 790 "790 21" 100 0 0 100 foo bar ));
DESCR("divide");
DATA(insert OID = 886 ( cash_in PGUID 11 f t f 1 f 790 "0" 100 0 0 100 foo bar ));
@@ -1214,22 +1214,22 @@ DATA(insert OID = 920 ( oidint4in PGUID 11 f t f 1 f 910 "0" 100 0 0 100 f
DESCR("(internal)");
DATA(insert OID = 921 ( oidint4out PGUID 11 f t f 1 f 19 "0" 100 0 0 100 foo bar));
DESCR("(internal)");
-DATA(insert OID = 922 ( oidint4lt PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
+DATA(insert OID = 922 ( oidint4lt PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
DESCR("less-than");
-DATA(insert OID = 923 ( oidint4le PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
+DATA(insert OID = 923 ( oidint4le PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
DESCR("less-than-or-equals");
-DATA(insert OID = 924 ( oidint4eq PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
+DATA(insert OID = 924 ( oidint4eq PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
DESCR("equals");
#define OidInt4EqRegProcedure 924
-DATA(insert OID = 925 ( oidint4ge PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
+DATA(insert OID = 925 ( oidint4ge PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
DESCR("greater-than-or-equals");
-DATA(insert OID = 926 ( oidint4gt PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
+DATA(insert OID = 926 ( oidint4gt PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
DESCR("greater-than");
-DATA(insert OID = 927 ( oidint4ne PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
+DATA(insert OID = 927 ( oidint4ne PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar));
DESCR("not equal");
-DATA(insert OID = 928 ( oidint4cmp PGUID 11 f t f 2 f 23 "910 910" 100 0 0 100 foo bar));
+DATA(insert OID = 928 ( oidint4cmp PGUID 11 f t f 2 f 23 "910 910" 100 0 0 100 foo bar));
DESCR("less-equal-greater");
DATA(insert OID = 929 ( mkoidint4 PGUID 11 f t f 2 f 910 "26 23" 100 0 0 100 foo bar));
DESCR("");
@@ -1248,22 +1248,22 @@ DATA(insert OID = 940 ( oidnamein PGUID 11 f t f 1 f 911 "0" 100 0 0 100 f
DESCR("(internal)");
DATA(insert OID = 941 ( oidnameout PGUID 11 f t f 1 f 19 "0" 100 0 0 100 foo bar));
DESCR("(internal)");
-DATA(insert OID = 942 ( oidnamelt PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
+DATA(insert OID = 942 ( oidnamelt PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
DESCR("less-than");
-DATA(insert OID = 943 ( oidnamele PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
+DATA(insert OID = 943 ( oidnamele PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
DESCR("less-than-or-equals");
-DATA(insert OID = 944 ( oidnameeq PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
+DATA(insert OID = 944 ( oidnameeq PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
DESCR("equals");
#define OidNameEqRegProcedure 944
-DATA(insert OID = 945 ( oidnamege PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
+DATA(insert OID = 945 ( oidnamege PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
DESCR("greater-than-or-equals");
-DATA(insert OID = 946 ( oidnamegt PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
+DATA(insert OID = 946 ( oidnamegt PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
DESCR("greater-than");
-DATA(insert OID = 947 ( oidnamene PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
+DATA(insert OID = 947 ( oidnamene PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar));
DESCR("not equal");
-DATA(insert OID = 948 ( oidnamecmp PGUID 11 f t f 2 f 23 "911 911" 100 0 0 100 foo bar));
+DATA(insert OID = 948 ( oidnamecmp PGUID 11 f t f 2 f 23 "911 911" 100 0 0 100 foo bar));
DESCR("less-equal-greater");
DATA(insert OID = 949 ( mkoidname PGUID 11 f t f 2 f 911 "26 19" 100 0 0 100 foo bar));
DESCR("");
@@ -1299,9 +1299,9 @@ DESCR("closest point to line segment on line");
DATA(insert OID = 963 ( close_lb PGUID 11 f t f 2 f 600 "628 603" 100 0 10 100 foo bar ));
DESCR("closest point to line on box");
-DATA(insert OID = 964 ( lo_unlink PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar ));
+DATA(insert OID = 964 ( lo_unlink PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar ));
DESCR("large object unlink(delete)");
-DATA(insert OID = 972 ( regproctooid PGUID 11 f t f 1 f 26 "24" 100 0 0 100 foo bar ));
+DATA(insert OID = 972 ( regproctooid PGUID 11 f t f 1 f 26 "24" 100 0 0 100 foo bar ));
DESCR("get oid for regproc");
DATA(insert OID = 973 ( path_inter PGUID 11 f t f 2 f 16 "602 602" 100 0 10 100 foo bar ));
@@ -1318,23 +1318,23 @@ DATA(insert OID = 980 ( box_intersect PGUID 11 f t f 2 f 603 "603 603" 100 0
DESCR("intersects");
DATA(insert OID = 981 ( box_diagonal PGUID 11 f t f 1 f 601 "603" 100 0 0 100 foo bar ));
DESCR("box diagonal");
-DATA(insert OID = 982 ( path_n_lt PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar ));
+DATA(insert OID = 982 ( path_n_lt PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 983 ( path_n_gt PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar ));
+DATA(insert OID = 983 ( path_n_gt PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 984 ( path_n_eq PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar ));
+DATA(insert OID = 984 ( path_n_eq PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 985 ( path_n_le PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar ));
+DATA(insert OID = 985 ( path_n_le PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 986 ( path_n_ge PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar ));
+DATA(insert OID = 986 ( path_n_ge PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
DATA(insert OID = 987 ( path_length PGUID 11 f t f 1 f 701 "602" 100 0 1 0 foo bar ));
DESCR("sum of path segments");
-DATA(insert OID = 988 ( point_ne PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
+DATA(insert OID = 988 ( point_ne PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 989 ( point_vert PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
+DATA(insert OID = 989 ( point_vert PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
DESCR("is vertical");
-DATA(insert OID = 990 ( point_horiz PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
+DATA(insert OID = 990 ( point_horiz PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar ));
DESCR("is horizontal");
DATA(insert OID = 991 ( point_distance PGUID 11 f t f 2 f 701 "600 600" 100 0 0 100 foo bar ));
DESCR("distance between");
@@ -1342,17 +1342,17 @@ DATA(insert OID = 992 ( point_slope PGUID 11 f t f 2 f 701 "600 600" 100 0 0
DESCR("slope between points");
DATA(insert OID = 993 ( lseg_construct PGUID 11 f t f 2 f 601 "600 600" 100 0 0 100 foo bar ));
DESCR("convert points to line segment");
-DATA(insert OID = 994 ( lseg_intersect PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
+DATA(insert OID = 994 ( lseg_intersect PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
DESCR("intersects");
-DATA(insert OID = 995 ( lseg_parallel PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
+DATA(insert OID = 995 ( lseg_parallel PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
DESCR("is parallel to");
-DATA(insert OID = 996 ( lseg_perp PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
+DATA(insert OID = 996 ( lseg_perp PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
DESCR("is perpendicular to");
-DATA(insert OID = 997 ( lseg_vertical PGUID 11 f t f 1 f 16 "601" 100 0 0 100 foo bar ));
+DATA(insert OID = 997 ( lseg_vertical PGUID 11 f t f 1 f 16 "601" 100 0 0 100 foo bar ));
DESCR("is vertical");
-DATA(insert OID = 998 ( lseg_horizontal PGUID 11 f t f 1 f 16 "601" 100 0 0 100 foo bar ));
+DATA(insert OID = 998 ( lseg_horizontal PGUID 11 f t f 1 f 16 "601" 100 0 0 100 foo bar ));
DESCR("is horizontal");
-DATA(insert OID = 999 ( lseg_eq PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
+DATA(insert OID = 999 ( lseg_eq PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
DESCR("equals");
/* OIDS 1000 - 1999 */
@@ -1363,13 +1363,13 @@ DESCR("(internal)");
DATA(insert OID = 1030 ( nonnullvalue PGUID 11 f t f 1 f 16 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
#define NonNullValueRegProcedure 1030
-DATA(insert OID = 1031 ( aclitemin PGUID 11 f t f 1 f 1033 "0" 100 0 0 100 foo bar ));
+DATA(insert OID = 1031 ( aclitemin PGUID 11 f t f 1 f 1033 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
DATA(insert OID = 1032 ( aclitemout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 1035 ( aclinsert PGUID 11 f t f 2 f 1034 "1034 1033" 100 0 0 100 foo bar ));
+DATA(insert OID = 1035 ( aclinsert PGUID 11 f t f 2 f 1034 "1034 1033" 100 0 0 100 foo bar ));
DESCR("addition");
-DATA(insert OID = 1036 ( aclremove PGUID 11 f t f 2 f 1034 "1034 1033" 100 0 0 100 foo bar ));
+DATA(insert OID = 1036 ( aclremove PGUID 11 f t f 2 f 1034 "1034 1033" 100 0 0 100 foo bar ));
DESCR("subtract");
DATA(insert OID = 1037 ( aclcontains PGUID 11 f t f 2 f 16 "1034 1033" 100 0 0 100 foo bar ));
DESCR("matches regex., case-sensitive");
@@ -1377,11 +1377,11 @@ DATA(insert OID = 1038 ( seteval PGUID 11 f t f 1 f 23 "26" 100 0 0 100 fo
DESCR("");
#define SetEvalRegProcedure 1038
-DATA(insert OID = 1044 ( bpcharin PGUID 11 f t f 3 f 1042 "0" 100 0 0 100 foo bar ));
+DATA(insert OID = 1044 ( bpcharin PGUID 11 f t f 3 f 1042 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
DATA(insert OID = 1045 ( bpcharout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 1046 ( varcharin PGUID 11 f t f 3 f 1043 "0" 100 0 0 100 foo bar ));
+DATA(insert OID = 1046 ( varcharin PGUID 11 f t f 3 f 1043 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
DATA(insert OID = 1047 ( varcharout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
@@ -1418,7 +1418,7 @@ DESCR("hash");
DATA(insert OID = 1081 ( hashvarchar PGUID 11 f t f 1 f 23 "1043" 100 0 0 100 foo bar ));
DESCR("hash");
-DATA(insert OID = 1084 ( date_in PGUID 11 f t f 1 f 1082 "0" 100 0 0 100 foo bar ));
+DATA(insert OID = 1084 ( date_in PGUID 11 f t f 1 f 1082 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
DATA(insert OID = 1085 ( date_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
@@ -1451,9 +1451,9 @@ DATA(insert OID = 1106 ( time_ne PGUID 11 f t f 2 f 16 "1083 1083" 100 0 0
DESCR("not equal");
DATA(insert OID = 1107 ( time_cmp PGUID 11 f t f 2 f 23 "1083 1083" 100 0 0 100 foo bar ));
DESCR("less-equal-greater");
-DATA(insert OID = 1138 ( date_larger PGUID 11 f t f 2 f 1082 "1082 1082" 100 0 0 100 foo bar ));
+DATA(insert OID = 1138 ( date_larger PGUID 11 f t f 2 f 1082 "1082 1082" 100 0 0 100 foo bar ));
DESCR("");
-DATA(insert OID = 1139 ( date_smaller PGUID 11 f t f 2 f 1082 "1082 1082" 100 0 0 100 foo bar ));
+DATA(insert OID = 1139 ( date_smaller PGUID 11 f t f 2 f 1082 "1082 1082" 100 0 0 100 foo bar ));
DESCR("");
DATA(insert OID = 1140 ( date_mi PGUID 11 f t f 2 f 23 "1082 1082" 100 0 0 100 foo bar ));
DESCR("subtract");
@@ -1461,7 +1461,7 @@ DATA(insert OID = 1141 ( date_pli PGUID 11 f t f 2 f 1082 "1082 23" 100 0 0
DESCR("addition");
DATA(insert OID = 1142 ( date_mii PGUID 11 f t f 2 f 1082 "1082 23" 100 0 0 100 foo bar ));
DESCR("subtract");
-DATA(insert OID = 1143 ( time_in PGUID 11 f t f 1 f 1083 "0" 100 0 0 100 foo bar ));
+DATA(insert OID = 1143 ( time_in PGUID 11 f t f 1 f 1083 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
DATA(insert OID = 1144 ( time_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
@@ -1477,28 +1477,28 @@ DESCR("multiply");
DATA(insert OID = 1149 ( circle_div_pt PGUID 11 f t f 2 f 718 "718 600" 100 0 0 100 foo bar ));
DESCR("divide");
-DATA(insert OID = 1150 ( datetime_in PGUID 11 f t f 1 f 1184 "0" 100 0 0 100 foo bar ));
+DATA(insert OID = 1150 ( datetime_in PGUID 11 f t f 1 f 1184 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 1151 ( datetime_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
+DATA(insert OID = 1151 ( datetime_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 1152 ( datetime_eq PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
+DATA(insert OID = 1152 ( datetime_eq PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 1153 ( datetime_ne PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
+DATA(insert OID = 1153 ( datetime_ne PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 1154 ( datetime_lt PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
+DATA(insert OID = 1154 ( datetime_lt PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 1155 ( datetime_le PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
+DATA(insert OID = 1155 ( datetime_le PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 1156 ( datetime_ge PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
+DATA(insert OID = 1156 ( datetime_ge PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 1157 ( datetime_gt PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
+DATA(insert OID = 1157 ( datetime_gt PGUID 11 f t f 2 f 16 "1184 1184" 100 0 0 100 foo bar ));
DESCR("greater-than");
DATA(insert OID = 1158 ( datetime_finite PGUID 11 f t f 1 f 16 "1184" 100 0 0 100 foo bar ));
DESCR("");
DATA(insert OID = 1159 ( datetime_zone PGUID 11 f t f 2 f 25 "25 1184" 100 0 0 100 foo bar ));
DESCR("");
-DATA(insert OID = 1160 ( timespan_in PGUID 11 f t f 1 f 1186 "0" 100 0 0 100 foo bar ));
+DATA(insert OID = 1160 ( timespan_in PGUID 11 f t f 1 f 1186 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
DATA(insert OID = 1161 ( timespan_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
@@ -1581,21 +1581,21 @@ DATA(insert OID = 1236 ( char16icregexeq PGUID 11 f t f 2 f 16 "20 25" 100 0 0
DESCR("matches regex., case-insensitive");
DATA(insert OID = 1237 ( char16icregexne PGUID 11 f t f 2 f 16 "20 25" 100 0 0 100 foo bar ));
DESCR("does not match regex., case-insensitive");
-DATA(insert OID = 1238 ( texticregexeq PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
+DATA(insert OID = 1238 ( texticregexeq PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
DESCR("matches regex., case-insensitive");
-DATA(insert OID = 1239 ( texticregexne PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
+DATA(insert OID = 1239 ( texticregexne PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar ));
DESCR("does not match regex., case-insensitive");
DATA(insert OID = 1240 ( nameicregexeq PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar ));
DESCR("matches regex., case-insensitive");
DATA(insert OID = 1241 ( nameicregexne PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar ));
DESCR("does not match regex., case-insensitive");
-DATA(insert OID = 1251 ( bpcharlen PGUID 11 f t f 1 f 23 "1042" 100 0 0 100 foo bar ));
+DATA(insert OID = 1251 ( bpcharlen PGUID 11 f t f 1 f 23 "1042" 100 0 0 100 foo bar ));
DESCR("octet length");
-DATA(insert OID = 1253 ( varcharlen PGUID 11 f t f 1 f 23 "1043" 100 0 0 100 foo bar ));
+DATA(insert OID = 1253 ( varcharlen PGUID 11 f t f 1 f 23 "1043" 100 0 0 100 foo bar ));
DESCR("octet length");
-DATA(insert OID = 1263 ( text_timespan PGUID 11 f t f 1 f 1186 "25" 100 0 0 100 foo bar ));
+DATA(insert OID = 1263 ( text_timespan PGUID 11 f t f 1 f 1186 "25" 100 0 0 100 foo bar ));
DESCR("convert");
DATA(insert OID = 1271 ( timespan_finite PGUID 11 f t f 1 f 16 "1186" 100 0 0 100 foo bar ));
DESCR("boolean test");
@@ -1613,108 +1613,108 @@ DESCR("matches regex., case-insensitive");
DATA(insert OID = 1295 ( char8icregexne PGUID 11 f t f 2 f 16 "411 25" 100 0 0 100 foo bar ));
DESCR("does not match regex., case-insensitive");
-DATA(insert OID = 1297 ( timestamp_in PGUID 11 f t f 1 f 1296 "0" 100 0 0 100 foo bar ));
+DATA(insert OID = 1297 ( timestamp_in PGUID 11 f t f 1 f 1296 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 1298 ( timestamp_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
+DATA(insert OID = 1298 ( timestamp_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 1299 ( now PGUID 11 f t f 0 f 1296 "0" 100 0 0 100 foo bar ));
+DATA(insert OID = 1299 ( now PGUID 11 f t f 0 f 1296 "0" 100 0 0 100 foo bar ));
DESCR("current transaction time");
/* OIDS 1300 - 1399 */
-DATA(insert OID = 1306 ( timestampeq PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
+DATA(insert OID = 1306 ( timestampeq PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
DESCR("equals");
-DATA(insert OID = 1307 ( timestampne PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
+DATA(insert OID = 1307 ( timestampne PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 1308 ( timestamplt PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
+DATA(insert OID = 1308 ( timestamplt PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 1309 ( timestampgt PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
+DATA(insert OID = 1309 ( timestampgt PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 1310 ( timestample PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
+DATA(insert OID = 1310 ( timestample PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 1311 ( timestampge PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
+DATA(insert OID = 1311 ( timestampge PGUID 11 f t f 2 f 16 "1296 1296" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 1314 ( datetime_cmp PGUID 11 f t f 2 f 23 "1184 1184" 100 0 0 100 foo bar ));
+DATA(insert OID = 1314 ( datetime_cmp PGUID 11 f t f 2 f 23 "1184 1184" 100 0 0 100 foo bar ));
DESCR("less-equal-greater");
-DATA(insert OID = 1315 ( timespan_cmp PGUID 11 f t f 2 f 23 "1186 1186" 100 0 0 100 foo bar ));
+DATA(insert OID = 1315 ( timespan_cmp PGUID 11 f t f 2 f 23 "1186 1186" 100 0 0 100 foo bar ));
DESCR("less-equal-greater");
-DATA(insert OID = 1316 ( datetime_time PGUID 11 f t f 1 f 1083 "1184" 100 0 0 100 foo bar ));
+DATA(insert OID = 1316 ( datetime_time PGUID 11 f t f 1 f 1083 "1184" 100 0 0 100 foo bar ));
DESCR("convert");
DATA(insert OID = 1318 ( datetime_timestamp PGUID 11 f t f 1 f 1296 "1184" 100 0 0 100 foo bar ));
DESCR("convert");
-DATA(insert OID = 1326 ( timespan_div PGUID 11 f t f 2 f 1186 "1186 701" 100 0 0 100 foo bar ));
+DATA(insert OID = 1326 ( timespan_div PGUID 11 f t f 2 f 1186 "1186 701" 100 0 0 100 foo bar ));
DESCR("divide");
-DATA(insert OID = 1339 ( date_zone PGUID 14 f t f 2 f 25 "25 1184" 100 0 0 100 "select datetime_zone($1, $2)" - ));
+DATA(insert OID = 1339 ( date_zone PGUID 14 f t f 2 f 25 "25 1184" 100 0 0 100 "select datetime_zone($1, $2)" - ));
DESCR("");
-DATA(insert OID = 1340 ( text PGUID 14 f t f 1 f 25 "1184" 100 0 0 100 "select datetime_text($1)" - ));
+DATA(insert OID = 1340 ( text PGUID 14 f t f 1 f 25 "1184" 100 0 0 100 "select datetime_text($1)" - ));
DESCR("convert");
-DATA(insert OID = 1341 ( text PGUID 14 f t f 1 f 25 "1186" 100 0 0 100 "select timespan_text($1)" - ));
+DATA(insert OID = 1341 ( text PGUID 14 f t f 1 f 25 "1186" 100 0 0 100 "select timespan_text($1)" - ));
DESCR("convert");
-DATA(insert OID = 1342 ( text PGUID 14 f t f 1 f 25 "23" 100 0 0 100 "select int4_text($1)" - ));
+DATA(insert OID = 1342 ( text PGUID 14 f t f 1 f 25 "23" 100 0 0 100 "select int4_text($1)" - ));
DESCR("convert");
-DATA(insert OID = 1343 ( text PGUID 14 f t f 1 f 25 "21" 100 0 0 100 "select int2_text($1)" - ));
+DATA(insert OID = 1343 ( text PGUID 14 f t f 1 f 25 "21" 100 0 0 100 "select int2_text($1)" - ));
DESCR("convert");
-DATA(insert OID = 1344 ( text PGUID 14 f t f 1 f 25 "26" 100 0 0 100 "select oid_text($1)" - ));
+DATA(insert OID = 1344 ( text PGUID 14 f t f 1 f 25 "26" 100 0 0 100 "select oid_text($1)" - ));
DESCR("convert");
-DATA(insert OID = 1345 ( oid PGUID 14 f t f 1 f 26 "25" 100 0 0 100 "select text_oid($1)" - ));
+DATA(insert OID = 1345 ( oid PGUID 14 f t f 1 f 26 "25" 100 0 0 100 "select text_oid($1)" - ));
DESCR("convert");
-DATA(insert OID = 1346 ( int2 PGUID 14 f t f 1 f 21 "25" 100 0 0 100 "select text_int2($1)" - ));
+DATA(insert OID = 1346 ( int2 PGUID 14 f t f 1 f 21 "25" 100 0 0 100 "select text_int2($1)" - ));
DESCR("convert");
-DATA(insert OID = 1347 ( int4 PGUID 14 f t f 1 f 23 "25" 100 0 0 100 "select text_int4($1)" - ));
+DATA(insert OID = 1347 ( int4 PGUID 14 f t f 1 f 23 "25" 100 0 0 100 "select text_int4($1)" - ));
DESCR("convert");
-DATA(insert OID = 1348 ( obj_description PGUID 14 f t f 1 f 25 "26" 100 0 0 100 "select description from pg_description where objoid = $1" - ));
+DATA(insert OID = 1348 ( obj_description PGUID 14 f t f 1 f 25 "26" 100 0 0 100 "select description from pg_description where objoid = $1" - ));
DESCR("get description for object id");
-DATA(insert OID = 1349 ( oid8types PGUID 11 f t f 1 f 25 "30" 100 0 0 100 foo bar ));
+DATA(insert OID = 1349 ( oid8types PGUID 11 f t f 1 f 25 "30" 100 0 0 100 foo bar ));
DESCR("print type names of oid8 field");
-DATA(insert OID = 1350 ( datetime PGUID 14 f t f 1 f 1184 "1184" 100 0 0 100 "select $1" - ));
+DATA(insert OID = 1350 ( datetime PGUID 14 f t f 1 f 1184 "1184" 100 0 0 100 "select $1" - ));
DESCR("convert");
-DATA(insert OID = 1351 ( datetime PGUID 14 f t f 1 f 1184 "25" 100 0 0 100 "select text_datetime($1)" - ));
+DATA(insert OID = 1351 ( datetime PGUID 14 f t f 1 f 1184 "25" 100 0 0 100 "select text_datetime($1)" - ));
DESCR("convert");
-DATA(insert OID = 1352 ( datetime PGUID 14 f t f 1 f 1184 "702" 100 0 0 100 "select abstime_datetime($1)" - ));
+DATA(insert OID = 1352 ( datetime PGUID 14 f t f 1 f 1184 "702" 100 0 0 100 "select abstime_datetime($1)" - ));
DESCR("convert");
-DATA(insert OID = 1353 ( datetime PGUID 14 f t f 1 f 1184 "1082" 100 0 0 100 "select date_datetime($1)" - ));
+DATA(insert OID = 1353 ( datetime PGUID 14 f t f 1 f 1184 "1082" 100 0 0 100 "select date_datetime($1)" - ));
DESCR("convert");
-DATA(insert OID = 1354 ( datetime PGUID 14 f t f 1 f 1184 "1296" 100 0 0 100 "select timestamp_datetime($1)" - ));
+DATA(insert OID = 1354 ( datetime PGUID 14 f t f 1 f 1184 "1296" 100 0 0 100 "select timestamp_datetime($1)" - ));
DESCR("convert");
-DATA(insert OID = 1355 ( datetime PGUID 14 f t f 2 f 1184 "1082 1083" 100 0 0 100 "select datetime_datetime($1, $2)" - ));
+DATA(insert OID = 1355 ( datetime PGUID 14 f t f 2 f 1184 "1082 1083" 100 0 0 100 "select datetime_datetime($1, $2)" - ));
DESCR("convert");
-DATA(insert OID = 1356 ( timespan PGUID 14 f t f 1 f 1186 "1186" 100 0 0 100 "select $1" - ));
+DATA(insert OID = 1356 ( timespan PGUID 14 f t f 1 f 1186 "1186" 100 0 0 100 "select $1" - ));
DESCR("convert");
-DATA(insert OID = 1357 ( timespan PGUID 14 f t f 1 f 1186 "703" 100 0 0 100 "select reltime_timespan($1)" - ));
+DATA(insert OID = 1357 ( timespan PGUID 14 f t f 1 f 1186 "703" 100 0 0 100 "select reltime_timespan($1)" - ));
DESCR("convert");
-DATA(insert OID = 1358 ( timespan PGUID 14 f t f 1 f 1186 "1083" 100 0 0 100 "select time_timespan($1)" - ));
+DATA(insert OID = 1358 ( timespan PGUID 14 f t f 1 f 1186 "1083" 100 0 0 100 "select time_timespan($1)" - ));
DESCR("convert");
-DATA(insert OID = 1359 ( date PGUID 14 f t f 1 f 1082 "1082" 100 0 0 100 "select $1" - ));
+DATA(insert OID = 1359 ( date PGUID 14 f t f 1 f 1082 "1082" 100 0 0 100 "select $1" - ));
DESCR("convert");
-DATA(insert OID = 1360 ( date PGUID 14 f t f 1 f 1082 "1184" 100 0 0 100 "select datetime_date($1)" - ));
+DATA(insert OID = 1360 ( date PGUID 14 f t f 1 f 1082 "1184" 100 0 0 100 "select datetime_date($1)" - ));
DESCR("convert");
-DATA(insert OID = 1361 ( date PGUID 14 f t f 1 f 1082 "702" 100 0 0 100 "select abstime_date($1)" - ));
+DATA(insert OID = 1361 ( date PGUID 14 f t f 1 f 1082 "702" 100 0 0 100 "select abstime_date($1)" - ));
DESCR("convert");
-DATA(insert OID = 1362 ( time PGUID 14 f t f 1 f 1083 "1083" 100 0 0 100 "select $1" - ));
+DATA(insert OID = 1362 ( time PGUID 14 f t f 1 f 1083 "1083" 100 0 0 100 "select $1" - ));
DESCR("convert");
-DATA(insert OID = 1363 ( time PGUID 14 f t f 1 f 1083 "1184" 100 0 0 100 "select datetime_time($1)" - ));
+DATA(insert OID = 1363 ( time PGUID 14 f t f 1 f 1083 "1184" 100 0 0 100 "select datetime_time($1)" - ));
DESCR("convert");
-DATA(insert OID = 1364 ( time PGUID 14 f t f 1 f 1083 "702" 100 0 0 100 "select abstime_time($1)" - ));
+DATA(insert OID = 1364 ( time PGUID 14 f t f 1 f 1083 "702" 100 0 0 100 "select abstime_time($1)" - ));
DESCR("convert");
-DATA(insert OID = 1365 ( abstime PGUID 14 f t f 1 f 702 "702" 100 0 0 100 "select $1" - ));
+DATA(insert OID = 1365 ( abstime PGUID 14 f t f 1 f 702 "702" 100 0 0 100 "select $1" - ));
DESCR("convert");
-DATA(insert OID = 1366 ( abstime PGUID 14 f t f 1 f 702 "1184" 100 0 0 100 "select datetime_abstime($1)" - ));
+DATA(insert OID = 1366 ( abstime PGUID 14 f t f 1 f 702 "1184" 100 0 0 100 "select datetime_abstime($1)" - ));
DESCR("convert");
-DATA(insert OID = 1367 ( reltime PGUID 14 f t f 1 f 703 "703" 100 0 0 100 "select $1" - ));
+DATA(insert OID = 1367 ( reltime PGUID 14 f t f 1 f 703 "703" 100 0 0 100 "select $1" - ));
DESCR("convert");
-DATA(insert OID = 1368 ( reltime PGUID 14 f t f 1 f 703 "1186" 100 0 0 100 "select timespan_reltime($1)" - ));
+DATA(insert OID = 1368 ( reltime PGUID 14 f t f 1 f 703 "1186" 100 0 0 100 "select timespan_reltime($1)" - ));
DESCR("convert");
-DATA(insert OID = 1369 ( timestamp PGUID 14 f t f 1 f 1296 "1296" 100 0 0 100 "select $1" - ));
+DATA(insert OID = 1369 ( timestamp PGUID 14 f t f 1 f 1296 "1296" 100 0 0 100 "select $1" - ));
DESCR("convert");
-DATA(insert OID = 1370 ( timestamp PGUID 14 f t f 1 f 1296 "1184" 100 0 0 100 "select datetime_stamp($1)" - ));
+DATA(insert OID = 1370 ( timestamp PGUID 14 f t f 1 f 1296 "1184" 100 0 0 100 "select datetime_stamp($1)" - ));
DESCR("convert");
-DATA(insert OID = 1371 ( length PGUID 14 f t f 1 f 23 "25" 100 0 0 100 "select textlen($1)" - ));
+DATA(insert OID = 1371 ( length PGUID 14 f t f 1 f 23 "25" 100 0 0 100 "select textlen($1)" - ));
DESCR("octet length");
-DATA(insert OID = 1372 ( length PGUID 14 f t f 1 f 23 "1042" 100 0 0 100 "select bpcharlen($1)" - ));
+DATA(insert OID = 1372 ( length PGUID 14 f t f 1 f 23 "1042" 100 0 0 100 "select bpcharlen($1)" - ));
DESCR("octet length");
-DATA(insert OID = 1373 ( length PGUID 14 f t f 1 f 23 "1043" 100 0 0 100 "select varcharlen($1)" - ));
+DATA(insert OID = 1373 ( length PGUID 14 f t f 1 f 23 "1043" 100 0 0 100 "select varcharlen($1)" - ));
DESCR("octet length");
DATA(insert OID = 1380 ( date_part PGUID 14 f t f 2 f 701 "25 1184" 100 0 0 100 "select datetime_part($1, $2)" - ));
@@ -1733,19 +1733,19 @@ DATA(insert OID = 1386 ( date_trunc PGUID 14 f t f 2 f 1184 "25 1184" 100 0 0
DESCR("truncate datetime to field");
DATA(insert OID = 1387 ( date_trunc PGUID 14 f t f 2 f 1186 "25 1186" 100 0 0 100 "select timespan_trunc($1, $2)" - ));
DESCR("truncate timespan to field");
-DATA(insert OID = 1388 ( age PGUID 14 f t f 2 f 1186 "1184 1184" 100 0 0 100 "select datetime_age($1, $2)" - ));
+DATA(insert OID = 1388 ( age PGUID 14 f t f 2 f 1186 "1184 1184" 100 0 0 100 "select datetime_age($1, $2)" - ));
DESCR("difference between datetimes but leave years and months unresolved");
-DATA(insert OID = 1389 ( age PGUID 14 f t f 1 f 1186 "1184" 100 0 0 100 "select datetime_age(\'today\', $1)" - ));
+DATA(insert OID = 1389 ( age PGUID 14 f t f 1 f 1186 "1184" 100 0 0 100 "select datetime_age(\'today\', $1)" - ));
DESCR("difference between datetime and today but leave years and months unresolved");
-DATA(insert OID = 1390 ( isfinite PGUID 14 f t f 1 f 16 "1184" 100 0 0 100 "select datetime_finite($1)" - ));
+DATA(insert OID = 1390 ( isfinite PGUID 14 f t f 1 f 16 "1184" 100 0 0 100 "select datetime_finite($1)" - ));
DESCR("boolean test");
-DATA(insert OID = 1391 ( isfinite PGUID 14 f t f 1 f 16 "1186" 100 0 0 100 "select timespan_finite($1)" - ));
+DATA(insert OID = 1391 ( isfinite PGUID 14 f t f 1 f 16 "1186" 100 0 0 100 "select timespan_finite($1)" - ));
DESCR("boolean test");
-DATA(insert OID = 1392 ( isfinite PGUID 14 f t f 1 f 16 "702" 100 0 0 100 "select abstime_finite($1)" - ));
+DATA(insert OID = 1392 ( isfinite PGUID 14 f t f 1 f 16 "702" 100 0 0 100 "select abstime_finite($1)" - ));
DESCR("boolean test");
-DATA(insert OID = 1393 ( timespan PGUID 14 f t f 1 f 1186 "25" 100 0 0 100 "select text_timespan($1)" - ));
+DATA(insert OID = 1393 ( timespan PGUID 14 f t f 1 f 1186 "25" 100 0 0 100 "select text_timespan($1)" - ));
DESCR("convert");
/* reserve OIDs 1370-1399 for additional date/time conversion routines! tgl 97/04/01 */
@@ -1860,79 +1860,79 @@ DATA(insert OID = 1450 ( circle_in PGUID 11 f t f 1 f 718 "0" 100 0 1 0 foo
DESCR("(internal)");
DATA(insert OID = 1451 ( circle_out PGUID 11 f t f 1 f 23 "0" 100 0 1 0 foo bar ));
DESCR("(internal)");
-DATA(insert OID = 1452 ( circle_same PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1452 ( circle_same PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("same as");
-DATA(insert OID = 1453 ( circle_contain PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1453 ( circle_contain PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("contains");
-DATA(insert OID = 1454 ( circle_left PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1454 ( circle_left PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("is left of");
-DATA(insert OID = 1455 ( circle_overleft PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1455 ( circle_overleft PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("overlaps, but does not extend to right of");
-DATA(insert OID = 1456 ( circle_overright PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1456 ( circle_overright PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("");
-DATA(insert OID = 1457 ( circle_right PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1457 ( circle_right PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("is left of");
-DATA(insert OID = 1458 ( circle_contained PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1458 ( circle_contained PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("");
-DATA(insert OID = 1459 ( circle_overlap PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1459 ( circle_overlap PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("overlaps");
-DATA(insert OID = 1460 ( circle_below PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1460 ( circle_below PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("is below");
-DATA(insert OID = 1461 ( circle_above PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1461 ( circle_above PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("is above");
-DATA(insert OID = 1462 ( circle_eq PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1462 ( circle_eq PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("equals");
-DATA(insert OID = 1463 ( circle_ne PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1463 ( circle_ne PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("not equal");
-DATA(insert OID = 1464 ( circle_lt PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1464 ( circle_lt PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("less-than");
-DATA(insert OID = 1465 ( circle_gt PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1465 ( circle_gt PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 1466 ( circle_le PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1466 ( circle_le PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 1467 ( circle_ge PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1467 ( circle_ge PGUID 11 f t f 2 f 16 "718 718" 100 0 1 0 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 1468 ( circle_area PGUID 11 f t f 1 f 701 "718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1468 ( circle_area PGUID 11 f t f 1 f 701 "718" 100 0 1 0 foo bar ));
DESCR("area");
-DATA(insert OID = 1469 ( circle_diameter PGUID 11 f t f 1 f 701 "718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1469 ( circle_diameter PGUID 11 f t f 1 f 701 "718" 100 0 1 0 foo bar ));
DESCR("diameter");
-DATA(insert OID = 1470 ( circle_radius PGUID 11 f t f 1 f 701 "718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1470 ( circle_radius PGUID 11 f t f 1 f 701 "718" 100 0 1 0 foo bar ));
DESCR("radius");
-DATA(insert OID = 1471 ( circle_distance PGUID 11 f t f 2 f 701 "718 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1471 ( circle_distance PGUID 11 f t f 2 f 701 "718 718" 100 0 1 0 foo bar ));
DESCR("distance between");
-DATA(insert OID = 1472 ( circle_center PGUID 11 f t f 1 f 600 "718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1472 ( circle_center PGUID 11 f t f 1 f 600 "718" 100 0 1 0 foo bar ));
DESCR("center of");
-DATA(insert OID = 1473 ( circle PGUID 11 f t f 2 f 718 "600 701" 100 0 1 0 foo bar ));
+DATA(insert OID = 1473 ( circle PGUID 11 f t f 2 f 718 "600 701" 100 0 1 0 foo bar ));
DESCR("convert");
-DATA(insert OID = 1474 ( poly_circle PGUID 11 f t f 1 f 718 "604" 100 0 1 0 foo bar ));
+DATA(insert OID = 1474 ( poly_circle PGUID 11 f t f 1 f 718 "604" 100 0 1 0 foo bar ));
DESCR("convert");
DATA(insert OID = 1475 ( circle_poly PGUID 11 f t f 2 f 604 "23 718" 100 0 1 0 foo bar ));
DESCR("convert");
-DATA(insert OID = 1476 ( dist_pc PGUID 11 f t f 2 f 604 "600 718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1476 ( dist_pc PGUID 11 f t f 2 f 604 "600 718" 100 0 1 0 foo bar ));
DESCR("distance between");
-DATA(insert OID = 1477 ( circle_contain_pt PGUID 11 f t f 2 f 16 "718 600" 100 0 0 100 foo bar ));
+DATA(insert OID = 1477 ( circle_contain_pt PGUID 11 f t f 2 f 16 "718 600" 100 0 0 100 foo bar ));
DESCR("");
-DATA(insert OID = 1478 ( pt_contained_circle PGUID 11 f t f 2 f 16 "600 718" 100 0 0 100 foo bar ));
+DATA(insert OID = 1478 ( pt_contained_circle PGUID 11 f t f 2 f 16 "600 718" 100 0 0 100 foo bar ));
DESCR("");
-DATA(insert OID = 1479 ( box_circle PGUID 11 f t f 1 f 718 "603" 100 0 1 0 foo bar ));
+DATA(insert OID = 1479 ( box_circle PGUID 11 f t f 1 f 718 "603" 100 0 1 0 foo bar ));
DESCR("convert");
-DATA(insert OID = 1480 ( circle_box PGUID 11 f t f 1 f 603 "718" 100 0 1 0 foo bar ));
+DATA(insert OID = 1480 ( circle_box PGUID 11 f t f 1 f 603 "718" 100 0 1 0 foo bar ));
DESCR("convert");
DATA(insert OID = 1481 ( text_substr PGUID 11 f t f 3 f 25 "25 23 23" 100 0 0 100 foo bar ));
DESCR("return portion of string");
-DATA(insert OID = 1482 ( lseg_ne PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
+DATA(insert OID = 1482 ( lseg_ne PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
DESCR("not equal");
-DATA(insert OID = 1483 ( lseg_lt PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
+DATA(insert OID = 1483 ( lseg_lt PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
DESCR("less-than");
-DATA(insert OID = 1484 ( lseg_le PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
+DATA(insert OID = 1484 ( lseg_le PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
DESCR("less-than-or-equals");
-DATA(insert OID = 1485 ( lseg_gt PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
+DATA(insert OID = 1485 ( lseg_gt PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
DESCR("greater-than");
-DATA(insert OID = 1486 ( lseg_ge PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
+DATA(insert OID = 1486 ( lseg_ge PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar ));
DESCR("greater-than-or-equals");
-DATA(insert OID = 1487 ( lseg_length PGUID 11 f t f 1 f 701 "601" 100 0 1 0 foo bar ));
+DATA(insert OID = 1487 ( lseg_length PGUID 11 f t f 1 f 701 "601" 100 0 1 0 foo bar ));
DESCR("distance between endpoints");
DATA(insert OID = 1488 ( close_ls PGUID 11 f t f 2 f 600 "628 601" 100 0 10 100 foo bar ));
DESCR("closest point to line on line segment");
@@ -2075,7 +2075,8 @@ DESCR("sequence current value");
/*
* prototypes for functions pg_proc.c
*/
-extern Oid ProcedureCreate(char *procedureName,
+extern Oid
+ProcedureCreate(char *procedureName,
bool returnsSet,
char *returnTypeName,
char *languageName,
diff --git a/src/include/catalog/pg_shadow.h b/src/include/catalog/pg_shadow.h
index 67c0191a91c..fbe03775cd1 100644
--- a/src/include/catalog/pg_shadow.h
+++ b/src/include/catalog/pg_shadow.h
@@ -3,19 +3,19 @@
* pg_shadow.h--
* definition of the system "shadow" relation (pg_shadow)
* along with the relation's initial contents.
- * pg_user is now a public accessible view on pg_shadow.
+ * pg_user is now a public accessible view on pg_shadow.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_shadow.h,v 1.1 1998/02/25 13:09:26 scrappy Exp $
+ * $Id: pg_shadow.h,v 1.2 1998/02/26 04:41:00 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
* information from the DATA() statements.
*
- * WHENEVER the definition for pg_shadow changes, the
- * view creation of pg_user must be changed in initdb.sh!
+ * WHENEVER the definition for pg_shadow changes, the
+ * view creation of pg_user must be changed in initdb.sh!
*
*-------------------------------------------------------------------------
*/
diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h
index 49f8b100942..bc6b8c05519 100644
--- a/src/include/catalog/pg_type.h
+++ b/src/include/catalog/pg_type.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_type.h,v 1.34 1998/02/25 13:09:27 scrappy Exp $
+ * $Id: pg_type.h,v 1.35 1998/02/26 04:41:01 momjian Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -374,7 +374,8 @@ DESCR("limited-range ISO-format date and time");
*/
extern Oid TypeGet(char *typeName, bool *defined);
extern Oid TypeShellMake(char *typeName);
-extern Oid TypeCreate(char *typeName,
+extern Oid
+TypeCreate(char *typeName,
Oid relationOid,
int16 internalSize,
int16 externalSize,
diff --git a/src/include/commands/command.h b/src/include/commands/command.h
index fd191f68a3c..c10807668d9 100644
--- a/src/include/commands/command.h
+++ b/src/include/commands/command.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: command.h,v 1.8 1998/01/24 22:48:44 momjian Exp $
+ * $Id: command.h,v 1.9 1998/02/26 04:41:04 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,8 @@ extern MemoryContext PortalExecutorHeapMemory;
* BadArg if forward invalid.
* "WARN" if portal not found.
*/
-extern void PerformPortalFetch(char *name, bool forward, int count,
+extern void
+PerformPortalFetch(char *name, bool forward, int count,
char *tag, CommandDest dest);
/*
@@ -41,7 +42,8 @@ extern void PortalCleanup(Portal portal);
* PerformAddAttribute --
* Performs the POSTQUEL function ADD.
*/
-extern void PerformAddAttribute(char *relationName, char *userName,
+extern void
+PerformAddAttribute(char *relationName, char *userName,
bool inh, ColumnDef *colDef);
#endif /* COMMAND_H */
diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h
index adab627504b..9a78b32942e 100644
--- a/src/include/commands/defrem.h
+++ b/src/include/commands/defrem.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: defrem.h,v 1.11 1998/01/24 22:48:45 momjian Exp $
+ * $Id: defrem.h,v 1.12 1998/02/26 04:41:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,7 +19,8 @@
/*
* prototypes in defind.c
*/
-extern void DefineIndex(char *heapRelationName,
+extern void
+DefineIndex(char *heapRelationName,
char *indexRelationName,
char *accessMethodName,
List *attributeList,
@@ -27,7 +28,8 @@ extern void DefineIndex(char *heapRelationName,
bool unique,
Expr *predicate,
List *rangetable);
-extern void ExtendIndex(char *indexRelationName,
+extern void
+ExtendIndex(char *indexRelationName,
Expr *predicate,
List *rangetable);
extern void RemoveIndex(char *name);
@@ -45,7 +47,8 @@ extern void CreateFunction(ProcedureStmt *stmt, CommandDest dest);
* prototypes in remove.c
*/
extern void RemoveFunction(char *functionName, int nargs, List *argNameList);
-extern void RemoveOperator(char *operatorName,
+extern void
+RemoveOperator(char *operatorName,
char *typeName1, char *typeName2);
extern void RemoveType(char *typeName);
extern void RemoveAggregate(char *aggName, char *aggType);
diff --git a/src/include/commands/proclang.h b/src/include/commands/proclang.h
index af6182cccab..7b9fdf34da9 100644
--- a/src/include/commands/proclang.h
+++ b/src/include/commands/proclang.h
@@ -11,7 +11,7 @@
#include <nodes/parsenodes.h>
-extern void CreateProceduralLanguage(CreatePLangStmt * stmt);
-extern void DropProceduralLanguage(DropPLangStmt * stmt);
+extern void CreateProceduralLanguage(CreatePLangStmt *stmt);
+extern void DropProceduralLanguage(DropPLangStmt *stmt);
#endif /* PROCLANG_H */
diff --git a/src/include/commands/rename.h b/src/include/commands/rename.h
index b091cd5a403..49c42b6b33f 100644
--- a/src/include/commands/rename.h
+++ b/src/include/commands/rename.h
@@ -6,19 +6,21 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rename.h,v 1.3 1998/01/24 22:48:46 momjian Exp $
+ * $Id: rename.h,v 1.4 1998/02/26 04:41:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef RENAME_H
#define RENAME_H
-extern void renameatt(char *relname,
+extern void
+renameatt(char *relname,
char *oldattname,
char *newattname,
char *userName, int recurse);
-extern void renamerel(char *oldrelname,
+extern void
+renamerel(char *oldrelname,
char *newrelname);
#endif /* RENAME_H */
diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h
index 28ae082d687..1ed6b61d1dd 100644
--- a/src/include/commands/trigger.h
+++ b/src/include/commands/trigger.h
@@ -23,7 +23,7 @@ typedef struct TriggerData
HeapTuple tg_trigtuple;
HeapTuple tg_newtuple;
Trigger *tg_trigger;
-} TriggerData;
+} TriggerData;
extern TriggerData *CurrentTriggerData;
@@ -59,8 +59,8 @@ extern TriggerData *CurrentTriggerData;
(!TRIGGER_FIRED_BEFORE (event))
-extern void CreateTrigger(CreateTrigStmt * stmt);
-extern void DropTrigger(DropTrigStmt * stmt);
+extern void CreateTrigger(CreateTrigStmt *stmt);
+extern void DropTrigger(DropTrigStmt *stmt);
extern void RelationRemoveTriggers(Relation rel);
extern HeapTuple ExecBRInsertTriggers(Relation rel, HeapTuple tuple);
diff --git a/src/include/commands/user.h b/src/include/commands/user.h
index 1994b0bcd12..d75478403db 100644
--- a/src/include/commands/user.h
+++ b/src/include/commands/user.h
@@ -12,6 +12,6 @@
extern void DefineUser(CreateUserStmt *stmt);
extern void AlterUser(AlterUserStmt *stmt);
-extern void RemoveUser(char* user);
+extern void RemoveUser(char *user);
#endif /* USER_H */
diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h
index 250e8952dd0..05e737f7349 100644
--- a/src/include/commands/vacuum.h
+++ b/src/include/commands/vacuum.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: vacuum.h,v 1.12 1998/01/15 19:46:24 pgsql Exp $
+ * $Id: vacuum.h,v 1.13 1998/02/26 04:41:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,7 +19,7 @@
#include "nodes/pg_list.h"
#include "storage/block.h"
#include "storage/off.h"
-
+
typedef struct VAttListData
{
diff --git a/src/include/commands/variable.h b/src/include/commands/variable.h
index 772e9981d9c..920536e50f2 100644
--- a/src/include/commands/variable.h
+++ b/src/include/commands/variable.h
@@ -2,7 +2,7 @@
* Headers for handling of 'SET var TO', 'SHOW var' and 'RESET var'
* statements
*
- * $Id: variable.h,v 1.1 1998/01/05 18:53:08 momjian Exp $
+ * $Id: variable.h,v 1.2 1998/02/26 04:41:13 momjian Exp $
*
*/
#ifndef VARIABLE_H
@@ -55,4 +55,4 @@ extern bool show_geqo(void);
extern bool reset_geqo(void);
extern bool parse_geqo(const char *);
-#endif /* VARIABLE_H */
+#endif /* VARIABLE_H */
diff --git a/src/include/executor/execdesc.h b/src/include/executor/execdesc.h
index 503df7a5368..b7d71250ea0 100644
--- a/src/include/executor/execdesc.h
+++ b/src/include/executor/execdesc.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: execdesc.h,v 1.7 1998/01/24 22:48:50 momjian Exp $
+ * $Id: execdesc.h,v 1.8 1998/02/26 04:41:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,7 +33,8 @@ typedef struct QueryDesc
} QueryDesc;
/* in pquery.c */
-extern QueryDesc * CreateQueryDesc(Query *parsetree, Plan *plantree,
+extern QueryDesc *
+CreateQueryDesc(Query *parsetree, Plan *plantree,
CommandDest dest);
#endif /* EXECDESC_H */
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index 6769c5df76c..0ce8dc3fc9f 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: executor.h,v 1.20 1998/02/13 03:43:33 vadim Exp $
+ * $Id: executor.h,v 1.21 1998/02/26 04:41:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,12 +21,14 @@
/*
* prototypes from functions in execAmi.c
*/
-extern void ExecOpenScanR(Oid relOid, int nkeys, ScanKey skeys, bool isindex,
+extern void
+ExecOpenScanR(Oid relOid, int nkeys, ScanKey skeys, bool isindex,
ScanDirection dir, Relation *returnRelation,
Pointer *returnScanDesc);
extern void ExecCloseR(Plan *node);
extern void ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent);
-extern HeapScanDesc ExecReScanR(Relation relDesc, HeapScanDesc scanDesc,
+extern HeapScanDesc
+ExecReScanR(Relation relDesc, HeapScanDesc scanDesc,
ScanDirection direction, int nkeys, ScanKey skeys);
extern void ExecMarkPos(Plan *node);
extern void ExecRestrPos(Plan *node);
@@ -36,7 +38,8 @@ extern Relation ExecCreatR(TupleDesc tupType, Oid relationOid);
* prototypes from functions in execJunk.c
*/
extern JunkFilter *ExecInitJunkFilter(List *targetList);
-extern bool ExecGetJunkAttribute(JunkFilter *junkfilter, TupleTableSlot *slot,
+extern bool
+ExecGetJunkAttribute(JunkFilter *junkfilter, TupleTableSlot *slot,
char *attrName, Datum *value, bool *isNull);
extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot);
@@ -63,16 +66,20 @@ extern void ExecEndNode(Plan *node, Plan *parent);
extern bool execConstByVal;
extern int execConstLen;
-extern Datum ExecExtractResult(TupleTableSlot *slot, AttrNumber attnum,
+extern Datum
+ExecExtractResult(TupleTableSlot *slot, AttrNumber attnum,
bool *isNull);
-extern Datum ExecEvalParam(Param *expression, ExprContext *econtext,
+extern Datum
+ExecEvalParam(Param *expression, ExprContext *econtext,
bool *isNull);
/* stop here */
-extern char *GetAttributeByNum(TupleTableSlot *slot, AttrNumber attrno,
- bool *isNull);
+extern char *
+GetAttributeByNum(TupleTableSlot *slot, AttrNumber attrno,
+ bool *isNull);
extern char *GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull);
-extern Datum ExecEvalExpr(Node *expression, ExprContext *econtext, bool *isNull,
+extern Datum
+ExecEvalExpr(Node *expression, ExprContext *econtext, bool *isNull,
bool *isDone);
extern bool ExecQual(List *qual, ExprContext *econtext);
extern int ExecTargetListLength(List *targetlist);
@@ -89,53 +96,63 @@ extern TupleTableSlot *ExecScan(Scan *node, TupleTableSlot *(*accessMtd) ());
extern TupleTable ExecCreateTupleTable(int initialSize);
extern void ExecDestroyTupleTable(TupleTable table, bool shouldFree);
extern TupleTableSlot *ExecAllocTableSlot(TupleTable table);
-extern TupleTableSlot *ExecStoreTuple(HeapTuple tuple,
+extern TupleTableSlot *
+ExecStoreTuple(HeapTuple tuple,
TupleTableSlot *slot,
Buffer buffer,
bool shouldFree);
extern TupleTableSlot *ExecClearTuple(TupleTableSlot *slot);
extern bool ExecSetSlotPolicy(TupleTableSlot *slot, bool shouldFree);
-extern TupleDesc ExecSetSlotDescriptor(TupleTableSlot *slot,
+extern TupleDesc
+ExecSetSlotDescriptor(TupleTableSlot *slot,
TupleDesc tupdesc);
extern void ExecSetSlotDescriptorIsNew(TupleTableSlot *slot, bool isNew);
extern void ExecIncrSlotBufferRefcnt(TupleTableSlot *slot);
extern bool TupIsNull(TupleTableSlot *slot);
extern void ExecInitResultTupleSlot(EState *estate, CommonState *commonstate);
-extern void ExecInitScanTupleSlot(EState *estate,
+extern void
+ExecInitScanTupleSlot(EState *estate,
CommonScanState *commonscanstate);
extern void ExecInitMarkedTupleSlot(EState *estate, MergeJoinState *mergestate);
extern void ExecInitOuterTupleSlot(EState *estate, HashJoinState *hashstate);
extern TupleDesc ExecGetTupType(Plan *node);
extern TupleDesc ExecTypeFromTL(List *targetList);
-extern void SetChangedParamList (Plan *node, List *newchg);
+extern void SetChangedParamList(Plan *node, List *newchg);
/*
* prototypes from functions in execTuples.c
*/
extern void ResetTupleCount(void);
-extern void ExecAssignNodeBaseInfo(EState *estate, CommonState *basenode,
+extern void
+ExecAssignNodeBaseInfo(EState *estate, CommonState *basenode,
Plan *parent);
extern void ExecAssignExprContext(EState *estate, CommonState *commonstate);
-extern void ExecAssignResultType(CommonState *commonstate,
+extern void
+ExecAssignResultType(CommonState *commonstate,
TupleDesc tupDesc);
-extern void ExecAssignResultTypeFromOuterPlan(Plan *node,
+extern void
+ExecAssignResultTypeFromOuterPlan(Plan *node,
CommonState *commonstate);
extern void ExecAssignResultTypeFromTL(Plan *node, CommonState *commonstate);
extern TupleDesc ExecGetResultType(CommonState *commonstate);
extern void ExecAssignProjectionInfo(Plan *node, CommonState *commonstate);
extern void ExecFreeProjectionInfo(CommonState *commonstate);
extern TupleDesc ExecGetScanType(CommonScanState *csstate);
-extern void ExecAssignScanType(CommonScanState *csstate,
+extern void
+ExecAssignScanType(CommonScanState *csstate,
TupleDesc tupDesc);
-extern void ExecAssignScanTypeFromOuterPlan(Plan *node,
+extern void
+ExecAssignScanTypeFromOuterPlan(Plan *node,
CommonScanState *csstate);
extern AttributeTupleForm ExecGetTypeInfo(Relation relDesc);
-extern void ExecOpenIndices(Oid resultRelationOid,
+extern void
+ExecOpenIndices(Oid resultRelationOid,
RelationInfo *resultRelationInfo);
extern void ExecCloseIndices(RelationInfo *resultRelationInfo);
-extern void ExecInsertIndexTuples(TupleTableSlot *slot, ItemPointer tupleid,
+extern void
+ExecInsertIndexTuples(TupleTableSlot *slot, ItemPointer tupleid,
EState *estate, bool is_update);
#endif /* EXECUTOR_H */
diff --git a/src/include/executor/functions.h b/src/include/executor/functions.h
index d54afe99a31..209d4b34e9d 100644
--- a/src/include/executor/functions.h
+++ b/src/include/executor/functions.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: functions.h,v 1.6 1998/01/24 22:48:55 momjian Exp $
+ * $Id: functions.h,v 1.7 1998/02/26 04:41:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,10 +18,12 @@
#include "nodes/primnodes.h"
#include "utils/syscache.h"
-extern Datum ProjectAttribute(TupleDesc TD, TargetEntry *tlist,
+extern Datum
+ProjectAttribute(TupleDesc TD, TargetEntry *tlist,
HeapTuple tup, bool *isnullP);
-extern Datum postquel_function(Func *funcNode, char **args,
+extern Datum
+postquel_function(Func *funcNode, char **args,
bool *isNull, bool *isDone);
#endif /* FUNCTIONS_H */
diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h
index a814c61ed6f..720fcf80678 100644
--- a/src/include/executor/nodeHash.h
+++ b/src/include/executor/nodeHash.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodeHash.h,v 1.8 1998/02/13 03:43:35 vadim Exp $
+ * $Id: nodeHash.h,v 1.9 1998/02/26 04:41:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,18 +20,21 @@
#include "nodes/plannodes.h"
#include "storage/fd.h"
#include "utils/syscache.h"
-
+
extern TupleTableSlot *ExecHash(Hash *node);
extern bool ExecInitHash(Hash *node, EState *estate, Plan *parent);
extern int ExecCountSlotsHash(Hash *node);
extern void ExecEndHash(Hash *node);
extern HashJoinTable ExecHashTableCreate(Hash *node);
-extern void ExecHashTableInsert(HashJoinTable hashtable, ExprContext *econtext,
+extern void
+ExecHashTableInsert(HashJoinTable hashtable, ExprContext *econtext,
Var *hashkey, File *batches);
extern void ExecHashTableDestroy(HashJoinTable hashtable);
-extern int ExecHashGetBucket(HashJoinTable hashtable, ExprContext *econtext,
+extern int
+ExecHashGetBucket(HashJoinTable hashtable, ExprContext *econtext,
Var *hashkey);
-extern HeapTuple ExecScanHashBucket(HashJoinState *hjstate, HashBucket bucket,
+extern HeapTuple
+ExecScanHashBucket(HashJoinState *hjstate, HashBucket bucket,
HeapTuple curtuple, List *hjclauses,
ExprContext *econtext);
extern void ExecHashTableReset(HashJoinTable hashtable, int ntuples);
diff --git a/src/include/executor/nodeHashjoin.h b/src/include/executor/nodeHashjoin.h
index e88e1a67cf4..08827cec072 100644
--- a/src/include/executor/nodeHashjoin.h
+++ b/src/include/executor/nodeHashjoin.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodeHashjoin.h,v 1.8 1998/02/13 03:43:36 vadim Exp $
+ * $Id: nodeHashjoin.h,v 1.9 1998/02/26 04:41:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,7 +21,8 @@ extern TupleTableSlot *ExecHashJoin(HashJoin *node);
extern bool ExecInitHashJoin(HashJoin *node, EState *estate, Plan *parent);
extern int ExecCountSlotsHashJoin(HashJoin *node);
extern void ExecEndHashJoin(HashJoin *node);
-extern char * ExecHashJoinSaveTuple(HeapTuple heapTuple, char *buffer,
+extern char *
+ExecHashJoinSaveTuple(HeapTuple heapTuple, char *buffer,
File file, char *position);
extern void ExecReScanHashJoin(HashJoin *node, ExprContext *exprCtxt, Plan *parent);
diff --git a/src/include/executor/nodeMaterial.h b/src/include/executor/nodeMaterial.h
index 1c612ea4fa4..c52e06ec98f 100644
--- a/src/include/executor/nodeMaterial.h
+++ b/src/include/executor/nodeMaterial.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodeMaterial.h,v 1.6 1998/02/13 03:43:37 vadim Exp $
+ * $Id: nodeMaterial.h,v 1.7 1998/02/26 04:41:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,8 +22,10 @@ extern bool ExecInitMaterial(Material *node, EState *estate, Plan *parent);
extern int ExecCountSlotsMaterial(Material *node);
extern void ExecEndMaterial(Material *node);
extern void ExecMaterialReScan(Material *node, ExprContext *exprCtxt, Plan *parent);
+
#if 0
extern List ExecMaterialMarkPos(Material *node);
extern void ExecMaterialRestrPos(Material *node);
+
#endif
#endif /* NODEMATERIAL_H */
diff --git a/src/include/executor/nodeSubplan.h b/src/include/executor/nodeSubplan.h
index 6fa8945482e..dc25902a793 100644
--- a/src/include/executor/nodeSubplan.h
+++ b/src/include/executor/nodeSubplan.h
@@ -13,8 +13,8 @@
extern Datum ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext);
extern bool ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent);
-extern void ExecReScanSetParamPlan (SubPlan *node, Plan *parent);
-extern void ExecSetParamPlan (SubPlan *node);
+extern void ExecReScanSetParamPlan(SubPlan *node, Plan *parent);
+extern void ExecSetParamPlan(SubPlan *node);
extern void ExecEndSubPlan(SubPlan *node);
#endif /* NODESUBPLAN_H */
diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h
index ef8b268faab..d5479007087 100644
--- a/src/include/executor/spi.h
+++ b/src/include/executor/spi.h
@@ -41,7 +41,7 @@ typedef struct
uint32 free; /* # of free vals */
TupleDesc tupdesc; /* tuple descriptor */
HeapTuple *vals; /* tuples */
-} SPITupleTable;
+} SPITupleTable;
#define SPI_ERROR_CONNECT -1
#define SPI_ERROR_COPY -2
@@ -73,22 +73,23 @@ extern int SPI_result;
extern int SPI_connect(void);
extern int SPI_finish(void);
extern int SPI_exec(char *src, int tcount);
-extern int SPI_execp(void *plan, Datum * values, char *Nulls, int tcount);
-extern void *SPI_prepare(char *src, int nargs, Oid * argtypes);
+extern int SPI_execp(void *plan, Datum *values, char *Nulls, int tcount);
+extern void *SPI_prepare(char *src, int nargs, Oid *argtypes);
extern void *SPI_saveplan(void *plan);
extern HeapTuple SPI_copytuple(HeapTuple tuple);
-extern HeapTuple SPI_modifytuple(Relation rel, HeapTuple tuple, int natts,
- int *attnum, Datum * Values, char *Nulls);
+extern HeapTuple
+SPI_modifytuple(Relation rel, HeapTuple tuple, int natts,
+ int *attnum, Datum *Values, char *Nulls);
extern int SPI_fnumber(TupleDesc tupdesc, char *fname);
extern char *SPI_fname(TupleDesc tupdesc, int fnumber);
extern char *SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber);
-extern Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull);
+extern Datum SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull);
extern char *SPI_gettype(TupleDesc tupdesc, int fnumber);
extern Oid SPI_gettypeid(TupleDesc tupdesc, int fnumber);
extern char *SPI_getrelname(Relation rel);
-extern void *SPI_palloc (Size size);
-extern void *SPI_repalloc(void *pointer, Size size);
-extern void SPI_pfree(void *pointer);
+extern void *SPI_palloc(Size size);
+extern void *SPI_repalloc(void *pointer, Size size);
+extern void SPI_pfree(void *pointer);
#endif /* SPI_H */
diff --git a/src/include/lib/qsort.h b/src/include/lib/qsort.h
index 5ec39ee7a04..9bf57408d43 100644
--- a/src/include/lib/qsort.h
+++ b/src/include/lib/qsort.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: qsort.h,v 1.4 1998/01/24 22:49:12 momjian Exp $
+ * $Id: qsort.h,v 1.5 1998/02/26 04:41:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -14,7 +14,8 @@
#define QSORT_H
-extern void pg_qsort(void *bot,
+extern void
+pg_qsort(void *bot,
size_t nmemb,
size_t size,
int (*compar) (void *, void *));
diff --git a/src/include/libpq/auth.h b/src/include/libpq/auth.h
index bf85ee59961..0adc4d46582 100644
--- a/src/include/libpq/auth.h
+++ b/src/include/libpq/auth.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: auth.h,v 1.8 1998/01/26 01:42:05 scrappy Exp $
+ * $Id: auth.h,v 1.9 1998/02/26 04:41:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,8 +20,8 @@
*----------------------------------------------------------------
*/
-void be_recvauth(Port *port);
-void auth_failed(Port *port);
+void be_recvauth(Port *port);
+void auth_failed(Port *port);
#define PG_KRB4_VERSION "PGVER4.1" /* at most KRB_SENDAUTH_VLEN chars */
#define PG_KRB5_VERSION "PGVER5.1"
diff --git a/src/include/libpq/crypt.h b/src/include/libpq/crypt.h
index b1da83ac603..4c0117d616c 100644
--- a/src/include/libpq/crypt.h
+++ b/src/include/libpq/crypt.h
@@ -15,15 +15,17 @@
#define CRYPT_PWD_FILE_SEPCHAR "'\\t'"
#define CRYPT_PWD_FILE_SEPSTR "\t"
#define CRYPT_PWD_RELOAD_SUFX ".reload"
-
-extern char** pwd_cache;
-extern int pwd_cache_count;
-extern char* crypt_getpwdfilename(void);
-extern char* crypt_getpwdreloadfilename(void);
+extern char **pwd_cache;
+extern int pwd_cache_count;
+
+extern char *crypt_getpwdfilename(void);
+extern char *crypt_getpwdreloadfilename(void);
+
#if 0
-extern MsgType crypt_salt(const char* user);
+extern MsgType crypt_salt(const char *user);
+
#endif
-extern int crypt_verify(Port* port, const char* user, const char* pgpass);
+extern int crypt_verify(Port *port, const char *user, const char *pgpass);
#endif
diff --git a/src/include/libpq/hba.h b/src/include/libpq/hba.h
index fdadfc0d85c..8900c6f34f8 100644
--- a/src/include/libpq/hba.h
+++ b/src/include/libpq/hba.h
@@ -4,7 +4,7 @@
* Interface to hba.c
*
*
- * $Id: hba.h,v 1.7 1998/01/26 01:42:15 scrappy Exp $
+ * $Id: hba.h,v 1.8 1998/02/26 04:41:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,7 +31,7 @@
#define MAX_TOKEN 80
/* Maximum size of one token in the configuration file */
-#define MAX_AUTH_ARG 80 /* Max size of an authentication arg */
+#define MAX_AUTH_ARG 80 /* Max size of an authentication arg */
#define IDENT_PORT 113
/* Standard TCP port number for Ident service. Assigned by IANA */
@@ -39,7 +39,8 @@
#define IDENT_USERNAME_MAX 512
/* Max size of username ident server can return */
-typedef enum UserAuth {
+typedef enum UserAuth
+{
uaReject,
uaKrb4,
uaKrb5,
@@ -49,9 +50,11 @@ typedef enum UserAuth {
uaCrypt
} UserAuth;
-int hba_getauthmethod(SockAddr *raddr, char *database, char *auth_arg,
- UserAuth *auth_method);
-int authident(struct sockaddr_in *raddr, struct sockaddr_in *laddr,
- const char postgres_username[], const char auth_arg[]);
+int
+hba_getauthmethod(SockAddr *raddr, char *database, char *auth_arg,
+ UserAuth *auth_method);
+int
+authident(struct sockaddr_in * raddr, struct sockaddr_in * laddr,
+ const char postgres_username[], const char auth_arg[]);
#endif
diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h
index 4d0e186198c..7058eec2462 100644
--- a/src/include/libpq/libpq-be.h
+++ b/src/include/libpq/libpq-be.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: libpq-be.h,v 1.9 1998/01/26 01:42:17 scrappy Exp $
+ * $Id: libpq-be.h,v 1.10 1998/02/26 04:41:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,7 +23,8 @@
/* Protocol v0 password packet. */
-typedef struct PasswordPacketV0 {
+typedef struct PasswordPacketV0
+{
uint32 unused;
char data[288]; /* User and password as strings. */
} PasswordPacketV0;
@@ -33,68 +34,76 @@ typedef struct PasswordPacketV0 {
* Password packet. The length of the password can be changed without
* affecting anything.
*/
-
-typedef struct PasswordPacket {
- char passwd[100]; /* The password. */
+
+typedef struct PasswordPacket
+{
+ char passwd[100]; /* The password. */
} PasswordPacket;
/* Error message packet. */
-typedef struct ErrorMessagePacket {
- char data[1 + 100]; /* 'E' + the message. */
+typedef struct ErrorMessagePacket
+{
+ char data[1 + 100]; /* 'E' + the message. */
} ErrorMessagePacket;
/* Authentication request packet. */
-typedef struct AuthRequestPacket {
- char data[1 + sizeof (AuthRequest) + 2]; /* 'R' + the request + optional salt. */
+typedef struct AuthRequestPacket
+{
+ char data[1 + sizeof(AuthRequest) + 2]; /* 'R' + the request +
+ * optional salt. */
} AuthRequestPacket;
-
+
/* These are used by the packet handling routines. */
-typedef enum {
+typedef enum
+{
Idle,
ReadingPacketLength,
ReadingPacket,
WritingPacket
} PacketState;
-typedef struct Packet {
- PacketState state; /* What's in progress. */
+typedef struct Packet
+{
+ PacketState state; /* What's in progress. */
PacketLen len; /* Actual length */
- int nrtodo; /* Bytes still to transfer */
- char *ptr; /* Buffer pointer */
- void (*iodone)(); /* I/O complete callback */
- char *arg; /* Argument to callback */
+ int nrtodo; /* Bytes still to transfer */
+ char *ptr; /* Buffer pointer */
+ void (*iodone) (); /* I/O complete callback */
+ char *arg; /* Argument to callback */
/* A union of all the different packets. */
- union {
+ union
+ {
/* These are outgoing so have no packet length prepended. */
- ErrorMessagePacket em;
- AuthRequestPacket ar;
+ ErrorMessagePacket em;
+ AuthRequestPacket ar;
/* These are incoming and have a packet length prepended. */
- StartupPacket si;
- PasswordPacketV0 pwv0;
- PasswordPacket pw;
- } pkt;
+ StartupPacket si;
+ PasswordPacketV0 pwv0;
+ PasswordPacket pw;
+ } pkt;
} Packet;
/*
- * This is used by the postmaster in its communication with frontends. It is
+ * This is used by the postmaster in its communication with frontends. It is
* contains all state information needed during this communication before the
* backend is run.
*/
-
-typedef struct Port {
- int sock; /* File descriptor */
+
+typedef struct Port
+{
+ int sock; /* File descriptor */
Packet pktInfo; /* For the packet handlers */
SockAddr laddr; /* local addr (us) */
SockAddr raddr; /* remote addr (them) */
@@ -105,7 +114,7 @@ typedef struct Port {
* handshake.
*/
- ProtocolVersion proto;
+ ProtocolVersion proto;
char database[SM_DATABASE + 1];
char user[SM_USER + 1];
char options[SM_OPTIONS + 1];
@@ -115,18 +124,19 @@ typedef struct Port {
} Port;
-extern FILE *Pfout, *Pfin;
-extern int PQAsyncNotifyWaiting;
+extern FILE *Pfout,
+ *Pfin;
+extern int PQAsyncNotifyWaiting;
extern ProtocolVersion FrontendProtocol;
/*
* prototypes for functions in pqpacket.c
*/
-void PacketReceiveSetup(Packet *pkt, void (*iodone)(), char *arg);
-int PacketReceiveFragment(Packet *pkt, int sock);
-void PacketSendSetup(Packet *pkt, int nbytes, void (*iodone)(), char *arg);
-int PacketSendFragment(Packet *pkt, int sock);
-void PacketSendError(Packet *pkt, char *errormsg);
-
+void PacketReceiveSetup(Packet *pkt, void (*iodone) (), char *arg);
+int PacketReceiveFragment(Packet *pkt, int sock);
+void PacketSendSetup(Packet *pkt, int nbytes, void (*iodone) (), char *arg);
+int PacketSendFragment(Packet *pkt, int sock);
+void PacketSendError(Packet *pkt, char *errormsg);
+
#endif /* LIBPQ_BE_H */
diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h
index b4d7407f12d..57ec39576d0 100644
--- a/src/include/libpq/libpq.h
+++ b/src/include/libpq/libpq.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: libpq.h,v 1.11 1998/01/26 01:49:19 scrappy Exp $
+ * $Id: libpq.h,v 1.12 1998/02/26 04:41:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -180,9 +180,11 @@ extern int PQninstancesGroup(PortalBuffer *portal, int group_index);
extern int PQnfieldsGroup(PortalBuffer *portal, int group_index);
extern int PQfnumberGroup(PortalBuffer *portal, int group_index, char *field_name);
extern char *PQfnameGroup(PortalBuffer *portal, int group_index, int field_number);
-extern int PQftypeGroup(PortalBuffer *portal, int group_index,
+extern int
+PQftypeGroup(PortalBuffer *portal, int group_index,
int field_number);
-extern int PQfsizeGroup(PortalBuffer *portal, int group_index,
+extern int
+PQfsizeGroup(PortalBuffer *portal, int group_index,
int field_number);
extern GroupBuffer *PQgroup(PortalBuffer *portal, int tuple_index);
extern int PQgetgroup(PortalBuffer *portal, int tuple_index);
@@ -270,7 +272,8 @@ extern int pq_sendoob(char *msg, int len);
extern int pq_recvoob(char *msgPtr, int *lenPtr);
extern int pq_getinaddr(struct sockaddr_in * sin, char *host, int port);
extern int pq_getinserv(struct sockaddr_in * sin, char *host, char *serv);
-extern int pq_connect(char *dbname, char *user, char *args, char *hostName,
+extern int
+pq_connect(char *dbname, char *user, char *args, char *hostName,
char *debugTty, char *execFile, short portName);
extern int StreamOpen(char *hostName, short portName, Port *port);
extern void pq_regoob(void (*fptr) ());
diff --git a/src/include/libpq/password.h b/src/include/libpq/password.h
index f0c24794c3e..9c7421d8935 100644
--- a/src/include/libpq/password.h
+++ b/src/include/libpq/password.h
@@ -1,6 +1,6 @@
#ifndef PASSWORD_H
#define PASSWORD_H
-int verify_password(char *auth_arg, char *user, char *password);
+int verify_password(char *auth_arg, char *user, char *password);
#endif
diff --git a/src/include/libpq/pqcomm.h b/src/include/libpq/pqcomm.h
index 0145f262702..0b06de0df15 100644
--- a/src/include/libpq/pqcomm.h
+++ b/src/include/libpq/pqcomm.h
@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* pqcomm.h--
- * Definitions common to frontends and backends.
+ * Definitions common to frontends and backends.
*
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pqcomm.h,v 1.22 1998/01/28 02:29:40 momjian Exp $
+ * $Id: pqcomm.h,v 1.23 1998/02/26 04:41:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,16 +24,17 @@
/* Define a generic socket address type. */
-typedef union SockAddr {
- struct sockaddr sa;
- struct sockaddr_in in;
- struct sockaddr_un un;
+typedef union SockAddr
+{
+ struct sockaddr sa;
+ struct sockaddr_in in;
+ struct sockaddr_un un;
} SockAddr;
/* Configure the UNIX socket address for the well known port. */
-#define UNIXSOCK_PATH(sun,port) \
+#define UNIXSOCK_PATH(sun,port) \
(sprintf((sun).sun_path, "/tmp/.s.PGSQL.%d", (port)) + \
offsetof(struct sockaddr_un, sun_path))
/*
@@ -57,14 +58,14 @@ typedef union SockAddr {
* version.
*/
-#define PG_PROTOCOL_MAJOR(v) ((v) >> 16)
-#define PG_PROTOCOL_MINOR(v) ((v) & 0x0000ffff)
-#define PG_PROTOCOL(m,n) (((m) << 16) | (n))
+#define PG_PROTOCOL_MAJOR(v) ((v) >> 16)
+#define PG_PROTOCOL_MINOR(v) ((v) & 0x0000ffff)
+#define PG_PROTOCOL(m,n) (((m) << 16) | (n))
/* The earliest and latest frontend/backend protocol version supported. */
-#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(0,0)
-#define PG_PROTOCOL_LATEST PG_PROTOCOL(1,0)
+#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(0,0)
+#define PG_PROTOCOL_LATEST PG_PROTOCOL(1,0)
/*
* All packets sent to the postmaster start with the length. This is omitted
@@ -73,48 +74,49 @@ typedef union SockAddr {
typedef uint32 PacketLen;
-
+
/*
* Startup message parameters sizes. These must not be changed without changing
* the protcol version. These are all strings that are '\0' terminated only if
* there is room.
*/
-#define SM_DATABASE 64
-#define SM_USER 32
-#define SM_OPTIONS 64
-#define SM_UNUSED 64
-#define SM_TTY 64
+#define SM_DATABASE 64
+#define SM_USER 32
+#define SM_OPTIONS 64
+#define SM_UNUSED 64
+#define SM_TTY 64
-typedef uint32 ProtocolVersion; /* Fe/Be protocol version nr. */
+typedef uint32 ProtocolVersion; /* Fe/Be protocol version nr. */
-typedef struct StartupPacket {
- ProtocolVersion protoVersion; /* Protocol version */
+typedef struct StartupPacket
+{
+ ProtocolVersion protoVersion; /* Protocol version */
char database[SM_DATABASE]; /* Database name */
- char user[SM_USER]; /* User name */
+ char user[SM_USER]; /* User name */
char options[SM_OPTIONS]; /* Optional additional args */
- char unused[SM_UNUSED]; /* Unused */
- char tty[SM_TTY]; /* Tty for debug output */
+ char unused[SM_UNUSED]; /* Unused */
+ char tty[SM_TTY]; /* Tty for debug output */
} StartupPacket;
/* These are the authentication requests sent by the backend. */
-#define AUTH_REQ_OK 0 /* User is authenticated */
-#define AUTH_REQ_KRB4 1 /* Kerberos V4 */
-#define AUTH_REQ_KRB5 2 /* Kerberos V5 */
-#define AUTH_REQ_PASSWORD 3 /* Password */
-#define AUTH_REQ_CRYPT 4 /* Encrypted password */
+#define AUTH_REQ_OK 0 /* User is authenticated */
+#define AUTH_REQ_KRB4 1 /* Kerberos V4 */
+#define AUTH_REQ_KRB5 2 /* Kerberos V5 */
+#define AUTH_REQ_PASSWORD 3 /* Password */
+#define AUTH_REQ_CRYPT 4 /* Encrypted password */
typedef uint32 AuthRequest;
/* This next section is to maintain compatibility with protocol v0.0. */
-#define STARTUP_MSG 7 /* Initialise a connection */
-#define STARTUP_KRB4_MSG 10 /* krb4 session follows */
-#define STARTUP_KRB5_MSG 11 /* krb5 session follows */
-#define STARTUP_PASSWORD_MSG 14 /* Password follows */
+#define STARTUP_MSG 7 /* Initialise a connection */
+#define STARTUP_KRB4_MSG 10 /* krb4 session follows */
+#define STARTUP_KRB5_MSG 11 /* krb5 session follows */
+#define STARTUP_PASSWORD_MSG 14 /* Password follows */
typedef ProtocolVersion MsgType;
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index 774ff0f34d8..9b7749323ae 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -11,7 +11,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: miscadmin.h,v 1.19 1998/01/25 05:15:01 momjian Exp $
+ * $Id: miscadmin.h,v 1.20 1998/02/26 04:39:48 momjian Exp $
*
* NOTES
* some of the information in this file will be moved to
@@ -64,7 +64,7 @@ extern short DebugLvl;
* USE_POSTGRES_DATES specifies traditional postgres format for output.
* USE_ISO_DATES specifies ISO-compliant format for output.
* USE_SQL_DATES specified Oracle/Ingres-compliant format for output.
- * USE_GERMAN_DATES specifies German-style dd.mm/yyyy date format.
+ * USE_GERMAN_DATES specifies German-style dd.mm/yyyy date format.
*
* DateStyle specifies preference for date formatting for output.
* EuroDates if client prefers dates interpreted and written w/European conventions.
@@ -112,7 +112,7 @@ extern Oid LastOidProcessed; /* for query rewrite */
/* in utils/misc/database.c */
extern void GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path);
-extern int GetDatabaseInfo(char *name, Oid *owner, char *path);
+extern int GetDatabaseInfo(char *name, Oid *owner, char *path);
extern char *ExpandDatabasePath(char *path);
/* now in utils/init/miscinit.c */
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index f3e60bcc091..7decc99e298 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: execnodes.h,v 1.14 1998/02/18 12:41:36 vadim Exp $
+ * $Id: execnodes.h,v 1.15 1998/02/26 04:41:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -80,17 +80,17 @@ typedef struct RelationInfo
*/
typedef struct ExprContext
{
- NodeTag type;
- TupleTableSlot *ecxt_scantuple;
- TupleTableSlot *ecxt_innertuple;
- TupleTableSlot *ecxt_outertuple;
- Relation ecxt_relation;
- Index ecxt_relid;
- ParamListInfo ecxt_param_list_info;
- ParamExecData *ecxt_param_exec_vals; /* this is for subselects */
- List *ecxt_range_table;
- Datum *ecxt_values; /* precomputed values for aggreg */
- char *ecxt_nulls; /* null flags for aggreg values */
+ NodeTag type;
+ TupleTableSlot *ecxt_scantuple;
+ TupleTableSlot *ecxt_innertuple;
+ TupleTableSlot *ecxt_outertuple;
+ Relation ecxt_relation;
+ Index ecxt_relid;
+ ParamListInfo ecxt_param_list_info;
+ ParamExecData *ecxt_param_exec_vals; /* this is for subselects */
+ List *ecxt_range_table;
+ Datum *ecxt_values; /* precomputed values for aggreg */
+ char *ecxt_nulls; /* null flags for aggreg values */
} ExprContext;
/* ----------------
@@ -194,19 +194,19 @@ typedef struct JunkFilter
*/
typedef struct EState
{
- NodeTag type;
- ScanDirection es_direction;
- List *es_range_table;
- RelationInfo *es_result_relation_info;
- Relation es_into_relation_descriptor;
- ParamListInfo es_param_list_info;
- ParamExecData *es_param_exec_vals; /* this is for subselects */
- int es_BaseId;
- TupleTable es_tupleTable;
- JunkFilter *es_junkFilter;
- int *es_refcount;
- uint32 es_processed; /* # of tuples processed */
- Oid es_lastoid; /* last oid processed (by INSERT) */
+ NodeTag type;
+ ScanDirection es_direction;
+ List *es_range_table;
+ RelationInfo *es_result_relation_info;
+ Relation es_into_relation_descriptor;
+ ParamListInfo es_param_list_info;
+ ParamExecData *es_param_exec_vals; /* this is for subselects */
+ int es_BaseId;
+ TupleTable es_tupleTable;
+ JunkFilter *es_junkFilter;
+ int *es_refcount;
+ uint32 es_processed; /* # of tuples processed */
+ Oid es_lastoid; /* last oid processed (by INSERT) */
} EState;
/* ----------------
@@ -586,8 +586,8 @@ typedef struct AggState
*/
typedef struct GroupState
{
- CommonScanState csstate; /* its first field is NodeTag */
- bool grp_useFirstTuple; /* first tuple not processed yet */
+ CommonScanState csstate; /* its first field is NodeTag */
+ bool grp_useFirstTuple; /* first tuple not processed yet */
bool grp_done;
HeapTuple grp_firstTuple;
} GroupState;
diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h
index 569c70f15db..9ab40e1a2d7 100644
--- a/src/include/nodes/makefuncs.h
+++ b/src/include/nodes/makefuncs.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: makefuncs.h,v 1.10 1998/02/21 16:58:45 momjian Exp $
+ * $Id: makefuncs.h,v 1.11 1998/02/26 04:41:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -16,13 +16,15 @@
#include <nodes/primnodes.h>
#include <utils/fcache.h>
-extern Oper * makeOper(Oid opno,
+extern Oper *
+makeOper(Oid opno,
Oid opid,
Oid opresulttype,
int opsize,
FunctionCachePtr op_fcache);
-extern Var * makeVar(Index varno,
+extern Var *
+makeVar(Index varno,
AttrNumber varattno,
Oid vartype,
int16 vartypmod,
@@ -30,7 +32,8 @@ extern Var * makeVar(Index varno,
Index varnoold,
AttrNumber varoattno);
-extern Resdom * makeResdom(AttrNumber resno,
+extern Resdom *
+makeResdom(AttrNumber resno,
Oid restype,
int16 restypmod,
char *resname,
@@ -38,7 +41,8 @@ extern Resdom * makeResdom(AttrNumber resno,
Oid reskeyop,
int resjunk);
-extern Const * makeConst(Oid consttype,
+extern Const *
+makeConst(Oid consttype,
int constlen,
Datum constvalue,
bool constisnull,
diff --git a/src/include/nodes/params.h b/src/include/nodes/params.h
index 7a70a888b45..aaa56572081 100644
--- a/src/include/nodes/params.h
+++ b/src/include/nodes/params.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: params.h,v 1.7 1998/02/13 03:45:24 vadim Exp $
+ * $Id: params.h,v 1.8 1998/02/26 04:41:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@
#define PARAM_NUM 12
#define PARAM_NEW 13
#define PARAM_OLD 14
-#define PARAM_EXEC 15
+#define PARAM_EXEC 15
#define PARAM_INVALID 100
@@ -93,7 +93,8 @@ typedef ParamListInfoData *ParamListInfo;
typedef struct ParamExecData
{
- void *execPlan; /* plan must be executed to get param value */
+ void *execPlan; /* plan must be executed to get param
+ * value */
Datum value;
bool isnull;
} ParamExecData;
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index f91e1153732..15137731393 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parsenodes.h,v 1.48 1998/02/21 06:32:02 scrappy Exp $
+ * $Id: parsenodes.h,v 1.49 1998/02/26 04:41:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,7 +46,7 @@ typedef struct Query
bool unionall; /* union without unique sort */
bool hasAggs; /* has aggregates in target list */
bool hasSubLinks; /* has subquery SubLink */
-
+
char *uniqueFlag; /* NULL, '*', or Unique attribute name */
List *sortClause; /* a list of SortClause's */
@@ -58,7 +58,8 @@ typedef struct Query
* BY */
Node *havingQual; /* qualification of each group */
- List *unionClause; /* unions are linked under the previous query */
+ List *unionClause; /* unions are linked under the previous
+ * query */
/* internal to planner */
List *base_relation_list_; /* base relation list */
@@ -202,26 +203,26 @@ typedef struct DropPLangStmt
/* ----------------------
- * Create/Alter/Drop User Statements
+ * Create/Alter/Drop User Statements
* ----------------------
*/
typedef struct CreateUserStmt
{
- NodeTag type;
- char* user; /* PostgreSQL user login */
- char* password; /* PostgreSQL user password */
- bool* createdb; /* Can the user create databases? */
- bool* createuser; /* Can this user create users? */
- List* groupElts; /* The groups the user is a member of */
- char* validUntil; /* The time the login is valid until */
+ NodeTag type;
+ char *user; /* PostgreSQL user login */
+ char *password; /* PostgreSQL user password */
+ bool *createdb; /* Can the user create databases? */
+ bool *createuser; /* Can this user create users? */
+ List *groupElts; /* The groups the user is a member of */
+ char *validUntil; /* The time the login is valid until */
} CreateUserStmt;
-typedef CreateUserStmt AlterUserStmt;
+typedef CreateUserStmt AlterUserStmt;
typedef struct DropUserStmt
{
- NodeTag type;
- char* user; /* PostgreSQL user login */
+ NodeTag type;
+ char *user; /* PostgreSQL user login */
} DropUserStmt;
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 0091891aaea..fabed6cf906 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: plannodes.h,v 1.14 1998/02/13 03:45:25 vadim Exp $
+ * $Id: plannodes.h,v 1.15 1998/02/26 04:42:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -74,20 +74,22 @@ typedef struct Plan
List *qual; /* Node* or List* ?? */
struct Plan *lefttree;
struct Plan *righttree;
- List *extParam; /* indices of _all_ _external_ PARAM_EXEC for
- * this plan in global es_param_exec_vals.
- * Params from setParam from initPlan-s
- * are not included, but their execParam-s
- * are here!!! */
+ List *extParam; /* indices of _all_ _external_ PARAM_EXEC
+ * for this plan in global
+ * es_param_exec_vals. Params from
+ * setParam from initPlan-s are not
+ * included, but their execParam-s are
+ * here!!! */
List *locParam; /* someones from setParam-s */
List *chgParam; /* list of changed ones from the above */
- List *initPlan; /* Init Plan nodes (un-correlated expr subselects) */
+ List *initPlan; /* Init Plan nodes (un-correlated expr
+ * subselects) */
List *subPlan; /* Other SubPlan nodes */
-
- /*
+
+ /*
* We really need in some TopPlan node to store range table and
- * resultRelation from Query there and get rid of Query itself
- * from Executor. Some other stuff like below could be put there, too.
+ * resultRelation from Query there and get rid of Query itself from
+ * Executor. Some other stuff like below could be put there, too.
*/
int nParamExec; /* Number of them in entire query. This is
* to get Executor know about how many
@@ -232,7 +234,7 @@ typedef struct HashJoin
typedef struct Agg
{
Plan plan;
- List *aggs;
+ List *aggs;
AggState *aggstate;
} Agg;
@@ -359,18 +361,19 @@ typedef struct Tee
*/
typedef struct SubPlan
{
- NodeTag type;
- Plan *plan; /* subselect plan itself */
- int plan_id; /* dummy thing because of we haven't
- * equal funcs for plan nodes... actually,
- * we could put *plan itself somewhere else
+ NodeTag type;
+ Plan *plan; /* subselect plan itself */
+ int plan_id; /* dummy thing because of we haven't equal
+ * funcs for plan nodes... actually, we
+ * could put *plan itself somewhere else
* (TopPlan node ?)... */
- List *rtable; /* range table */
- List *setParam; /* non-correlated EXPR & EXISTS subqueries
+ List *rtable; /* range table */
+ List *setParam; /* non-correlated EXPR & EXISTS subqueries
* have to set some Params for paren Plan */
- List *parParam; /* indices of corr. Vars from parent plan */
- SubLink *sublink; /* SubLink node for subselects in WHERE and HAVING */
- bool shutdown; /* shutdown plan if TRUE */
+ List *parParam; /* indices of corr. Vars from parent plan */
+ SubLink *sublink; /* SubLink node for subselects in WHERE
+ * and HAVING */
+ bool shutdown; /* shutdown plan if TRUE */
} SubPlan;
#endif /* PLANNODES_H */
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index e49d7898716..e8c7a957477 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: primnodes.h,v 1.20 1998/02/21 16:58:49 momjian Exp $
+ * $Id: primnodes.h,v 1.21 1998/02/26 04:42:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -269,7 +269,7 @@ typedef struct Aggreg
char *aggname;
Oid basetype;
Oid aggtype;
- Node *target;
+ Node *target;
int aggno;
bool usenulls;
} Aggreg;
@@ -292,11 +292,11 @@ typedef enum SubLinkType
typedef struct SubLink
{
NodeTag type;
- SubLinkType subLinkType;
+ SubLinkType subLinkType;
bool useor;
- List *lefthand;
- List *oper;
- Node *subselect;
+ List *lefthand;
+ List *oper;
+ Node *subselect;
} SubLink;
/* ----------------
diff --git a/src/include/nodes/print.h b/src/include/nodes/print.h
index 66ee2f75610..308c2d9363f 100644
--- a/src/include/nodes/print.h
+++ b/src/include/nodes/print.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: print.h,v 1.6 1998/01/24 22:49:28 momjian Exp $
+ * $Id: print.h,v 1.7 1998/02/26 04:42:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,8 @@ extern void print_expr(Node *expr, List *rtable);
extern void print_keys(List *keys, List *rtable);
extern void print_tl(List *tlist, List *rtable);
extern void print_slot(TupleTableSlot *slot);
-extern void print_plan_recursive(Plan *p, Query *parsetree,
+extern void
+print_plan_recursive(Plan *p, Query *parsetree,
int indentLevel, char *label);
extern void print_plan(Plan *p, Query *parsetree);
diff --git a/src/include/optimizer/clauseinfo.h b/src/include/optimizer/clauseinfo.h
index c688d9020a9..db8fffe4d29 100644
--- a/src/include/optimizer/clauseinfo.h
+++ b/src/include/optimizer/clauseinfo.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: clauseinfo.h,v 1.6 1998/01/24 22:49:34 momjian Exp $
+ * $Id: clauseinfo.h,v 1.7 1998/02/26 04:42:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,9 +18,11 @@
extern bool valid_or_clause(CInfo *clauseinfo);
extern List *get_actual_clauses(List *clauseinfo_list);
-extern void get_relattvals(List *clauseinfo_list, List **attnos,
+extern void
+get_relattvals(List *clauseinfo_list, List **attnos,
List **values, List **flags);
-extern void get_joinvars(Oid relid, List *clauseinfo_list,
+extern void
+get_joinvars(Oid relid, List *clauseinfo_list,
List **attnos, List **values, List **flags);
extern List *get_opnos(List *clauseinfo_list);
diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h
index 60ca943fb51..5c92930f404 100644
--- a/src/include/optimizer/clauses.h
+++ b/src/include/optimizer/clauses.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: clauses.h,v 1.9 1998/02/13 03:46:54 vadim Exp $
+ * $Id: clauses.h,v 1.10 1998/02/26 04:42:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,13 +42,15 @@ extern bool join_clause_p(Node *clause);
extern bool qual_clause_p(Node *clause);
extern void fix_opid(Node *clause);
extern List *fix_opids(List *clauses);
-extern void get_relattval(Node *clause, int *relid,
+extern void
+get_relattval(Node *clause, int *relid,
AttrNumber *attno, Datum *constval, int *flag);
-extern void get_rels_atts(Node *clause, int *relid1,
+extern void
+get_rels_atts(Node *clause, int *relid1,
AttrNumber *attno1, int *relid2, AttrNumber *attno2);
extern void CommuteClause(Node *clause);
-#define is_subplan(clause) ((Node*) clause != NULL && \
+#define is_subplan(clause) ((Node*) clause != NULL && \
nodeTag((Node*) clause) == T_Expr && \
((Expr *) clause)->opType == SUBPLAN_EXPR)
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
index 149c75a29f5..05bc19fec85 100644
--- a/src/include/optimizer/cost.h
+++ b/src/include/optimizer/cost.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: cost.h,v 1.7 1998/01/24 22:49:41 momjian Exp $
+ * $Id: cost.h,v 1.8 1998/02/26 04:42:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,16 +31,20 @@ extern bool _enable_mergesort_;
extern bool _enable_hashjoin_;
extern Cost cost_seqscan(int relid, int relpages, int reltuples);
-extern Cost cost_index(Oid indexid, int expected_indexpages, Cost selec,
+extern Cost
+cost_index(Oid indexid, int expected_indexpages, Cost selec,
int relpages, int reltuples, int indexpages,
int indextuples, bool is_injoin);
extern Cost cost_sort(List *keys, int tuples, int width, bool noread);
-extern Cost cost_nestloop(Cost outercost, Cost innercost, int outertuples,
+extern Cost
+cost_nestloop(Cost outercost, Cost innercost, int outertuples,
int innertuples, int outerpages, bool is_indexjoin);
-extern Cost cost_mergesort(Cost outercost, Cost innercost,
+extern Cost
+cost_mergesort(Cost outercost, Cost innercost,
List *outersortkeys, List *innersortkeys,
int outersize, int innersize, int outerwidth, int innerwidth);
-extern Cost cost_hashjoin(Cost outercost, Cost innercost, List *outerkeys,
+extern Cost
+cost_hashjoin(Cost outercost, Cost innercost, List *outerkeys,
List *innerkeys, int outersize, int innersize,
int outerwidth, int innerwidth);
extern int compute_rel_size(Rel *rel);
@@ -56,7 +60,8 @@ extern void set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity
extern Cost product_selec(List *clauseinfo_list);
extern void set_rest_relselec(Query *root, List *rel_list);
extern void set_rest_selec(Query *root, List *clauseinfo_list);
-extern Cost compute_clause_selec(Query *root,
+extern Cost
+compute_clause_selec(Query *root,
Node *clause, List *or_selectivities);
#endif /* COST_H */
diff --git a/src/include/optimizer/ordering.h b/src/include/optimizer/ordering.h
index 5209f029f74..f06487b4470 100644
--- a/src/include/optimizer/ordering.h
+++ b/src/include/optimizer/ordering.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: ordering.h,v 1.7 1998/01/24 22:49:43 momjian Exp $
+ * $Id: ordering.h,v 1.8 1998/02/26 04:42:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,11 +15,14 @@
#include <nodes/relation.h>
-extern bool equal_path_path_ordering(PathOrder *path_ordering1,
+extern bool
+equal_path_path_ordering(PathOrder *path_ordering1,
PathOrder *path_ordering2);
-extern bool equal_path_merge_ordering(Oid *path_ordering,
+extern bool
+equal_path_merge_ordering(Oid *path_ordering,
MergeOrder *merge_ordering);
-extern bool equal_merge_merge_ordering(MergeOrder *merge_ordering1,
+extern bool
+equal_merge_merge_ordering(MergeOrder *merge_ordering1,
MergeOrder *merge_ordering2);
#endif /* ORDERING_H */
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
index d73ebaf76c3..b71512cad7f 100644
--- a/src/include/optimizer/pathnode.h
+++ b/src/include/optimizer/pathnode.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pathnode.h,v 1.6 1998/01/24 22:49:46 momjian Exp $
+ * $Id: pathnode.h,v 1.7 1998/02/26 04:42:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,19 +22,24 @@
*/
extern bool path_is_cheaper(Path *path1, Path *path2);
extern Path *set_cheapest(Rel *parent_rel, List *pathlist);
-extern List * add_pathlist(Rel *parent_rel, List *unique_paths,
+extern List *
+add_pathlist(Rel *parent_rel, List *unique_paths,
List *new_paths);
extern Path *create_seqscan_path(Rel *rel);
-extern IndexPath * create_index_path(Query *root, Rel *rel, Rel *index,
+extern IndexPath *
+create_index_path(Query *root, Rel *rel, Rel *index,
List *restriction_clauses, bool is_join_scan);
-extern JoinPath * create_nestloop_path(Rel *joinrel, Rel *outer_rel,
+extern JoinPath *
+create_nestloop_path(Rel *joinrel, Rel *outer_rel,
Path *outer_path, Path *inner_path, List *keys);
-extern MergePath * create_mergesort_path(Rel *joinrel, int outersize,
+extern MergePath *
+create_mergesort_path(Rel *joinrel, int outersize,
int innersize, int outerwidth, int innerwidth, Path *outer_path,
Path *inner_path, List *keys, MergeOrder *order,
List *mergeclauses, List *outersortkeys, List *innersortkeys);
-extern HashPath * create_hashjoin_path(Rel *joinrel, int outersize,
+extern HashPath *
+create_hashjoin_path(Rel *joinrel, int outersize,
int innersize, int outerwidth, int innerwidth, Path *outer_path,
Path *inner_path, List *keys, Oid operator, List *hashclauses,
List *outerkeys, List *innerkeys);
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h
index 0e2d532bf29..741204dfe87 100644
--- a/src/include/optimizer/paths.h
+++ b/src/include/optimizer/paths.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: paths.h,v 1.7 1998/01/24 22:49:48 momjian Exp $
+ * $Id: paths.h,v 1.8 1998/02/26 04:42:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,7 +27,8 @@ extern List *find_paths(Query *root, List *rels);
* indxpath.h
* routines to generate index paths
*/
-extern List * find_index_paths(Query *root, Rel *rel, List *indices,
+extern List *
+find_index_paths(Query *root, Rel *rel, List *indices,
List *clauseinfo_list,
List *joininfo_list);
@@ -47,30 +48,37 @@ extern List *create_or_index_paths(Query *root, Rel *rel, List *clauses);
* hashutils.h
* routines to deal with hash keys and clauses
*/
-extern List * group_clauses_by_hashop(List *clauseinfo_list,
+extern List *
+group_clauses_by_hashop(List *clauseinfo_list,
int inner_relid);
/*
* joinutils.h
* generic join method key/clause routines
*/
-extern List * match_pathkeys_joinkeys(List *pathkeys,
+extern List *
+match_pathkeys_joinkeys(List *pathkeys,
List *joinkeys, List *joinclauses, int which_subkey,
List **matchedJoinClausesPtr);
-extern List * extract_path_keys(List *joinkeys, List *tlist,
+extern List *
+extract_path_keys(List *joinkeys, List *tlist,
int which_subkey);
-extern Path * match_paths_joinkeys(List *joinkeys, PathOrder *ordering,
+extern Path *
+match_paths_joinkeys(List *joinkeys, PathOrder *ordering,
List *paths, int which_subkey);
-extern List * new_join_pathkeys(List *outer_pathkeys,
+extern List *
+new_join_pathkeys(List *outer_pathkeys,
List *join_rel_tlist, List *joinclauses);
/*
* mergeutils.h
* routines to deal with merge keys and clauses
*/
-extern List * group_clauses_by_order(List *clauseinfo_list,
+extern List *
+group_clauses_by_order(List *clauseinfo_list,
int inner_relid);
-extern MInfo * match_order_mergeinfo(PathOrder *ordering,
+extern MInfo *
+match_order_mergeinfo(PathOrder *ordering,
List *mergeinfo_list);
/*
diff --git a/src/include/optimizer/plancat.h b/src/include/optimizer/plancat.h
index a52effd632e..5eab2c653da 100644
--- a/src/include/optimizer/plancat.h
+++ b/src/include/optimizer/plancat.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: plancat.h,v 1.7 1998/01/24 22:49:50 momjian Exp $
+ * $Id: plancat.h,v 1.8 1998/02/26 04:42:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,26 +34,31 @@ typedef struct IdxInfoRetval
} IdxInfoRetval;
-extern void relation_info(Query *root,
+extern void
+relation_info(Query *root,
Oid relid,
bool *hashindex, int *pages,
int *tuples);
-extern bool index_info(Query *root,
+extern bool
+index_info(Query *root,
bool first, int relid, IdxInfoRetval *info);
-extern Cost restriction_selectivity(Oid functionObjectId,
+extern Cost
+restriction_selectivity(Oid functionObjectId,
Oid operatorObjectId,
Oid relationObjectId,
AttrNumber attributeNumber,
char *constValue,
int32 constFlag);
-extern void index_selectivity(Oid indid, Oid *classes, List *opnos,
+extern void
+index_selectivity(Oid indid, Oid *classes, List *opnos,
Oid relid, List *attnos, List *values, List *flags,
int32 nkeys, float *idxPages, float *idxSelec);
-extern Cost join_selectivity(Oid functionObjectId, Oid operatorObjectId,
+extern Cost
+join_selectivity(Oid functionObjectId, Oid operatorObjectId,
Oid relationObjectId1, AttrNumber attributeNumber1,
Oid relationObjectId2, AttrNumber attributeNumber2);
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
index 041a48b612a..0e7708c60e1 100644
--- a/src/include/optimizer/planmain.h
+++ b/src/include/optimizer/planmain.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: planmain.h,v 1.10 1998/01/15 19:00:15 momjian Exp $
+ * $Id: planmain.h,v 1.11 1998/02/26 04:42:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,7 +21,8 @@
/*
* prototypes for plan/planmain.c
*/
-extern Plan *query_planner(Query *root,
+extern Plan *
+query_planner(Query *root,
int command_type, List *tlist, List *qual);
@@ -29,12 +30,15 @@ extern Plan *query_planner(Query *root,
* prototypes for plan/createplan.c
*/
extern Plan *create_plan(Path *best_path);
-extern SeqScan *make_seqscan(List *qptlist, List *qpqual, Index scanrelid,
+extern SeqScan *
+make_seqscan(List *qptlist, List *qpqual, Index scanrelid,
Plan *lefttree);
-extern Sort *make_sort(List *tlist, Oid tempid, Plan *lefttree,
+extern Sort *
+make_sort(List *tlist, Oid tempid, Plan *lefttree,
int keycount);
extern Agg *make_agg(List *tlist, Plan *lefttree);
-extern Group *make_group(List *tlist, bool tuplePerGroup, int ngrp,
+extern Group *
+make_group(List *tlist, bool tuplePerGroup, int ngrp,
AttrNumber *grpColIdx, Sort *lefttree);
extern Unique *make_unique(List *tlist, Plan *lefttree, char *uniqueAttr);
@@ -50,9 +54,11 @@ extern void add_missing_vars_to_base_rels(Query *root, List *tlist);
* prototypes for plan/setrefs.c
*/
extern void set_tlist_references(Plan *plan);
-extern List *join_references(List *clauses, List *outer_tlist,
+extern List *
+join_references(List *clauses, List *outer_tlist,
List *inner_tlist);
-extern List *index_outerjoin_references(List *inner_indxqual,
+extern List *
+index_outerjoin_references(List *inner_indxqual,
List *outer_tlist, Index inner_relid);
extern void set_result_tlist_references(Result *resultNode);
extern List *set_agg_tlist_references(Agg *aggNode);
diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h
index 91e6d189931..7776e5be1e4 100644
--- a/src/include/optimizer/prep.h
+++ b/src/include/optimizer/prep.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: prep.h,v 1.11 1997/12/29 01:13:23 momjian Exp $
+ * $Id: prep.h,v 1.12 1998/02/26 04:42:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,10 +24,12 @@ extern List *cnfify(Expr *qual, bool removeAndFlag);
/*
* prototypes for preptlist.h
*/
-extern List *preprocess_targetlist(List *tlist, int command_type,
+extern List *
+preprocess_targetlist(List *tlist, int command_type,
Index result_relation, List *range_table);
-extern List *find_all_inheritors(List *unexamined_relids,
+extern List *
+find_all_inheritors(List *unexamined_relids,
List *examined_relids);
extern int first_inherit_rt_entry(List *rangetable);
extern Append *plan_union_queries(Query *parse);
diff --git a/src/include/optimizer/subselect.h b/src/include/optimizer/subselect.h
index 64f9851909e..833750c960f 100644
--- a/src/include/optimizer/subselect.h
+++ b/src/include/optimizer/subselect.h
@@ -7,14 +7,14 @@
#ifndef SUBSELECT_H
#define SUBSELECT_H
-extern int PlannerQueryLevel; /* level of current query */
-extern List *PlannerVarParam; /* correlation Vars to Param mapper */
-extern List *PlannerParamVar; /* to get Var from Param->paramid */
-extern List *PlannerInitPlan; /* init subplans for current query */
-extern int PlannerPlanId; /* to assigne unique ID to subquery plans */
+extern int PlannerQueryLevel; /* level of current query */
+extern List *PlannerVarParam; /* correlation Vars to Param mapper */
+extern List *PlannerParamVar; /* to get Var from Param->paramid */
+extern List *PlannerInitPlan; /* init subplans for current query */
+extern int PlannerPlanId; /* to assigne unique ID to subquery plans */
-extern List *SS_finalize_plan (Plan *plan);
-extern Node *SS_replace_correlation_vars (Node *expr);
-extern Node *SS_process_sublinks (Node *expr);
+extern List *SS_finalize_plan(Plan *plan);
+extern Node *SS_replace_correlation_vars(Node *expr);
+extern Node *SS_process_sublinks(Node *expr);
#endif /* SUBSELECT_H */
diff --git a/src/include/optimizer/tlist.h b/src/include/optimizer/tlist.h
index d29535908c7..76dd57439e1 100644
--- a/src/include/optimizer/tlist.h
+++ b/src/include/optimizer/tlist.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tlist.h,v 1.7 1998/01/24 22:49:51 momjian Exp $
+ * $Id: tlist.h,v 1.8 1998/02/26 04:42:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,7 +33,8 @@ extern TargetEntry *match_varid(Var *test_var, List *tlist);
extern List *new_unsorted_tlist(List *targetlist);
extern List *copy_vars(List *target, List *source);
extern List *flatten_tlist(List *tlist);
-extern List * flatten_tlist_vars(List *full_tlist,
+extern List *
+flatten_tlist_vars(List *full_tlist,
List *flat_tlist);
#endif /* TLIST_H */
diff --git a/src/include/optimizer/xfunc.h b/src/include/optimizer/xfunc.h
index 0d13e7b00ea..c3888cdc3bc 100644
--- a/src/include/optimizer/xfunc.h
+++ b/src/include/optimizer/xfunc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: xfunc.h,v 1.6 1998/01/24 22:49:52 momjian Exp $
+ * $Id: xfunc.h,v 1.7 1998/02/26 04:42:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,9 +50,11 @@ extern int XfuncMode; /* defined in tcop/postgres.c */
/* function prototypes from planner/path/xfunc.c */
extern void xfunc_trypullup(Rel *rel);
-extern int xfunc_shouldpull(Path *childpath, JoinPath *parentpath,
+extern int
+xfunc_shouldpull(Path *childpath, JoinPath *parentpath,
int whichchild, CInfo *maxcinfopt);
-extern CInfo * xfunc_pullup(Path *childpath, JoinPath *parentpath, CInfo *cinfo,
+extern CInfo *
+xfunc_pullup(Path *childpath, JoinPath *parentpath, CInfo *cinfo,
int whichchild, int clausetype);
extern Cost xfunc_rank(Expr *clause);
extern Cost xfunc_expense(Query *queryInfo, Expr *clause);
diff --git a/src/include/parser/gramparse.h b/src/include/parser/gramparse.h
index db400cb416a..bb650d3f27c 100644
--- a/src/include/parser/gramparse.h
+++ b/src/include/parser/gramparse.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: gramparse.h,v 1.6 1997/11/26 03:43:05 momjian Exp $
+ * $Id: gramparse.h,v 1.7 1998/02/26 04:42:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,7 +18,7 @@
extern void init_io(void);
/* from gram.y */
-extern Oid param_type(int t);
+extern Oid param_type(int t);
extern void parser_init(Oid *typev, int nargs);
extern int yyparse(void);
diff --git a/src/include/parser/parse_agg.h b/src/include/parser/parse_agg.h
index 1381f14f8c4..5f6987253b8 100644
--- a/src/include/parser/parse_agg.h
+++ b/src/include/parser/parse_agg.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_agg.h,v 1.5 1998/01/20 05:04:41 momjian Exp $
+ * $Id: parse_agg.h,v 1.6 1998/02/26 04:42:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,9 +20,9 @@
extern void AddAggToParseState(ParseState *pstate, Aggreg *aggreg);
extern void parseCheckAggregates(ParseState *pstate, Query *qry);
-extern Aggreg *ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
- List *target, int precedence);
+extern Aggreg *
+ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
+ List *target, int precedence);
extern void agg_error(char *caller, char *aggname, Oid basetypeID);
#endif /* PARSE_AGG_H */
-
diff --git a/src/include/parser/parse_clause.h b/src/include/parser/parse_clause.h
index 4c04a41cb3b..0a232fecd06 100644
--- a/src/include/parser/parse_clause.h
+++ b/src/include/parser/parse_clause.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_clause.h,v 1.5 1997/12/29 04:31:50 momjian Exp $
+ * $Id: parse_clause.h,v 1.6 1998/02/26 04:42:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,12 +21,13 @@
extern void makeRangeTable(ParseState *pstate, char *relname, List *frmList);
extern Node *transformWhereClause(ParseState *pstate, Node *a_expr);
-extern List *transformGroupClause(ParseState *pstate, List *grouplist,
- List *targetlist);
-extern List *transformSortClause(ParseState *pstate,
+extern List *
+transformGroupClause(ParseState *pstate, List *grouplist,
+ List *targetlist);
+extern List *
+transformSortClause(ParseState *pstate,
List *orderlist, List *sortClause,
List *targetlist, char *uniqueFlag);
extern List *transformUnionClause(List *unionClause, List *targetlist);
#endif /* PARSE_CLAUSE_H */
-
diff --git a/src/include/parser/parse_expr.h b/src/include/parser/parse_expr.h
index e533741ec25..1a990e4518f 100644
--- a/src/include/parser/parse_expr.h
+++ b/src/include/parser/parse_expr.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_expr.h,v 1.7 1998/02/10 16:04:30 momjian Exp $
+ * $Id: parse_expr.h,v 1.8 1998/02/26 04:42:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,8 +20,7 @@
extern Node *transformExpr(ParseState *pstate, Node *expr, int precedence);
extern Node *transformIdent(ParseState *pstate, Node *expr, int precedence);
-extern Oid exprType(Node *expr);
+extern Oid exprType(Node *expr);
extern Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int16 attypmod);
#endif /* PARSE_EXPR_H */
-
diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h
index 4b03e0ced58..8b59613363c 100644
--- a/src/include/parser/parse_func.h
+++ b/src/include/parser/parse_func.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_func.h,v 1.7 1998/02/05 04:08:44 scrappy Exp $
+ * $Id: parse_func.h,v 1.8 1998/02/26 04:42:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,12 +42,13 @@ typedef struct _CandidateList
struct _CandidateList *next;
} *CandidateList;
-extern Node *ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr,
- int *curr_resno, int precedence);
-extern Node *ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
- int *curr_resno, int precedence);
+extern Node *
+ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr,
+ int *curr_resno, int precedence);
+extern Node *
+ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
+ int *curr_resno, int precedence);
extern void func_error(char *caller, char *funcname, int nargs, Oid *argtypes);
#endif /* PARSE_FUNC_H */
-
diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h
index 5300db1e86b..e77b3789b0e 100644
--- a/src/include/parser/parse_node.h
+++ b/src/include/parser/parse_node.h
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_node.h,v 1.9 1998/02/10 04:02:47 momjian Exp $
+ * $Id: parse_node.h,v 1.10 1998/02/26 04:42:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,14 +44,17 @@ typedef struct ParseState
extern ParseState *make_parsestate(ParseState *parentParseState);
extern Expr *make_op(char *opname, Node *ltree, Node *rtree);
-extern Var *make_var(ParseState *pstate, Oid relid, char *refname,
- char *attrname);
-extern ArrayRef *make_array_ref(Node *expr,
+extern Var *
+make_var(ParseState *pstate, Oid relid, char *refname,
+ char *attrname);
+extern ArrayRef *
+make_array_ref(Node *expr,
List *indirection);
-extern ArrayRef *make_array_set(Expr *target_expr,
- List *upperIndexpr,
- List *lowerIndexpr,
- Expr *expr);
+extern ArrayRef *
+make_array_set(Expr *target_expr,
+ List *upperIndexpr,
+ List *lowerIndexpr,
+ Expr *expr);
extern Const *make_const(Value *value);
-
+
#endif /* PARSE_NODE_H */
diff --git a/src/include/parser/parse_oper.h b/src/include/parser/parse_oper.h
index 972f0991df7..01f21adc1ef 100644
--- a/src/include/parser/parse_oper.h
+++ b/src/include/parser/parse_oper.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_oper.h,v 1.3 1997/11/26 03:43:14 momjian Exp $
+ * $Id: parse_oper.h,v 1.4 1998/02/26 04:42:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,8 +18,8 @@
typedef HeapTuple Operator;
-extern Oid any_ordering_op(int restype);
-extern Oid oprid(Operator op);
+extern Oid any_ordering_op(int restype);
+extern Oid oprid(Operator op);
extern Operator oper(char *op, Oid arg1, Oid arg2, bool noWarnings);
extern Operator right_oper(char *op, Oid arg);
extern Operator left_oper(char *op, Oid arg);
diff --git a/src/include/parser/parse_relation.h b/src/include/parser/parse_relation.h
index 506fdad46b7..5fc882e75d7 100644
--- a/src/include/parser/parse_relation.h
+++ b/src/include/parser/parse_relation.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_relation.h,v 1.6 1998/01/20 22:12:17 momjian Exp $
+ * $Id: parse_relation.h,v 1.7 1998/02/26 04:42:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,21 +21,25 @@
#include <utils/rel.h>
extern RangeTblEntry *refnameRangeTableEntry(ParseState *pstate, char *refname);
-extern int refnameRangeTablePosn(ParseState *pstate,
- char *refname, int *sublevels_up);
+extern int
+refnameRangeTablePosn(ParseState *pstate,
+ char *refname, int *sublevels_up);
extern RangeTblEntry *colnameRangeTableEntry(ParseState *pstate, char *colname);
-extern RangeTblEntry *addRangeTableEntry(ParseState *pstate,
- char *relname,
- char *refname,
- bool inh,
- bool inFromCl);
-extern List *expandAll(ParseState *pstate, char *relname, char *refname,
- int *this_resno);
-extern int attnameAttNum(Relation rd, char *a);
+extern RangeTblEntry *
+addRangeTableEntry(ParseState *pstate,
+ char *relname,
+ char *refname,
+ bool inh,
+ bool inFromCl);
+extern List *
+expandAll(ParseState *pstate, char *relname, char *refname,
+ int *this_resno);
+extern int attnameAttNum(Relation rd, char *a);
extern bool attnameIsSet(Relation rd, char *name);
-extern int attnumAttNelems(Relation rd, int attid);
-extern Oid attnumTypeId(Relation rd, int attid);
-extern void handleTargetColname(ParseState *pstate, char **resname,
+extern int attnumAttNelems(Relation rd, int attid);
+extern Oid attnumTypeId(Relation rd, int attid);
+extern void
+handleTargetColname(ParseState *pstate, char **resname,
char *refname, char *colname);
#endif /* PARSE_RANGE_H */
diff --git a/src/include/parser/parse_target.h b/src/include/parser/parse_target.h
index 31b2c1594d7..98dd31f68c3 100644
--- a/src/include/parser/parse_target.h
+++ b/src/include/parser/parse_target.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_target.h,v 1.3 1997/11/26 03:43:18 momjian Exp $
+ * $Id: parse_target.h,v 1.4 1998/02/26 04:42:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,10 +20,9 @@
#include <parser/parse_node.h>
#define EXPR_COLUMN_FIRST 1
-#define EXPR_RELATION_FIRST 2
+#define EXPR_RELATION_FIRST 2
extern List *transformTargetList(ParseState *pstate, List *targetlist);
extern List *makeTargetNames(ParseState *pstate, List *cols);
#endif /* PARSE_TARGET_H */
-
diff --git a/src/include/parser/parse_type.h b/src/include/parser/parse_type.h
index da92efe984c..12b489839ad 100644
--- a/src/include/parser/parse_type.h
+++ b/src/include/parser/parse_type.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_type.h,v 1.5 1998/02/13 19:46:18 momjian Exp $
+ * $Id: parse_type.h,v 1.6 1998/02/26 04:42:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,17 +21,17 @@ extern bool typeidIsValid(Oid id);
extern Type typeidType(Oid id);
extern Type typenameType(char *s);
extern char *typeidTypeName(Oid id);
-extern Oid typeTypeId(Type tp);
+extern Oid typeTypeId(Type tp);
extern int16 typeLen(Type t);
extern bool typeByVal(Type t);
extern char *typeTypeName(Type t);
extern char typeTypeFlag(Type t);
extern char *stringTypeString(Type tp, char *string, int16 atttypmod);
-extern Oid typeidOutfunc(Oid type_id);
-extern Oid typeidTypeRelid(Oid type_id);
-extern Oid typeTypeRelid(Type typ);
-extern Oid typeidTypElem(Oid type_id);
-extern Oid GetArrayElementType(Oid typearray);
-extern Oid typeidInfunc(Oid type_id);
+extern Oid typeidOutfunc(Oid type_id);
+extern Oid typeidTypeRelid(Oid type_id);
+extern Oid typeTypeRelid(Type typ);
+extern Oid typeidTypElem(Oid type_id);
+extern Oid GetArrayElementType(Oid typearray);
+extern Oid typeidInfunc(Oid type_id);
#endif /* PARSE_TYPE_H */
diff --git a/src/include/parser/parser.h b/src/include/parser/parser.h
index 820d7f960aa..17867623e08 100644
--- a/src/include/parser/parser.h
+++ b/src/include/parser/parser.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: parser.h,v 1.2 1997/11/26 01:14:17 momjian Exp $
+ * $Id: parser.h,v 1.3 1998/02/26 04:42:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,4 +18,3 @@
extern QueryTreeList *parser(char *str, Oid *typev, int nargs);
#endif /* PARSER_H */
-
diff --git a/src/include/port/bsd.h b/src/include/port/bsd.h
index f64ea094563..03c99acd873 100644
--- a/src/include/port/bsd.h
+++ b/src/include/port/bsd.h
@@ -25,6 +25,6 @@
#endif
#if defined(__mips__)
-/* # undef HAS_TEST_AND_SET */
+/* # undef HAS_TEST_AND_SET */
#endif
typedef unsigned char slock_t;
diff --git a/src/include/port/linux.h b/src/include/port/linux.h
index 727260a6d6e..1a7f74b8b98 100644
--- a/src/include/port/linux.h
+++ b/src/include/port/linux.h
@@ -12,18 +12,24 @@
#if defined(PPC)
typedef unsigned int slock_t;
+
#elif defined(__alpha__)
typedef long int slock_t;
+
#else
typedef unsigned char slock_t;
+
#endif
#if (__GLIBC__ >= 2)
-# ifdef HAVE_INT_TIMEZONE
-# undef HAVE_INT_TIMEZONE
-# endif
- /* currently undefined as I (teunis@computersupportcentre.com) have not
- checked this yet */
+#ifdef HAVE_INT_TIMEZONE
+#undef HAVE_INT_TIMEZONE
+#endif
+
+ /*
+ * currently undefined as I (teunis@computersupportcentre.com) have not
+ * checked this yet
+ */
/* #define HAVE_SIGSETJMP 1 */
#endif
diff --git a/src/include/port/univel.h b/src/include/port/univel.h
index 028c8859bfb..a7daf59460d 100644
--- a/src/include/port/univel.h
+++ b/src/include/port/univel.h
@@ -7,14 +7,15 @@
#define NEED_I386_TAS_ASM
/***************************************
* Define this if you are compiling with
- * the native UNIXWARE C compiler.
+ * the native UNIXWARE C compiler.
***************************************/
-#define USE_UNIVEL_CC_ASM
+#define USE_UNIVEL_CC_ASM
typedef unsigned char slock_t;
+
/***************************************************************
- * strcasecmp() is in c89, but is not in any include file :-(
+ * strcasecmp() is in c89, but is not in any include file :-(
***************************************************************/
-int strcasecmp(char *, char *);
+int strcasecmp(char *, char *);
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
diff --git a/src/include/postgres.h b/src/include/postgres.h
index f1d4704e46b..896e8239db9 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1995, Regents of the University of California
*
- * $Id: postgres.h,v 1.12 1998/02/24 15:27:04 scrappy Exp $
+ * $Id: postgres.h,v 1.13 1998/02/26 04:39:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -219,7 +219,8 @@ typedef uint32 CommandId;
* ---------------
*/
#ifdef CYR_RECODE
-void SetCharSet();
-#endif /* CYR_RECODE */
+void SetCharSet();
+
+#endif /* CYR_RECODE */
#endif /* POSTGRES_H */
diff --git a/src/include/rewrite/locks.h b/src/include/rewrite/locks.h
index 6622070710e..88ff5921397 100644
--- a/src/include/rewrite/locks.h
+++ b/src/include/rewrite/locks.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: locks.h,v 1.7 1998/01/24 22:49:55 momjian Exp $
+ * $Id: locks.h,v 1.8 1998/02/26 04:43:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,7 +17,8 @@
#include "nodes/parsenodes.h"
#include "rewrite/prs2lock.h"
-extern List * matchLocks(CmdType event, RuleLock *rulelocks, int varno,
+extern List *
+matchLocks(CmdType event, RuleLock *rulelocks, int varno,
Query *parsetree);
#endif /* LOCKS_H */
diff --git a/src/include/rewrite/rewriteManip.h b/src/include/rewrite/rewriteManip.h
index c564dbf1d31..9dbd73d2ef1 100644
--- a/src/include/rewrite/rewriteManip.h
+++ b/src/include/rewrite/rewriteManip.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rewriteManip.h,v 1.6 1998/01/21 04:24:46 momjian Exp $
+ * $Id: rewriteManip.h,v 1.7 1998/02/26 04:43:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,8 +19,9 @@
/* RewriteManip.c */
void OffsetVarNodes(Node *node, int offset);
-void ChangeVarNodes(Node *node, int old_varno, int new_varno,
- int sublevels_up);
+void
+ChangeVarNodes(Node *node, int old_varno, int new_varno,
+ int sublevels_up);
void AddQual(Query *parsetree, Node *qual);
void AddNotQual(Query *parsetree, Node *qual);
void FixResdomTypes(List *user_tlist);
diff --git a/src/include/rewrite/rewriteSupport.h b/src/include/rewrite/rewriteSupport.h
index 274db5a98ea..098443144d2 100644
--- a/src/include/rewrite/rewriteSupport.h
+++ b/src/include/rewrite/rewriteSupport.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rewriteSupport.h,v 1.7 1998/01/24 22:49:55 momjian Exp $
+ * $Id: rewriteSupport.h,v 1.8 1998/02/26 04:43:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,7 +18,8 @@
extern int IsDefinedRewriteRule(char *ruleName);
-extern void prs2_addToRelation(Oid relid, Oid ruleId, CmdType event_type,
+extern void
+prs2_addToRelation(Oid relid, Oid ruleId, CmdType event_type,
AttrNumber attno, bool isInstead, Node *qual,
List *actions);
extern void prs2_deleteFromRelation(Oid relid, Oid ruleId);
diff --git a/src/include/rusagestub.h b/src/include/rusagestub.h
index 0d55c1f9287..794d5bed666 100644
--- a/src/include/rusagestub.h
+++ b/src/include/rusagestub.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rusagestub.h,v 1.1 1998/02/20 13:10:03 scrappy Exp $
+ * $Id: rusagestub.h,v 1.2 1998/02/26 04:39:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h
index c9b7d36cef9..e3ccfb92886 100644
--- a/src/include/storage/buf_internals.h
+++ b/src/include/storage/buf_internals.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: buf_internals.h,v 1.20 1998/01/24 22:50:00 momjian Exp $
+ * $Id: buf_internals.h,v 1.21 1998/02/26 04:43:21 momjian Exp $
*
* NOTE
* If BUFFERPAGE0 is defined, then 0 will be used as a
@@ -227,7 +227,8 @@ extern long *LocalRefCount;
extern BufferDesc *LocalBufferDescriptors;
extern int NLocBuffer;
-extern BufferDesc * LocalBufferAlloc(Relation reln, BlockNumber blockNum,
+extern BufferDesc *
+LocalBufferAlloc(Relation reln, BlockNumber blockNum,
bool *foundPtr);
extern int WriteLocalBuffer(Buffer buffer, bool release);
extern int FlushLocalBuffer(Buffer buffer, bool release);
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index d5f6d475ff2..fdc3abcee43 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: bufmgr.h,v 1.17 1998/01/24 22:50:03 momjian Exp $
+ * $Id: bufmgr.h,v 1.18 1998/02/26 04:43:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -75,12 +75,14 @@ extern int ShowPinTrace;
/*
* prototypes for functions in bufmgr.c
*/
-extern Buffer RelationGetBufferWithBuffer(Relation relation,
+extern Buffer
+RelationGetBufferWithBuffer(Relation relation,
BlockNumber blockNumber, Buffer buffer);
extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum);
extern int WriteBuffer(Buffer buffer);
extern int WriteNoReleaseBuffer(Buffer buffer);
-extern Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation,
+extern Buffer
+ReleaseAndReadBuffer(Buffer buffer, Relation relation,
BlockNumber blockNum);
extern void InitBufferPool(IPCKey key);
diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h
index 873d58cacaa..2be7093e4c7 100644
--- a/src/include/storage/bufpage.h
+++ b/src/include/storage/bufpage.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: bufpage.h,v 1.16 1998/01/24 22:50:05 momjian Exp $
+ * $Id: bufpage.h,v 1.17 1998/02/26 04:43:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -198,7 +198,7 @@ typedef enum
* XXX currently all page sizes are "valid" but we only actually
* use BLCKSZ.
*
- * 01/06/98 Now does something useful. darrenk
+ * 01/06/98 Now does something useful. darrenk
*
*/
#define PageSizeIsValid(pageSize) ((pageSize) == BLCKSZ)
@@ -287,7 +287,8 @@ typedef enum
*/
extern void PageInit(Page page, Size pageSize, Size specialSize);
-extern OffsetNumber PageAddItem(Page page, Item item, Size size,
+extern OffsetNumber
+PageAddItem(Page page, Item item, Size size,
OffsetNumber offsetNumber, ItemIdFlags flags);
extern Page PageGetTempPage(Page page, Size specialSize);
extern void PageRestoreTempPage(Page tempPage, Page oldPage);
diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h
index d1023e48f84..cbd649234a7 100644
--- a/src/include/storage/ipc.h
+++ b/src/include/storage/ipc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: ipc.h,v 1.23 1998/01/24 22:50:08 momjian Exp $
+ * $Id: ipc.h,v 1.24 1998/02/26 04:43:26 momjian Exp $
*
* NOTES
* This file is very architecture-specific. This stuff should actually
@@ -75,7 +75,8 @@ extern void exitpg(int code);
extern void quasi_exitpg(void);
extern int on_exitpg(void (*function) (), caddr_t arg);
-extern IpcSemaphoreId IpcSemaphoreCreate(IpcSemaphoreKey semKey,
+extern IpcSemaphoreId
+IpcSemaphoreCreate(IpcSemaphoreKey semKey,
int semNum, int permission, int semStartValue,
int removeOnExit, int *status);
extern void IpcSemaphoreKill(IpcSemaphoreKey key);
@@ -83,7 +84,8 @@ extern void IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock);
extern void IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock);
extern int IpcSemaphoreGetCount(IpcSemaphoreId semId, int sem);
extern int IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem);
-extern IpcMemoryId IpcMemoryCreate(IpcMemoryKey memKey, uint32 size,
+extern IpcMemoryId
+IpcMemoryCreate(IpcMemoryKey memKey, uint32 size,
int permission);
extern IpcMemoryId IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size);
extern char *IpcMemoryAttach(IpcMemoryId memId);
diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h
index 1d53dd96327..8fecda3840a 100644
--- a/src/include/storage/lmgr.h
+++ b/src/include/storage/lmgr.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: lmgr.h,v 1.9 1998/01/24 22:50:09 momjian Exp $
+ * $Id: lmgr.h,v 1.10 1998/02/26 04:43:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,17 +49,22 @@ extern void RelationSetLockForWrite(Relation relation);
extern void RelationUnsetLockForWrite(Relation relation);
/* used in vaccum.c */
-extern void RelationSetLockForWritePage(Relation relation,
+extern void
+RelationSetLockForWritePage(Relation relation,
ItemPointer itemPointer);
/* used in nbtpage.c, hashpage.c */
-extern void RelationSetSingleWLockPage(Relation relation,
+extern void
+RelationSetSingleWLockPage(Relation relation,
ItemPointer itemPointer);
-extern void RelationUnsetSingleWLockPage(Relation relation,
+extern void
+RelationUnsetSingleWLockPage(Relation relation,
ItemPointer itemPointer);
-extern void RelationSetSingleRLockPage(Relation relation,
+extern void
+RelationSetSingleRLockPage(Relation relation,
ItemPointer itemPointer);
-extern void RelationUnsetSingleRLockPage(Relation relation,
+extern void
+RelationUnsetSingleRLockPage(Relation relation,
ItemPointer itemPointer);
extern void RelationSetRIntentLock(Relation relation);
extern void RelationUnsetRIntentLock(Relation relation);
@@ -68,7 +73,8 @@ extern void RelationUnsetWIntentLock(Relation relation);
/* single.c */
extern bool SingleLockReln(LockInfo linfo, LOCKT lockt, int action);
-extern bool SingleLockPage(LockInfo linfo, ItemPointer tidPtr,
+extern bool
+SingleLockPage(LockInfo linfo, ItemPointer tidPtr,
LOCKT lockt, int action);
/* proc.c */
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index 98804eb1f08..0cbca115e9c 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: lock.h,v 1.10 1998/01/27 03:00:43 momjian Exp $
+ * $Id: lock.h,v 1.11 1998/02/26 04:43:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -204,10 +204,12 @@ extern SPINLOCK LockMgrLock;
*/
extern void InitLocks(void);
extern void LockDisable(int status);
-extern LockTableId LockTabInit(char *tabName, MASK *conflictsP, int *prioP,
+extern LockTableId
+LockTabInit(char *tabName, MASK *conflictsP, int *prioP,
int ntypes);
extern bool LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt);
-extern int LockResolveConflicts(LOCKTAB *ltable, LOCK *lock, LOCKT lockt,
+extern int
+LockResolveConflicts(LOCKTAB *ltable, LOCK *lock, LOCKT lockt,
TransactionId xid);
extern bool LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt);
extern void GrantLock(LOCK *lock, LOCKT lockt);
@@ -215,6 +217,7 @@ extern bool LockReleaseAll(LockTableId tableId, SHM_QUEUE *lockQueue);
extern int LockShmemSize(void);
extern bool LockingDisabled(void);
extern bool DeadLockCheck(SHM_QUEUE *lockQueue, LOCK *findlock, bool skip_check);
+
#ifdef DEADLOCK_DEBUG
extern void DumpLocks(void);
diff --git a/src/include/storage/multilev.h b/src/include/storage/multilev.h
index 0f8218e1755..92a47e479f0 100644
--- a/src/include/storage/multilev.h
+++ b/src/include/storage/multilev.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: multilev.h,v 1.6 1998/01/23 19:53:44 scrappy Exp $
+ * $Id: multilev.h,v 1.7 1998/02/26 04:43:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,7 +39,7 @@
#define RELN_LEVEL 0
#define PAGE_LEVEL 1
#define TUPLE_LEVEL 2
-typedef int PG_LOCK_LEVEL;
+typedef int PG_LOCK_LEVEL;
/* multi.c */
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index e1e582e47e3..c41df70e897 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: proc.h,v 1.10 1998/01/25 05:15:15 momjian Exp $
+ * $Id: proc.h,v 1.11 1998/02/26 04:43:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -97,7 +97,8 @@ extern bool ProcRemove(int pid);
/* make static in storage/lmgr/proc.c -- jolly */
extern void ProcQueueInit(PROC_QUEUE *queue);
-extern int ProcSleep(PROC_QUEUE *queue, SPINLOCK spinlock, int token,
+extern int
+ProcSleep(PROC_QUEUE *queue, SPINLOCK spinlock, int token,
int prio, LOCK *lock);
extern int ProcLockWakeup(PROC_QUEUE *queue, char *ltable, char *lock);
extern void ProcAddLock(SHM_QUEUE *elem);
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index f90afed5dee..f63a37193c7 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.26 1998/02/13 17:11:55 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.27 1998/02/26 04:43:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,15 +49,15 @@
* NEXTSTEP (mach)
* slock_t is defined as a struct mutex.
*/
-#define S_LOCK(lock) mutex_lock(lock)
+#define S_LOCK(lock) mutex_lock(lock)
-#define S_UNLOCK(lock) mutex_unlock(lock)
+#define S_UNLOCK(lock) mutex_unlock(lock)
-#define S_INIT_LOCK(lock) mutex_init(lock)
+#define S_INIT_LOCK(lock) mutex_init(lock)
/* S_LOCK_FREE should return 1 if lock is free; 0 if lock is locked */
/* For Mach, we have to delve inside the entrails of `struct mutex'. Ick! */
-#define S_LOCK_FREE(alock) ((alock)->lock == 0)
+#define S_LOCK_FREE(alock) ((alock)->lock == 0)
#endif /* next */
@@ -73,7 +73,7 @@
* assembly from his NECEWS SVR4 port, but we probably ought to retain this
* for the R3000 chips out there.
*/
-#define S_LOCK(lock) do \
+#define S_LOCK(lock) do \
{ \
while (!acquire_lock(lock)) \
; \
@@ -81,11 +81,11 @@
#define S_UNLOCK(lock) release_lock(lock)
-#define S_INIT_LOCK(lock) init_lock(lock)
+#define S_INIT_LOCK(lock) init_lock(lock)
/* S_LOCK_FREE should return 1 if lock is free; 0 if lock is locked */
-#define S_LOCK_FREE(lock) (stat_lock(lock) == UNLOCKED)
+#define S_LOCK_FREE(lock) (stat_lock(lock) == UNLOCKED)
#endif /* __sgi */
@@ -99,17 +99,17 @@
#if (defined(__alpha__) || defined(__alpha)) && !defined(linux)
-#define S_LOCK(lock) do \
+#define S_LOCK(lock) do \
{ \
while (msem_lock((lock), MSEM_IF_NOWAIT) < 0) \
; \
} while (0)
-#define S_UNLOCK(lock) msem_unlock((lock), 0)
+#define S_UNLOCK(lock) msem_unlock((lock), 0)
-#define S_INIT_LOCK(lock) msem_init((lock), MSEM_UNLOCKED)
+#define S_INIT_LOCK(lock) msem_init((lock), MSEM_UNLOCKED)
-#define S_LOCK_FREE(lock) (!(lock)->msem_state)
+#define S_LOCK_FREE(lock) (!(lock)->msem_state)
#endif /* alpha */
@@ -122,15 +122,15 @@
static int tas(slock_t *lock);
-#define S_LOCK(lock) do \
+#define S_LOCK(lock) do \
{ \
while (tas(lock)) \
; \
} while (0)
-#define S_UNLOCK(lock) (*(lock) = 0)
+#define S_UNLOCK(lock) (*(lock) = 0)
-#define S_INIT_LOCK(lock) S_UNLOCK(lock)
+#define S_INIT_LOCK(lock) S_UNLOCK(lock)
#endif /* i86pc_solaris || sparc_solaris */
@@ -143,15 +143,15 @@ static int tas(slock_t *lock);
#if defined(_AIX)
-#define S_LOCK(lock) do \
+#define S_LOCK(lock) do \
{ \
while (cs((int *) (lock), 0, 1)) \
; \
} while (0)
-#define S_UNLOCK(lock) (*(lock) = 0)
+#define S_UNLOCK(lock) (*(lock) = 0)
-#define S_INIT_LOCK(lock) S_UNLOCK(lock)
+#define S_INIT_LOCK(lock) S_UNLOCK(lock)
#endif /* _AIX */
@@ -172,17 +172,17 @@ static slock_t clear_lock = {-1, -1, -1, -1};
static int tas(slock_t *lock);
-#define S_LOCK(lock) do \
+#define S_LOCK(lock) do \
{ \
while (tas(lock)) \
; \
} while (0)
-#define S_UNLOCK(lock) (*(lock) = clear_lock) /* struct assignment */
+#define S_UNLOCK(lock) (*(lock) = clear_lock) /* struct assignment */
-#define S_INIT_LOCK(lock) S_UNLOCK(lock)
+#define S_INIT_LOCK(lock) S_UNLOCK(lock)
-#define S_LOCK_FREE(lock) ( *(int *) (((long) (lock) + 15) & ~15) != 0)
+#define S_LOCK_FREE(lock) ( *(int *) (((long) (lock) + 15) & ~15) != 0)
#endif /* __hpux */
@@ -200,9 +200,9 @@ static int tas(slock_t *lock);
; \
} while (0)
-#define S_UNLOCK(lock) (*(lock) = 0)
+#define S_UNLOCK(lock) (*(lock) = 0)
-#define S_INIT_LOCK(lock) S_UNLOCK(lock)
+#define S_INIT_LOCK(lock) S_UNLOCK(lock)
static int
tas_dummy()
@@ -272,7 +272,7 @@ tas_dummy()
asm("nop");
}
-#define S_LOCK(addr) do \
+#define S_LOCK(addr) do \
{ \
while (tas(addr)) \
; \
@@ -281,9 +281,9 @@ tas_dummy()
/*
* addr should be as in the above S_LOCK routine
*/
-#define S_UNLOCK(addr) (*(addr) = 0)
+#define S_UNLOCK(addr) (*(addr) = 0)
-#define S_INIT_LOCK(addr) (*(addr) = 0)
+#define S_INIT_LOCK(addr) (*(addr) = 0)
#endif /* NEED_SPARC_TAS_ASM */
@@ -306,22 +306,24 @@ tas_dummy()
#if defined(NEED_I386_TAS_ASM)
#if defined(USE_UNIVEL_CC_ASM)
-asm void S_LOCK(char *lval)
+asm void
+S_LOCK(char *lval)
{
-% lab again;
+ %lab again;
/* Upon entry, %eax will contain the pointer to the lock byte */
- pushl %ebx
- xchgl %eax,%ebx
- movb $-1,%al
+ pushl % ebx
+ xchgl % eax, %ebx
+ movb $ - 1, %al
again:
lock
- xchgb %al,(%ebx)
- cmpb $0,%al
- jne again
- popl %ebx
+ xchgb % al, (%ebx)
+ cmpb $0, %al
+ jne again
+ popl % ebx
}
+
#else
-#define S_LOCK(lock) do \
+#define S_LOCK(lock) do \
{ \
slock_t _res; \
do \
@@ -331,20 +333,20 @@ again:
} while (0)
#endif
-#define S_UNLOCK(lock) (*(lock) = 0)
+#define S_UNLOCK(lock) (*(lock) = 0)
-#define S_INIT_LOCK(lock) S_UNLOCK(lock)
+#define S_INIT_LOCK(lock) S_UNLOCK(lock)
#endif /* NEED_I386_TAS_ASM */
#if defined(__alpha__) && defined(linux)
-void S_LOCK(slock_t* lock);
+void S_LOCK(slock_t *lock);
#define S_UNLOCK(lock) { __asm__("mb"); *(lock) = 0; }
-#define S_INIT_LOCK(lock) S_UNLOCK(lock)
+#define S_INIT_LOCK(lock) S_UNLOCK(lock)
#endif /* defined(__alpha__) && defined(linux) */
@@ -362,9 +364,9 @@ void S_LOCK(slock_t* lock);
} while (_res != 0); \
} while (0)
-#define S_UNLOCK(lock) (*(lock) = 0)
+#define S_UNLOCK(lock) (*(lock) = 0)
-#define S_INIT_LOCK(lock) S_UNLOCK(lock)
+#define S_INIT_LOCK(lock) S_UNLOCK(lock)
#endif /* defined(linux) && defined(sparc) */
@@ -389,22 +391,23 @@ success: \n\
");
}
-#define S_LOCK(lock) do \
+#define S_LOCK(lock) do \
{ \
while (tas(lock)) \
; \
} while (0)
-#define S_UNLOCK(lock) (*(lock) = 0)
+#define S_UNLOCK(lock) (*(lock) = 0)
-#define S_INIT_LOCK(lock) S_UNLOCK(lock)
+#define S_INIT_LOCK(lock) S_UNLOCK(lock)
#endif /* defined(linux) && defined(PPC) */
-#ifndef S_LOCK_FREE /* for those who have not already defined it */
+#ifndef S_LOCK_FREE /* for those who have not already defined
+ * it */
#define S_LOCK_FREE(lock) ((*lock) == 0)
#endif
#endif /* HAS_TEST_AND_SET */
-#endif /* S_LOCK_H */
+#endif /* S_LOCK_H */
diff --git a/src/include/storage/shmem.h b/src/include/storage/shmem.h
index e895e755228..af72b7c098a 100644
--- a/src/include/storage/shmem.h
+++ b/src/include/storage/shmem.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: shmem.h,v 1.10 1998/01/24 22:50:13 momjian Exp $
+ * $Id: shmem.h,v 1.11 1998/02/26 04:43:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -64,11 +64,13 @@ extern void ShmemCreate(unsigned int key, unsigned int size);
extern int InitShmem(unsigned int key, unsigned int size);
extern long *ShmemAlloc(unsigned long size);
extern int ShmemIsValid(unsigned long addr);
-extern HTAB * ShmemInitHash(char *name, long init_size, long max_size,
+extern HTAB *
+ShmemInitHash(char *name, long init_size, long max_size,
HASHCTL *infoP, int hash_flags);
extern bool ShmemPIDLookup(int pid, SHMEM_OFFSET *locationPtr);
extern SHMEM_OFFSET ShmemPIDDestroy(int pid);
-extern long * ShmemInitStruct(char *name, unsigned long size,
+extern long *
+ShmemInitStruct(char *name, unsigned long size,
bool *foundPtr);
extern bool TransactionIdIsInProgress(TransactionId xid);
@@ -98,7 +100,8 @@ extern void SHMQueueInit(SHM_QUEUE *queue);
extern void SHMQueueElemInit(SHM_QUEUE *queue);
extern void SHMQueueDelete(SHM_QUEUE *queue);
extern void SHMQueueInsertTL(SHM_QUEUE *queue, SHM_QUEUE *elem);
-extern void SHMQueueFirst(SHM_QUEUE *queue, Pointer *nextPtrPtr,
+extern void
+SHMQueueFirst(SHM_QUEUE *queue, Pointer *nextPtrPtr,
SHM_QUEUE *nextQueue);
extern bool SHMQueueEmpty(SHM_QUEUE *queue);
diff --git a/src/include/storage/sinval.h b/src/include/storage/sinval.h
index 2548d5c9298..2b9939516f9 100644
--- a/src/include/storage/sinval.h
+++ b/src/include/storage/sinval.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: sinval.h,v 1.7 1998/01/24 22:50:15 momjian Exp $
+ * $Id: sinval.h,v 1.8 1998/02/26 04:43:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,7 +21,8 @@ extern SPINLOCK SInvalLock;
extern void CreateSharedInvalidationState(IPCKey key);
extern void AttachSharedInvalidationState(IPCKey key);
extern void InitSharedInvalidationState(void);
-extern void RegisterSharedInvalid(int cacheId, Index hashIndex,
+extern void
+RegisterSharedInvalid(int cacheId, Index hashIndex,
ItemPointer pointer);
extern void InvalidateSharedInvalid(void (*invalFunction) (),
void (*resetFunction) ());
diff --git a/src/include/storage/sinvaladt.h b/src/include/storage/sinvaladt.h
index e1d5dd8ed2a..de24ce9e257 100644
--- a/src/include/storage/sinvaladt.h
+++ b/src/include/storage/sinvaladt.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: sinvaladt.h,v 1.7 1998/01/24 22:50:17 momjian Exp $
+ * $Id: sinvaladt.h,v 1.8 1998/02/26 04:43:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -125,7 +125,8 @@ extern int SISegmentInit(bool killExistingSegment, IPCKey key);
extern bool SISetDataEntry(SISeg *segP, SharedInvalidData *data);
extern void SISetProcStateInvalid(SISeg *segP);
extern bool SIDelDataEntry(SISeg *segP);
-extern void SIReadEntryData(SISeg *segP, int backendId,
+extern void
+SIReadEntryData(SISeg *segP, int backendId,
void (*invalFunction) (), void (*resetFunction) ());
extern void SIDelExpiredDataEntries(SISeg *segP);
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
index cf785c0aec2..0f7087d6466 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: smgr.h,v 1.10 1998/01/24 22:50:18 momjian Exp $
+ * $Id: smgr.h,v 1.11 1998/02/26 04:43:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,13 +28,17 @@ extern int smgrunlink(int16 which, Relation reln);
extern int smgrextend(int16 which, Relation reln, char *buffer);
extern int smgropen(int16 which, Relation reln);
extern int smgrclose(int16 which, Relation reln);
-extern int smgrread(int16 which, Relation reln, BlockNumber blocknum,
+extern int
+smgrread(int16 which, Relation reln, BlockNumber blocknum,
char *buffer);
-extern int smgrwrite(int16 which, Relation reln, BlockNumber blocknum,
+extern int
+smgrwrite(int16 which, Relation reln, BlockNumber blocknum,
char *buffer);
-extern int smgrflush(int16 which, Relation reln, BlockNumber blocknum,
+extern int
+smgrflush(int16 which, Relation reln, BlockNumber blocknum,
char *buffer);
-extern int smgrblindwrt(int16 which, char *dbname, char *relname, Oid dbid,
+extern int
+smgrblindwrt(int16 which, char *dbname, char *relname, Oid dbid,
Oid relid, BlockNumber blkno, char *buffer);
extern int smgrnblocks(int16 which, Relation reln);
extern int smgrtruncate(int16 which, Relation reln, int nblocks);
@@ -55,7 +59,8 @@ extern int mdclose(Relation reln);
extern int mdread(Relation reln, BlockNumber blocknum, char *buffer);
extern int mdwrite(Relation reln, BlockNumber blocknum, char *buffer);
extern int mdflush(Relation reln, BlockNumber blocknum, char *buffer);
-extern int mdblindwrt(char *dbstr, char *relstr, Oid dbid, Oid relid,
+extern int
+mdblindwrt(char *dbstr, char *relstr, Oid dbid, Oid relid,
BlockNumber blkno, char *buffer);
extern int mdnblocks(Relation reln);
extern int mdtruncate(Relation reln, int nblocks);
@@ -75,7 +80,8 @@ extern int mmclose(Relation reln);
extern int mmread(Relation reln, BlockNumber blocknum, char *buffer);
extern int mmwrite(Relation reln, BlockNumber blocknum, char *buffer);
extern int mmflush(Relation reln, BlockNumber blocknum, char *buffer);
-extern int mmblindwrt(char *dbstr, char *relstr, Oid dbid, Oid relid,
+extern int
+mmblindwrt(char *dbstr, char *relstr, Oid dbid, Oid relid,
BlockNumber blkno, char *buffer);
extern int mmnblocks(Relation reln);
extern int mmcommit(void);
diff --git a/src/include/tcop/dest.h b/src/include/tcop/dest.h
index 0209370d8fe..3f3dd71b123 100644
--- a/src/include/tcop/dest.h
+++ b/src/include/tcop/dest.h
@@ -26,7 +26,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: dest.h,v 1.12 1998/01/24 22:50:22 momjian Exp $
+ * $Id: dest.h,v 1.13 1998/02/26 04:43:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,7 +70,8 @@ extern void EndCommand(char *commandTag, CommandDest dest);
extern void SendCopyBegin(void);
extern void ReceiveCopyBegin(void);
extern void NullCommand(CommandDest dest);
-extern void BeginCommand(char *pname, int operation, TupleDesc attinfo,
+extern void
+BeginCommand(char *pname, int operation, TupleDesc attinfo,
bool isIntoRel, bool isIntoPortal, char *tag,
CommandDest dest);
extern void UpdateCommandInfo(int operation, Oid lastoid, uint32 tuples);
diff --git a/src/include/tcop/pquery.h b/src/include/tcop/pquery.h
index 359d673ac44..10935ae63ea 100644
--- a/src/include/tcop/pquery.h
+++ b/src/include/tcop/pquery.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pquery.h,v 1.8 1998/01/24 22:50:24 momjian Exp $
+ * $Id: pquery.h,v 1.9 1998/02/26 04:43:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,11 +23,13 @@ extern QueryDesc *CreateQueryDesc(Query *parsetree, Plan *plantree,
extern EState *CreateExecutorState(void);
-extern void ProcessPortal(char *portalName, Query *parseTree,
+extern void
+ProcessPortal(char *portalName, Query *parseTree,
Plan *plan, EState *state, TupleDesc attinfo,
CommandDest dest);
-extern void ProcessQuery(Query *parsetree, Plan *plan, char *argv[],
+extern void
+ProcessQuery(Query *parsetree, Plan *plan, char *argv[],
Oid *typev, int nargs, CommandDest dest);
#endif /* pqueryIncluded */
diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h
index 93604b4e805..0e2706f05da 100644
--- a/src/include/tcop/tcopprot.h
+++ b/src/include/tcop/tcopprot.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tcopprot.h,v 1.10 1998/01/24 22:50:26 momjian Exp $
+ * $Id: tcopprot.h,v 1.11 1998/02/26 04:43:41 momjian Exp $
*
* OLD COMMENTS
* This file was created so that other c files could get the two
@@ -22,11 +22,13 @@
#include <parser/parse_node.h>
#ifndef BOOTSTRAP_INCLUDE
-extern List * pg_parse_and_plan(char *query_string, Oid *typev, int nargs,
- QueryTreeList **queryListP, CommandDest dest);
+extern List *
+pg_parse_and_plan(char *query_string, Oid *typev, int nargs,
+ QueryTreeList **queryListP, CommandDest dest);
extern void pg_exec_query(char *query_string, char **argv, Oid *typev, int nargs);
-extern void pg_exec_query_dest(char *query_string, char **argv, Oid *typev,
- int nargs, CommandDest dest);
+extern void
+pg_exec_query_dest(char *query_string, char **argv, Oid *typev,
+ int nargs, CommandDest dest);
#endif /* BOOTSTRAP_HEADER */
diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h
index d4dd628613d..6ebd5baf718 100644
--- a/src/include/utils/acl.h
+++ b/src/include/utils/acl.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: acl.h,v 1.16 1998/02/25 13:09:49 scrappy Exp $
+ * $Id: acl.h,v 1.17 1998/02/26 04:43:43 momjian Exp $
*
* NOTES
* For backward-compatability purposes we have to allow there
@@ -141,7 +141,8 @@ extern Acl *aclinsert3(Acl *old_acl, AclItem *mod_aip, unsigned modechg);
extern char *aclmakepriv(char *old_privlist, char new_priv);
extern char *aclmakeuser(char *user_type, char *user);
-extern ChangeACLStmt * makeAclStmt(char *privs, List *rel_list, char *grantee,
+extern ChangeACLStmt *
+makeAclStmt(char *privs, List *rel_list, char *grantee,
char grant_or_revoke);
/*
@@ -163,9 +164,11 @@ extern char *get_groname(AclId grosysid);
extern int32 pg_aclcheck(char *relname, char *usename, AclMode mode);
extern int32 pg_ownercheck(char *usename, char *value, int cacheid);
-extern int32 pg_func_ownercheck(char *usename, char *funcname,
+extern int32
+pg_func_ownercheck(char *usename, char *funcname,
int nargs, Oid *arglist);
-extern int32 pg_aggr_ownercheck(char *usename, char *aggname,
+extern int32
+pg_aggr_ownercheck(char *usename, char *aggname,
Oid basetypeID);
#endif /* ACL_H */
diff --git a/src/include/utils/array.h b/src/include/utils/array.h
index d5c1b8e5151..86603cd453a 100644
--- a/src/include/utils/array.h
+++ b/src/include/utils/array.h
@@ -10,7 +10,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: array.h,v 1.10 1998/02/13 19:46:22 momjian Exp $
+ * $Id: array.h,v 1.11 1998/02/26 04:43:45 momjian Exp $
*
* NOTES
* XXX the data array should be LONGALIGN'd -- notice that the array
@@ -117,17 +117,22 @@ typedef struct
extern char *array_in(char *string, Oid element_type, int16 typmod);
extern char *array_out(ArrayType *v, Oid element_type);
extern char *array_dims(ArrayType *v, bool *isNull);
-extern Datum array_ref(ArrayType *array, int n, int indx[], int reftype,
+extern Datum
+array_ref(ArrayType *array, int n, int indx[], int reftype,
int elmlen, int arraylen, bool *isNull);
-extern Datum array_clip(ArrayType *array, int n, int upperIndx[],
+extern Datum
+array_clip(ArrayType *array, int n, int upperIndx[],
int lowerIndx[], int reftype, int len, bool *isNull);
-extern char * array_set(ArrayType *array, int n, int indx[], char *dataPtr,
+extern char *
+array_set(ArrayType *array, int n, int indx[], char *dataPtr,
int reftype, int elmlen, int arraylen, bool *isNull);
-extern char * array_assgn(ArrayType *array, int n, int upperIndx[],
+extern char *
+array_assgn(ArrayType *array, int n, int upperIndx[],
int lowerIndx[], ArrayType *newArr, int reftype,
int len, bool *isNull);
extern int array_eq(ArrayType *array1, ArrayType *array2);
-extern int _LOtransfer(char **destfd, int size, int nitems, char **srcfd,
+extern int
+_LOtransfer(char **destfd, int size, int nitems, char **srcfd,
int isSrcLO, int isDestLO);
extern char *_array_newLO(int *fd, int flag);
@@ -151,11 +156,14 @@ extern int next_tuple(int n, int curr[], int span[]);
/*
* prototypes for functions defined in chunk.c
*/
-extern char * _ChunkArray(int fd, FILE *afd, int ndim, int dim[], int baseSize,
+extern char *
+_ChunkArray(int fd, FILE *afd, int ndim, int dim[], int baseSize,
int *nbytes, char *chunkfile);
-extern int _ReadChunkArray(int st[], int endp[], int bsize, int fp,
+extern int
+_ReadChunkArray(int st[], int endp[], int bsize, int fp,
char *destfp, ArrayType *array, int isDestLO, bool *isNull);
-extern struct varlena * _ReadChunkArray1El(int st[], int bsize, int fp,
+extern struct varlena *
+_ReadChunkArray1El(int st[], int bsize, int fp,
ArrayType *array, bool *isNull);
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 7ff819940b7..e7541d49e81 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: builtins.h,v 1.36 1998/02/10 16:04:36 momjian Exp $
+ * $Id: builtins.h,v 1.37 1998/02/26 04:43:48 momjian Exp $
*
* NOTES
* This should normally only be included by fmgr.h.
@@ -371,7 +371,7 @@ extern bool oid8eq(Oid arg1[], Oid arg2[]);
extern bool oideqint4(Oid arg1, int32 arg2);
extern bool int4eqoid(int32 arg1, Oid arg2);
extern text *oid_text(Oid arg1);
-extern Oid text_oid(text *arg1);
+extern Oid text_oid(text *arg1);
/* regexp.c */
extern bool char2regexeq(uint16 arg1, struct varlena * p);
@@ -484,7 +484,7 @@ extern int32 textpos(text *arg1, text *arg2);
extern text *text_substr(text *string, int32 m, int32 n);
extern struct varlena *byteain(char *inputText);
-extern char *byteaout(struct varlena *vlena);
+extern char *byteaout(struct varlena * vlena);
extern int32 byteaGetSize(struct varlena * v);
extern int32 byteaGetByte(struct varlena * v, int32 n);
extern int32 byteaGetBit(struct varlena * v, int32 n);
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index e32035b7494..c759416ab09 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: catcache.h,v 1.10 1998/02/23 17:44:22 scrappy Exp $
+ * $Id: catcache.h,v 1.11 1998/02/26 04:43:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,15 +63,19 @@ typedef struct catcache
extern struct catcache *Caches;
extern GlobalMemory CacheCxt;
-extern void CatalogCacheIdInvalidate(int cacheId, Index hashIndex,
+extern void
+CatalogCacheIdInvalidate(int cacheId, Index hashIndex,
ItemPointer pointer);
extern void ResetSystemCache(void);
extern void SystemCacheRelationFlushed(Oid relId);
-extern CatCache * InitSysCache(char *relname, char *indname, int id, int nkeys,
+extern CatCache *
+InitSysCache(char *relname, char *indname, int id, int nkeys,
int key[], HeapTuple (*iScanfuncP) ());
-extern HeapTuple SearchSysCache(struct catcache * cache, Datum v1, Datum v2,
+extern HeapTuple
+SearchSysCache(struct catcache * cache, Datum v1, Datum v2,
Datum v3, Datum v4);
-extern void RelationInvalidateCatalogCacheTuple(Relation relation,
+extern void
+RelationInvalidateCatalogCacheTuple(Relation relation,
HeapTuple tuple, void (*function) ());
#endif /* CATCACHE_H */
diff --git a/src/include/utils/datum.h b/src/include/utils/datum.h
index 04a48099ec4..ab394e7fcd6 100644
--- a/src/include/utils/datum.h
+++ b/src/include/utils/datum.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: datum.h,v 1.6 1998/01/24 22:50:36 momjian Exp $
+ * $Id: datum.h,v 1.7 1998/02/26 04:43:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,7 +57,8 @@ extern void datumFree(Datum value, Oid type, bool byVal, Size len);
* return true if thwo datums are equal, false otherwise.
* XXX : See comments in the code for restrictions!
*/
-extern bool datumIsEqual(Datum value1, Datum value2, Oid type,
+extern bool
+datumIsEqual(Datum value1, Datum value2, Oid type,
bool byVal, Size len);
#endif /* DATUM_H */
diff --git a/src/include/utils/dt.h b/src/include/utils/dt.h
index fe583b8641c..c027e7e4247 100644
--- a/src/include/utils/dt.h
+++ b/src/include/utils/dt.h
@@ -8,7 +8,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: dt.h,v 1.27 1998/02/13 17:12:07 scrappy Exp $
+ * $Id: dt.h,v 1.28 1998/02/26 04:43:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -128,7 +128,7 @@ typedef struct
* so actually restrict them to within [0,31] for now.
* - thomas 97/06/19
* Not all of these fields are used for masks in DecodeDateDelta
- * so allow some larger than 31. - thomas 1997-11-17
+ * so allow some larger than 31. - thomas 1997-11-17
*/
#define DTK_NUMBER 0
@@ -271,7 +271,7 @@ extern bool datetime_le(DateTime *dt1, DateTime *dt2);
extern bool datetime_ge(DateTime *dt1, DateTime *dt2);
extern bool datetime_gt(DateTime *dt1, DateTime *dt2);
extern bool datetime_finite(DateTime *datetime);
-extern int datetime_cmp(DateTime *dt1, DateTime *dt2);
+extern int datetime_cmp(DateTime *dt1, DateTime *dt2);
extern DateTime *datetime_smaller(DateTime *dt1, DateTime *dt2);
extern DateTime *datetime_larger(DateTime *dt1, DateTime *dt2);
@@ -284,7 +284,7 @@ extern bool timespan_le(TimeSpan *span1, TimeSpan *span2);
extern bool timespan_ge(TimeSpan *span1, TimeSpan *span2);
extern bool timespan_gt(TimeSpan *span1, TimeSpan *span2);
extern bool timespan_finite(TimeSpan *span);
-extern int timespan_cmp(TimeSpan *span1, TimeSpan *span2);
+extern int timespan_cmp(TimeSpan *span1, TimeSpan *span2);
extern TimeSpan *timespan_smaller(TimeSpan *span1, TimeSpan *span2);
extern TimeSpan *timespan_larger(TimeSpan *span1, TimeSpan *span2);
@@ -310,30 +310,34 @@ extern TimeSpan *datetime_age(DateTime *dt1, DateTime *dt2);
extern void GetCurrentTime(struct tm * tm);
extern DateTime SetDateTime(DateTime datetime);
-extern int tm2datetime(struct tm * tm, double fsec, int *tzp, DateTime *dt);
-extern int datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn);
-extern int timespan2tm(TimeSpan span, struct tm * tm, float8 *fsec);
-extern int tm2timespan(struct tm * tm, double fsec, TimeSpan *span);
+extern int tm2datetime(struct tm * tm, double fsec, int *tzp, DateTime *dt);
+extern int datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn);
+extern int timespan2tm(TimeSpan span, struct tm * tm, float8 *fsec);
+extern int tm2timespan(struct tm * tm, double fsec, TimeSpan *span);
extern void j2date(int jd, int *year, int *month, int *day);
-extern int date2j(int year, int month, int day);
+extern int date2j(int year, int month, int day);
extern double time2t(const int hour, const int min, const double sec);
-extern int ParseDateTime(char *timestr, char *lowstr,
+extern int
+ParseDateTime(char *timestr, char *lowstr,
char *field[], int ftype[], int maxfields, int *numfields);
-extern int DecodeDateTime(char *field[], int ftype[],
+extern int
+DecodeDateTime(char *field[], int ftype[],
int nf, int *dtype, struct tm * tm, double *fsec, int *tzp);
-extern int DecodeTimeOnly(char *field[], int ftype[], int nf,
+extern int
+DecodeTimeOnly(char *field[], int ftype[], int nf,
int *dtype, struct tm * tm, double *fsec);
-extern int DecodeDateDelta(char *field[], int ftype[],
+extern int
+DecodeDateDelta(char *field[], int ftype[],
int nf, int *dtype, struct tm * tm, double *fsec);
-extern int EncodeDateOnly(struct tm * tm, int style, char *str);
-extern int EncodeTimeOnly(struct tm * tm, double fsec, int style, char *str);
-extern int EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, char *str);
-extern int EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str);
+extern int EncodeDateOnly(struct tm * tm, int style, char *str);
+extern int EncodeTimeOnly(struct tm * tm, double fsec, int style, char *str);
+extern int EncodeDateTime(struct tm * tm, double fsec, int *tzp, char **tzn, int style, char *str);
+extern int EncodeTimeSpan(struct tm * tm, double fsec, int style, char *str);
-#endif /* DT_H */
+#endif /* DT_H */
diff --git a/src/include/utils/exc.h b/src/include/utils/exc.h
index dd53d9f9112..7400f9ce038 100644
--- a/src/include/utils/exc.h
+++ b/src/include/utils/exc.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: exc.h,v 1.11 1998/01/24 22:50:41 momjian Exp $
+ * $Id: exc.h,v 1.12 1998/02/26 04:43:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -78,7 +78,8 @@ typedef void ExcProc (Exception *, ExcDetail, ExcData, ExcMessage);
* prototypes for functions in exc.c
*/
extern void EnableExceptionHandling(bool on);
-extern void ExcRaise(Exception *excP,
+extern void
+ExcRaise(Exception *excP,
ExcDetail detail,
ExcData data,
ExcMessage message);
@@ -87,7 +88,8 @@ extern void ExcRaise(Exception *excP,
/*
* prototypes for functions in excabort.c
*/
-extern void ExcAbort(const Exception *excP, ExcDetail detail, ExcData data,
+extern void
+ExcAbort(const Exception *excP, ExcDetail detail, ExcData data,
ExcMessage message);
#endif /* EXC_H */
diff --git a/src/include/utils/geo_decls.h b/src/include/utils/geo_decls.h
index 14163f12178..18529c06cb2 100644
--- a/src/include/utils/geo_decls.h
+++ b/src/include/utils/geo_decls.h
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geo_decls.h,v 1.18 1998/02/03 16:01:06 thomas Exp $
+ * $Id: geo_decls.h,v 1.19 1998/02/26 04:44:00 momjian Exp $
*
* NOTE
* These routines do *not* use the float types from adt/.
@@ -348,9 +348,11 @@ extern double *circle_area(CIRCLE *circle);
extern double circle_dt(CIRCLE *circle1, CIRCLE *circle2);
/* geo_selfuncs.c */
-extern float64 areasel(Oid opid, Oid relid, AttrNumber attno,
+extern float64
+areasel(Oid opid, Oid relid, AttrNumber attno,
char *value, int32 flag);
-extern float64 areajoinsel(Oid opid, Oid relid, AttrNumber attno,
+extern float64
+areajoinsel(Oid opid, Oid relid, AttrNumber attno,
char *value, int32 flag);
#endif /* GEO_DECLS_H */
diff --git a/src/include/utils/hsearch.h b/src/include/utils/hsearch.h
index bf9ca2128c2..977a843a13f 100644
--- a/src/include/utils/hsearch.h
+++ b/src/include/utils/hsearch.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: hsearch.h,v 1.7 1998/01/24 22:50:45 momjian Exp $
+ * $Id: hsearch.h,v 1.8 1998/02/26 04:44:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -133,7 +133,8 @@ typedef enum
extern HTAB *hash_create(int nelem, HASHCTL *info, int flags);
extern void hash_destroy(HTAB *hashp);
extern void hash_stats(char *where, HTAB *hashp);
-extern long * hash_search(HTAB *hashp, char *keyPtr, HASHACTION action,
+extern long *
+hash_search(HTAB *hashp, char *keyPtr, HASHACTION action,
bool *foundPtr);
extern long *hash_seq(HTAB *hashp);
diff --git a/src/include/utils/lselect.h b/src/include/utils/lselect.h
index 35d8483d5b9..40e8d2ba510 100644
--- a/src/include/utils/lselect.h
+++ b/src/include/utils/lselect.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: lselect.h,v 1.9 1998/01/24 22:50:46 momjian Exp $
+ * $Id: lselect.h,v 1.10 1998/02/26 04:44:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,11 +39,14 @@ typedef struct
} LeftistContextData;
typedef LeftistContextData *LeftistContext;
-extern struct leftist * lmerge(struct leftist * pt, struct leftist * qt,
+extern struct leftist *
+lmerge(struct leftist * pt, struct leftist * qt,
LeftistContext context);
-extern HeapTuple gettuple(struct leftist ** treep, short *devnum,
+extern HeapTuple
+gettuple(struct leftist ** treep, short *devnum,
LeftistContext context);
-extern void puttuple(struct leftist ** treep, HeapTuple newtuple, short devnum,
+extern void
+puttuple(struct leftist ** treep, HeapTuple newtuple, short devnum,
LeftistContext context);
extern int tuplecmp(HeapTuple ltup, HeapTuple rtup, LeftistContext context);
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index b1b402d897b..6bc94a874ca 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: lsyscache.h,v 1.9 1998/02/10 16:04:38 momjian Exp $
+ * $Id: lsyscache.h,v 1.10 1998/02/26 04:44:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,8 @@ extern bool get_attisset(Oid relid, char *attname);
extern int16 get_atttypmod(Oid relid, AttrNumber attnum);
extern RegProcedure get_opcode(Oid opid);
extern char *get_opname(Oid opid);
-extern bool op_mergesortable(Oid opid, Oid ltype, Oid rtype,
+extern bool
+op_mergesortable(Oid opid, Oid ltype, Oid rtype,
Oid *leftOp, Oid *rightOp);
extern Oid op_hashjoinable(Oid opid, Oid ltype, Oid rtype);
extern Oid get_commutator(Oid opid);
diff --git a/src/include/utils/mcxt.h b/src/include/utils/mcxt.h
index 092501a1930..44427d65b64 100644
--- a/src/include/utils/mcxt.h
+++ b/src/include/utils/mcxt.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: mcxt.h,v 1.9 1998/01/24 22:50:50 momjian Exp $
+ * $Id: mcxt.h,v 1.10 1998/02/26 04:44:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,7 +39,8 @@ extern MemoryContext TopMemoryContext;
*/
extern void EnableMemoryContext(bool on);
extern Pointer MemoryContextAlloc(MemoryContext context, Size size);
-extern Pointer MemoryContextRealloc(MemoryContext context,
+extern Pointer
+MemoryContextRealloc(MemoryContext context,
Pointer pointer,
Size size);
extern void MemoryContextFree(MemoryContext context, Pointer pointer);
diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h
index 2afcfdebe23..fdfde10ffe8 100644
--- a/src/include/utils/memutils.h
+++ b/src/include/utils/memutils.h
@@ -15,7 +15,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: memutils.h,v 1.13 1998/01/24 22:50:51 momjian Exp $
+ * $Id: memutils.h,v 1.14 1998/02/26 04:44:08 momjian Exp $
*
* NOTES
* some of the information in this file will be moved to
@@ -90,7 +90,7 @@ s...)
(((long)(LEN) + (sizeof (double) - 1)) & ~(sizeof (double) -1))
#else
#define DOUBLEALIGN(LEN) INTALIGN(LEN)
-#define MAXALIGN(LEN) INTALIGN(LEN)
+#define MAXALIGN(LEN) INTALIGN(LEN)
#endif
/*****************************************************************************
@@ -233,7 +233,8 @@ extern void AllocSetReset(AllocSet set);
extern bool AllocSetContains(AllocSet set, AllocPointer pointer);
extern AllocPointer AllocSetAlloc(AllocSet set, Size size);
extern void AllocSetFree(AllocSet set, AllocPointer pointer);
-extern AllocPointer AllocSetRealloc(AllocSet set, AllocPointer pointer,
+extern AllocPointer
+AllocSetRealloc(AllocSet set, AllocPointer pointer,
Size size);
extern void AllocSetDump(AllocSet set);
diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h
index cedc3cfe31f..2a99e2381d6 100644
--- a/src/include/utils/portal.h
+++ b/src/include/utils/portal.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: portal.h,v 1.8 1998/01/24 22:50:52 momjian Exp $
+ * $Id: portal.h,v 1.9 1998/02/26 04:44:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -68,7 +68,8 @@ extern void AtEOXact_portals(void);
extern void EnablePortalManager(bool on);
extern Portal GetPortalByName(char *name);
extern Portal BlankPortalAssignName(char *name);
-extern void PortalSetQuery(Portal portal, QueryDesc *queryDesc,
+extern void
+PortalSetQuery(Portal portal, QueryDesc *queryDesc,
TupleDesc attinfo, EState *state,
void (*cleanup) (Portal portal));
extern QueryDesc *PortalGetQueryDesc(Portal portal);
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index fd846cc73dd..8b1d45edb15 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rel.h,v 1.16 1998/01/24 22:50:54 momjian Exp $
+ * $Id: rel.h,v 1.17 1998/02/26 04:44:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -186,7 +186,8 @@ typedef Relation *RelationPtr;
extern IndexStrategy RelationGetIndexStrategy(Relation relation);
-extern void RelationSetIndexSupport(Relation relation, IndexStrategy strategy,
+extern void
+RelationSetIndexSupport(Relation relation, IndexStrategy strategy,
RegProcedure *support);
#endif /* REL_H */
diff --git a/src/include/utils/rel2.h b/src/include/utils/rel2.h
index afe8246a049..4440e508e44 100644
--- a/src/include/utils/rel2.h
+++ b/src/include/utils/rel2.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rel2.h,v 1.5 1998/01/24 22:50:55 momjian Exp $
+ * $Id: rel2.h,v 1.6 1998/02/26 04:44:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,7 +17,8 @@
extern IndexStrategy RelationGetIndexStrategy(Relation relation);
-extern void RelationSetIndexSupport(Relation relation, IndexStrategy strategy,
+extern void
+RelationSetIndexSupport(Relation relation, IndexStrategy strategy,
RegProcedure *support);
#endif /* TMP_REL2_H */
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index f363d66e1db..712345614be 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: syscache.h,v 1.9 1998/01/24 22:50:57 momjian Exp $
+ * $Id: syscache.h,v 1.10 1998/02/26 04:44:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -79,11 +79,14 @@ struct cachedesc
extern void zerocaches(void);
extern void InitCatalogCache(void);
-extern HeapTuple SearchSysCacheTuple(int cacheId, Datum key1, Datum key2,
+extern HeapTuple
+SearchSysCacheTuple(int cacheId, Datum key1, Datum key2,
Datum key3, Datum key4);
-extern int32 SearchSysCacheStruct(int cacheId, char *returnStruct,
+extern int32
+SearchSysCacheStruct(int cacheId, char *returnStruct,
Datum key1, Datum key2, Datum key3, Datum key4);
-extern void * SearchSysCacheGetAttribute(int cacheId,
+extern void *
+SearchSysCacheGetAttribute(int cacheId,
AttrNumber attributeNumber,
Datum key1,
Datum key2,
diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h
index 4634b695735..a19b1a4f7a1 100644
--- a/src/interfaces/ecpg/include/ecpglib.h
+++ b/src/interfaces/ecpg/include/ecpglib.h
@@ -1,32 +1,34 @@
#include <c.h>
-void ECPGdebug(int, FILE *);
-bool ECPGconnect(const char * dbname);
-bool ECPGdo(int, char *, ...);
-bool ECPGcommit(int);
-bool ECPGrollback(int);
-bool ECPGfinish();
-bool ECPGstatus();
+void ECPGdebug(int, FILE *);
+bool ECPGconnect(const char *dbname);
+bool ECPGdo(int, char *,...);
+bool ECPGcommit(int);
+bool ECPGrollback(int);
+bool ECPGfinish();
+bool ECPGstatus();
-void ECPGlog(const char * format, ...);
+void ECPGlog(const char *format,...);
#ifdef LIBPQ_FE_H
-bool ECPGsetdb(PGconn *);
+bool ECPGsetdb(PGconn *);
+
#endif
/* Here are some methods used by the lib. */
/* Returns a pointer to a string containing a simple type name. */
-const char * ECPGtype_name(enum ECPGttype);
+const char *ECPGtype_name(enum ECPGttype);
/* A generic varchar type. */
-struct ECPGgeneric_varchar {
- int len;
- char arr[1];
+struct ECPGgeneric_varchar
+{
+ int len;
+ char arr[1];
};
/* print an error message */
-void sqlprint(void);
+void sqlprint(void);
/* define this for simplicity as well as compatibility */
-#define SQLCODE sqlca.sqlcode
+#define SQLCODE sqlca.sqlcode
diff --git a/src/interfaces/ecpg/include/ecpgtype.h b/src/interfaces/ecpg/include/ecpgtype.h
index 496c934f4f4..35bac4d0288 100644
--- a/src/interfaces/ecpg/include/ecpgtype.h
+++ b/src/interfaces/ecpg/include/ecpgtype.h
@@ -29,16 +29,17 @@
*/
#include <stdio.h>
-enum ECPGttype {
- ECPGt_char = 1, ECPGt_unsigned_char, ECPGt_short, ECPGt_unsigned_short,
- ECPGt_int, ECPGt_unsigned_int, ECPGt_long, ECPGt_unsigned_long,
- ECPGt_bool,
- ECPGt_float, ECPGt_double,
- ECPGt_varchar, ECPGt_varchar2,
- ECPGt_array,
- ECPGt_record,
- ECPGt_EOIT, /* End of insert types. */
- ECPGt_EORT /* End of result types. */
+enum ECPGttype
+{
+ ECPGt_char = 1, ECPGt_unsigned_char, ECPGt_short, ECPGt_unsigned_short,
+ ECPGt_int, ECPGt_unsigned_int, ECPGt_long, ECPGt_unsigned_long,
+ ECPGt_bool,
+ ECPGt_float, ECPGt_double,
+ ECPGt_varchar, ECPGt_varchar2,
+ ECPGt_array,
+ ECPGt_record,
+ ECPGt_EOIT, /* End of insert types. */
+ ECPGt_EORT /* End of result types. */
};
#define IS_SIMPLE_TYPE(type) ((type) >= ECPGt_char && (type) <= ECPGt_varchar2)
diff --git a/src/interfaces/ecpg/include/sqlca.h b/src/interfaces/ecpg/include/sqlca.h
index 0e7126e7b36..454eba22018 100644
--- a/src/interfaces/ecpg/include/sqlca.h
+++ b/src/interfaces/ecpg/include/sqlca.h
@@ -1,11 +1,14 @@
#ifndef POSTGRES_SQLCA_H
#define POSTGRES_SQLCA_H
-struct sqlca {
- int sqlcode;
- struct {
- int sqlerrml;
- char sqlerrmc[1000];
- } sqlerrm;
-} sqlca;
+struct sqlca
+{
+ int sqlcode;
+ struct
+ {
+ int sqlerrml;
+ char sqlerrmc[1000];
+ } sqlerrm;
+} sqlca;
+
#endif
diff --git a/src/interfaces/ecpg/lib/ecpglib.c b/src/interfaces/ecpg/lib/ecpglib.c
index 823a335c764..f5778f9ac3c 100644
--- a/src/interfaces/ecpg/lib/ecpglib.c
+++ b/src/interfaces/ecpg/lib/ecpglib.c
@@ -45,7 +45,7 @@ register_error(int code, char *fmt,...)
in the argument quoted with \.
*/
static
-char *
+char *
quote_postgres(char *arg)
{
char *res = (char *) malloc(2 * strlen(arg) + 1);
@@ -89,9 +89,10 @@ ECPGdo(int lineno, char *query,...)
type = va_arg(ap, enum ECPGttype);
/*
- * Now, if the type is one of the fill in types then we take the argument
- * and enter that in the string at the first %s position. Then if there
- * are any more fill in types we fill in at the next and so on.
+ * Now, if the type is one of the fill in types then we take the
+ * argument and enter that in the string at the first %s position.
+ * Then if there are any more fill in types we fill in at the next and
+ * so on.
*/
while (type != ECPGt_EOIT)
{
@@ -106,8 +107,11 @@ ECPGdo(int lineno, char *query,...)
char *p;
char buff[20];
- /* Some special treatment is needed for records since we want their
- contents to arrive in a comma-separated list on insert (I think). */
+ /*
+ * Some special treatment is needed for records since we want
+ * their contents to arrive in a comma-separated list on insert (I
+ * think).
+ */
value = va_arg(ap, void *);
varcharsize = va_arg(ap, long);
@@ -157,8 +161,8 @@ ECPGdo(int lineno, char *query,...)
case ECPGt_unsigned_char:
{
/* set slen to string length if type is char * */
- int slen = (varcharsize == 0) ? strlen((char *) value) : varcharsize;
-
+ int slen = (varcharsize == 0) ? strlen((char *) value) : varcharsize;
+
newcopy = (char *) malloc(slen + 1);
strncpy(newcopy, (char *) value, slen);
newcopy[slen] = '\0';
@@ -203,8 +207,9 @@ ECPGdo(int lineno, char *query,...)
break;
}
- /* Now tobeinserted points to an area that is to be inserted at
- the first %s
+ /*
+ * Now tobeinserted points to an area that is to be inserted at
+ * the first %s
*/
newcopy = (char *) malloc(strlen(copiedquery)
+ strlen(tobeinserted)
@@ -212,8 +217,10 @@ ECPGdo(int lineno, char *query,...)
strcpy(newcopy, copiedquery);
if ((p = strstr(newcopy, ";;")) == NULL)
{
- /* We have an argument but we dont have the matched up string
- in the string
+
+ /*
+ * We have an argument but we dont have the matched up string
+ * in the string
*/
register_error(-1, "Too many arguments line %d.", lineno);
return false;
@@ -221,16 +228,20 @@ ECPGdo(int lineno, char *query,...)
else
{
strcpy(p, tobeinserted);
- /* The strange thing in the second argument is the rest of the
- string from the old string */
+
+ /*
+ * The strange thing in the second argument is the rest of the
+ * string from the old string
+ */
strcat(newcopy,
copiedquery
+ (p - newcopy)
+ 2 /* Length of ;; */ );
}
- /* Now everything is safely copied to the newcopy. Lets free the
- oldcopy and let the copiedquery get the value from the newcopy.
+ /*
+ * Now everything is safely copied to the newcopy. Lets free the
+ * oldcopy and let the copiedquery get the value from the newcopy.
*/
if (mallocedval != NULL)
{
@@ -283,9 +294,11 @@ ECPGdo(int lineno, char *query,...)
x;
case PGRES_TUPLES_OK:
- /* XXX Cheap Hack. For now, we see only the last group
- * of tuples. This is clearly not the right
- * way to do things !!
+
+ /*
+ * XXX Cheap Hack. For now, we see only the last group of
+ * tuples. This is clearly not the right way to do things
+ * !!
*/
m = PQnfields(results);
@@ -318,10 +331,10 @@ ECPGdo(int lineno, char *query,...)
char *pval = PQgetvalue(results, 0, x);
- /*long int * res_int;
- char ** res_charstar;
- char * res_char;
- int res_len; */
+ /*
+ * long int * res_int; char ** res_charstar; char *
+ * res_char; int res_len;
+ */
char *scan_length;
ECPGlog("ECPGdo line %d: RESULT: %s\n", lineno, pval ? pval : "");
@@ -476,7 +489,7 @@ ECPGdo(int lineno, char *query,...)
strncpy((char *) value, pval, varcharsize);
}
break;
-
+
case ECPGt_varchar:
{
struct ECPGgeneric_varchar *var =
@@ -673,8 +686,9 @@ ECPGlog(const char *format,...)
}
/* print out an error message */
-void sqlprint(void)
+void
+sqlprint(void)
{
sqlca.sqlerrm.sqlerrmc[sqlca.sqlerrm.sqlerrml] = '\0';
- printf ("sql error %s\n", sqlca.sqlerrm.sqlerrmc);
+ printf("sql error %s\n", sqlca.sqlerrm.sqlerrmc);
}
diff --git a/src/interfaces/ecpg/lib/typename.c b/src/interfaces/ecpg/lib/typename.c
index 55756037b30..a79fa67202d 100644
--- a/src/interfaces/ecpg/lib/typename.c
+++ b/src/interfaces/ecpg/lib/typename.c
@@ -5,20 +5,30 @@
const char *
ECPGtype_name(enum ECPGttype typ)
{
- switch (typ)
- {
- case ECPGt_char: return "char";
- case ECPGt_unsigned_char: return "unsigned char";
- case ECPGt_short: return "short";
- case ECPGt_unsigned_short: return "unsigned short";
- case ECPGt_int: return "int";
- case ECPGt_unsigned_int: return "unsigned int";
- case ECPGt_long: return "long";
- case ECPGt_unsigned_long: return "unsigned long";
- case ECPGt_float: return "float";
- case ECPGt_double: return "double";
- case ECPGt_bool: return "bool";
- default:
- abort();
- }
+ switch (typ)
+ {
+ case ECPGt_char:return "char";
+ case ECPGt_unsigned_char:
+ return "unsigned char";
+ case ECPGt_short:
+ return "short";
+ case ECPGt_unsigned_short:
+ return "unsigned short";
+ case ECPGt_int:
+ return "int";
+ case ECPGt_unsigned_int:
+ return "unsigned int";
+ case ECPGt_long:
+ return "long";
+ case ECPGt_unsigned_long:
+ return "unsigned long";
+ case ECPGt_float:
+ return "float";
+ case ECPGt_double:
+ return "double";
+ case ECPGt_bool:
+ return "bool";
+ default:
+ abort();
+ }
}
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index 0239ece7d3c..483a7c52fcc 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -6,15 +6,15 @@
#include <stdio.h>
#if HAVE_GETOPT_H
-# include <getopt.h>
+#include <getopt.h>
#else
-# include <unistd.h>
+#include <unistd.h>
#endif
#include <stdlib.h>
#if defined(HAVE_STRING_H)
-# include <string.h>
+#include <string.h>
#else
-# include <strings.h>
+#include <strings.h>
#endif
#include "extern.h"
@@ -29,7 +29,8 @@ usage(char *progname)
int
main(int argc, char *const argv[])
{
- char c, out_option = 0;
+ char c,
+ out_option = 0;
int fnr;
while ((c = getopt(argc, argv, "vdo:")) != EOF)
@@ -52,15 +53,16 @@ main(int argc, char *const argv[])
}
}
- if (optind >= argc) /* no files specified */
+ if (optind >= argc) /* no files specified */
usage(argv[0]);
else
{
/* after the options there must not be anything but filenames */
for (fnr = optind; fnr < argc; fnr++)
{
- char *filename, *ptr2ext;
- int ext = 0;
+ char *filename,
+ *ptr2ext;
+ int ext = 0;
filename = mm_alloc(strlen(argv[fnr]) + 4);
@@ -69,9 +71,9 @@ main(int argc, char *const argv[])
ptr2ext = strrchr(filename, '.');
/* no extension or extension not equal .pgc */
if (ptr2ext == NULL || strcmp(ptr2ext, ".pgc") != 0)
- {
+ {
if (ptr2ext == NULL)
- ext = 1; /* we need this information a while later */
+ ext = 1; /* we need this information a while later */
ptr2ext = filename + strlen(filename);
ptr2ext[0] = '.';
}
@@ -80,7 +82,7 @@ main(int argc, char *const argv[])
ptr2ext[1] = 'c';
ptr2ext[2] = '\0';
- if (out_option == 0) /* calculate the output name */
+ if (out_option == 0)/* calculate the output name */
{
yyout = fopen(filename, "w");
if (yyout == NULL)
@@ -91,7 +93,7 @@ main(int argc, char *const argv[])
}
}
- if (ext == 1)
+ if (ext == 1)
{
/* no extension => add .pgc */
ptr2ext = strrchr(filename, '.');
diff --git a/src/interfaces/ecpg/preproc/extern.h b/src/interfaces/ecpg/preproc/extern.h
index 8055e5b07c1..b6166f9bb9f 100644
--- a/src/interfaces/ecpg/preproc/extern.h
+++ b/src/interfaces/ecpg/preproc/extern.h
@@ -1,14 +1,17 @@
/* variables */
-extern int debugging, braces_open;
-extern char * yytext;
-extern int yylineno, yyleng;
-extern FILE *yyin, *yyout;
+extern int debugging,
+ braces_open;
+extern char *yytext;
+extern int yylineno,
+ yyleng;
+extern FILE *yyin,
+ *yyout;
/* functions */
extern void lex_init(void);
-extern char * input_filename;
-extern int yyparse(void);
+extern char *input_filename;
+extern int yyparse(void);
extern void *mm_alloc(size_t), *mm_realloc(void *, size_t);
diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c
index a436997aaa2..f5ff41c8c76 100644
--- a/src/interfaces/ecpg/preproc/type.c
+++ b/src/interfaces/ecpg/preproc/type.c
@@ -5,31 +5,33 @@
#include "type.h"
/* malloc + error check */
-void *mm_alloc(size_t size)
+void *
+mm_alloc(size_t size)
{
- void *ptr = malloc(size);
+ void *ptr = malloc(size);
- if (ptr == NULL)
- {
- fprintf(stderr, "Out of memory\n");
- exit(1);
- }
+ if (ptr == NULL)
+ {
+ fprintf(stderr, "Out of memory\n");
+ exit(1);
+ }
- return (ptr);
+ return (ptr);
}
/* realloc + error check */
-void *mm_realloc(void * ptr, size_t size)
+void *
+mm_realloc(void *ptr, size_t size)
{
- ptr = realloc(ptr, size);
+ ptr = realloc(ptr, size);
- if (ptr == NULL)
- {
- fprintf(stderr, "Out of memory\n");
- exit(1);
- }
+ if (ptr == NULL)
+ {
+ fprintf(stderr, "Out of memory\n");
+ exit(1);
+ }
- return (ptr);
+ return (ptr);
}
/* Constructors
@@ -38,75 +40,76 @@ void *mm_realloc(void * ptr, size_t size)
/* The NAME argument is copied. The type argument is preserved as a pointer. */
struct ECPGrecord_member *
-ECPGmake_record_member(char *name, struct ECPGtype *type, struct ECPGrecord_member **start)
+ECPGmake_record_member(char *name, struct ECPGtype * type, struct ECPGrecord_member ** start)
{
- struct ECPGrecord_member *ptr, *ne =
- (struct ECPGrecord_member *) mm_alloc(sizeof(struct ECPGrecord_member));
+ struct ECPGrecord_member *ptr,
+ *ne =
+ (struct ECPGrecord_member *) mm_alloc(sizeof(struct ECPGrecord_member));
- ne->name = strdup(name);
- ne->typ = type;
- ne->next = NULL;
+ ne->name = strdup(name);
+ ne->typ = type;
+ ne->next = NULL;
- for (ptr = *start; ptr && ptr->next; ptr = ptr->next);
+ for (ptr = *start; ptr && ptr->next; ptr = ptr->next);
- if (ptr)
- ptr->next=ne;
- else
- *start=ne;
- return ne;
+ if (ptr)
+ ptr->next = ne;
+ else
+ *start = ne;
+ return ne;
}
struct ECPGtype *
ECPGmake_simple_type(enum ECPGttype typ, long siz)
{
- struct ECPGtype *ne = (struct ECPGtype *) mm_alloc(sizeof(struct ECPGtype));
+ struct ECPGtype *ne = (struct ECPGtype *) mm_alloc(sizeof(struct ECPGtype));
- ne->typ = typ;
- ne->size = siz;
- ne->u.element = 0;
+ ne->typ = typ;
+ ne->size = siz;
+ ne->u.element = 0;
- return ne;
+ return ne;
}
struct ECPGtype *
ECPGmake_varchar_type(enum ECPGttype typ, long siz)
{
- struct ECPGtype *ne = ECPGmake_simple_type(typ, 1);
+ struct ECPGtype *ne = ECPGmake_simple_type(typ, 1);
- ne->size = siz;
+ ne->size = siz;
- return ne;
+ return ne;
}
struct ECPGtype *
-ECPGmake_array_type(struct ECPGtype *typ, long siz)
+ECPGmake_array_type(struct ECPGtype * typ, long siz)
{
- struct ECPGtype *ne = ECPGmake_simple_type(ECPGt_array, siz);
+ struct ECPGtype *ne = ECPGmake_simple_type(ECPGt_array, siz);
- ne->size = siz;
- ne->u.element = typ;
+ ne->size = siz;
+ ne->u.element = typ;
- return ne;
+ return ne;
}
struct ECPGtype *
-ECPGmake_record_type(struct ECPGrecord_member *rm)
+ECPGmake_record_type(struct ECPGrecord_member * rm)
{
- struct ECPGtype *ne = ECPGmake_simple_type(ECPGt_record, 1);
+ struct ECPGtype *ne = ECPGmake_simple_type(ECPGt_record, 1);
- ne->u.members = rm;
+ ne->u.members = rm;
- return ne;
+ return ne;
}
/* Dump a type.
The type is dumped as:
- type-tag <comma> - enum ECPGttype
+ type-tag <comma> - enum ECPGttype
reference-to-variable <comma> - void *
- size <comma> - long size of this field (if varchar)
- arrsize <comma> - long number of elements in the arr
- offset <comma> - offset to the next element
+ size <comma> - long size of this field (if varchar)
+ arrsize <comma> - long number of elements in the arr
+ offset <comma> - offset to the next element
Where:
type-tag is one of the simple types or varchar.
reference-to-variable can be a reference to a struct element.
@@ -114,47 +117,49 @@ ECPGmake_record_type(struct ECPGrecord_member *rm)
size is the maxsize in case it is a varchar. Otherwise it is the size of
the variable (required to do array fetches of records).
*/
-void ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype typ,
- long varcharsize,
- long arrsiz, const char *siz, const char *prefix);
-void ECPGdump_a_record(FILE *o, const char *name, long arrsiz,
- struct ECPGtype *typ, const char *offset, const char *prefix);
+void
+ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype typ,
+ long varcharsize,
+ long arrsiz, const char *siz, const char *prefix);
+void
+ECPGdump_a_record(FILE *o, const char *name, long arrsiz,
+ struct ECPGtype * typ, const char *offset, const char *prefix);
void
-ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype *typ, const char *prefix)
+ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * typ, const char *prefix)
{
- if (IS_SIMPLE_TYPE(typ->typ))
- {
- ECPGdump_a_simple(o, name, typ->typ, typ->size, 0, 0, prefix);
- }
- else if (typ->typ == ECPGt_array)
- {
- if (IS_SIMPLE_TYPE(typ->u.element->typ))
- ECPGdump_a_simple(o, name, typ->u.element->typ,
- typ->u.element->size, typ->size, 0, prefix);
- else if (typ->u.element->typ == ECPGt_array)
- {
- abort(); /* Array of array, */
- }
- else if (typ->u.element->typ == ECPGt_record)
- {
- /* Array of records. */
- ECPGdump_a_record(o, name, typ->size, typ->u.element, 0, prefix);
- }
- else
- {
- abort();
- }
- }
- else if (typ->typ == ECPGt_record)
- {
- ECPGdump_a_record(o, name, 0, typ, 0, prefix);
- }
- else
- {
- abort();
- }
+ if (IS_SIMPLE_TYPE(typ->typ))
+ {
+ ECPGdump_a_simple(o, name, typ->typ, typ->size, 0, 0, prefix);
+ }
+ else if (typ->typ == ECPGt_array)
+ {
+ if (IS_SIMPLE_TYPE(typ->u.element->typ))
+ ECPGdump_a_simple(o, name, typ->u.element->typ,
+ typ->u.element->size, typ->size, 0, prefix);
+ else if (typ->u.element->typ == ECPGt_array)
+ {
+ abort(); /* Array of array, */
+ }
+ else if (typ->u.element->typ == ECPGt_record)
+ {
+ /* Array of records. */
+ ECPGdump_a_record(o, name, typ->size, typ->u.element, 0, prefix);
+ }
+ else
+ {
+ abort();
+ }
+ }
+ else if (typ->typ == ECPGt_record)
+ {
+ ECPGdump_a_record(o, name, 0, typ, 0, prefix);
+ }
+ else
+ {
+ abort();
+ }
}
@@ -162,163 +167,170 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype *typ, const char *pre
string, it represents the offset needed if we are in an array of records. */
void
ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype typ,
- long varcharsize,
- long arrsiz,
- const char *siz,
- const char *prefix)
+ long varcharsize,
+ long arrsiz,
+ const char *siz,
+ const char *prefix)
{
- switch (typ)
- {
- case ECPGt_char:
- if (varcharsize == 0) /* pointer */
- fprintf(o, "\n\tECPGt_char,%s%s,%ldL,%ldL,%s, ", prefix ? prefix : "", name, varcharsize, arrsiz,
- siz == NULL ? "sizeof(char)" : siz);
- else
- fprintf(o, "\n\tECPGt_char,&%s%s,%ldL,%ldL,%s, ", prefix ? prefix : "", name, varcharsize, arrsiz,
- siz == NULL ? "sizeof(char)" : siz);
- break;
- case ECPGt_unsigned_char:
- if (varcharsize == 0) /* pointer */
- fprintf(o, "\n\tECPGt_unsigned_char,%s%s,%ldL,%ldL,%s, ", prefix ? prefix : "", name, varcharsize, arrsiz,
- siz == NULL ? "sizeof(char)" : siz);
- else
- fprintf(o, "\n\tECPGt_unsigned_char,&%s%s,%ldL,%ldL,%s, ", prefix ? prefix : "", name, varcharsize, arrsiz,
- siz == NULL ? "sizeof(unsigned char)" : siz);
- break;
- case ECPGt_short:
- fprintf(o, "\n\tECPGt_short,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
- siz == NULL ? "sizeof(short)" : siz);
- break;
- case ECPGt_unsigned_short:
- fprintf(o,
- "\n\tECPGt_unsigned_short,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
- siz == NULL ? "sizeof(unsigned short)" : siz);
- break;
- case ECPGt_int:
- fprintf(o, "\n\tECPGt_int,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
- siz == NULL ? "sizeof(int)" : siz);
- break;
- case ECPGt_unsigned_int:
- fprintf(o, "\n\tECPGt_unsigned_int,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
- siz == NULL ? "sizeof(unsigned int)" : siz);
- break;
- case ECPGt_long:
- fprintf(o, "\n\tECPGt_long,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
- siz == NULL ? "sizeof(long)" : siz);
- break;
- case ECPGt_unsigned_long:
- fprintf(o, "\n\tECPGt_unsigned_int,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
- siz == NULL ? "sizeof(unsigned int)" : siz);
- break;
- case ECPGt_float:
- fprintf(o, "\n\tECPGt_float,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
- siz == NULL ? "sizeof(float)" : siz);
- break;
- case ECPGt_double:
- fprintf(o, "\n\tECPGt_double,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
- siz == NULL ? "sizeof(double)" : siz);
- break;
- case ECPGt_bool:
- fprintf(o, "\n\tECPGt_bool,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
- siz == NULL ? "sizeof(bool)" : siz);
- break;
- case ECPGt_varchar:
- case ECPGt_varchar2:
- if (siz == NULL)
- fprintf(o, "\n\tECPGt_varchar,&%s%s,%ldL,%ldL,sizeof(struct varchar_%s), ",
- prefix ? prefix : "", name,
- varcharsize,
- arrsiz, name);
- else
- fprintf(o, "\n\tECPGt_varchar,&%s%s,%ldL,%ldL,%s, ",
- prefix ? prefix : "", name,
- varcharsize,
- arrsiz, siz);
- break;
- default:
- abort();
- }
+ switch (typ)
+ {
+ case ECPGt_char:
+ if (varcharsize == 0) /* pointer */
+ fprintf(o, "\n\tECPGt_char,%s%s,%ldL,%ldL,%s, ", prefix ? prefix : "", name, varcharsize, arrsiz,
+ siz == NULL ? "sizeof(char)" : siz);
+ else
+ fprintf(o, "\n\tECPGt_char,&%s%s,%ldL,%ldL,%s, ", prefix ? prefix : "", name, varcharsize, arrsiz,
+ siz == NULL ? "sizeof(char)" : siz);
+ break;
+ case ECPGt_unsigned_char:
+ if (varcharsize == 0) /* pointer */
+ fprintf(o, "\n\tECPGt_unsigned_char,%s%s,%ldL,%ldL,%s, ", prefix ? prefix : "", name, varcharsize, arrsiz,
+ siz == NULL ? "sizeof(char)" : siz);
+ else
+ fprintf(o, "\n\tECPGt_unsigned_char,&%s%s,%ldL,%ldL,%s, ", prefix ? prefix : "", name, varcharsize, arrsiz,
+ siz == NULL ? "sizeof(unsigned char)" : siz);
+ break;
+ case ECPGt_short:
+ fprintf(o, "\n\tECPGt_short,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
+ siz == NULL ? "sizeof(short)" : siz);
+ break;
+ case ECPGt_unsigned_short:
+ fprintf(o,
+ "\n\tECPGt_unsigned_short,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
+ siz == NULL ? "sizeof(unsigned short)" : siz);
+ break;
+ case ECPGt_int:
+ fprintf(o, "\n\tECPGt_int,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
+ siz == NULL ? "sizeof(int)" : siz);
+ break;
+ case ECPGt_unsigned_int:
+ fprintf(o, "\n\tECPGt_unsigned_int,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
+ siz == NULL ? "sizeof(unsigned int)" : siz);
+ break;
+ case ECPGt_long:
+ fprintf(o, "\n\tECPGt_long,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
+ siz == NULL ? "sizeof(long)" : siz);
+ break;
+ case ECPGt_unsigned_long:
+ fprintf(o, "\n\tECPGt_unsigned_int,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
+ siz == NULL ? "sizeof(unsigned int)" : siz);
+ break;
+ case ECPGt_float:
+ fprintf(o, "\n\tECPGt_float,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
+ siz == NULL ? "sizeof(float)" : siz);
+ break;
+ case ECPGt_double:
+ fprintf(o, "\n\tECPGt_double,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
+ siz == NULL ? "sizeof(double)" : siz);
+ break;
+ case ECPGt_bool:
+ fprintf(o, "\n\tECPGt_bool,&%s%s,0L,%ldL,%s, ", prefix ? prefix : "", name, arrsiz,
+ siz == NULL ? "sizeof(bool)" : siz);
+ break;
+ case ECPGt_varchar:
+ case ECPGt_varchar2:
+ if (siz == NULL)
+ fprintf(o, "\n\tECPGt_varchar,&%s%s,%ldL,%ldL,sizeof(struct varchar_%s), ",
+ prefix ? prefix : "", name,
+ varcharsize,
+ arrsiz, name);
+ else
+ fprintf(o, "\n\tECPGt_varchar,&%s%s,%ldL,%ldL,%s, ",
+ prefix ? prefix : "", name,
+ varcharsize,
+ arrsiz, siz);
+ break;
+ default:
+ abort();
+ }
}
/* Penetrate a record and dump the contents. */
void
-ECPGdump_a_record(FILE *o, const char *name, long arrsiz, struct ECPGtype *typ, const char *offsetarg, const char *prefix)
+ECPGdump_a_record(FILE *o, const char *name, long arrsiz, struct ECPGtype * typ, const char *offsetarg, const char *prefix)
{
- /* If offset is NULL, then this is the first recursive level. If not then
- we are in a record in a record and the offset is used as offset.
- */
- struct ECPGrecord_member *p;
- char obuf[BUFSIZ];
- char pbuf[BUFSIZ];
- const char *offset;
-
- if (offsetarg == NULL)
- {
- sprintf(obuf, "sizeof(%s)", name);
- offset = obuf;
- }
- else
- {
- offset = offsetarg;
- }
-
- sprintf(pbuf, "%s%s.", prefix ? prefix : "", name);
- prefix = pbuf;
-
- for (p = typ->u.members; p; p=p->next)
- {
+
+ /*
+ * If offset is NULL, then this is the first recursive level. If not
+ * then we are in a record in a record and the offset is used as
+ * offset.
+ */
+ struct ECPGrecord_member *p;
+ char obuf[BUFSIZ];
+ char pbuf[BUFSIZ];
+ const char *offset;
+
+ if (offsetarg == NULL)
+ {
+ sprintf(obuf, "sizeof(%s)", name);
+ offset = obuf;
+ }
+ else
+ {
+ offset = offsetarg;
+ }
+
+ sprintf(pbuf, "%s%s.", prefix ? prefix : "", name);
+ prefix = pbuf;
+
+ for (p = typ->u.members; p; p = p->next)
+ {
#if 0
- if (IS_SIMPLE_TYPE(p->typ->typ))
- {
- sprintf(buf, "%s.%s", name, p->name);
- ECPGdump_a_simple(o, buf, p->typ->typ, p->typ->size,
- arrsiz, offset);
- }
- else if (p->typ->typ == ECPGt_array)
- {
- int i;
-
- for (i = 0; i < p->typ->size; i++)
- {
- if (IS_SIMPLE_TYPE(p->typ->u.element->typ))
- {
- /* sprintf(buf, "%s.%s[%d]", name, p->name, i); */
- sprintf(buf, "%s.%s", name, p->name);
- ECPGdump_a_simple(o, buf, p->typ->u.element->typ, p->typ->u.element->size,
- p->typ->u.element->size, offset);
- }
- else if (p->typ->u.element->typ == ECPGt_array)
- {
- /* Array within an array. NOT implemented. */
- abort();
- }
- else if (p->typ->u.element->typ == ECPGt_record)
- {
- /* Record within array within record. NOT implemented yet. */
- abort();
- }
- else
- {
- /* Unknown type */
- abort();
- }
- }
- }
- else if (p->typ->typ == ECPGt_record)
- {
- /* Record within a record */
- sprintf(buf, "%s.%s", name, p->name);
- ECPGdump_a_record(o, buf, arrsiz, p->typ, offset);
- }
- else
- {
- /* Unknown type */
- abort();
- }
+ if (IS_SIMPLE_TYPE(p->typ->typ))
+ {
+ sprintf(buf, "%s.%s", name, p->name);
+ ECPGdump_a_simple(o, buf, p->typ->typ, p->typ->size,
+ arrsiz, offset);
+ }
+ else if (p->typ->typ == ECPGt_array)
+ {
+ int i;
+
+ for (i = 0; i < p->typ->size; i++)
+ {
+ if (IS_SIMPLE_TYPE(p->typ->u.element->typ))
+ {
+ /* sprintf(buf, "%s.%s[%d]", name, p->name, i); */
+ sprintf(buf, "%s.%s", name, p->name);
+ ECPGdump_a_simple(o, buf, p->typ->u.element->typ, p->typ->u.element->size,
+ p->typ->u.element->size, offset);
+ }
+ else if (p->typ->u.element->typ == ECPGt_array)
+ {
+ /* Array within an array. NOT implemented. */
+ abort();
+ }
+ else if (p->typ->u.element->typ == ECPGt_record)
+ {
+
+ /*
+ * Record within array within record. NOT implemented
+ * yet.
+ */
+ abort();
+ }
+ else
+ {
+ /* Unknown type */
+ abort();
+ }
+ }
+ }
+ else if (p->typ->typ == ECPGt_record)
+ {
+ /* Record within a record */
+ sprintf(buf, "%s.%s", name, p->name);
+ ECPGdump_a_record(o, buf, arrsiz, p->typ, offset);
+ }
+ else
+ {
+ /* Unknown type */
+ abort();
+ }
#endif
ECPGdump_a_type(o, p->name, p->typ, prefix);
- }
+ }
}
@@ -326,43 +338,43 @@ ECPGdump_a_record(FILE *o, const char *name, long arrsiz, struct ECPGtype *typ,
anyway. Lets implement that last! */
void
-ECPGfree_record_member(struct ECPGrecord_member *rm)
+ECPGfree_record_member(struct ECPGrecord_member * rm)
{
- while (rm)
- {
- struct ECPGrecord_member *p = rm;
-
- rm = rm->next;
- free(p->name);
- free(p);
- }
+ while (rm)
+ {
+ struct ECPGrecord_member *p = rm;
+
+ rm = rm->next;
+ free(p->name);
+ free(p);
+ }
}
void
-ECPGfree_type(struct ECPGtype *typ)
+ECPGfree_type(struct ECPGtype * typ)
{
- if (!IS_SIMPLE_TYPE(typ->typ))
- {
- if (typ->typ == ECPGt_array)
- {
- if (IS_SIMPLE_TYPE(typ->u.element->typ))
- free(typ->u.element);
- else if (typ->u.element->typ == ECPGt_array)
- abort(); /* Array of array, */
- else if (typ->u.element->typ == ECPGt_record)
- /* Array of records. */
- ECPGfree_record_member(typ->u.members);
- else
- abort();
- }
- else if (typ->typ == ECPGt_record)
- {
- ECPGfree_record_member(typ->u.members);
- }
- else
- {
- abort();
- }
- }
- free(typ);
+ if (!IS_SIMPLE_TYPE(typ->typ))
+ {
+ if (typ->typ == ECPGt_array)
+ {
+ if (IS_SIMPLE_TYPE(typ->u.element->typ))
+ free(typ->u.element);
+ else if (typ->u.element->typ == ECPGt_array)
+ abort(); /* Array of array, */
+ else if (typ->u.element->typ == ECPGt_record)
+ /* Array of records. */
+ ECPGfree_record_member(typ->u.members);
+ else
+ abort();
+ }
+ else if (typ->typ == ECPGt_record)
+ {
+ ECPGfree_record_member(typ->u.members);
+ }
+ else
+ {
+ abort();
+ }
+ }
+ free(typ);
}
diff --git a/src/interfaces/ecpg/preproc/type.h b/src/interfaces/ecpg/preproc/type.h
index 8ff6ed1b9c2..69bea16b52d 100644
--- a/src/interfaces/ecpg/preproc/type.h
+++ b/src/interfaces/ecpg/preproc/type.h
@@ -1,36 +1,39 @@
#include <ecpgtype.h>
struct ECPGtype;
-struct ECPGrecord_member {
- char * name;
- struct ECPGtype * typ;
- struct ECPGrecord_member * next;
+struct ECPGrecord_member
+{
+ char *name;
+ struct ECPGtype *typ;
+ struct ECPGrecord_member *next;
};
-struct ECPGtype {
- enum ECPGttype typ;
- long size; /* For array it is the number of elements.
- * For varchar it is the maxsize of the area.
- */
- union {
- struct ECPGtype * element; /* For an array this is the type of the
- * element */
+struct ECPGtype
+{
+ enum ECPGttype typ;
+ long size; /* For array it is the number of elements.
+ * For varchar it is the maxsize of the
+ * area. */
+ union
+ {
+ struct ECPGtype *element; /* For an array this is the type
+ * of the element */
- struct ECPGrecord_member * members;
- /* A pointer to a list of members. */
- } u;
+ struct ECPGrecord_member *members;
+ /* A pointer to a list of members. */
+ } u;
};
/* Everything is malloced. */
-struct ECPGrecord_member * ECPGmake_record_member(char *, struct ECPGtype *, struct ECPGrecord_member **);
-struct ECPGtype * ECPGmake_simple_type(enum ECPGttype, long);
-struct ECPGtype * ECPGmake_varchar_type(enum ECPGttype, long);
-struct ECPGtype * ECPGmake_array_type(struct ECPGtype *, long);
-struct ECPGtype * ECPGmake_record_type(struct ECPGrecord_member *);
+struct ECPGrecord_member *ECPGmake_record_member(char *, struct ECPGtype *, struct ECPGrecord_member **);
+struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, long);
+struct ECPGtype *ECPGmake_varchar_type(enum ECPGttype, long);
+struct ECPGtype *ECPGmake_array_type(struct ECPGtype *, long);
+struct ECPGtype *ECPGmake_record_type(struct ECPGrecord_member *);
/* Frees a type. */
-void ECPGfree_record_member(struct ECPGrecord_member *);
-void ECPGfree_type(struct ECPGtype *);
+void ECPGfree_record_member(struct ECPGrecord_member *);
+void ECPGfree_type(struct ECPGtype *);
/* Dump a type.
The type is dumped as:
@@ -39,32 +42,34 @@ void ECPGfree_type(struct ECPGtype *);
type-tag is one of the simple types or varchar.
reference-to-variable can be a reference to a struct element.
arrsize is the size of the array in case of array fetches. Otherwise 0.
- size is the maxsize in case it is a varchar. Otherwise it is the size of
- the variable (required to do array fetches of records).
+ size is the maxsize in case it is a varchar. Otherwise it is the size of
+ the variable (required to do array fetches of records).
*/
-void ECPGdump_a_type(FILE *, const char * name, struct ECPGtype *, const char *);
+void ECPGdump_a_type(FILE *, const char *name, struct ECPGtype *, const char *);
/* A simple struct to keep a variable and its type. */
-struct ECPGtemp_type {
- struct ECPGtype * typ;
- const char * name;
+struct ECPGtemp_type
+{
+ struct ECPGtype *typ;
+ const char *name;
};
-extern const char * ECPGtype_name(enum ECPGttype typ);
+extern const char *ECPGtype_name(enum ECPGttype typ);
/* some stuff for whenever statements */
-enum WHEN {
- W_NOTHING,
- W_CONTINUE,
- W_BREAK,
- W_SQLPRINT,
- W_GOTO,
- W_DO,
- W_STOP
+enum WHEN
+{
+ W_NOTHING,
+ W_CONTINUE,
+ W_BREAK,
+ W_SQLPRINT,
+ W_GOTO,
+ W_DO,
+ W_STOP
};
struct when
-{
- enum WHEN code;
- char * str;
+{
+ enum WHEN code;
+ char *str;
};
diff --git a/src/interfaces/ecpg/test/Ptest1.c b/src/interfaces/ecpg/test/Ptest1.c
index 5aee48e7d5c..5418e2c1a40 100644
--- a/src/interfaces/ecpg/test/Ptest1.c
+++ b/src/interfaces/ecpg/test/Ptest1.c
@@ -3,62 +3,75 @@
#include <ecpglib.h>
/* exec sql begin declare section */
- /* VARSIZE */struct varchar_uid { int len; char arr[200]; } uid;
- struct varchar_name { int len; char arr[200]; } name;
- short value;
+ /* VARSIZE */ struct varchar_uid
+{
+ int len;
+ char arr[200];
+} uid;
+struct varchar_name
+{
+ int len;
+ char arr[200];
+} name;
+short value;
+
/* exec sql end declare section */
#include "sqlca.h"
-#define DBCP(x,y) strcpy(x.arr,y);x.len = strlen(x.arr)
-#define LENFIX(x) x.len=strlen(x.arr)
-#define STRFIX(x) x.arr[x.len]='\0'
-#define SQLCODE sqlca.sqlcode
+#define DBCP(x,y) strcpy(x.arr,y);x.len = strlen(x.arr)
+#define LENFIX(x) x.len=strlen(x.arr)
+#define STRFIX(x) x.arr[x.len]='\0'
+#define SQLCODE sqlca.sqlcode
void
-db_error (char *msg)
+db_error(char *msg)
{
sqlca.sqlerrm.sqlerrmc[sqlca.sqlerrm.sqlerrml] = '\0';
- printf ("%s: db error %s\n", msg, sqlca.sqlerrm.sqlerrmc);
- exit (1);
+ printf("%s: db error %s\n", msg, sqlca.sqlerrm.sqlerrmc);
+ exit(1);
}
int
-main ()
+main()
{
- strcpy (uid.arr, "test/test");
- LENFIX (uid);
+ strcpy(uid.arr, "test/test");
+ LENFIX(uid);
ECPGconnect("kom");
if (SQLCODE)
- db_error ("connect");
+ db_error("connect");
- strcpy (name.arr, "opt1");
- LENFIX (name);
+ strcpy(name.arr, "opt1");
+ LENFIX(name);
+
+ ECPGdo(__LINE__, "declare cur cursor for select name , value from pace_test ", ECPGt_EOIT, ECPGt_EORT);
+ if (SQLCODE)
+ db_error("declare");
- ECPGdo(__LINE__, "declare cur cursor for select name , value from pace_test ", ECPGt_EOIT, ECPGt_EORT );
- if (SQLCODE) db_error ("declare");
-
if (SQLCODE)
- db_error ("open");
+ db_error("open");
- while (1) {
- ECPGdo(__LINE__, "fetch in cur ", ECPGt_EOIT, ECPGt_varchar,&name,200,0,sizeof(struct varchar_name), ECPGt_short,&value,0,0,sizeof(short), ECPGt_EORT );
+ while (1)
+ {
+ ECPGdo(__LINE__, "fetch in cur ", ECPGt_EOIT, ECPGt_varchar, &name, 200, 0, sizeof(struct varchar_name), ECPGt_short, &value, 0, 0, sizeof(short), ECPGt_EORT);
if (SQLCODE)
break;
- STRFIX (name);
- printf ("%s\t%d\n", name.arr, value);
+ STRFIX(name);
+ printf("%s\t%d\n", name.arr, value);
}
if (SQLCODE < 0)
- db_error ("fetch");
+ db_error("fetch");
- ECPGdo(__LINE__, "close cur ", ECPGt_EOIT, ECPGt_EORT );
- if (SQLCODE) db_error ("close");
+ ECPGdo(__LINE__, "close cur ", ECPGt_EOIT, ECPGt_EORT);
+ if (SQLCODE)
+ db_error("close");
ECPGcommit(__LINE__);
- if (SQLCODE) db_error ("commit");
+ if (SQLCODE)
+ db_error("commit");
return (0);
}
diff --git a/src/interfaces/ecpg/test/test1.c b/src/interfaces/ecpg/test/test1.c
index 68d9dd53981..f2533d544d9 100644
--- a/src/interfaces/ecpg/test/test1.c
+++ b/src/interfaces/ecpg/test/test1.c
@@ -1,60 +1,72 @@
exec sql begin declare section;
-VARCHAR uid[200 /* VARSIZE */];
-varchar name[200];
-short value;
+VARCHAR uid[200 /* VARSIZE */ ];
+varchar name[200];
+short value;
exec sql end declare section;
exec sql include sqlca;
-#define DBCP(x,y) strcpy(x.arr,y);x.len = strlen(x.arr)
-#define LENFIX(x) x.len=strlen(x.arr)
-#define STRFIX(x) x.arr[x.len]='\0'
-#define SQLCODE sqlca.sqlcode
+#define DBCP(x,y) strcpy(x.arr,y);x.len = strlen(x.arr)
+#define LENFIX(x) x.len=strlen(x.arr)
+#define STRFIX(x) x.arr[x.len]='\0'
+#define SQLCODE sqlca.sqlcode
void
-db_error (char *msg)
+db_error(char *msg)
{
sqlca.sqlerrm.sqlerrmc[sqlca.sqlerrm.sqlerrml] = '\0';
- printf ("%s: db error %s\n", msg, sqlca.sqlerrm.sqlerrmc);
- exit (1);
+ printf("%s: db error %s\n", msg, sqlca.sqlerrm.sqlerrmc);
+ exit(1);
}
int
-main ()
+main()
{
- strcpy (uid.arr, "test/test");
- LENFIX (uid);
+ strcpy(uid.arr, "test/test");
+ LENFIX(uid);
+
+ exec sql connect 'kom';
- exec sql connect 'kom';
if (SQLCODE)
- db_error ("connect");
+ db_error("connect");
+
+ strcpy(name.arr, "opt1");
+ LENFIX(name);
- strcpy (name.arr, "opt1");
- LENFIX (name);
+ exec sql declare cur cursor for
+ select name,
+ value from pace_test;
- exec sql declare cur cursor for
- select name, value from pace_test;
- if (SQLCODE) db_error ("declare");
+ if (SQLCODE)
+ db_error("declare");
exec sql open cur;
+
if (SQLCODE)
- db_error ("open");
+ db_error("open");
+
+ while (1)
+ {
+ exec sql fetch in cur into:name,
+ : value;
- while (1) {
- exec sql fetch in cur into :name, :value;
if (SQLCODE)
break;
- STRFIX (name);
- printf ("%s\t%d\n", name.arr, value);
+ STRFIX(name);
+ printf("%s\t%d\n", name.arr, value);
}
if (SQLCODE < 0)
- db_error ("fetch");
+ db_error("fetch");
exec sql close cur;
- if (SQLCODE) db_error ("close");
- exec sql commit;
- if (SQLCODE) db_error ("commit");
+
+ if (SQLCODE)
+ db_error("close");
+ exec sql commit;
+
+ if (SQLCODE)
+ db_error("commit");
return (0);
}
diff --git a/src/interfaces/libpgtcl/pgtclCmds.c b/src/interfaces/libpgtcl/pgtclCmds.c
index ae14ae3a975..7f30db08183 100644
--- a/src/interfaces/libpgtcl/pgtclCmds.c
+++ b/src/interfaces/libpgtcl/pgtclCmds.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.20 1998/02/11 19:13:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.21 1998/02/26 04:44:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,7 +41,7 @@
static inline char *
translate_escape(char *p, int isArray)
{
- char c,
+ char c,
*q,
*s;
@@ -155,7 +155,7 @@ tcl_value(char *value)
{
int literal,
last;
- char *p;
+ char *p;
if (!value)
{
@@ -645,7 +645,7 @@ Pg_result(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
#ifdef TCL_ARRAYS
for (i = 0; i < PQnfields(result); i++)
{
- Tcl_AppendElement(interp, PQgetvalue(result,tupno,i));
+ Tcl_AppendElement(interp, PQgetvalue(result, tupno, i));
}
#else
/* Tcl_AppendResult(interp, PQgetvalue(result,tupno,0),NULL); */
@@ -1323,17 +1323,24 @@ Pg_select(ClientData cData, Tcl_Interp * interp, int argc, char **argv)
for (column = 0; column < ncols; column++)
{
- Tcl_SetVar2(interp, argv[3], info[column].cname,
- PQgetvalue(result, tupno, column), 0);
+ Tcl_SetVar2(interp, argv[3], info[column].cname,
+ PQgetvalue(result, tupno, column), 0);
}
Tcl_SetVar2(interp, argv[3], ".command", "update", 0);
if ((r = Tcl_Eval(interp, argv[4])) != TCL_OK && r != TCL_CONTINUE)
{
- if (r == TCL_BREAK) {
- /* I suppose that memory used by info and result must be released */
- free(info); PQclear(result);Tcl_UnsetVar(interp, argv[3], 0);
+ if (r == TCL_BREAK)
+ {
+
+ /*
+ * I suppose that memory used by info and result must be
+ * released
+ */
+ free(info);
+ PQclear(result);
+ Tcl_UnsetVar(interp, argv[3], 0);
return TCL_OK;
}
if (r == TCL_ERROR)
@@ -1345,7 +1352,9 @@ Pg_select(ClientData cData, Tcl_Interp * interp, int argc, char **argv)
Tcl_AddErrorInfo(interp, msg);
}
/* also, releasing memory used by info and result */
- free(info); PQclear(result);Tcl_UnsetVar(interp, argv[3], 0);
+ free(info);
+ PQclear(result);
+ Tcl_UnsetVar(interp, argv[3], 0);
return r;
}
}
diff --git a/src/interfaces/libpgtcl/pgtclId.c b/src/interfaces/libpgtcl/pgtclId.c
index 5b82ff1a51c..2473b6c3181 100644
--- a/src/interfaces/libpgtcl/pgtclId.c
+++ b/src/interfaces/libpgtcl/pgtclId.c
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.6 1997/09/08 21:55:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.7 1998/02/26 04:44:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,7 +49,7 @@ PgSetConnectionId(Pg_clientData * cd, char *id, PGconn *conn)
/*
* Get back the connection from the Id
*/
-PGconn *
+PGconn *
PgGetConnectionId(Pg_clientData * cd, char *id)
{
Tcl_HashEntry *hent;
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c
index 7f77589a6b9..93fb4442b05 100644
--- a/src/interfaces/libpq/fe-auth.c
+++ b/src/interfaces/libpq/fe-auth.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.14 1998/01/29 03:24:03 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.15 1998/02/26 04:44:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -477,14 +477,14 @@ pg_password_sendauth(PGconn *conn, const char *password, AuthRequest areq)
*/
int
fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
- const char *password, char *PQerrormsg)
+ const char *password, char *PQerrormsg)
{
switch (areq)
{
- case AUTH_REQ_OK:
- break;
+ case AUTH_REQ_OK:
+ break;
- case AUTH_REQ_KRB4:
+ case AUTH_REQ_KRB4:
#ifdef KRB4
if (pg_krb4_sendauth(PQerrormsg, conn->sock, &conn->laddr.in,
&conn->raddr.in,
@@ -496,12 +496,12 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
}
break;
#else
- (void)sprintf(PQerrormsg,
- "fe_sendauth: krb4 authentication not supported\n");
- return (STATUS_ERROR);
+ (void) sprintf(PQerrormsg,
+ "fe_sendauth: krb4 authentication not supported\n");
+ return (STATUS_ERROR);
#endif
- case AUTH_REQ_KRB5:
+ case AUTH_REQ_KRB5:
#ifdef KRB5
if (pg_krb5_sendauth(PQerrormsg, conn->sock, &conn->laddr.in,
&conn->raddr.in,
@@ -513,27 +513,27 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
}
break;
#else
- (void)sprintf(PQerrormsg,
- "fe_sendauth: krb5 authentication not supported\n");
- return (STATUS_ERROR);
+ (void) sprintf(PQerrormsg,
+ "fe_sendauth: krb5 authentication not supported\n");
+ return (STATUS_ERROR);
#endif
- case AUTH_REQ_PASSWORD:
- case AUTH_REQ_CRYPT:
- if (pg_password_sendauth(conn, password, areq) != STATUS_OK)
- {
- (void)sprintf(PQerrormsg,
- "fe_sendauth: error sending password authentication\n");
- return (STATUS_ERROR);
- }
+ case AUTH_REQ_PASSWORD:
+ case AUTH_REQ_CRYPT:
+ if (pg_password_sendauth(conn, password, areq) != STATUS_OK)
+ {
+ (void) sprintf(PQerrormsg,
+ "fe_sendauth: error sending password authentication\n");
+ return (STATUS_ERROR);
+ }
- break;
+ break;
- default:
- (void)sprintf(PQerrormsg,
- "fe_sendauth: authentication type %u not supported\n",areq);
- return (STATUS_ERROR);
- }
+ default:
+ (void) sprintf(PQerrormsg,
+ "fe_sendauth: authentication type %u not supported\n", areq);
+ return (STATUS_ERROR);
+ }
return (STATUS_OK);
}
@@ -580,7 +580,7 @@ fe_getauthsvc(char *PQerrormsg)
* name the user has authenticated to the system
* if there is an error, return the error message in PQerrormsg
*/
-char *
+char *
fe_getauthname(char *PQerrormsg)
{
char *name = (char *) NULL;
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index f9d856d207a..30f07927c60 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.62 1998/01/31 21:27:28 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.63 1998/02/26 04:44:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,7 +49,7 @@ static void closePGconn(PGconn *conn);
static int conninfo_parse(const char *conninfo, char *errorMessage);
static char *conninfo_getval(char *keyword);
static void conninfo_free(void);
-void PQsetenv(PGconn *conn);
+void PQsetenv(PGconn *conn);
#define NOTIFYLIST_INITIAL_SIZE 10
#define NOTIFYLIST_GROWBY 10
@@ -114,15 +114,29 @@ struct EnvironmentOptions
{
/* common user-interface settings */
- { "PGDATESTYLE", "datestyle" },
- { "PGTZ", "timezone" },
+ {
+ "PGDATESTYLE", "datestyle"
+ },
+ {
+ "PGTZ", "timezone"
+ },
/* internal performance-related settings */
- { "PGCOSTHEAP", "cost_heap" },
- { "PGCOSTINDEX", "cost_index" },
- { "PGRPLANS", "r_plans" },
- { "PGGEQO", "geqo" },
- { NULL }
+ {
+ "PGCOSTHEAP", "cost_heap"
+ },
+ {
+ "PGCOSTINDEX", "cost_index"
+ },
+ {
+ "PGRPLANS", "r_plans"
+ },
+ {
+ "PGGEQO", "geqo"
+ },
+ {
+ NULL
+ }
};
/* ----------------
@@ -149,7 +163,8 @@ PQconnectdb(const char *conninfo)
{
PGconn *conn;
char errorMessage[ERROR_MSG_LENGTH];
- char* tmp;
+ char *tmp;
+
/* ----------
* Allocate memory for the conn structure
* ----------
@@ -190,7 +205,7 @@ PQconnectdb(const char *conninfo)
tmp = conninfo_getval("port");
conn->pgport = tmp ? strdup(tmp) : NULL;
tmp = conninfo_getval("tty");
- conn->pgtty = tmp ? strdup(tmp) : NULL;
+ conn->pgtty = tmp ? strdup(tmp) : NULL;
tmp = conninfo_getval("options");
conn->pgoptions = tmp ? strdup(tmp) : NULL;
tmp = conninfo_getval("user");
@@ -291,7 +306,7 @@ PQconndefaults(void)
*
* ----------------
*/
-PGconn *
+PGconn *
PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, const char *pgtty, const char *dbName, const char *login, const char *pwd)
{
PGconn *conn;
@@ -399,8 +414,8 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, cons
conn->dbName = strdup(conn->pguser);
/*
- * if the database name is surrounded by double-quotes,
- * then don't convert case
+ * if the database name is surrounded by double-quotes, then
+ * don't convert case
*/
if (*conn->dbName == '"')
{
@@ -455,8 +470,8 @@ connectDB(PGconn *conn)
{
struct hostent *hp;
- StartupPacket sp;
- AuthRequest areq;
+ StartupPacket sp;
+ AuthRequest areq;
int laddrlen = sizeof(SockAddr);
int portno,
family,
@@ -466,9 +481,9 @@ connectDB(PGconn *conn)
* Initialize the startup packet.
*/
- MemSet((char *)&sp, 0, sizeof (StartupPacket));
+ MemSet((char *) &sp, 0, sizeof(StartupPacket));
- sp.protoVersion = (ProtocolVersion)htonl(PG_PROTOCOL_LATEST);
+ sp.protoVersion = (ProtocolVersion) htonl(PG_PROTOCOL_LATEST);
strncpy(sp.user, conn->pguser, SM_USER);
strncpy(sp.database, conn->dbName, SM_DATABASE);
@@ -491,7 +506,8 @@ connectDB(PGconn *conn)
conn->pghost);
goto connect_errReturn;
}
- } else
+ }
+ else
hp = NULL;
#if FALSE
@@ -572,7 +588,7 @@ connectDB(PGconn *conn)
/* Send the startup packet. */
- if (packetSend(conn, (char *)&sp, sizeof(StartupPacket)) != STATUS_OK)
+ if (packetSend(conn, (char *) &sp, sizeof(StartupPacket)) != STATUS_OK)
{
sprintf(conn->errorMessage,
"connectDB() -- couldn't send complete packet: errno=%d\n%s\n", errno, strerror(errno));
@@ -586,12 +602,12 @@ connectDB(PGconn *conn)
do
{
- int beresp;
+ int beresp;
if ((beresp = pqGetc(conn->Pfin, conn->Pfdebug)) == EOF)
{
- (void)sprintf(conn->errorMessage,
- "connectDB() -- error getting authentication request\n");
+ (void) sprintf(conn->errorMessage,
+ "connectDB() -- error getting authentication request\n");
goto connect_errReturn;
}
@@ -600,8 +616,8 @@ connectDB(PGconn *conn)
if (beresp == 'E')
{
- pqGets(conn->errorMessage, sizeof (conn->errorMessage),
- conn->Pfin, conn->Pfdebug);
+ pqGets(conn->errorMessage, sizeof(conn->errorMessage),
+ conn->Pfin, conn->Pfdebug);
goto connect_errReturn;
}
@@ -610,18 +626,18 @@ connectDB(PGconn *conn)
if (beresp != 'R')
{
- (void)sprintf(conn->errorMessage,
- "connectDB() -- expected authentication request\n");
+ (void) sprintf(conn->errorMessage,
+ "connectDB() -- expected authentication request\n");
goto connect_errReturn;
}
/* Get the type of request. */
- if (pqGetInt((int *)&areq, 4, conn->Pfin, conn->Pfdebug))
+ if (pqGetInt((int *) &areq, 4, conn->Pfin, conn->Pfdebug))
{
- (void)sprintf(conn->errorMessage,
- "connectDB() -- error getting authentication request type\n");
+ (void) sprintf(conn->errorMessage,
+ "connectDB() -- error getting authentication request type\n");
goto connect_errReturn;
}
@@ -629,11 +645,11 @@ connectDB(PGconn *conn)
/* Get the password salt if there is one. */
if (areq == AUTH_REQ_CRYPT &&
- pqGetnchar(conn->salt, sizeof (conn->salt),
- conn->Pfin, conn->Pfdebug))
+ pqGetnchar(conn->salt, sizeof(conn->salt),
+ conn->Pfin, conn->Pfdebug))
{
- (void)sprintf(conn->errorMessage,
- "connectDB() -- error getting password salt\n");
+ (void) sprintf(conn->errorMessage,
+ "connectDB() -- error getting password salt\n");
goto connect_errReturn;
}
@@ -642,7 +658,7 @@ connectDB(PGconn *conn)
/* Respond to the request. */
if (fe_sendauth(areq, conn, conn->pghost, conn->pgpass,
- conn->errorMessage) != STATUS_OK)
+ conn->errorMessage) != STATUS_OK)
goto connect_errReturn;
}
while (areq != AUTH_REQ_OK);
@@ -664,7 +680,7 @@ void
PQsetenv(PGconn *conn)
{
struct EnvironmentOptions *eo;
- char setQuery[80]; /* mjl: size okay? XXX */
+ char setQuery[80]; /* mjl: size okay? XXX */
for (eo = EnvironmentOptions; eo->envName; eo++)
{
@@ -679,13 +695,13 @@ PQsetenv(PGconn *conn)
else
sprintf(setQuery, "SET %s = '%.60s'", eo->pgName, val);
#ifdef CONNECTDEBUG
-printf("Use environment variable %s to send %s\n", eo->envName, setQuery);
+ printf("Use environment variable %s to send %s\n", eo->envName, setQuery);
#endif
res = PQexec(conn, setQuery);
- PQclear(res); /* Don't care? */
+ PQclear(res); /* Don't care? */
}
}
-} /* PQsetenv() */
+} /* PQsetenv() */
/*
* freePGconn
@@ -1095,7 +1111,7 @@ conninfo_free()
}
/* =========== accessor functions for PGconn ========= */
-char *
+char *
PQdb(PGconn *conn)
{
if (!conn)
@@ -1106,7 +1122,7 @@ PQdb(PGconn *conn)
return conn->dbName;
}
-char *
+char *
PQuser(PGconn *conn)
{
if (!conn)
@@ -1117,7 +1133,7 @@ PQuser(PGconn *conn)
return conn->pguser;
}
-char *
+char *
PQhost(PGconn *conn)
{
if (!conn)
@@ -1129,7 +1145,7 @@ PQhost(PGconn *conn)
return conn->pghost;
}
-char *
+char *
PQoptions(PGconn *conn)
{
if (!conn)
@@ -1140,7 +1156,7 @@ PQoptions(PGconn *conn)
return conn->pgoptions;
}
-char *
+char *
PQtty(PGconn *conn)
{
if (!conn)
@@ -1151,7 +1167,7 @@ PQtty(PGconn *conn)
return conn->pgtty;
}
-char *
+char *
PQport(PGconn *conn)
{
if (!conn)
@@ -1173,7 +1189,7 @@ PQstatus(PGconn *conn)
return conn->status;
}
-char *
+char *
PQerrorMessage(PGconn *conn)
{
if (!conn)
diff --git a/src/interfaces/libpq/fe-connect.h b/src/interfaces/libpq/fe-connect.h
index 53c9d8e2881..e1260be533e 100644
--- a/src/interfaces/libpq/fe-connect.h
+++ b/src/interfaces/libpq/fe-connect.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: fe-connect.h,v 1.7 1998/01/29 03:24:36 scrappy Exp $
+ * $Id: fe-connect.h,v 1.8 1998/02/26 04:45:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,6 @@
*----------------------------------------------------------------
*/
-int packetSend(PGconn *conn, const char *buf, size_t len);
+int packetSend(PGconn *conn, const char *buf, size_t len);
#endif /* FE_CONNECT_H */
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index b9517cebbf2..ffa15a6428c 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.46 1998/01/26 01:42:35 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.47 1998/02/26 04:45:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -457,10 +457,11 @@ process_response_from_backend(FILE *pfin, FILE *pfout, FILE *pfdebug,
{
/* hmm, no response from the backend-end, that's bad */
(void) sprintf(reason, "PQexec() -- Request was sent to backend"
- ", but backend closed the channel before responding."
- "\n\tThis probably means the backend terminated abnormally"
- " before or while processing the request.\n");
- conn->status = CONNECTION_BAD; /* No more connection to backend */
+ ", but backend closed the channel before responding."
+ "\n\tThis probably means the backend terminated abnormally"
+ " before or while processing the request.\n");
+ conn->status = CONNECTION_BAD; /* No more connection to
+ * backend */
*result_p = (PGresult *) NULL;
done = true;
}
@@ -1643,7 +1644,7 @@ PQnfields(PGresult *res)
/*
returns NULL if the field_num is invalid
*/
-char *
+char *
PQfname(PGresult *res, int field_num)
{
if (!res)
@@ -1756,7 +1757,7 @@ PQfsize(PGresult *res, int field_num)
return 0;
}
-char *
+char *
PQcmdStatus(PGresult *res)
{
if (!res)
@@ -1853,7 +1854,7 @@ PQcmdTuples(PGresult *res)
if res is not binary, a null-terminated ASCII string is returned.
*/
-char *
+char *
PQgetvalue(PGresult *res, int tup_num, int field_num)
{
if (!res)
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index d1c18ee05ae..8a16950cdcd 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.9 1998/01/26 01:42:36 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.10 1998/02/26 04:45:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,7 +65,7 @@ pqPutnchar(const char *s, int len, FILE *f, FILE *debug)
int
pqGetnchar(char *s, int len, FILE *f, FILE *debug)
{
- int status;
+ int status;
status = pqGetNBytes(s, len, f);
@@ -82,7 +82,7 @@ pqGetnchar(char *s, int len, FILE *f, FILE *debug)
int
pqGets(char *s, int len, FILE *f, FILE *debug)
{
- int status;
+ int status;
status = pqGetString(s, len, f);
diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h
index 9248ffc4d91..4d801efd153 100644
--- a/src/interfaces/libpq/libpq-fe.h
+++ b/src/interfaces/libpq/libpq-fe.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: libpq-fe.h,v 1.26 1998/02/24 06:04:55 scrappy Exp $
+ * $Id: libpq-fe.h,v 1.27 1998/02/26 04:45:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -138,10 +138,10 @@ extern "C"
FILE *Pfin;
FILE *Pfout;
FILE *Pfdebug;
- int sock; /* The socket */
- SockAddr laddr; /* Local address */
- SockAddr raddr; /* Remote address */
- char salt[2];
+ int sock; /* The socket */
+ SockAddr laddr; /* Local address */
+ SockAddr raddr; /* Remote address */
+ char salt[2];
int asyncNotifyWaiting;
Dllist *notifyList;
char *pguser; /* Postgres username of user who is
@@ -224,7 +224,7 @@ extern "C"
extern PGconn *PQconnectdb(const char *conninfo);
extern PQconninfoOption *PQconndefaults(void);
extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
- const char *pgtty, const char *dbName, const char *login, const char *pwd);
+ const char *pgtty, const char *dbName, const char *login, const char *pwd);
#define PQsetdb(M_PGHOST,M_PGPORT,M_PGOPT,M_PGTTY,M_DBNAME) PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, NULL, NULL)
/* close the current connection and free the PGconn data structure */
extern void PQfinish(PGconn *conn);
diff --git a/src/interfaces/python/pgmodule.c b/src/interfaces/python/pgmodule.c
index 1dbadb1fc08..44f4856e26f 100644
--- a/src/interfaces/python/pgmodule.c
+++ b/src/interfaces/python/pgmodule.c
@@ -3,27 +3,27 @@
* D'Arcy J.M. Cain, (darcy@druid.net). Based heavily on code written by
* Pascal Andre, andre@chimay.via.ecp.fr. Copyright (c) 1995, Pascal Andre
* (andre@via.ecp.fr).
- *
+ *
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without a written
* agreement is hereby granted, provided that the above copyright notice and
* this paragraph and the following two paragraphs appear in all copies or in
* any new file that contains a substantial portion of this file.
- *
+ *
* IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
* SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE
* AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE
* AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
* ENHANCEMENTS, OR MODIFICATIONS.
- *
+ *
* Further modifications copyright 1997 by D'Arcy J.M. Cain (darcy@druid.net)
* subject to the same terms and conditions as above.
- *
+ *
*/
#include <Python.h>
@@ -36,21 +36,21 @@ static PyObject *PGError;
/* taken from fileobject.c */
#define BUF(v) PyString_AS_STRING((PyStringObject *)(v))
-#define CHECK_OPEN 1
-#define CHECK_CLOSE 2
+#define CHECK_OPEN 1
+#define CHECK_CLOSE 2
#define MAX_BUFFER_SIZE 8192 /* maximum transaction size */
#ifndef NO_DIRECT
-#define DIRECT_ACCESS 1 /* enables direct access functions */
+#define DIRECT_ACCESS 1 /* enables direct access functions */
#endif /* NO_DIRECT */
#ifndef NO_LARGE
-#define LARGE_OBJECTS 1 /* enables large objects support */
+#define LARGE_OBJECTS 1 /* enables large objects support */
#endif /* NO_LARGE */
#ifndef NO_DEF_VAR
-#define DEFAULT_VARS 1 /* enables default variables use */
+#define DEFAULT_VARS 1 /* enables default variables use */
#endif /* NO_DEF_VAR */
/* --------------------------------------------------------------------- */
@@ -59,11 +59,11 @@ static PyObject *PGError;
#ifdef DEFAULT_VARS
-PyObject *pg_default_host; /* default database host */
-PyObject *pg_default_base; /* default database name */
-PyObject *pg_default_opt; /* default connection options */
-PyObject *pg_default_tty; /* default debug tty */
-PyObject *pg_default_port; /* default connection port */
+PyObject *pg_default_host; /* default database host */
+PyObject *pg_default_base; /* default database name */
+PyObject *pg_default_opt; /* default connection options */
+PyObject *pg_default_tty; /* default debug tty */
+PyObject *pg_default_port; /* default connection port */
#endif /* DEFAULT_VARS */
@@ -76,9 +76,9 @@ PyObject *pg_default_port; /* default connection port */
typedef struct
{
PyObject_HEAD
- int valid; /* validity flag */
- PGconn *cnx; /* PostGres connection handle */
-} pgobject;
+ int valid; /* validity flag */
+ PGconn *cnx; /* PostGres connection handle */
+} pgobject;
staticforward PyTypeObject PgType;
@@ -89,8 +89,8 @@ staticforward PyTypeObject PgType;
typedef struct
{
PyObject_HEAD
- PGresult *last_result; /* last result content */
-} pgqueryobject;
+ PGresult *last_result; /* last result content */
+} pgqueryobject;
staticforward PyTypeObject PgQueryType;
@@ -103,9 +103,9 @@ typedef struct
{
PyObject_HEAD
pgobject * pgcnx;
- Oid lo_oid;
- int lo_fd;
-} pglargeobject;
+ Oid lo_oid;
+ int lo_fd;
+} pglargeobject;
staticforward PyTypeObject PglargeType;
@@ -158,17 +158,17 @@ check_lo(pglargeobject * self, int level)
/* pglargeobject initialisation (from pgobject) */
/* creates large object */
-static PyObject *
+static PyObject *
pg_locreate(pgobject * self, PyObject * args)
{
- int mode;
- pglargeobject *npglo;
+ int mode;
+ pglargeobject *npglo;
/* gets arguments */
if (!PyArg_ParseTuple(args, "i", &mode))
{
PyErr_SetString(PyExc_TypeError,
- "locreate(mode), with mode (integer).");
+ "locreate(mode), with mode (integer).");
return NULL;
}
@@ -195,8 +195,8 @@ pg_locreate(pgobject * self, PyObject * args)
static PyObject *
pg_getlo(pgobject * self, PyObject * args)
{
- int lo_oid;
- pglargeobject *npglo;
+ int lo_oid;
+ pglargeobject *npglo;
/* gets arguments */
if (!PyArg_ParseTuple(args, "i", &lo_oid))
@@ -227,8 +227,8 @@ pg_getlo(pgobject * self, PyObject * args)
static PyObject *
pg_loimport(pgobject * self, PyObject * args)
{
- char *name;
- pglargeobject *npglo;
+ char *name;
+ pglargeobject *npglo;
/* gets arguments */
if (!PyArg_ParseTuple(args, "s", &name))
@@ -273,7 +273,8 @@ pglarge_dealloc(pglargeobject * self)
static PyObject *
pglarge_open(pglargeobject * self, PyObject * args)
{
- int mode, fd;
+ int mode,
+ fd;
/* check validity */
if (!check_lo(self, CHECK_CLOSE))
@@ -307,7 +308,7 @@ pglarge_close(pglargeobject * self, PyObject * args)
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method close() takes no parameters.");
+ "method close() takes no parameters.");
return NULL;
}
@@ -332,8 +333,8 @@ pglarge_close(pglargeobject * self, PyObject * args)
static PyObject *
pglarge_read(pglargeobject * self, PyObject * args)
{
- int size;
- PyObject *buffer;
+ int size;
+ PyObject *buffer;
/* checks validity */
if (!check_lo(self, CHECK_OPEN))
@@ -371,8 +372,8 @@ pglarge_read(pglargeobject * self, PyObject * args)
static PyObject *
pglarge_write(pglargeobject * self, PyObject * args)
{
- PyObject *buffer;
- int size;
+ PyObject *buffer;
+ int size;
/* checks validity */
if (!check_lo(self, CHECK_OPEN))
@@ -382,13 +383,13 @@ pglarge_write(pglargeobject * self, PyObject * args)
if (!PyArg_ParseTuple(args, "s", &buffer))
{
PyErr_SetString(PyExc_TypeError,
- "write(buffer), with buffer (sized string).");
+ "write(buffer), with buffer (sized string).");
return NULL;
}
/* sends query */
if ((size = lo_write(self->pgcnx->cnx, self->lo_fd, (char *) BUF(buffer),
- PyString_Size(buffer))) < PyString_Size(buffer))
+ PyString_Size(buffer))) < PyString_Size(buffer))
{
PyErr_SetString(PyExc_IOError, "buffer truncated during write.");
return NULL;
@@ -403,7 +404,9 @@ pglarge_write(pglargeobject * self, PyObject * args)
static PyObject *
pglarge_lseek(pglargeobject * self, PyObject * args)
{
- int ret, offset, whence;
+ int ret,
+ offset,
+ whence;
/* checks validity */
if (!check_lo(self, CHECK_OPEN))
@@ -413,7 +416,7 @@ pglarge_lseek(pglargeobject * self, PyObject * args)
if (!PyArg_ParseTuple(args, "ii", offset, whence))
{
PyErr_SetString(PyExc_TypeError,
- "lseek(offset, whence), with offset and whence (integers).");
+ "lseek(offset, whence), with offset and whence (integers).");
return NULL;
}
@@ -432,13 +435,14 @@ pglarge_lseek(pglargeobject * self, PyObject * args)
static PyObject *
pglarge_size(pglargeobject * self, PyObject * args)
{
- int start, end;
+ int start,
+ end;
/* checks args */
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method size() takes no parameters.");
+ "method size() takes no parameters.");
return NULL;
}
@@ -461,10 +465,10 @@ pglarge_size(pglargeobject * self, PyObject * args)
}
/* move back to start position */
- if ((start = lo_lseek(self->pgcnx->cnx,self->lo_fd,start,SEEK_SET)) == -1)
+ if ((start = lo_lseek(self->pgcnx->cnx, self->lo_fd, start, SEEK_SET)) == -1)
{
PyErr_SetString(PyExc_IOError,
- "error while moving back to first position.");
+ "error while moving back to first position.");
return NULL;
}
@@ -476,13 +480,13 @@ pglarge_size(pglargeobject * self, PyObject * args)
static PyObject *
pglarge_tell(pglargeobject * self, PyObject * args)
{
- int start;
+ int start;
/* checks args */
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method tell() takes no parameters.");
+ "method tell() takes no parameters.");
return NULL;
}
@@ -505,7 +509,7 @@ pglarge_tell(pglargeobject * self, PyObject * args)
static PyObject *
pglarge_export(pglargeobject * self, PyObject * args)
{
- char *name;
+ char *name;
/* checks validity */
if (!check_lo(self, CHECK_CLOSE))
@@ -515,7 +519,7 @@ pglarge_export(pglargeobject * self, PyObject * args)
if (!PyArg_ParseTuple(args, "s", &name))
{
PyErr_SetString(PyExc_TypeError,
- "export(filename), with filename (string).");
+ "export(filename), with filename (string).");
return NULL;
}
@@ -538,7 +542,7 @@ pglarge_unlink(pglargeobject * self, PyObject * args)
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method unlink() takes no parameters.");
+ "method unlink() takes no parameters.");
return NULL;
}
@@ -560,16 +564,17 @@ pglarge_unlink(pglargeobject * self, PyObject * args)
/* large object methods */
static struct PyMethodDef pglarge_methods[] = {
- {"open", (PyCFunction) pglarge_open, 1}, /* opens large object */
- {"close", (PyCFunction) pglarge_close, 1},/* closes large object */
- {"read", (PyCFunction) pglarge_read, 1}, /* reads from large object */
- {"write", (PyCFunction) pglarge_write, 1},/* writes to large object */
- {"seek", (PyCFunction) pglarge_lseek, 1},/* seeks position */
- {"size", (PyCFunction) pglarge_size, 1}, /* gives object size */
- {"tell", (PyCFunction) pglarge_tell, 1}, /* gives position in lobj */
- {"export", (PyCFunction) pglarge_export, 1},/* exports to unix file */
- {"unlink", (PyCFunction) pglarge_unlink, 1},/* deletes a large object */
- {NULL, NULL} /* sentinel */
+ {"open", (PyCFunction) pglarge_open, 1}, /* opens large object */
+ {"close", (PyCFunction) pglarge_close, 1}, /* closes large object */
+ {"read", (PyCFunction) pglarge_read, 1}, /* reads from large object */
+ {"write", (PyCFunction) pglarge_write, 1}, /* writes to large object */
+ {"seek", (PyCFunction) pglarge_lseek, 1}, /* seeks position */
+ {"size", (PyCFunction) pglarge_size, 1}, /* gives object size */
+ {"tell", (PyCFunction) pglarge_tell, 1}, /* gives position in lobj */
+ {"export", (PyCFunction) pglarge_export, 1}, /* exports to unix file */
+ {"unlink", (PyCFunction) pglarge_unlink, 1}, /* deletes a large
+ * object */
+ {NULL, NULL} /* sentinel */
};
/* get attribute */
@@ -608,7 +613,7 @@ pglarge_getattr(pglargeobject * self, char *name)
/* attributes list */
if (!strcmp(name, "__members__"))
{
- PyObject *list = PyList_New(3);
+ PyObject *list = PyList_New(3);
if (list)
{
@@ -626,22 +631,22 @@ pglarge_getattr(pglargeobject * self, char *name)
/* object type definition */
staticforward PyTypeObject PglargeType = {
PyObject_HEAD_INIT(&PyType_Type)
- 0, /* ob_size */
- "pglarge", /* tp_name */
- sizeof(pglargeobject), /* tp_basicsize */
- 0, /* tp_itemsize */
+ 0, /* ob_size */
+ "pglarge", /* tp_name */
+ sizeof(pglargeobject), /* tp_basicsize */
+ 0, /* tp_itemsize */
/* methods */
- (destructor) pglarge_dealloc, /* tp_dealloc */
- 0, /* tp_print */
- (getattrfunc) pglarge_getattr, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_compare */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
+ (destructor) pglarge_dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ (getattrfunc) pglarge_getattr, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_compare */
+ 0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
};
#endif /* LARGE_OBJECTS */
@@ -655,26 +660,29 @@ staticforward PyTypeObject PglargeType = {
static PyObject *
pgconnect(pgobject * self, PyObject * args, PyObject * dict)
{
- char *pghost, *pgopt, *pgtty, *pgdbname;
- int pgport;
- char port_buffer[20];
- PyObject *temp;
- pgobject *npgobj;
- PGconn *test_cnx;
+ char *pghost,
+ *pgopt,
+ *pgtty,
+ *pgdbname;
+ int pgport;
+ char port_buffer[20];
+ PyObject *temp;
+ pgobject *npgobj;
+ PGconn *test_cnx;
pghost = pgopt = pgtty = pgdbname = NULL;
pgport = -1;
/* parses standard arguments */
if (!PyArg_ParseTuple(args, "|zzlzz",
- &pgdbname, &pghost, &pgport, &pgopt, &pgtty))
+ &pgdbname, &pghost, &pgport, &pgopt, &pgtty))
{
PyErr_Clear();
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_TypeError,
- "connect(dbname, host, port, opt, tty), "
+ "connect(dbname, host, port, opt, tty), "
"with args (opt., strings or None).");
return NULL;
}
@@ -691,14 +699,14 @@ pgconnect(pgobject * self, PyObject * args, PyObject * dict)
if (pghost)
{
PyErr_SetString(PyExc_SyntaxError,
- "Duplicate argument definition.");
+ "Duplicate argument definition.");
return NULL;
}
if (!PyString_Check(temp))
{
PyErr_SetString(PyExc_TypeError,
- "'Host' argument must be a string.");
+ "'Host' argument must be a string.");
return NULL;
}
@@ -714,14 +722,14 @@ pgconnect(pgobject * self, PyObject * args, PyObject * dict)
if (pgport != -1)
{
PyErr_SetString(PyExc_SyntaxError,
- "Duplicate argument definition.");
+ "Duplicate argument definition.");
return NULL;
}
if (!PyInt_Check(temp))
{
PyErr_SetString(PyExc_TypeError,
- "'Port' argument must be an integer.");
+ "'Port' argument must be an integer.");
return NULL;
}
@@ -737,14 +745,14 @@ pgconnect(pgobject * self, PyObject * args, PyObject * dict)
if (pgtty)
{
PyErr_SetString(PyExc_SyntaxError,
- "Duplicate argument definition.");
+ "Duplicate argument definition.");
return NULL;
}
if (!PyString_Check(temp))
{
PyErr_SetString(PyExc_TypeError,
- "'opt' argument must be a string.");
+ "'opt' argument must be a string.");
return NULL;
}
@@ -760,14 +768,14 @@ pgconnect(pgobject * self, PyObject * args, PyObject * dict)
if (pgtty)
{
PyErr_SetString(PyExc_SyntaxError,
- "Duplicate argument definition.");
+ "Duplicate argument definition.");
return NULL;
}
if (!PyString_Check(temp))
{
PyErr_SetString(PyExc_TypeError,
- "'tty' argument must be a string.");
+ "'tty' argument must be a string.");
return NULL;
}
@@ -783,14 +791,14 @@ pgconnect(pgobject * self, PyObject * args, PyObject * dict)
if (pgdbname)
{
PyErr_SetString(PyExc_SyntaxError,
- "Duplicate argument definition.");
+ "Duplicate argument definition.");
return NULL;
}
if (!PyString_Check(temp))
{
PyErr_SetString(PyExc_TypeError,
- "'dbname' argument must be a string.");
+ "'dbname' argument must be a string.");
return NULL;
}
@@ -866,7 +874,7 @@ pg_reset(pgobject * self, PyObject * args)
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method reset() takes no parameters.");
+ "method reset() takes no parameters.");
return NULL;
}
@@ -880,15 +888,17 @@ pg_reset(pgobject * self, PyObject * args)
static PyObject *
pg_listfields(pgqueryobject * self, PyObject * args)
{
- int i, n;
- char *name;
- PyObject *fieldstuple, *str;
+ int i,
+ n;
+ char *name;
+ PyObject *fieldstuple,
+ *str;
/* checks args */
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method listfields() takes no parameters.");
+ "method listfields() takes no parameters.");
return NULL;
}
@@ -910,14 +920,14 @@ pg_listfields(pgqueryobject * self, PyObject * args)
static PyObject *
pg_fieldname(pgqueryobject * self, PyObject * args)
{
- int i;
- char *name;
+ int i;
+ char *name;
/* gets args */
if (!PyArg_ParseTuple(args, "i", &i))
{
PyErr_SetString(PyExc_TypeError,
- "fieldname(number), with number(integer).");
+ "fieldname(number), with number(integer).");
return NULL;
}
@@ -937,8 +947,8 @@ pg_fieldname(pgqueryobject * self, PyObject * args)
static PyObject *
pg_fieldnum(pgqueryobject * self, PyObject * args)
{
- char *name;
- int num;
+ char *name;
+ int num;
/* gets args */
if (!PyArg_ParseTuple(args, "s", &name))
@@ -961,14 +971,19 @@ pg_fieldnum(pgqueryobject * self, PyObject * args)
static PyObject *
pg_getresult(pgqueryobject * self, PyObject * args)
{
- PyObject *rowtuple, *reslist, *str;
- int i, j, m, n;
+ PyObject *rowtuple,
+ *reslist,
+ *str;
+ int i,
+ j,
+ m,
+ n;
/* checks args (args == NULL for an internal call) */
if ((args != NULL) && (!PyArg_ParseTuple(args, "")))
{
PyErr_SetString(PyExc_SyntaxError,
- "method getresult() takes no parameters.");
+ "method getresult() takes no parameters.");
return NULL;
}
@@ -998,20 +1013,25 @@ pg_getresult(pgqueryobject * self, PyObject * args)
static PyObject *
pg_getnotify(pgobject * self, PyObject * args)
{
- PGnotify *notify;
- PGresult *result;
- PyObject *notify_result, *temp;
+ PGnotify *notify;
+ PGresult *result;
+ PyObject *notify_result,
+ *temp;
/* checks args */
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method getnotify() takes no parameters.");
+ "method getnotify() takes no parameters.");
return NULL;
}
/* gets notify and builds result */
- /* notifies only come back as result of a query, so I send an empty query */
+
+ /*
+ * notifies only come back as result of a query, so I send an empty
+ * query
+ */
result = PQexec(self->cnx, " ");
if ((notify = PQnotifies(self->cnx)) != NULL)
@@ -1039,11 +1059,17 @@ pg_getnotify(pgobject * self, PyObject * args)
static PyObject *
pg_query(pgobject * self, PyObject * args)
{
- char *query;
- PGresult *result;
- PyObject *rowtuple, *reslist, *str;
- pgqueryobject *npgobj;
- int i, j, m, n, status;
+ char *query;
+ PGresult *result;
+ PyObject *rowtuple,
+ *reslist,
+ *str;
+ pgqueryobject *npgobj;
+ int i,
+ j,
+ m,
+ n,
+ status;
/* get query args */
if (!PyArg_ParseTuple(args, "s", &query))
@@ -1074,24 +1100,24 @@ pg_query(pgobject * self, PyObject * args)
break;
case PGRES_BAD_RESPONSE:
PyErr_SetString(PGError,
- "unexpected responsed received from server.");
+ "unexpected responsed received from server.");
break;
case PGRES_FATAL_ERROR:
PyErr_SetString(PGError,
- "server fatal error. "
- "Please report to your db administrator.");
+ "server fatal error. "
+ "Please report to your db administrator.");
break;
case PGRES_NONFATAL_ERROR:
PyErr_SetString(PGError, "server (non fatal) error.");
break;
- case PGRES_COMMAND_OK: /* no data will be received */
+ case PGRES_COMMAND_OK: /* no data will be received */
case PGRES_COPY_OUT:
case PGRES_COPY_IN:
Py_INCREF(Py_None);
return Py_None;
default:
PyErr_SetString(PGError, "internal error: "
- "unknown result status.");
+ "unknown result status.");
break;
}
@@ -1111,7 +1137,7 @@ pg_query(pgobject * self, PyObject * args)
static PyObject *
pg_putline(pgobject * self, PyObject * args)
{
- char *line;
+ char *line;
/* reads args */
if (!PyArg_ParseTuple(args, "s", &line))
@@ -1130,15 +1156,15 @@ pg_putline(pgobject * self, PyObject * args)
static PyObject *
pg_getline(pgobject * self, PyObject * args)
{
- char *line;
- PyObject *str;
- int ret;
+ char *line;
+ PyObject *str;
+ int ret;
/* checks args */
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method getline() takes no parameters.");
+ "method getline() takes no parameters.");
return NULL;
}
@@ -1177,7 +1203,7 @@ pg_endcopy(pgobject * self, PyObject * args)
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method endcopy() takes no parameters.");
+ "method endcopy() takes no parameters.");
return NULL;
}
@@ -1186,16 +1212,17 @@ pg_endcopy(pgobject * self, PyObject * args)
Py_INCREF(Py_None);
return Py_None;
}
+
#endif /* DIRECT_ACCESS */
static PyObject *
-pg_print(pgqueryobject *self, FILE *fp, int flags)
+pg_print(pgqueryobject * self, FILE *fp, int flags)
{
- PQprintOpt op;
+ PQprintOpt op;
memset(&op, 0, sizeof(op));
- op.align = 1;
+ op.align = 1;
op.header = 1;
op.fieldSep = "|";
op.pager = 1;
@@ -1207,20 +1234,25 @@ pg_print(pgqueryobject *self, FILE *fp, int flags)
static PyObject *
pg_inserttable(pgobject * self, PyObject * args)
{
- PGresult *result;
- char *table, *buffer, *temp;
- char temp_buffer[256];
- PyObject *list, *sublist, *item;
- PyObject *(*getitem) (PyObject *, int);
- PyObject *(*getsubitem) (PyObject *, int);
- int i, j;
+ PGresult *result;
+ char *table,
+ *buffer,
+ *temp;
+ char temp_buffer[256];
+ PyObject *list,
+ *sublist,
+ *item;
+ PyObject *(*getitem) (PyObject *, int);
+ PyObject *(*getsubitem) (PyObject *, int);
+ int i,
+ j;
/* gets arguments */
if (!PyArg_ParseTuple(args, "sO:filter", &table, &list))
{
PyErr_SetString(PyExc_TypeError,
- "tableinsert(table, content), with table (string) "
- "and content (list).");
+ "tableinsert(table, content), with table (string) "
+ "and content (list).");
return NULL;
}
@@ -1232,7 +1264,7 @@ pg_inserttable(pgobject * self, PyObject * args)
else
{
PyErr_SetString(PyExc_TypeError,
- "second arg must be some kind of array.");
+ "second arg must be some kind of array.");
return NULL;
}
@@ -1242,7 +1274,7 @@ pg_inserttable(pgobject * self, PyObject * args)
if (!PyTuple_Check(sublist) && !PyList_Check(sublist))
{
PyErr_SetString(PyExc_TypeError,
- "second arg must contain some kind of arrays.");
+ "second arg must contain some kind of arrays.");
return NULL;
}
}
@@ -1284,7 +1316,7 @@ pg_inserttable(pgobject * self, PyObject * args)
PyArg_ParseTuple(item, "s", &temp);
else if (PyInt_Check(item))
{
- int k;
+ int k;
PyArg_ParseTuple(item, "i", &k);
sprintf(temp_buffer, "%d", k);
@@ -1292,7 +1324,7 @@ pg_inserttable(pgobject * self, PyObject * args)
}
else if (PyLong_Check(item))
{
- long k;
+ long k;
PyArg_ParseTuple(item, "l", &k);
sprintf(temp_buffer, "%ld", k);
@@ -1300,7 +1332,7 @@ pg_inserttable(pgobject * self, PyObject * args)
}
else if (PyFloat_Check(item))
{
- double k;
+ double k;
PyArg_ParseTuple(item, "d", &k);
sprintf(temp_buffer, "%g", k);
@@ -1310,8 +1342,8 @@ pg_inserttable(pgobject * self, PyObject * args)
{
free(buffer);
PyErr_SetString(PyExc_ValueError,
- "items must be strings, integers, "
- "longs or double (real).");
+ "items must be strings, integers, "
+ "longs or double (real).");
return NULL;
}
@@ -1340,21 +1372,21 @@ pg_inserttable(pgobject * self, PyObject * args)
/* connection object methods */
static struct PyMethodDef pgobj_methods[] = {
- {"query", (PyCFunction) pg_query, 1}, /* query method */
- {"reset", (PyCFunction) pg_reset, 1}, /* connection reset */
- {"getnotify", (PyCFunction) pg_getnotify, 1}, /* checks for notify */
- {"inserttable", (PyCFunction) pg_inserttable, 1}, /* table insert */
+ {"query", (PyCFunction) pg_query, 1}, /* query method */
+ {"reset", (PyCFunction) pg_reset, 1}, /* connection reset */
+ {"getnotify", (PyCFunction) pg_getnotify, 1}, /* checks for notify */
+ {"inserttable", (PyCFunction) pg_inserttable, 1}, /* table insert */
#ifdef DIRECT_ACCESS
- {"putline", (PyCFunction) pg_putline, 1}, /* direct access: putline */
- {"getline", (PyCFunction) pg_getline, 1}, /* direct access: getline */
- {"endcopy", (PyCFunction) pg_endcopy, 1}, /* direct access: endcopy */
+ {"putline", (PyCFunction) pg_putline, 1}, /* direct access: putline */
+ {"getline", (PyCFunction) pg_getline, 1}, /* direct access: getline */
+ {"endcopy", (PyCFunction) pg_endcopy, 1}, /* direct access: endcopy */
#endif /* DIRECT_ACCESS */
#ifdef LARGE_OBJECTS
- {"locreate", (PyCFunction) pg_locreate, 1}, /* creates large object */
- {"getlo", (PyCFunction) pg_getlo, 1}, /* get lo from oid */
- {"loimport", (PyCFunction) pg_loimport, 1}, /* imports lo from file */
+ {"locreate", (PyCFunction) pg_locreate, 1}, /* creates large object */
+ {"getlo", (PyCFunction) pg_getlo, 1}, /* get lo from oid */
+ {"loimport", (PyCFunction) pg_loimport, 1}, /* imports lo from file */
#endif /* LARGE_OBJECTS */
{NULL, NULL} /* sentinel */
@@ -1401,7 +1433,7 @@ pg_getattr(pgobject * self, char *name)
/* attributes list */
if (!strcmp(name, "__members__"))
{
- PyObject *list = PyList_New(8);
+ PyObject *list = PyList_New(8);
if (list)
{
@@ -1444,10 +1476,10 @@ staticforward PyTypeObject PgType = {
/* query object methods */
static struct PyMethodDef pgquery_methods[] = {
- {"getresult", (PyCFunction) pg_getresult, 1}, /* get last result */
- {"fieldname", (PyCFunction) pg_fieldname, 1}, /* get field name */
- {"fieldnum", (PyCFunction) pg_fieldnum, 1}, /* get field number */
- {"listfields", (PyCFunction) pg_listfields, 1}, /* list fields names */
+ {"getresult", (PyCFunction) pg_getresult, 1}, /* get last result */
+ {"fieldname", (PyCFunction) pg_fieldname, 1}, /* get field name */
+ {"fieldnum", (PyCFunction) pg_fieldnum, 1}, /* get field number */
+ {"listfields", (PyCFunction) pg_listfields, 1}, /* list fields names */
{NULL, NULL} /* sentinel */
};
@@ -1466,9 +1498,9 @@ staticforward PyTypeObject PgQueryType = {
sizeof(pgqueryobject), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
- (destructor) pg_querydealloc,/* tp_dealloc */
+ (destructor) pg_querydealloc, /* tp_dealloc */
(printfunc) pg_print, /* tp_print */
- (getattrfunc) pg_querygetattr,/* tp_getattr */
+ (getattrfunc) pg_querygetattr, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
@@ -1487,14 +1519,14 @@ staticforward PyTypeObject PgQueryType = {
#ifdef DEFAULT_VARS
/* gets default host */
-PyObject *
-pggetdefhost(PyObject *self, PyObject *args)
+PyObject *
+pggetdefhost(PyObject * self, PyObject * args)
{
/* checks args */
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method get_defhost() takes no parameter.");
+ "method get_defhost() takes no parameter.");
return NULL;
}
@@ -1503,17 +1535,17 @@ pggetdefhost(PyObject *self, PyObject *args)
}
/* sets default host */
-PyObject *
-pgsetdefhost(PyObject * self, PyObject *args)
+PyObject *
+pgsetdefhost(PyObject * self, PyObject * args)
{
- char *temp = NULL;
- PyObject *old;
+ char *temp = NULL;
+ PyObject *old;
/* gets arguments */
if (!PyArg_ParseTuple(args, "z", &temp))
{
PyErr_SetString(PyExc_TypeError,
- "set_defhost(name), with name (string/None).");
+ "set_defhost(name), with name (string/None).");
return NULL;
}
@@ -1532,14 +1564,14 @@ pgsetdefhost(PyObject * self, PyObject *args)
}
/* gets default base */
-PyObject *
-pggetdefbase(PyObject * self, PyObject *args)
+PyObject *
+pggetdefbase(PyObject * self, PyObject * args)
{
/* checks args */
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method get_defbase() takes no parameter.");
+ "method get_defbase() takes no parameter.");
return NULL;
}
@@ -1548,17 +1580,17 @@ pggetdefbase(PyObject * self, PyObject *args)
}
/* sets default base */
-PyObject *
-pgsetdefbase(PyObject * self, PyObject *args)
+PyObject *
+pgsetdefbase(PyObject * self, PyObject * args)
{
- char *temp = NULL;
- PyObject *old;
+ char *temp = NULL;
+ PyObject *old;
/* gets arguments */
if (!PyArg_ParseTuple(args, "z", &temp))
{
PyErr_SetString(PyExc_TypeError,
- "set_defbase(name), with name (string/None).");
+ "set_defbase(name), with name (string/None).");
return NULL;
}
@@ -1577,14 +1609,14 @@ pgsetdefbase(PyObject * self, PyObject *args)
}
/* gets default options */
-PyObject *
-pggetdefopt(PyObject * self, PyObject *args)
+PyObject *
+pggetdefopt(PyObject * self, PyObject * args)
{
/* checks args */
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method get_defopt() takes no parameter.");
+ "method get_defopt() takes no parameter.");
return NULL;
}
@@ -1593,17 +1625,17 @@ pggetdefopt(PyObject * self, PyObject *args)
}
/* sets default opt */
-PyObject *
-pgsetdefopt(PyObject * self, PyObject *args)
+PyObject *
+pgsetdefopt(PyObject * self, PyObject * args)
{
- char *temp = NULL;
- PyObject *old;
+ char *temp = NULL;
+ PyObject *old;
/* gets arguments */
if (!PyArg_ParseTuple(args, "z", &temp))
{
PyErr_SetString(PyExc_TypeError,
- "set_defopt(name), with name (string/None).");
+ "set_defopt(name), with name (string/None).");
return NULL;
}
@@ -1622,14 +1654,14 @@ pgsetdefopt(PyObject * self, PyObject *args)
}
/* gets default tty */
-PyObject *
-pggetdeftty(PyObject * self, PyObject *args)
+PyObject *
+pggetdeftty(PyObject * self, PyObject * args)
{
/* checks args */
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method get_deftty() takes no parameter.");
+ "method get_deftty() takes no parameter.");
return NULL;
}
@@ -1638,17 +1670,17 @@ pggetdeftty(PyObject * self, PyObject *args)
}
/* sets default tty */
-PyObject *
-pgsetdeftty(PyObject * self, PyObject *args)
+PyObject *
+pgsetdeftty(PyObject * self, PyObject * args)
{
- char *temp = NULL;
- PyObject *old;
+ char *temp = NULL;
+ PyObject *old;
/* gets arguments */
if (!PyArg_ParseTuple(args, "z", &temp))
{
PyErr_SetString(PyExc_TypeError,
- "set_deftty(name), with name (string/None).");
+ "set_deftty(name), with name (string/None).");
return NULL;
}
@@ -1667,16 +1699,16 @@ pgsetdeftty(PyObject * self, PyObject *args)
}
/* gets default port */
-PyObject *
-pggetdefport(PyObject * self, PyObject *args)
+PyObject *
+pggetdefport(PyObject * self, PyObject * args)
{
- char *temp;
+ char *temp;
/* checks args */
if (!PyArg_ParseTuple(args, ""))
{
PyErr_SetString(PyExc_SyntaxError,
- "method get_defport() takes no parameter.");
+ "method get_defport() takes no parameter.");
return NULL;
}
@@ -1685,18 +1717,19 @@ pggetdefport(PyObject * self, PyObject *args)
}
/* sets default port */
-PyObject *
-pgsetdefport(PyObject * self, PyObject *args)
+PyObject *
+pgsetdefport(PyObject * self, PyObject * args)
{
- long int port = -2;
- char buffer[64], *temp;
- PyObject *old;
+ long int port = -2;
+ char buffer[64],
+ *temp;
+ PyObject *old;
/* gets arguments */
if ((!PyArg_ParseTuple(args, "l", &port)) || (port < -1))
{
PyErr_SetString(PyExc_TypeError, "set_defport(port), with port "
- "(positive integer/-1).");
+ "(positive integer/-1).");
return NULL;
}
@@ -1719,29 +1752,31 @@ pgsetdefport(PyObject * self, PyObject *args)
/* List of functions defined in the module */
static struct PyMethodDef pg_methods[] = {
- {"connect", (PyCFunction) pgconnect, 3},/* connect to a postgres database */
+ {"connect", (PyCFunction) pgconnect, 3}, /* connect to a postgres
+ * database */
#ifdef DEFAULT_VARS
- {"get_defhost", pggetdefhost, 1}, /* gets default host */
- {"set_defhost", pgsetdefhost, 1}, /* sets default host */
- {"get_defbase", pggetdefbase, 1}, /* gets default base */
- {"set_defbase", pgsetdefbase, 1}, /* sets default base */
- {"get_defopt", pggetdefopt, 1}, /* gets default options */
- {"set_defopt", pgsetdefopt, 1}, /* sets default options */
- {"get_deftty", pggetdeftty, 1}, /* gets default debug tty */
- {"set_deftty", pgsetdeftty, 1}, /* sets default debug tty */
- {"get_defport", pggetdefport, 1}, /* gets default port */
- {"set_defport", pgsetdefport, 1}, /* sets default port */
+ {"get_defhost", pggetdefhost, 1}, /* gets default host */
+ {"set_defhost", pgsetdefhost, 1}, /* sets default host */
+ {"get_defbase", pggetdefbase, 1}, /* gets default base */
+ {"set_defbase", pgsetdefbase, 1}, /* sets default base */
+ {"get_defopt", pggetdefopt, 1}, /* gets default options */
+ {"set_defopt", pgsetdefopt, 1}, /* sets default options */
+ {"get_deftty", pggetdeftty, 1}, /* gets default debug tty */
+ {"set_deftty", pgsetdeftty, 1}, /* sets default debug tty */
+ {"get_defport", pggetdefport, 1}, /* gets default port */
+ {"set_defport", pgsetdefport, 1}, /* sets default port */
#endif /* DEFAULT_VARS */
{NULL, NULL} /* sentinel */
};
-static char pg__doc__[] = "Python interface to PostgreSQL DB";
+static char pg__doc__[] = "Python interface to PostgreSQL DB";
/* Initialization function for the module */
void
initpg(void)
{
- PyObject *mod, *dict;
+ PyObject *mod,
+ *dict;
/* Create the module and add the functions */
mod = Py_InitModule4("pg", pg_methods, pg__doc__, NULL, PYTHON_API_VERSION);
@@ -1765,11 +1800,16 @@ initpg(void)
#ifdef DEFAULT_VARS
/* prepares default values */
- Py_INCREF(Py_None); pg_default_host = Py_None;
- Py_INCREF(Py_None); pg_default_base = Py_None;
- Py_INCREF(Py_None); pg_default_opt = Py_None;
- Py_INCREF(Py_None); pg_default_port = Py_None;
- Py_INCREF(Py_None); pg_default_tty = Py_None;
+ Py_INCREF(Py_None);
+ pg_default_host = Py_None;
+ Py_INCREF(Py_None);
+ pg_default_base = Py_None;
+ Py_INCREF(Py_None);
+ pg_default_opt = Py_None;
+ Py_INCREF(Py_None);
+ pg_default_port = Py_None;
+ Py_INCREF(Py_None);
+ pg_default_tty = Py_None;
#endif /* DEFAULT_VARS */
/* Check for errors */
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 9c5d6a85c7e..8a01e6509a0 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -3,35 +3,35 @@
* procedural language (PL)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.1 1998/02/11 14:07:59 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.2 1998/02/26 04:46:10 momjian Exp $
*
- * This software is copyrighted by Jan Wieck - Hamburg.
+ * This software is copyrighted by Jan Wieck - Hamburg.
*
- * The author hereby grants permission to use, copy, modify,
- * distribute, and license this software and its documentation
- * for any purpose, provided that existing copyright notices are
- * retained in all copies and that this notice is included
- * verbatim in any distributions. No written agreement, license,
- * or royalty fee is required for any of the authorized uses.
- * Modifications to this software may be copyrighted by their
- * author and need not follow the licensing terms described
- * here, provided that the new terms are clearly indicated on
- * the first page of each file where they apply.
+ * The author hereby grants permission to use, copy, modify,
+ * distribute, and license this software and its documentation
+ * for any purpose, provided that existing copyright notices are
+ * retained in all copies and that this notice is included
+ * verbatim in any distributions. No written agreement, license,
+ * or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their
+ * author and need not follow the licensing terms described
+ * here, provided that the new terms are clearly indicated on
+ * the first page of each file where they apply.
*
- * IN NO EVENT SHALL THE AUTHOR OR DISTRIBUTORS BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
- * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS
- * SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN
- * IF THE AUTHOR HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
+ * IN NO EVENT SHALL THE AUTHOR OR DISTRIBUTORS BE LIABLE TO ANY
+ * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
+ * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS
+ * SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN
+ * IF THE AUTHOR HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
*
- * THE AUTHOR AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- * PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON
- * AN "AS IS" BASIS, AND THE AUTHOR AND DISTRIBUTORS HAVE NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- * ENHANCEMENTS, OR MODIFICATIONS.
+ * THE AUTHOR AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ * PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON
+ * AN "AS IS" BASIS, AND THE AUTHOR AND DISTRIBUTORS HAVE NO
+ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
+ * ENHANCEMENTS, OR MODIFICATIONS.
*
**********************************************************************/
@@ -60,32 +60,34 @@
/**********************************************************************
* The information we cache about loaded procedures
**********************************************************************/
-typedef struct pltcl_proc_desc {
- char *proname;
- FmgrInfo result_in_func;
- Oid result_in_elem;
- int result_in_len;
- int nargs;
- FmgrInfo arg_out_func[MAXFMGRARGS];
- Oid arg_out_elem[MAXFMGRARGS];
- int arg_out_len[MAXFMGRARGS];
- int arg_is_rel[MAXFMGRARGS];
-} pltcl_proc_desc;
+typedef struct pltcl_proc_desc
+{
+ char *proname;
+ FmgrInfo result_in_func;
+ Oid result_in_elem;
+ int result_in_len;
+ int nargs;
+ FmgrInfo arg_out_func[MAXFMGRARGS];
+ Oid arg_out_elem[MAXFMGRARGS];
+ int arg_out_len[MAXFMGRARGS];
+ int arg_is_rel[MAXFMGRARGS];
+} pltcl_proc_desc;
/**********************************************************************
* The information we cache about prepared and saved plans
**********************************************************************/
-typedef struct pltcl_query_desc {
- char qname[20];
- void *plan;
- int nargs;
- Oid *argtypes;
- FmgrInfo *arginfuncs;
- Oid *argtypelems;
- Datum *argvalues;
- int *arglen;
-} pltcl_query_desc;
+typedef struct pltcl_query_desc
+{
+ char qname[20];
+ void *plan;
+ int nargs;
+ Oid *argtypes;
+ FmgrInfo *arginfuncs;
+ Oid *argtypelems;
+ Datum *argvalues;
+ int *arglen;
+} pltcl_query_desc;
/************************************************************
@@ -98,23 +100,23 @@ typedef struct pltcl_query_desc {
* It's ugly - Jan
************************************************************/
#if defined(nextstep)
-#define sigjmp_buf jmp_buf
+#define sigjmp_buf jmp_buf
#define sigsetjmp(x,y) setjmp(x)
#define siglongjmp longjmp
#endif
-extern sigjmp_buf Warn_restart; /* in tcop/postgres.c */
+extern sigjmp_buf Warn_restart; /* in tcop/postgres.c */
/**********************************************************************
* Global data
**********************************************************************/
-static int pltcl_firstcall = 1;
-static int pltcl_call_level = 0;
-static int pltcl_restart_in_progress = 0;
-static Tcl_Interp *pltcl_hold_interp = NULL;
-static Tcl_Interp *pltcl_safe_interp = NULL;
-static Tcl_HashTable *pltcl_proc_hash = NULL;
-static Tcl_HashTable *pltcl_query_hash = NULL;
+static int pltcl_firstcall = 1;
+static int pltcl_call_level = 0;
+static int pltcl_restart_in_progress = 0;
+static Tcl_Interp *pltcl_hold_interp = NULL;
+static Tcl_Interp *pltcl_safe_interp = NULL;
+static Tcl_HashTable *pltcl_proc_hash = NULL;
+static Tcl_HashTable *pltcl_query_hash = NULL;
/**********************************************************************
* Forward declarations
@@ -124,169 +126,191 @@ static void pltcl_init_safe_interp(void);
#ifdef PLTCL_UNKNOWN_SUPPORT
static void pltcl_init_load_unknown(void);
-#endif /* PLTCL_UNKNOWN_SUPPORT */
-Datum pltcl_call_handler(FmgrInfo *proinfo,
- FmgrValues *proargs, bool *isNull);
+#endif /* PLTCL_UNKNOWN_SUPPORT */
+
+Datum
+pltcl_call_handler(FmgrInfo *proinfo,
+ FmgrValues *proargs, bool *isNull);
-static Datum pltcl_func_handler(FmgrInfo *proinfo,
- FmgrValues *proargs, bool *isNull);
+static Datum
+pltcl_func_handler(FmgrInfo *proinfo,
+ FmgrValues *proargs, bool *isNull);
static HeapTuple pltcl_trigger_handler(FmgrInfo *proinfo);
-static int pltcl_elog(ClientData cdata, Tcl_Interp *interp,
- int argc, char *argv[]);
-static int pltcl_quote(ClientData cdata, Tcl_Interp *interp,
- int argc, char *argv[]);
-
-static int pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
- int argc, char *argv[]);
-static int pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
- int argc, char *argv[]);
-static int pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
- int argc, char *argv[]);
-
-static void pltcl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
- int tupno, HeapTuple tuple, TupleDesc tupdesc);
-static void pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
- Tcl_DString *retval);
-
+static int
+pltcl_elog(ClientData cdata, Tcl_Interp * interp,
+ int argc, char *argv[]);
+static int
+pltcl_quote(ClientData cdata, Tcl_Interp * interp,
+ int argc, char *argv[]);
+
+static int
+pltcl_SPI_exec(ClientData cdata, Tcl_Interp * interp,
+ int argc, char *argv[]);
+static int
+pltcl_SPI_prepare(ClientData cdata, Tcl_Interp * interp,
+ int argc, char *argv[]);
+static int
+pltcl_SPI_execp(ClientData cdata, Tcl_Interp * interp,
+ int argc, char *argv[]);
+
+static void
+pltcl_set_tuple_values(Tcl_Interp * interp, char *arrayname,
+ int tupno, HeapTuple tuple, TupleDesc tupdesc);
+static void
+pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
+ Tcl_DString * retval);
+
/**********************************************************************
* pltcl_init_all() - Initialize all
**********************************************************************/
static void
pltcl_init_all(void)
{
- Tcl_HashEntry *hashent;
- Tcl_HashSearch hashsearch;
- pltcl_proc_desc *prodesc;
- pltcl_query_desc *querydesc;
-
- /************************************************************
- * Do initialization only once
- ************************************************************/
- if (!pltcl_firstcall) return;
-
- /************************************************************
- * Create the dummy hold interpreter to prevent close of
- * stdout and stderr on DeleteInterp
- ************************************************************/
- if (pltcl_hold_interp == NULL) {
- if ((pltcl_hold_interp = Tcl_CreateInterp()) == NULL) {
- elog(ERROR, "pltcl: internal error - cannot create 'hold' "
- "interpreter");
- }
- }
-
- /************************************************************
- * Destroy the existing safe interpreter
- ************************************************************/
- if (pltcl_safe_interp != NULL) {
- Tcl_DeleteInterp(pltcl_safe_interp);
- pltcl_safe_interp = NULL;
- }
-
- /************************************************************
- * Free the proc hash table
- ************************************************************/
- if (pltcl_proc_hash != NULL) {
- hashent = Tcl_FirstHashEntry(pltcl_proc_hash, &hashsearch);
- while (hashent != NULL) {
- prodesc = (pltcl_proc_desc *)Tcl_GetHashValue(hashent);
- free(prodesc->proname);
- free(prodesc);
- hashent = Tcl_NextHashEntry(&hashsearch);
- }
- Tcl_DeleteHashTable(pltcl_proc_hash);
- free(pltcl_proc_hash);
- pltcl_proc_hash = NULL;
- }
-
- /************************************************************
- * Free the prepared query hash table
- ************************************************************/
- if (pltcl_query_hash != NULL) {
- hashent = Tcl_FirstHashEntry(pltcl_query_hash, &hashsearch);
- while (hashent != NULL) {
- querydesc = (pltcl_query_desc *)Tcl_GetHashValue(hashent);
- free(querydesc->argtypes);
- free(querydesc);
- hashent = Tcl_NextHashEntry(&hashsearch);
- }
- Tcl_DeleteHashTable(pltcl_query_hash);
- free(pltcl_query_hash);
- pltcl_query_hash = NULL;
- }
-
- /************************************************************
- * Now recreate a new safe interpreter
- ************************************************************/
- pltcl_init_safe_interp();
-
- pltcl_firstcall = 0;
- return;
+ Tcl_HashEntry *hashent;
+ Tcl_HashSearch hashsearch;
+ pltcl_proc_desc *prodesc;
+ pltcl_query_desc *querydesc;
+
+ /************************************************************
+ * Do initialization only once
+ ************************************************************/
+ if (!pltcl_firstcall)
+ return;
+
+ /************************************************************
+ * Create the dummy hold interpreter to prevent close of
+ * stdout and stderr on DeleteInterp
+ ************************************************************/
+ if (pltcl_hold_interp == NULL)
+ {
+ if ((pltcl_hold_interp = Tcl_CreateInterp()) == NULL)
+ {
+ elog(ERROR, "pltcl: internal error - cannot create 'hold' "
+ "interpreter");
+ }
+ }
+
+ /************************************************************
+ * Destroy the existing safe interpreter
+ ************************************************************/
+ if (pltcl_safe_interp != NULL)
+ {
+ Tcl_DeleteInterp(pltcl_safe_interp);
+ pltcl_safe_interp = NULL;
+ }
+
+ /************************************************************
+ * Free the proc hash table
+ ************************************************************/
+ if (pltcl_proc_hash != NULL)
+ {
+ hashent = Tcl_FirstHashEntry(pltcl_proc_hash, &hashsearch);
+ while (hashent != NULL)
+ {
+ prodesc = (pltcl_proc_desc *) Tcl_GetHashValue(hashent);
+ free(prodesc->proname);
+ free(prodesc);
+ hashent = Tcl_NextHashEntry(&hashsearch);
+ }
+ Tcl_DeleteHashTable(pltcl_proc_hash);
+ free(pltcl_proc_hash);
+ pltcl_proc_hash = NULL;
+ }
+
+ /************************************************************
+ * Free the prepared query hash table
+ ************************************************************/
+ if (pltcl_query_hash != NULL)
+ {
+ hashent = Tcl_FirstHashEntry(pltcl_query_hash, &hashsearch);
+ while (hashent != NULL)
+ {
+ querydesc = (pltcl_query_desc *) Tcl_GetHashValue(hashent);
+ free(querydesc->argtypes);
+ free(querydesc);
+ hashent = Tcl_NextHashEntry(&hashsearch);
+ }
+ Tcl_DeleteHashTable(pltcl_query_hash);
+ free(pltcl_query_hash);
+ pltcl_query_hash = NULL;
+ }
+
+ /************************************************************
+ * Now recreate a new safe interpreter
+ ************************************************************/
+ pltcl_init_safe_interp();
+
+ pltcl_firstcall = 0;
+ return;
}
/**********************************************************************
- * pltcl_init_safe_interp() - Create the safe Tcl interpreter
+ * pltcl_init_safe_interp() - Create the safe Tcl interpreter
**********************************************************************/
static void
pltcl_init_safe_interp(void)
{
- /************************************************************
- * Create the interpreter as a safe slave of the hold interp.
- ************************************************************/
- if ((pltcl_safe_interp =
- Tcl_CreateSlave(pltcl_hold_interp, "safe", 1)) == NULL) {
- elog(ERROR,
- "pltcl: internal error - cannot create 'safe' interpreter");
- }
-
- /************************************************************
- * Enable debugging output from the Tcl bytecode compiler
- * To see the trace, the interpreter must be created unsafe
- * USE ONLY FOR DEBUGGING!!!
- ************************************************************/
- /*
- Tcl_SetVar(pltcl_safe_interp, "tcl_traceCompile", "1", 0);
- */
-
- /************************************************************
- * Initialize the proc and query hash tables
- ************************************************************/
- pltcl_proc_hash = (Tcl_HashTable *)malloc(sizeof(Tcl_HashTable));
- pltcl_query_hash = (Tcl_HashTable *)malloc(sizeof(Tcl_HashTable));
- Tcl_InitHashTable(pltcl_proc_hash, TCL_STRING_KEYS);
- Tcl_InitHashTable(pltcl_query_hash, TCL_STRING_KEYS);
-
- /************************************************************
- * Install the commands for SPI support in the safe interpreter
- ************************************************************/
- Tcl_CreateCommand(pltcl_safe_interp, "elog",
- pltcl_elog, NULL, NULL);
- Tcl_CreateCommand(pltcl_safe_interp, "quote",
- pltcl_quote, NULL, NULL);
-
- Tcl_CreateCommand(pltcl_safe_interp, "spi_exec",
- pltcl_SPI_exec, NULL, NULL);
- Tcl_CreateCommand(pltcl_safe_interp, "spi_prepare",
- pltcl_SPI_prepare, NULL, NULL);
- Tcl_CreateCommand(pltcl_safe_interp, "spi_execp",
- pltcl_SPI_execp, NULL, NULL);
+ /************************************************************
+ * Create the interpreter as a safe slave of the hold interp.
+ ************************************************************/
+ if ((pltcl_safe_interp =
+ Tcl_CreateSlave(pltcl_hold_interp, "safe", 1)) == NULL)
+ {
+ elog(ERROR,
+ "pltcl: internal error - cannot create 'safe' interpreter");
+ }
+
+ /************************************************************
+ * Enable debugging output from the Tcl bytecode compiler
+ * To see the trace, the interpreter must be created unsafe
+ * USE ONLY FOR DEBUGGING!!!
+ ************************************************************/
+
+ /*
+ * Tcl_SetVar(pltcl_safe_interp, "tcl_traceCompile", "1", 0);
+ */
+
+ /************************************************************
+ * Initialize the proc and query hash tables
+ ************************************************************/
+ pltcl_proc_hash = (Tcl_HashTable *) malloc(sizeof(Tcl_HashTable));
+ pltcl_query_hash = (Tcl_HashTable *) malloc(sizeof(Tcl_HashTable));
+ Tcl_InitHashTable(pltcl_proc_hash, TCL_STRING_KEYS);
+ Tcl_InitHashTable(pltcl_query_hash, TCL_STRING_KEYS);
+
+ /************************************************************
+ * Install the commands for SPI support in the safe interpreter
+ ************************************************************/
+ Tcl_CreateCommand(pltcl_safe_interp, "elog",
+ pltcl_elog, NULL, NULL);
+ Tcl_CreateCommand(pltcl_safe_interp, "quote",
+ pltcl_quote, NULL, NULL);
+
+ Tcl_CreateCommand(pltcl_safe_interp, "spi_exec",
+ pltcl_SPI_exec, NULL, NULL);
+ Tcl_CreateCommand(pltcl_safe_interp, "spi_prepare",
+ pltcl_SPI_prepare, NULL, NULL);
+ Tcl_CreateCommand(pltcl_safe_interp, "spi_execp",
+ pltcl_SPI_execp, NULL, NULL);
#ifdef PLTCL_UNKNOWN_SUPPORT
- /************************************************************
- * Try to load the unknown procedure from pltcl_modules
- ************************************************************/
- if (SPI_connect() != SPI_OK_CONNECT) {
- elog(ERROR, "pltcl_init_safe_interp(): SPI_connect failed");
- }
- pltcl_init_load_unknown();
- if (SPI_finish() != SPI_OK_FINISH) {
- elog(ERROR, "pltcl_init_safe_interp(): SPI_finish failed");
- }
-#endif /* PLTCL_UNKNOWN_SUPPORT */
+ /************************************************************
+ * Try to load the unknown procedure from pltcl_modules
+ ************************************************************/
+ if (SPI_connect() != SPI_OK_CONNECT)
+ {
+ elog(ERROR, "pltcl_init_safe_interp(): SPI_connect failed");
+ }
+ pltcl_init_load_unknown();
+ if (SPI_finish() != SPI_OK_FINISH)
+ {
+ elog(ERROR, "pltcl_init_safe_interp(): SPI_finish failed");
+ }
+#endif /* PLTCL_UNKNOWN_SUPPORT */
}
@@ -299,68 +323,74 @@ pltcl_init_safe_interp(void)
static void
pltcl_init_load_unknown(void)
{
- int spi_rc;
- int tcl_rc;
- Tcl_DString unknown_src;
- char *part;
- int i;
- int fno;
-
- /************************************************************
- * Check if table pltcl_modules exists
- ************************************************************/
- spi_rc = SPI_exec("select 1 from pg_class "
- "where relname = 'pltcl_modules'", 1);
- if (spi_rc != SPI_OK_SELECT) {
- elog(ERROR, "pltcl_init_load_unknown(): select from pg_class failed");
- }
- if (SPI_processed == 0) {
- return;
- }
-
- /************************************************************
- * Read all the row's from it where modname = 'unknown' in
- * the order of modseq
- ************************************************************/
- Tcl_DStringInit(&unknown_src);
-
- spi_rc = SPI_exec("select modseq, modsrc from pltcl_modules "
- "where modname = 'unknown' "
- "order by modseq", 0);
- if (spi_rc != SPI_OK_SELECT) {
- elog(ERROR, "pltcl_init_load_unknown(): select from pltcl_modules "
- "failed");
- }
-
- /************************************************************
- * If there's nothing, module unknown doesn't exist
- ************************************************************/
- if (SPI_processed == 0) {
- Tcl_DStringFree(&unknown_src);
- elog(NOTICE, "pltcl: Module unknown not found in pltcl_modules");
- return;
- }
-
- /************************************************************
- * There is a module named unknown. Resemble the
- * source from the modsrc attributes and evaluate
- * it in the safe interpreter
- ************************************************************/
- fno = SPI_fnumber(SPI_tuptable->tupdesc, "modsrc");
-
- for (i = 0; i < SPI_processed; i++) {
- part = SPI_getvalue(SPI_tuptable->vals[i],
- SPI_tuptable->tupdesc, fno);
- if (part != NULL) {
- Tcl_DStringAppend(&unknown_src, part, -1);
- pfree(part);
- }
- }
- tcl_rc = Tcl_GlobalEval(pltcl_safe_interp, Tcl_DStringValue(&unknown_src));
- Tcl_DStringFree(&unknown_src);
+ int spi_rc;
+ int tcl_rc;
+ Tcl_DString unknown_src;
+ char *part;
+ int i;
+ int fno;
+
+ /************************************************************
+ * Check if table pltcl_modules exists
+ ************************************************************/
+ spi_rc = SPI_exec("select 1 from pg_class "
+ "where relname = 'pltcl_modules'", 1);
+ if (spi_rc != SPI_OK_SELECT)
+ {
+ elog(ERROR, "pltcl_init_load_unknown(): select from pg_class failed");
+ }
+ if (SPI_processed == 0)
+ {
+ return;
+ }
+
+ /************************************************************
+ * Read all the row's from it where modname = 'unknown' in
+ * the order of modseq
+ ************************************************************/
+ Tcl_DStringInit(&unknown_src);
+
+ spi_rc = SPI_exec("select modseq, modsrc from pltcl_modules "
+ "where modname = 'unknown' "
+ "order by modseq", 0);
+ if (spi_rc != SPI_OK_SELECT)
+ {
+ elog(ERROR, "pltcl_init_load_unknown(): select from pltcl_modules "
+ "failed");
+ }
+
+ /************************************************************
+ * If there's nothing, module unknown doesn't exist
+ ************************************************************/
+ if (SPI_processed == 0)
+ {
+ Tcl_DStringFree(&unknown_src);
+ elog(NOTICE, "pltcl: Module unknown not found in pltcl_modules");
+ return;
+ }
+
+ /************************************************************
+ * There is a module named unknown. Resemble the
+ * source from the modsrc attributes and evaluate
+ * it in the safe interpreter
+ ************************************************************/
+ fno = SPI_fnumber(SPI_tuptable->tupdesc, "modsrc");
+
+ for (i = 0; i < SPI_processed; i++)
+ {
+ part = SPI_getvalue(SPI_tuptable->vals[i],
+ SPI_tuptable->tupdesc, fno);
+ if (part != NULL)
+ {
+ Tcl_DStringAppend(&unknown_src, part, -1);
+ pfree(part);
+ }
+ }
+ tcl_rc = Tcl_GlobalEval(pltcl_safe_interp, Tcl_DStringValue(&unknown_src));
+ Tcl_DStringFree(&unknown_src);
}
-#endif /* PLTCL_UNKNOWN_SUPPORT */
+#endif /* PLTCL_UNKNOWN_SUPPORT */
/**********************************************************************
@@ -371,50 +401,56 @@ pltcl_init_load_unknown(void)
* PL/Tcl procedures.
**********************************************************************/
Datum
-pltcl_call_handler(FmgrInfo *proinfo,
- FmgrValues *proargs,
- bool *isNull)
+pltcl_call_handler(FmgrInfo *proinfo,
+ FmgrValues *proargs,
+ bool *isNull)
{
- Datum retval;
-
- /************************************************************
- * Initialize interpreters on first call
- ************************************************************/
- if (pltcl_firstcall) {
- pltcl_init_all();
- }
-
- /************************************************************
- * Connect to SPI manager
- ************************************************************/
- if (SPI_connect() != SPI_OK_CONNECT) {
- elog(ERROR, "pltcl: cannot connect to SPI manager");
- }
- /************************************************************
- * Keep track about the nesting of Tcl-SPI-Tcl-... calls
- ************************************************************/
- pltcl_call_level++;
-
- /************************************************************
- * Determine if called as function or trigger and
- * call appropriate subhandler
- ************************************************************/
- if (CurrentTriggerData == NULL) {
- retval = pltcl_func_handler(proinfo, proargs, isNull);
- } else {
- retval = (Datum)pltcl_trigger_handler(proinfo);
- }
-
- pltcl_call_level--;
-
- /************************************************************
- * Disconnect from SPI manager
- ************************************************************/
- if (SPI_finish() != SPI_OK_FINISH) {
- elog(ERROR, "pltcl: SPI_finish() failed");
- }
-
- return retval;
+ Datum retval;
+
+ /************************************************************
+ * Initialize interpreters on first call
+ ************************************************************/
+ if (pltcl_firstcall)
+ {
+ pltcl_init_all();
+ }
+
+ /************************************************************
+ * Connect to SPI manager
+ ************************************************************/
+ if (SPI_connect() != SPI_OK_CONNECT)
+ {
+ elog(ERROR, "pltcl: cannot connect to SPI manager");
+ }
+ /************************************************************
+ * Keep track about the nesting of Tcl-SPI-Tcl-... calls
+ ************************************************************/
+ pltcl_call_level++;
+
+ /************************************************************
+ * Determine if called as function or trigger and
+ * call appropriate subhandler
+ ************************************************************/
+ if (CurrentTriggerData == NULL)
+ {
+ retval = pltcl_func_handler(proinfo, proargs, isNull);
+ }
+ else
+ {
+ retval = (Datum) pltcl_trigger_handler(proinfo);
+ }
+
+ pltcl_call_level--;
+
+ /************************************************************
+ * Disconnect from SPI manager
+ ************************************************************/
+ if (SPI_finish() != SPI_OK_FINISH)
+ {
+ elog(ERROR, "pltcl: SPI_finish() failed");
+ }
+
+ return retval;
}
@@ -422,299 +458,327 @@ pltcl_call_handler(FmgrInfo *proinfo,
* pltcl_func_handler() - Handler for regular function calls
**********************************************************************/
static Datum
-pltcl_func_handler(FmgrInfo *proinfo,
- FmgrValues *proargs,
- bool *isNull)
+pltcl_func_handler(FmgrInfo *proinfo,
+ FmgrValues *proargs,
+ bool *isNull)
{
- int i;
- char internal_proname[512];
- char *stroid;
- Tcl_HashEntry *hashent;
- int hashnew;
- pltcl_proc_desc *prodesc;
- Tcl_DString tcl_cmd;
- Tcl_DString list_tmp;
- int tcl_rc;
- Datum retval;
- sigjmp_buf save_restart;
-
- /************************************************************
- * Build our internal proc name from the functions Oid
- ************************************************************/
- stroid = oidout(proinfo->fn_oid);
- strcpy(internal_proname, "__PLTcl_proc_");
- strcat(internal_proname, stroid);
- pfree(stroid);
-
- /************************************************************
- * Lookup the internal proc name in the hashtable
- ************************************************************/
- hashent = Tcl_FindHashEntry(pltcl_proc_hash, internal_proname);
- if (hashent == NULL) {
- /************************************************************
- * If we haven't found it in the hashtable, we analyze
- * the functions arguments and returntype and store
- * the in-/out-functions in the prodesc block and create
- * a new hashtable entry for it.
- *
- * Then we load the procedure into the safe interpreter.
- ************************************************************/
- HeapTuple procTup;
- HeapTuple typeTup;
- Form_pg_proc procStruct;
- TypeTupleForm typeStruct;
- Tcl_DString proc_internal_def;
- Tcl_DString proc_internal_body;
- char proc_internal_args[4096];
- char *proc_source;
- char buf[512];
-
- /************************************************************
- * Allocate a new procedure description block
- ************************************************************/
- prodesc = (pltcl_proc_desc *)malloc(sizeof(pltcl_proc_desc));
- prodesc->proname = malloc(strlen(internal_proname) + 1);
- strcpy(prodesc->proname, internal_proname);
-
- /************************************************************
- * Lookup the pg_proc tuple by Oid
- ************************************************************/
- procTup = SearchSysCacheTuple(PROOID,
- ObjectIdGetDatum(proinfo->fn_oid),
- 0, 0, 0);
- if (!HeapTupleIsValid(procTup)) {
- free(prodesc->proname);
- free(prodesc);
- elog(ERROR, "pltcl: cache lookup from pg_proc failed");
- }
- procStruct = (Form_pg_proc) GETSTRUCT(procTup);
-
- /************************************************************
- * Get the required information for input conversion of the
- * return value.
- ************************************************************/
- typeTup = SearchSysCacheTuple(TYPOID,
- ObjectIdGetDatum(procStruct->prorettype),
- 0, 0, 0);
- if (!HeapTupleIsValid(typeTup)) {
- free(prodesc->proname);
- free(prodesc);
- elog(ERROR, "pltcl: cache lookup for return type failed");
- }
- typeStruct = (TypeTupleForm) GETSTRUCT(typeTup);
-
- if (typeStruct->typrelid != InvalidOid) {
- free(prodesc->proname);
- free(prodesc);
- elog(ERROR, "pltcl: return types of tuples not supported yet");
- }
-
- fmgr_info(typeStruct->typinput, &(prodesc->result_in_func));
- prodesc->result_in_elem = (Oid) (typeStruct->typelem);
- prodesc->result_in_len = typeStruct->typlen;
-
- /************************************************************
- * Get the required information for output conversion
- * of all procedure arguments
- ************************************************************/
- prodesc->nargs = proinfo->fn_nargs;
- proc_internal_args[0] = '\0';
- for (i = 0; i < proinfo->fn_nargs; i++) {
- typeTup = SearchSysCacheTuple(TYPOID,
- ObjectIdGetDatum(procStruct->proargtypes[i]),
- 0, 0, 0);
- if (!HeapTupleIsValid(typeTup)) {
- free(prodesc->proname);
- free(prodesc);
- elog(ERROR, "pltcl: cache lookup for argument type failed");
- }
- typeStruct = (TypeTupleForm) GETSTRUCT(typeTup);
-
- if (typeStruct->typrelid != InvalidOid) {
- prodesc->arg_is_rel[i] = 1;
- if (i > 0) {
- strcat(proc_internal_args, " ");
+ int i;
+ char internal_proname[512];
+ char *stroid;
+ Tcl_HashEntry *hashent;
+ int hashnew;
+ pltcl_proc_desc *prodesc;
+ Tcl_DString tcl_cmd;
+ Tcl_DString list_tmp;
+ int tcl_rc;
+ Datum retval;
+ sigjmp_buf save_restart;
+
+ /************************************************************
+ * Build our internal proc name from the functions Oid
+ ************************************************************/
+ stroid = oidout(proinfo->fn_oid);
+ strcpy(internal_proname, "__PLTcl_proc_");
+ strcat(internal_proname, stroid);
+ pfree(stroid);
+
+ /************************************************************
+ * Lookup the internal proc name in the hashtable
+ ************************************************************/
+ hashent = Tcl_FindHashEntry(pltcl_proc_hash, internal_proname);
+ if (hashent == NULL)
+ {
+ /************************************************************
+ * If we haven't found it in the hashtable, we analyze
+ * the functions arguments and returntype and store
+ * the in-/out-functions in the prodesc block and create
+ * a new hashtable entry for it.
+ *
+ * Then we load the procedure into the safe interpreter.
+ ************************************************************/
+ HeapTuple procTup;
+ HeapTuple typeTup;
+ Form_pg_proc procStruct;
+ TypeTupleForm typeStruct;
+ Tcl_DString proc_internal_def;
+ Tcl_DString proc_internal_body;
+ char proc_internal_args[4096];
+ char *proc_source;
+ char buf[512];
+
+ /************************************************************
+ * Allocate a new procedure description block
+ ************************************************************/
+ prodesc = (pltcl_proc_desc *) malloc(sizeof(pltcl_proc_desc));
+ prodesc->proname = malloc(strlen(internal_proname) + 1);
+ strcpy(prodesc->proname, internal_proname);
+
+ /************************************************************
+ * Lookup the pg_proc tuple by Oid
+ ************************************************************/
+ procTup = SearchSysCacheTuple(PROOID,
+ ObjectIdGetDatum(proinfo->fn_oid),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(procTup))
+ {
+ free(prodesc->proname);
+ free(prodesc);
+ elog(ERROR, "pltcl: cache lookup from pg_proc failed");
}
- sprintf(buf, "__PLTcl_Tup_%d", i + 1);
- strcat(proc_internal_args, buf);
- continue;
- } else {
- prodesc->arg_is_rel[i] = 0;
- }
-
- fmgr_info(typeStruct->typoutput, &(prodesc->arg_out_func[i]));
- prodesc->arg_out_elem[i] = (Oid) (typeStruct->typelem);
- prodesc->arg_out_len[i] = typeStruct->typlen;
-
- if (i > 0) {
- strcat(proc_internal_args, " ");
- }
- sprintf(buf, "%d", i + 1);
- strcat(proc_internal_args, buf);
- }
-
- /************************************************************
- * Create the tcl command to define the internal
- * procedure
- ************************************************************/
- Tcl_DStringInit(&proc_internal_def);
- Tcl_DStringInit(&proc_internal_body);
- Tcl_DStringAppendElement(&proc_internal_def, "proc");
- Tcl_DStringAppendElement(&proc_internal_def, internal_proname);
- Tcl_DStringAppendElement(&proc_internal_def, proc_internal_args);
-
- /************************************************************
- * prefix procedure body with
- * upvar #0 <internal_procname> GD
- * and with appropriate upvars for tuple arguments
- ************************************************************/
- Tcl_DStringAppend(&proc_internal_body, "upvar #0 ", -1);
- Tcl_DStringAppend(&proc_internal_body, internal_proname, -1);
- Tcl_DStringAppend(&proc_internal_body, " GD\n", -1);
- for (i = 0; i < proinfo->fn_nargs; i++) {
- if (!prodesc->arg_is_rel[i]) continue;
- sprintf(buf, "array set %d $__PLTcl_Tup_%d\n", i + 1, i + 1);
- Tcl_DStringAppend(&proc_internal_body, buf, -1);
- }
- proc_source = textout(&(procStruct->prosrc));
- Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
- pfree(proc_source);
- Tcl_DStringAppendElement(&proc_internal_def,
- Tcl_DStringValue(&proc_internal_body));
- Tcl_DStringFree(&proc_internal_body);
-
- /************************************************************
- * Create the procedure in the safe interpreter
- ************************************************************/
- tcl_rc = Tcl_GlobalEval(pltcl_safe_interp,
- Tcl_DStringValue(&proc_internal_def));
- Tcl_DStringFree(&proc_internal_def);
- if (tcl_rc != TCL_OK) {
- free(prodesc->proname);
- free(prodesc);
- elog(ERROR, "pltcl: cannot create internal procedure %s - %s",
- internal_proname, pltcl_safe_interp->result);
- }
-
- /************************************************************
- * Add the proc description block to the hashtable
- ************************************************************/
- hashent = Tcl_CreateHashEntry(pltcl_proc_hash,
- prodesc->proname, &hashnew);
- Tcl_SetHashValue(hashent, (ClientData)prodesc);
- } else {
- /************************************************************
- * Found the proc description block in the hashtable
- ************************************************************/
- prodesc = (pltcl_proc_desc *)Tcl_GetHashValue(hashent);
- }
-
- /************************************************************
- * Create the tcl command to call the internal
- * proc in the safe interpreter
- ************************************************************/
- Tcl_DStringInit(&tcl_cmd);
- Tcl_DStringInit(&list_tmp);
- Tcl_DStringAppendElement(&tcl_cmd, internal_proname);
-
- /************************************************************
- * Catch elog(ERROR) during build of the Tcl command
- ************************************************************/
- memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
- if (sigsetjmp(Warn_restart, 1) != 0) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- Tcl_DStringFree(&tcl_cmd);
+ procStruct = (Form_pg_proc) GETSTRUCT(procTup);
+
+ /************************************************************
+ * Get the required information for input conversion of the
+ * return value.
+ ************************************************************/
+ typeTup = SearchSysCacheTuple(TYPOID,
+ ObjectIdGetDatum(procStruct->prorettype),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(typeTup))
+ {
+ free(prodesc->proname);
+ free(prodesc);
+ elog(ERROR, "pltcl: cache lookup for return type failed");
+ }
+ typeStruct = (TypeTupleForm) GETSTRUCT(typeTup);
+
+ if (typeStruct->typrelid != InvalidOid)
+ {
+ free(prodesc->proname);
+ free(prodesc);
+ elog(ERROR, "pltcl: return types of tuples not supported yet");
+ }
+
+ fmgr_info(typeStruct->typinput, &(prodesc->result_in_func));
+ prodesc->result_in_elem = (Oid) (typeStruct->typelem);
+ prodesc->result_in_len = typeStruct->typlen;
+
+ /************************************************************
+ * Get the required information for output conversion
+ * of all procedure arguments
+ ************************************************************/
+ prodesc->nargs = proinfo->fn_nargs;
+ proc_internal_args[0] = '\0';
+ for (i = 0; i < proinfo->fn_nargs; i++)
+ {
+ typeTup = SearchSysCacheTuple(TYPOID,
+ ObjectIdGetDatum(procStruct->proargtypes[i]),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(typeTup))
+ {
+ free(prodesc->proname);
+ free(prodesc);
+ elog(ERROR, "pltcl: cache lookup for argument type failed");
+ }
+ typeStruct = (TypeTupleForm) GETSTRUCT(typeTup);
+
+ if (typeStruct->typrelid != InvalidOid)
+ {
+ prodesc->arg_is_rel[i] = 1;
+ if (i > 0)
+ {
+ strcat(proc_internal_args, " ");
+ }
+ sprintf(buf, "__PLTcl_Tup_%d", i + 1);
+ strcat(proc_internal_args, buf);
+ continue;
+ }
+ else
+ {
+ prodesc->arg_is_rel[i] = 0;
+ }
+
+ fmgr_info(typeStruct->typoutput, &(prodesc->arg_out_func[i]));
+ prodesc->arg_out_elem[i] = (Oid) (typeStruct->typelem);
+ prodesc->arg_out_len[i] = typeStruct->typlen;
+
+ if (i > 0)
+ {
+ strcat(proc_internal_args, " ");
+ }
+ sprintf(buf, "%d", i + 1);
+ strcat(proc_internal_args, buf);
+ }
+
+ /************************************************************
+ * Create the tcl command to define the internal
+ * procedure
+ ************************************************************/
+ Tcl_DStringInit(&proc_internal_def);
+ Tcl_DStringInit(&proc_internal_body);
+ Tcl_DStringAppendElement(&proc_internal_def, "proc");
+ Tcl_DStringAppendElement(&proc_internal_def, internal_proname);
+ Tcl_DStringAppendElement(&proc_internal_def, proc_internal_args);
+
+ /************************************************************
+ * prefix procedure body with
+ * upvar #0 <internal_procname> GD
+ * and with appropriate upvars for tuple arguments
+ ************************************************************/
+ Tcl_DStringAppend(&proc_internal_body, "upvar #0 ", -1);
+ Tcl_DStringAppend(&proc_internal_body, internal_proname, -1);
+ Tcl_DStringAppend(&proc_internal_body, " GD\n", -1);
+ for (i = 0; i < proinfo->fn_nargs; i++)
+ {
+ if (!prodesc->arg_is_rel[i])
+ continue;
+ sprintf(buf, "array set %d $__PLTcl_Tup_%d\n", i + 1, i + 1);
+ Tcl_DStringAppend(&proc_internal_body, buf, -1);
+ }
+ proc_source = textout(&(procStruct->prosrc));
+ Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
+ pfree(proc_source);
+ Tcl_DStringAppendElement(&proc_internal_def,
+ Tcl_DStringValue(&proc_internal_body));
+ Tcl_DStringFree(&proc_internal_body);
+
+ /************************************************************
+ * Create the procedure in the safe interpreter
+ ************************************************************/
+ tcl_rc = Tcl_GlobalEval(pltcl_safe_interp,
+ Tcl_DStringValue(&proc_internal_def));
+ Tcl_DStringFree(&proc_internal_def);
+ if (tcl_rc != TCL_OK)
+ {
+ free(prodesc->proname);
+ free(prodesc);
+ elog(ERROR, "pltcl: cannot create internal procedure %s - %s",
+ internal_proname, pltcl_safe_interp->result);
+ }
+
+ /************************************************************
+ * Add the proc description block to the hashtable
+ ************************************************************/
+ hashent = Tcl_CreateHashEntry(pltcl_proc_hash,
+ prodesc->proname, &hashnew);
+ Tcl_SetHashValue(hashent, (ClientData) prodesc);
+ }
+ else
+ {
+ /************************************************************
+ * Found the proc description block in the hashtable
+ ************************************************************/
+ prodesc = (pltcl_proc_desc *) Tcl_GetHashValue(hashent);
+ }
+
+ /************************************************************
+ * Create the tcl command to call the internal
+ * proc in the safe interpreter
+ ************************************************************/
+ Tcl_DStringInit(&tcl_cmd);
+ Tcl_DStringInit(&list_tmp);
+ Tcl_DStringAppendElement(&tcl_cmd, internal_proname);
+
+ /************************************************************
+ * Catch elog(ERROR) during build of the Tcl command
+ ************************************************************/
+ memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
+ if (sigsetjmp(Warn_restart, 1) != 0)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ Tcl_DStringFree(&tcl_cmd);
+ Tcl_DStringFree(&list_tmp);
+ pltcl_restart_in_progress = 1;
+ if (--pltcl_call_level == 0)
+ {
+ pltcl_restart_in_progress = 0;
+ }
+ siglongjmp(Warn_restart, 1);
+ }
+
+ /************************************************************
+ * Add all call arguments to the command
+ ************************************************************/
+ for (i = 0; i < prodesc->nargs; i++)
+ {
+ if (prodesc->arg_is_rel[i])
+ {
+ /**************************************************
+ * For tuple values, add a list for 'array set ...'
+ **************************************************/
+ Tcl_DStringInit(&list_tmp);
+ pltcl_build_tuple_argument(
+ ((TupleTableSlot *) (proargs->data[i]))->val,
+ ((TupleTableSlot *) (proargs->data[i]))->ttc_tupleDescriptor,
+ &list_tmp);
+ Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&list_tmp));
+ Tcl_DStringFree(&list_tmp);
+ Tcl_DStringInit(&list_tmp);
+ }
+ else
+ {
+ /**************************************************
+ * Single values are added as string element
+ * of their external representation
+ **************************************************/
+ char *tmp;
+
+ tmp = (*fmgr_faddr(&(prodesc->arg_out_func[i])))
+ (proargs->data[i],
+ prodesc->arg_out_elem[i],
+ prodesc->arg_out_len[i]);
+ Tcl_DStringAppendElement(&tcl_cmd, tmp);
+ pfree(tmp);
+ }
+ }
Tcl_DStringFree(&list_tmp);
- pltcl_restart_in_progress = 1;
- if (--pltcl_call_level == 0) {
- pltcl_restart_in_progress = 0;
- }
- siglongjmp(Warn_restart, 1);
- }
-
- /************************************************************
- * Add all call arguments to the command
- ************************************************************/
- for (i = 0; i < prodesc->nargs; i++) {
- if (prodesc->arg_is_rel[i]) {
- /**************************************************
- * For tuple values, add a list for 'array set ...'
- **************************************************/
- Tcl_DStringInit(&list_tmp);
- pltcl_build_tuple_argument(
- ((TupleTableSlot *)(proargs->data[i]))->val,
- ((TupleTableSlot *)(proargs->data[i]))->ttc_tupleDescriptor,
- &list_tmp);
- Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&list_tmp));
- Tcl_DStringFree(&list_tmp);
- Tcl_DStringInit(&list_tmp);
- } else {
- /**************************************************
- * Single values are added as string element
- * of their external representation
- **************************************************/
- char *tmp;
-
- tmp = (*fmgr_faddr(&(prodesc->arg_out_func[i])))
- (proargs->data[i],
- prodesc->arg_out_elem[i],
- prodesc->arg_out_len[i]);
- Tcl_DStringAppendElement(&tcl_cmd, tmp);
- pfree(tmp);
- }
- }
- Tcl_DStringFree(&list_tmp);
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
-
- /************************************************************
- * Call the Tcl function
- ************************************************************/
- tcl_rc = Tcl_GlobalEval(pltcl_safe_interp, Tcl_DStringValue(&tcl_cmd));
- Tcl_DStringFree(&tcl_cmd);
-
- /************************************************************
- * Check the return code from Tcl and handle
- * our special restart mechanism to get rid
- * of all nested call levels on transaction
- * abort.
- ************************************************************/
- if (tcl_rc != TCL_OK || pltcl_restart_in_progress) {
- if (!pltcl_restart_in_progress) {
- pltcl_restart_in_progress = 1;
- if (--pltcl_call_level == 0) {
- pltcl_restart_in_progress = 0;
- }
- elog(ERROR, "pltcl: %s", pltcl_safe_interp->result);
- }
- if (--pltcl_call_level == 0) {
- pltcl_restart_in_progress = 0;
- }
- siglongjmp(Warn_restart, 1);
- }
-
- /************************************************************
- * Convert the result value from the safe interpreter
- * into it's PostgreSQL data format and return it.
- * Again, the call to fmgr() could fire an elog and we
- * have to count for the current interpreter level we are
- * on. The save_restart from above is still good.
- ************************************************************/
- if (sigsetjmp(Warn_restart, 1) != 0) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- pltcl_restart_in_progress = 1;
- if (--pltcl_call_level == 0) {
- pltcl_restart_in_progress = 0;
- }
- siglongjmp(Warn_restart, 1);
- }
-
- retval = (Datum)(*fmgr_faddr(&prodesc->result_in_func))
- (pltcl_safe_interp->result,
- prodesc->result_in_elem,
- prodesc->result_in_len);
-
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- return retval;
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+
+ /************************************************************
+ * Call the Tcl function
+ ************************************************************/
+ tcl_rc = Tcl_GlobalEval(pltcl_safe_interp, Tcl_DStringValue(&tcl_cmd));
+ Tcl_DStringFree(&tcl_cmd);
+
+ /************************************************************
+ * Check the return code from Tcl and handle
+ * our special restart mechanism to get rid
+ * of all nested call levels on transaction
+ * abort.
+ ************************************************************/
+ if (tcl_rc != TCL_OK || pltcl_restart_in_progress)
+ {
+ if (!pltcl_restart_in_progress)
+ {
+ pltcl_restart_in_progress = 1;
+ if (--pltcl_call_level == 0)
+ {
+ pltcl_restart_in_progress = 0;
+ }
+ elog(ERROR, "pltcl: %s", pltcl_safe_interp->result);
+ }
+ if (--pltcl_call_level == 0)
+ {
+ pltcl_restart_in_progress = 0;
+ }
+ siglongjmp(Warn_restart, 1);
+ }
+
+ /************************************************************
+ * Convert the result value from the safe interpreter
+ * into it's PostgreSQL data format and return it.
+ * Again, the call to fmgr() could fire an elog and we
+ * have to count for the current interpreter level we are
+ * on. The save_restart from above is still good.
+ ************************************************************/
+ if (sigsetjmp(Warn_restart, 1) != 0)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ pltcl_restart_in_progress = 1;
+ if (--pltcl_call_level == 0)
+ {
+ pltcl_restart_in_progress = 0;
+ }
+ siglongjmp(Warn_restart, 1);
+ }
+
+ retval = (Datum) (*fmgr_faddr(&prodesc->result_in_func))
+ (pltcl_safe_interp->result,
+ prodesc->result_in_elem,
+ prodesc->result_in_len);
+
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ return retval;
}
@@ -724,486 +788,536 @@ pltcl_func_handler(FmgrInfo *proinfo,
static HeapTuple
pltcl_trigger_handler(FmgrInfo *proinfo)
{
- TriggerData *trigdata;
- char internal_proname[512];
- char *stroid;
- Tcl_HashEntry *hashent;
- int hashnew;
- pltcl_proc_desc *prodesc;
- TupleDesc tupdesc;
- HeapTuple rettup;
- Tcl_DString tcl_cmd;
- Tcl_DString tcl_trigtup;
- Tcl_DString tcl_newtup;
- int tcl_rc;
- int i;
-
- int *modattrs;
- Datum *modvalues;
- char *modnulls;
-
- int ret_numvals;
- char **ret_values;
-
- sigjmp_buf save_restart;
-
- /************************************************************
- * Save the current trigger data local
- ************************************************************/
- trigdata = CurrentTriggerData;
- CurrentTriggerData = NULL;
-
- /************************************************************
- * Build our internal proc name from the functions Oid
- ************************************************************/
- stroid = oidout(proinfo->fn_oid);
- strcpy(internal_proname, "__PLTcl_proc_");
- strcat(internal_proname, stroid);
- pfree(stroid);
-
- /************************************************************
- * Lookup the internal proc name in the hashtable
- ************************************************************/
- hashent = Tcl_FindHashEntry(pltcl_proc_hash, internal_proname);
- if (hashent == NULL) {
+ TriggerData *trigdata;
+ char internal_proname[512];
+ char *stroid;
+ Tcl_HashEntry *hashent;
+ int hashnew;
+ pltcl_proc_desc *prodesc;
+ TupleDesc tupdesc;
+ HeapTuple rettup;
+ Tcl_DString tcl_cmd;
+ Tcl_DString tcl_trigtup;
+ Tcl_DString tcl_newtup;
+ int tcl_rc;
+ int i;
+
+ int *modattrs;
+ Datum *modvalues;
+ char *modnulls;
+
+ int ret_numvals;
+ char **ret_values;
+
+ sigjmp_buf save_restart;
+
/************************************************************
- * If we haven't found it in the hashtable,
- * we load the procedure into the safe interpreter.
- ************************************************************/
- Tcl_DString proc_internal_def;
- Tcl_DString proc_internal_body;
- HeapTuple procTup;
- Form_pg_proc procStruct;
- char *proc_source;
-
- /************************************************************
- * Allocate a new procedure description block
- ************************************************************/
- prodesc = (pltcl_proc_desc *)malloc(sizeof(pltcl_proc_desc));
- memset(prodesc, 0, sizeof(pltcl_proc_desc));
- prodesc->proname = malloc(strlen(internal_proname) + 1);
- strcpy(prodesc->proname, internal_proname);
-
- /************************************************************
- * Lookup the pg_proc tuple by Oid
- ************************************************************/
- procTup = SearchSysCacheTuple(PROOID,
- ObjectIdGetDatum(proinfo->fn_oid),
- 0, 0, 0);
- if (!HeapTupleIsValid(procTup)) {
- free(prodesc->proname);
- free(prodesc);
- elog(ERROR, "pltcl: cache lookup from pg_proc failed");
- }
- procStruct = (Form_pg_proc) GETSTRUCT(procTup);
-
- /************************************************************
- * Create the tcl command to define the internal
- * procedure
- ************************************************************/
- Tcl_DStringInit(&proc_internal_def);
- Tcl_DStringInit(&proc_internal_body);
- Tcl_DStringAppendElement(&proc_internal_def, "proc");
- Tcl_DStringAppendElement(&proc_internal_def, internal_proname);
- Tcl_DStringAppendElement(&proc_internal_def,
- "TG_name TG_relid TG_relatts TG_when TG_level TG_op __PLTcl_Tup_NEW __PLTcl_Tup_OLD args");
-
- /************************************************************
- * prefix procedure body with
- * upvar #0 <internal_procname> GD
- * and with appropriate setting of NEW, OLD,
- * and the arguments as numerical variables.
- ************************************************************/
- Tcl_DStringAppend(&proc_internal_body, "upvar #0 ", -1);
- Tcl_DStringAppend(&proc_internal_body, internal_proname, -1);
- Tcl_DStringAppend(&proc_internal_body, " GD\n", -1);
-
- Tcl_DStringAppend(&proc_internal_body,
- "array set NEW $__PLTcl_Tup_NEW\n", -1);
- Tcl_DStringAppend(&proc_internal_body,
- "array set OLD $__PLTcl_Tup_OLD\n", -1);
-
- Tcl_DStringAppend(&proc_internal_body,
- "set i 0\n"
- "set v 0\n"
- "foreach v $args {\n"
- " incr i\n"
- " set $i $v\n"
- "}\n"
- "unset i v\n\n", -1);
-
- proc_source = textout(&(procStruct->prosrc));
- Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
- pfree(proc_source);
- Tcl_DStringAppendElement(&proc_internal_def,
- Tcl_DStringValue(&proc_internal_body));
- Tcl_DStringFree(&proc_internal_body);
+ * Save the current trigger data local
+ ************************************************************/
+ trigdata = CurrentTriggerData;
+ CurrentTriggerData = NULL;
/************************************************************
- * Create the procedure in the safe interpreter
+ * Build our internal proc name from the functions Oid
************************************************************/
- tcl_rc = Tcl_GlobalEval(pltcl_safe_interp,
- Tcl_DStringValue(&proc_internal_def));
- Tcl_DStringFree(&proc_internal_def);
- if (tcl_rc != TCL_OK) {
- free(prodesc->proname);
- free(prodesc);
- elog(ERROR, "pltcl: cannot create internal procedure %s - %s",
- internal_proname, pltcl_safe_interp->result);
+ stroid = oidout(proinfo->fn_oid);
+ strcpy(internal_proname, "__PLTcl_proc_");
+ strcat(internal_proname, stroid);
+ pfree(stroid);
+
+ /************************************************************
+ * Lookup the internal proc name in the hashtable
+ ************************************************************/
+ hashent = Tcl_FindHashEntry(pltcl_proc_hash, internal_proname);
+ if (hashent == NULL)
+ {
+ /************************************************************
+ * If we haven't found it in the hashtable,
+ * we load the procedure into the safe interpreter.
+ ************************************************************/
+ Tcl_DString proc_internal_def;
+ Tcl_DString proc_internal_body;
+ HeapTuple procTup;
+ Form_pg_proc procStruct;
+ char *proc_source;
+
+ /************************************************************
+ * Allocate a new procedure description block
+ ************************************************************/
+ prodesc = (pltcl_proc_desc *) malloc(sizeof(pltcl_proc_desc));
+ memset(prodesc, 0, sizeof(pltcl_proc_desc));
+ prodesc->proname = malloc(strlen(internal_proname) + 1);
+ strcpy(prodesc->proname, internal_proname);
+
+ /************************************************************
+ * Lookup the pg_proc tuple by Oid
+ ************************************************************/
+ procTup = SearchSysCacheTuple(PROOID,
+ ObjectIdGetDatum(proinfo->fn_oid),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(procTup))
+ {
+ free(prodesc->proname);
+ free(prodesc);
+ elog(ERROR, "pltcl: cache lookup from pg_proc failed");
+ }
+ procStruct = (Form_pg_proc) GETSTRUCT(procTup);
+
+ /************************************************************
+ * Create the tcl command to define the internal
+ * procedure
+ ************************************************************/
+ Tcl_DStringInit(&proc_internal_def);
+ Tcl_DStringInit(&proc_internal_body);
+ Tcl_DStringAppendElement(&proc_internal_def, "proc");
+ Tcl_DStringAppendElement(&proc_internal_def, internal_proname);
+ Tcl_DStringAppendElement(&proc_internal_def,
+ "TG_name TG_relid TG_relatts TG_when TG_level TG_op __PLTcl_Tup_NEW __PLTcl_Tup_OLD args");
+
+ /************************************************************
+ * prefix procedure body with
+ * upvar #0 <internal_procname> GD
+ * and with appropriate setting of NEW, OLD,
+ * and the arguments as numerical variables.
+ ************************************************************/
+ Tcl_DStringAppend(&proc_internal_body, "upvar #0 ", -1);
+ Tcl_DStringAppend(&proc_internal_body, internal_proname, -1);
+ Tcl_DStringAppend(&proc_internal_body, " GD\n", -1);
+
+ Tcl_DStringAppend(&proc_internal_body,
+ "array set NEW $__PLTcl_Tup_NEW\n", -1);
+ Tcl_DStringAppend(&proc_internal_body,
+ "array set OLD $__PLTcl_Tup_OLD\n", -1);
+
+ Tcl_DStringAppend(&proc_internal_body,
+ "set i 0\n"
+ "set v 0\n"
+ "foreach v $args {\n"
+ " incr i\n"
+ " set $i $v\n"
+ "}\n"
+ "unset i v\n\n", -1);
+
+ proc_source = textout(&(procStruct->prosrc));
+ Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
+ pfree(proc_source);
+ Tcl_DStringAppendElement(&proc_internal_def,
+ Tcl_DStringValue(&proc_internal_body));
+ Tcl_DStringFree(&proc_internal_body);
+
+ /************************************************************
+ * Create the procedure in the safe interpreter
+ ************************************************************/
+ tcl_rc = Tcl_GlobalEval(pltcl_safe_interp,
+ Tcl_DStringValue(&proc_internal_def));
+ Tcl_DStringFree(&proc_internal_def);
+ if (tcl_rc != TCL_OK)
+ {
+ free(prodesc->proname);
+ free(prodesc);
+ elog(ERROR, "pltcl: cannot create internal procedure %s - %s",
+ internal_proname, pltcl_safe_interp->result);
+ }
+
+ /************************************************************
+ * Add the proc description block to the hashtable
+ ************************************************************/
+ hashent = Tcl_CreateHashEntry(pltcl_proc_hash,
+ prodesc->proname, &hashnew);
+ Tcl_SetHashValue(hashent, (ClientData) prodesc);
}
+ else
+ {
+ /************************************************************
+ * Found the proc description block in the hashtable
+ ************************************************************/
+ prodesc = (pltcl_proc_desc *) Tcl_GetHashValue(hashent);
+ }
+
+ tupdesc = trigdata->tg_relation->rd_att;
/************************************************************
- * Add the proc description block to the hashtable
+ * Create the tcl command to call the internal
+ * proc in the safe interpreter
************************************************************/
- hashent = Tcl_CreateHashEntry(pltcl_proc_hash,
- prodesc->proname, &hashnew);
- Tcl_SetHashValue(hashent, (ClientData)prodesc);
- } else {
+ Tcl_DStringInit(&tcl_cmd);
+ Tcl_DStringInit(&tcl_trigtup);
+ Tcl_DStringInit(&tcl_newtup);
+
/************************************************************
- * Found the proc description block in the hashtable
+ * We call external functions below - care for elog(ERROR)
************************************************************/
- prodesc = (pltcl_proc_desc *)Tcl_GetHashValue(hashent);
- }
+ memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
+ if (sigsetjmp(Warn_restart, 1) != 0)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ Tcl_DStringFree(&tcl_cmd);
+ Tcl_DStringFree(&tcl_trigtup);
+ Tcl_DStringFree(&tcl_newtup);
+ pltcl_restart_in_progress = 1;
+ if (--pltcl_call_level == 0)
+ {
+ pltcl_restart_in_progress = 0;
+ }
+ siglongjmp(Warn_restart, 1);
+ }
- tupdesc = trigdata->tg_relation->rd_att;
+ /* The procedure name */
+ Tcl_DStringAppendElement(&tcl_cmd, internal_proname);
- /************************************************************
- * Create the tcl command to call the internal
- * proc in the safe interpreter
- ************************************************************/
- Tcl_DStringInit(&tcl_cmd);
- Tcl_DStringInit(&tcl_trigtup);
- Tcl_DStringInit(&tcl_newtup);
+ /* The trigger name for argument TG_name */
+ Tcl_DStringAppendElement(&tcl_cmd, trigdata->tg_trigger->tgname);
- /************************************************************
- * We call external functions below - care for elog(ERROR)
- ************************************************************/
- memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
- if (sigsetjmp(Warn_restart, 1) != 0) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- Tcl_DStringFree(&tcl_cmd);
- Tcl_DStringFree(&tcl_trigtup);
- Tcl_DStringFree(&tcl_newtup);
- pltcl_restart_in_progress = 1;
- if (--pltcl_call_level == 0) {
- pltcl_restart_in_progress = 0;
- }
- siglongjmp(Warn_restart, 1);
- }
-
- /* The procedure name */
- Tcl_DStringAppendElement(&tcl_cmd, internal_proname);
-
- /* The trigger name for argument TG_name */
- Tcl_DStringAppendElement(&tcl_cmd, trigdata->tg_trigger->tgname);
-
- /* The oid of the trigger relation for argument TG_relid */
- stroid = oidout(trigdata->tg_relation->rd_id);
- Tcl_DStringAppendElement(&tcl_cmd, stroid);
- pfree(stroid);
-
- /* A list of attribute names for argument TG_relatts */
- Tcl_DStringAppendElement(&tcl_trigtup, "");
- for (i = 0; i < tupdesc->natts; i++) {
- Tcl_DStringAppendElement(&tcl_trigtup, tupdesc->attrs[i]->attname.data);
- }
- Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
- Tcl_DStringFree(&tcl_trigtup);
- Tcl_DStringInit(&tcl_trigtup);
-
- /* The when part of the event for TG_when */
- if (TRIGGER_FIRED_BEFORE(trigdata->tg_event)) {
- Tcl_DStringAppendElement(&tcl_cmd, "BEFORE");
- }
- else if (TRIGGER_FIRED_AFTER(trigdata->tg_event)) {
- Tcl_DStringAppendElement(&tcl_cmd, "AFTER");
- }
- else {
- Tcl_DStringAppendElement(&tcl_cmd, "UNKNOWN");
- }
-
- /* The level part of the event for TG_level */
- if (TRIGGER_FIRED_FOR_ROW(trigdata->tg_event)) {
- Tcl_DStringAppendElement(&tcl_cmd, "ROW");
- }
- else if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event)) {
- Tcl_DStringAppendElement(&tcl_cmd, "STATEMENT");
- }
- else {
- Tcl_DStringAppendElement(&tcl_cmd, "UNKNOWN");
- }
-
- /* Build the data list for the trigtuple */
- pltcl_build_tuple_argument(trigdata->tg_trigtuple,
- tupdesc, &tcl_trigtup);
-
- /* Now the command part of the event for TG_op and data for NEW and OLD */
- if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event)) {
- Tcl_DStringAppendElement(&tcl_cmd, "INSERT");
+ /* The oid of the trigger relation for argument TG_relid */
+ stroid = oidout(trigdata->tg_relation->rd_id);
+ Tcl_DStringAppendElement(&tcl_cmd, stroid);
+ pfree(stroid);
+ /* A list of attribute names for argument TG_relatts */
+ Tcl_DStringAppendElement(&tcl_trigtup, "");
+ for (i = 0; i < tupdesc->natts; i++)
+ {
+ Tcl_DStringAppendElement(&tcl_trigtup, tupdesc->attrs[i]->attname.data);
+ }
Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
- Tcl_DStringAppendElement(&tcl_cmd, "");
-
- rettup = trigdata->tg_trigtuple;
- }
- else if (TRIGGER_FIRED_BY_DELETE(trigdata->tg_event)) {
- Tcl_DStringAppendElement(&tcl_cmd, "DELETE");
-
- Tcl_DStringAppendElement(&tcl_cmd, "");
- Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
+ Tcl_DStringFree(&tcl_trigtup);
+ Tcl_DStringInit(&tcl_trigtup);
+
+ /* The when part of the event for TG_when */
+ if (TRIGGER_FIRED_BEFORE(trigdata->tg_event))
+ {
+ Tcl_DStringAppendElement(&tcl_cmd, "BEFORE");
+ }
+ else if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
+ {
+ Tcl_DStringAppendElement(&tcl_cmd, "AFTER");
+ }
+ else
+ {
+ Tcl_DStringAppendElement(&tcl_cmd, "UNKNOWN");
+ }
- rettup = trigdata->tg_trigtuple;
- }
- else if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event)) {
- Tcl_DStringAppendElement(&tcl_cmd, "UPDATE");
+ /* The level part of the event for TG_level */
+ if (TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
+ {
+ Tcl_DStringAppendElement(&tcl_cmd, "ROW");
+ }
+ else if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
+ {
+ Tcl_DStringAppendElement(&tcl_cmd, "STATEMENT");
+ }
+ else
+ {
+ Tcl_DStringAppendElement(&tcl_cmd, "UNKNOWN");
+ }
- pltcl_build_tuple_argument(trigdata->tg_newtuple,
- tupdesc, &tcl_newtup);
+ /* Build the data list for the trigtuple */
+ pltcl_build_tuple_argument(trigdata->tg_trigtuple,
+ tupdesc, &tcl_trigtup);
- Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_newtup));
- Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
+ /*
+ * Now the command part of the event for TG_op and data for NEW and
+ * OLD
+ */
+ if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event))
+ {
+ Tcl_DStringAppendElement(&tcl_cmd, "INSERT");
- rettup = trigdata->tg_newtuple;
- }
- else {
- Tcl_DStringAppendElement(&tcl_cmd, "UNKNOWN");
+ Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
+ Tcl_DStringAppendElement(&tcl_cmd, "");
- Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
- Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
+ rettup = trigdata->tg_trigtuple;
+ }
+ else if (TRIGGER_FIRED_BY_DELETE(trigdata->tg_event))
+ {
+ Tcl_DStringAppendElement(&tcl_cmd, "DELETE");
- rettup = trigdata->tg_trigtuple;
- }
-
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- Tcl_DStringFree(&tcl_trigtup);
- Tcl_DStringFree(&tcl_newtup);
-
- /************************************************************
- * Finally append the arguments from CREATE TRIGGER
- ************************************************************/
- for (i = 0; i < trigdata->tg_trigger->tgnargs; i++) {
- Tcl_DStringAppendElement(&tcl_cmd, trigdata->tg_trigger->tgargs[i]);
- }
-
- /************************************************************
- * Call the Tcl function
- ************************************************************/
- tcl_rc = Tcl_GlobalEval(pltcl_safe_interp, Tcl_DStringValue(&tcl_cmd));
- Tcl_DStringFree(&tcl_cmd);
-
- /************************************************************
- * Check the return code from Tcl and handle
- * our special restart mechanism to get rid
- * of all nested call levels on transaction
- * abort.
- ************************************************************/
- if (tcl_rc == TCL_ERROR || pltcl_restart_in_progress) {
- if (!pltcl_restart_in_progress) {
- pltcl_restart_in_progress = 1;
- if (--pltcl_call_level == 0) {
- pltcl_restart_in_progress = 0;
- }
- elog(ERROR, "pltcl: %s", pltcl_safe_interp->result);
- }
- if (--pltcl_call_level == 0) {
- pltcl_restart_in_progress = 0;
- }
- siglongjmp(Warn_restart, 1);
- }
-
- switch (tcl_rc) {
- case TCL_OK:
- break;
-
- default:
- elog(ERROR, "pltcl: unsupported TCL return code %d", tcl_rc);
- }
-
- /************************************************************
- * The return value from the procedure might be one of
- * the magic strings OK or SKIP or a list from array get
- ************************************************************/
- if (strcmp(pltcl_safe_interp->result, "OK") == 0) {
- return rettup;
- }
- if (strcmp(pltcl_safe_interp->result, "SKIP") == 0) {
- return (HeapTuple)NULL;;
- }
-
- /************************************************************
- * Convert the result value from the safe interpreter
- * and setup structures for SPI_modifytuple();
- ************************************************************/
- if (Tcl_SplitList(pltcl_safe_interp, pltcl_safe_interp->result,
- &ret_numvals, &ret_values) != TCL_OK) {
- elog(NOTICE, "pltcl: cannot split return value from trigger");
- elog(ERROR, "pltcl: %s", pltcl_safe_interp->result);
- }
-
- if (ret_numvals % 2 != 0) {
- ckfree(ret_values);
- elog(ERROR, "pltcl: invalid return list from trigger - must have even # of elements");
- }
-
- modattrs = (int *)palloc(tupdesc->natts * sizeof(int));
- modvalues = (Datum *)palloc(tupdesc->natts * sizeof(Datum));
- for (i = 0; i < tupdesc->natts; i++) {
- modattrs[i] = i + 1;
- modvalues[i] = (Datum)NULL;
- }
-
- modnulls = palloc(tupdesc->natts + 1);
- memset(modnulls, 'n', tupdesc->natts);
- modnulls[tupdesc->natts] = '\0';
-
- /************************************************************
- * Care for possible elog(ERROR)'s below
- ************************************************************/
- if (sigsetjmp(Warn_restart, 1) != 0) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- ckfree(ret_values);
- pltcl_restart_in_progress = 1;
- if (--pltcl_call_level == 0) {
- pltcl_restart_in_progress = 0;
+ Tcl_DStringAppendElement(&tcl_cmd, "");
+ Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
+
+ rettup = trigdata->tg_trigtuple;
}
- siglongjmp(Warn_restart, 1);
- }
+ else if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
+ {
+ Tcl_DStringAppendElement(&tcl_cmd, "UPDATE");
- i = 0;
- while(i < ret_numvals) {
- int attnum;
- HeapTuple typeTup;
- Oid typinput;
- Oid typelem;
- FmgrInfo finfo;
+ pltcl_build_tuple_argument(trigdata->tg_newtuple,
+ tupdesc, &tcl_newtup);
+
+ Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_newtup));
+ Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
+
+ rettup = trigdata->tg_newtuple;
+ }
+ else
+ {
+ Tcl_DStringAppendElement(&tcl_cmd, "UNKNOWN");
+
+ Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
+ Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
+
+ rettup = trigdata->tg_trigtuple;
+ }
+
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ Tcl_DStringFree(&tcl_trigtup);
+ Tcl_DStringFree(&tcl_newtup);
/************************************************************
- * Ignore pseudo elements with a dot name
+ * Finally append the arguments from CREATE TRIGGER
************************************************************/
- if (*(ret_values[i]) == '.') {
- i += 2;
- continue;
+ for (i = 0; i < trigdata->tg_trigger->tgnargs; i++)
+ {
+ Tcl_DStringAppendElement(&tcl_cmd, trigdata->tg_trigger->tgargs[i]);
}
/************************************************************
- * Get the attribute number
+ * Call the Tcl function
+ ************************************************************/
+ tcl_rc = Tcl_GlobalEval(pltcl_safe_interp, Tcl_DStringValue(&tcl_cmd));
+ Tcl_DStringFree(&tcl_cmd);
+
+ /************************************************************
+ * Check the return code from Tcl and handle
+ * our special restart mechanism to get rid
+ * of all nested call levels on transaction
+ * abort.
************************************************************/
- attnum = SPI_fnumber(tupdesc, ret_values[i++]);
- if (attnum == SPI_ERROR_NOATTRIBUTE) {
- elog(ERROR, "pltcl: invalid attribute '%s'", ret_values[--i]);
+ if (tcl_rc == TCL_ERROR || pltcl_restart_in_progress)
+ {
+ if (!pltcl_restart_in_progress)
+ {
+ pltcl_restart_in_progress = 1;
+ if (--pltcl_call_level == 0)
+ {
+ pltcl_restart_in_progress = 0;
+ }
+ elog(ERROR, "pltcl: %s", pltcl_safe_interp->result);
+ }
+ if (--pltcl_call_level == 0)
+ {
+ pltcl_restart_in_progress = 0;
+ }
+ siglongjmp(Warn_restart, 1);
+ }
+
+ switch (tcl_rc)
+ {
+ case TCL_OK:
+ break;
+
+ default:
+ elog(ERROR, "pltcl: unsupported TCL return code %d", tcl_rc);
}
/************************************************************
- * Lookup the attribute type in the syscache
- * for the input function
+ * The return value from the procedure might be one of
+ * the magic strings OK or SKIP or a list from array get
************************************************************/
- typeTup = SearchSysCacheTuple(TYPOID,
- ObjectIdGetDatum(tupdesc->attrs[attnum - 1]->atttypid),
- 0, 0, 0);
- if (!HeapTupleIsValid(typeTup)) {
- elog(ERROR, "pltcl: Cache lookup for attribute '%s' type %ld failed",
- ret_values[--i],
- ObjectIdGetDatum(tupdesc->attrs[attnum - 1]->atttypid));
+ if (strcmp(pltcl_safe_interp->result, "OK") == 0)
+ {
+ return rettup;
+ }
+ if (strcmp(pltcl_safe_interp->result, "SKIP") == 0)
+ {
+ return (HeapTuple) NULL;;
}
- typinput = (Oid) (((TypeTupleForm)GETSTRUCT(typeTup))->typinput);
- typelem = (Oid) (((TypeTupleForm)GETSTRUCT(typeTup))->typelem);
/************************************************************
- * Set the attribute to NOT NULL and convert the contents
+ * Convert the result value from the safe interpreter
+ * and setup structures for SPI_modifytuple();
************************************************************/
- modnulls[attnum - 1] = ' ';
- fmgr_info(typinput, &finfo);
- modvalues[attnum - 1] = (Datum)(*fmgr_faddr(&finfo))
- (ret_values[i++],
- typelem,
- (!VARLENA_FIXED_SIZE(tupdesc->attrs[attnum - 1]))
- ? tupdesc->attrs[attnum - 1]->attlen
- : tupdesc->attrs[attnum - 1]->atttypmod
- );
- }
+ if (Tcl_SplitList(pltcl_safe_interp, pltcl_safe_interp->result,
+ &ret_numvals, &ret_values) != TCL_OK)
+ {
+ elog(NOTICE, "pltcl: cannot split return value from trigger");
+ elog(ERROR, "pltcl: %s", pltcl_safe_interp->result);
+ }
+ if (ret_numvals % 2 != 0)
+ {
+ ckfree(ret_values);
+ elog(ERROR, "pltcl: invalid return list from trigger - must have even # of elements");
+ }
- rettup = SPI_modifytuple(trigdata->tg_relation, rettup, tupdesc->natts,
- modattrs, modvalues, modnulls);
+ modattrs = (int *) palloc(tupdesc->natts * sizeof(int));
+ modvalues = (Datum *) palloc(tupdesc->natts * sizeof(Datum));
+ for (i = 0; i < tupdesc->natts; i++)
+ {
+ modattrs[i] = i + 1;
+ modvalues[i] = (Datum) NULL;
+ }
- pfree(modattrs);
- pfree(modvalues);
- pfree(modnulls);
+ modnulls = palloc(tupdesc->natts + 1);
+ memset(modnulls, 'n', tupdesc->natts);
+ modnulls[tupdesc->natts] = '\0';
- if (rettup == NULL) {
- elog(ERROR, "pltcl: SPI_modifytuple() failed - RC = %d\n", SPI_result);
- }
+ /************************************************************
+ * Care for possible elog(ERROR)'s below
+ ************************************************************/
+ if (sigsetjmp(Warn_restart, 1) != 0)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ ckfree(ret_values);
+ pltcl_restart_in_progress = 1;
+ if (--pltcl_call_level == 0)
+ {
+ pltcl_restart_in_progress = 0;
+ }
+ siglongjmp(Warn_restart, 1);
+ }
- ckfree(ret_values);
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ i = 0;
+ while (i < ret_numvals)
+ {
+ int attnum;
+ HeapTuple typeTup;
+ Oid typinput;
+ Oid typelem;
+ FmgrInfo finfo;
+
+ /************************************************************
+ * Ignore pseudo elements with a dot name
+ ************************************************************/
+ if (*(ret_values[i]) == '.')
+ {
+ i += 2;
+ continue;
+ }
- return rettup;
+ /************************************************************
+ * Get the attribute number
+ ************************************************************/
+ attnum = SPI_fnumber(tupdesc, ret_values[i++]);
+ if (attnum == SPI_ERROR_NOATTRIBUTE)
+ {
+ elog(ERROR, "pltcl: invalid attribute '%s'", ret_values[--i]);
+ }
+
+ /************************************************************
+ * Lookup the attribute type in the syscache
+ * for the input function
+ ************************************************************/
+ typeTup = SearchSysCacheTuple(TYPOID,
+ ObjectIdGetDatum(tupdesc->attrs[attnum - 1]->atttypid),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(typeTup))
+ {
+ elog(ERROR, "pltcl: Cache lookup for attribute '%s' type %ld failed",
+ ret_values[--i],
+ ObjectIdGetDatum(tupdesc->attrs[attnum - 1]->atttypid));
+ }
+ typinput = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typinput);
+ typelem = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typelem);
+
+ /************************************************************
+ * Set the attribute to NOT NULL and convert the contents
+ ************************************************************/
+ modnulls[attnum - 1] = ' ';
+ fmgr_info(typinput, &finfo);
+ modvalues[attnum - 1] = (Datum) (*fmgr_faddr(&finfo))
+ (ret_values[i++],
+ typelem,
+ (!VARLENA_FIXED_SIZE(tupdesc->attrs[attnum - 1]))
+ ? tupdesc->attrs[attnum - 1]->attlen
+ : tupdesc->attrs[attnum - 1]->atttypmod
+ );
+ }
+
+
+ rettup = SPI_modifytuple(trigdata->tg_relation, rettup, tupdesc->natts,
+ modattrs, modvalues, modnulls);
+
+ pfree(modattrs);
+ pfree(modvalues);
+ pfree(modnulls);
+
+ if (rettup == NULL)
+ {
+ elog(ERROR, "pltcl: SPI_modifytuple() failed - RC = %d\n", SPI_result);
+ }
+
+ ckfree(ret_values);
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+
+ return rettup;
}
/**********************************************************************
* pltcl_elog() - elog() support for PLTcl
**********************************************************************/
-static int pltcl_elog(ClientData cdata, Tcl_Interp *interp,
- int argc, char *argv[])
+static int
+pltcl_elog(ClientData cdata, Tcl_Interp * interp,
+ int argc, char *argv[])
{
- int level;
- sigjmp_buf save_restart;
-
- /************************************************************
- * Suppress messages during the restart process
- ************************************************************/
- if (pltcl_restart_in_progress)
- return TCL_ERROR;
-
- /************************************************************
- * Catch the restart longjmp and begin a controlled
- * return though all interpreter levels if it happens
- ************************************************************/
- memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
- if (sigsetjmp(Warn_restart, 1) != 0) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- pltcl_restart_in_progress = 1;
- return TCL_ERROR;
- }
-
- if (argc != 3) {
- Tcl_SetResult(interp, "syntax error - 'elog level msg'",
- TCL_VOLATILE);
- return TCL_ERROR;
- }
-
- if (strcmp(argv[1], "NOTICE") == 0) {
- level = NOTICE;
- } else
- if (strcmp(argv[1], "WARN") == 0) {
- level = ERROR;
- } else
- if (strcmp(argv[1], "ERROR") == 0) {
- level = ERROR;
- } else
- if (strcmp(argv[1], "FATAL") == 0) {
- level = FATAL;
- } else
- if (strcmp(argv[1], "DEBUG") == 0) {
- level = DEBUG;
- } else
- if (strcmp(argv[1], "NOIND") == 0) {
- level = NOIND;
- } else {
- Tcl_AppendResult(interp, "Unknown elog level '", argv[1],
- "'", NULL);
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- return TCL_ERROR;
- }
-
- /************************************************************
- * Call elog(), restore the original restart address
- * and return to the caller (if not catched)
- ************************************************************/
- elog(level, argv[2]);
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- return TCL_OK;
+ int level;
+ sigjmp_buf save_restart;
+
+ /************************************************************
+ * Suppress messages during the restart process
+ ************************************************************/
+ if (pltcl_restart_in_progress)
+ return TCL_ERROR;
+
+ /************************************************************
+ * Catch the restart longjmp and begin a controlled
+ * return though all interpreter levels if it happens
+ ************************************************************/
+ memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
+ if (sigsetjmp(Warn_restart, 1) != 0)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ pltcl_restart_in_progress = 1;
+ return TCL_ERROR;
+ }
+
+ if (argc != 3)
+ {
+ Tcl_SetResult(interp, "syntax error - 'elog level msg'",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+
+ if (strcmp(argv[1], "NOTICE") == 0)
+ {
+ level = NOTICE;
+ }
+ else if (strcmp(argv[1], "WARN") == 0)
+ {
+ level = ERROR;
+ }
+ else if (strcmp(argv[1], "ERROR") == 0)
+ {
+ level = ERROR;
+ }
+ else if (strcmp(argv[1], "FATAL") == 0)
+ {
+ level = FATAL;
+ }
+ else if (strcmp(argv[1], "DEBUG") == 0)
+ {
+ level = DEBUG;
+ }
+ else if (strcmp(argv[1], "NOIND") == 0)
+ {
+ level = NOIND;
+ }
+ else
+ {
+ Tcl_AppendResult(interp, "Unknown elog level '", argv[1],
+ "'", NULL);
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ return TCL_ERROR;
+ }
+
+ /************************************************************
+ * Call elog(), restore the original restart address
+ * and return to the caller (if not catched)
+ ************************************************************/
+ elog(level, argv[2]);
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ return TCL_OK;
}
@@ -1211,50 +1325,57 @@ static int pltcl_elog(ClientData cdata, Tcl_Interp *interp,
* pltcl_quote() - quote literal strings that are to
* be used in SPI_exec query strings
**********************************************************************/
-static int pltcl_quote(ClientData cdata, Tcl_Interp *interp,
- int argc, char *argv[])
+static int
+pltcl_quote(ClientData cdata, Tcl_Interp * interp,
+ int argc, char *argv[])
{
- char *tmp;
- char *cp1;
- char *cp2;
-
- /************************************************************
- * Check call syntax
- ************************************************************/
- if (argc != 2) {
- Tcl_SetResult(interp, "syntax error - 'quote string'", TCL_VOLATILE);
- return TCL_ERROR;
- }
-
- /************************************************************
- * Allocate space for the maximum the string can
- * grow to and initialize pointers
- ************************************************************/
- tmp = palloc(strlen(argv[1]) * 2 + 1);
- cp1 = argv[1];
- cp2 = tmp;
-
- /************************************************************
- * Walk through string and double every quote and backslash
- ************************************************************/
- while (*cp1) {
- if (*cp1 == '\'') {
- *cp2++ = '\'';
- } else {
- if (*cp1 == '\\') {
- *cp2++ = '\\';
- }
- }
- *cp2++ = *cp1++;
- }
-
- /************************************************************
- * Terminate the string and set it as result
- ************************************************************/
- *cp2 = '\0';
- Tcl_SetResult(interp, tmp, TCL_VOLATILE);
- pfree(tmp);
- return TCL_OK;
+ char *tmp;
+ char *cp1;
+ char *cp2;
+
+ /************************************************************
+ * Check call syntax
+ ************************************************************/
+ if (argc != 2)
+ {
+ Tcl_SetResult(interp, "syntax error - 'quote string'", TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+
+ /************************************************************
+ * Allocate space for the maximum the string can
+ * grow to and initialize pointers
+ ************************************************************/
+ tmp = palloc(strlen(argv[1]) * 2 + 1);
+ cp1 = argv[1];
+ cp2 = tmp;
+
+ /************************************************************
+ * Walk through string and double every quote and backslash
+ ************************************************************/
+ while (*cp1)
+ {
+ if (*cp1 == '\'')
+ {
+ *cp2++ = '\'';
+ }
+ else
+ {
+ if (*cp1 == '\\')
+ {
+ *cp2++ = '\\';
+ }
+ }
+ *cp2++ = *cp1++;
+ }
+
+ /************************************************************
+ * Terminate the string and set it as result
+ ************************************************************/
+ *cp2 = '\0';
+ Tcl_SetResult(interp, tmp, TCL_VOLATILE);
+ pfree(tmp);
+ return TCL_OK;
}
@@ -1262,211 +1383,231 @@ static int pltcl_quote(ClientData cdata, Tcl_Interp *interp,
* pltcl_SPI_exec() - The builtin SPI_exec command
* for the safe interpreter
**********************************************************************/
-static int pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
- int argc, char *argv[])
+static int
+pltcl_SPI_exec(ClientData cdata, Tcl_Interp * interp,
+ int argc, char *argv[])
{
- int spi_rc;
- char buf[64];
- int count = 0;
- char *arrayname = NULL;
- int query_idx;
- int i;
- int loop_rc;
- int ntuples;
- HeapTuple *tuples;
- TupleDesc tupdesc;
- sigjmp_buf save_restart;
-
- char *usage = "syntax error - 'SPI_exec "
- "?-count n? "
- "?-array name? query ?loop body?";
-
- /************************************************************
- * Don't do anything if we are already in restart mode
- ************************************************************/
- if (pltcl_restart_in_progress)
- return TCL_ERROR;
-
- /************************************************************
- * Check the call syntax and get the count option
- ************************************************************/
- if (argc < 2) {
- Tcl_SetResult(interp, usage, TCL_VOLATILE);
- return TCL_ERROR;
- }
-
- i = 1;
- while (i < argc) {
- if (strcmp(argv[i], "-array") == 0) {
- if (++i >= argc) {
- Tcl_SetResult(interp, usage, TCL_VOLATILE);
+ int spi_rc;
+ char buf[64];
+ int count = 0;
+ char *arrayname = NULL;
+ int query_idx;
+ int i;
+ int loop_rc;
+ int ntuples;
+ HeapTuple *tuples;
+ TupleDesc tupdesc;
+ sigjmp_buf save_restart;
+
+ char *usage = "syntax error - 'SPI_exec "
+ "?-count n? "
+ "?-array name? query ?loop body?";
+
+ /************************************************************
+ * Don't do anything if we are already in restart mode
+ ************************************************************/
+ if (pltcl_restart_in_progress)
+ return TCL_ERROR;
+
+ /************************************************************
+ * Check the call syntax and get the count option
+ ************************************************************/
+ if (argc < 2)
+ {
+ Tcl_SetResult(interp, usage, TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+
+ i = 1;
+ while (i < argc)
+ {
+ if (strcmp(argv[i], "-array") == 0)
+ {
+ if (++i >= argc)
+ {
+ Tcl_SetResult(interp, usage, TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+ arrayname = argv[i++];
+ continue;
+ }
+
+ if (strcmp(argv[i], "-count") == 0)
+ {
+ if (++i >= argc)
+ {
+ Tcl_SetResult(interp, usage, TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+ if (Tcl_GetInt(interp, argv[i++], &count) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+ continue;
+ }
+
+ break;
+ }
+
+ query_idx = i;
+ if (query_idx >= argc)
+ {
+ Tcl_SetResult(interp, usage, TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+
+ /************************************************************
+ * Prepare to start a controlled return through all
+ * interpreter levels on transaction abort
+ ************************************************************/
+ memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
+ if (sigsetjmp(Warn_restart, 1) != 0)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ pltcl_restart_in_progress = 1;
+ Tcl_SetResult(interp, "Transaction abort", TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+
+ /************************************************************
+ * Execute the query and handle return codes
+ ************************************************************/
+ spi_rc = SPI_exec(argv[query_idx], count);
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+
+ switch (spi_rc)
+ {
+ case SPI_OK_UTILITY:
+ Tcl_SetResult(interp, "0", TCL_VOLATILE);
+ return TCL_OK;
+
+ case SPI_OK_SELINTO:
+ case SPI_OK_INSERT:
+ case SPI_OK_DELETE:
+ case SPI_OK_UPDATE:
+ sprintf(buf, "%d", SPI_processed);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_OK;
+
+ case SPI_OK_SELECT:
+ break;
+
+ case SPI_ERROR_ARGUMENT:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_ARGUMENT",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ case SPI_ERROR_UNCONNECTED:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_UNCONNECTED",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ case SPI_ERROR_COPY:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_COPY",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ case SPI_ERROR_CURSOR:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_CURSOR",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ case SPI_ERROR_TRANSACTION:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_TRANSACTION",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ case SPI_ERROR_OPUNKNOWN:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_OPUNKNOWN",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ default:
+ sprintf(buf, "%d", spi_rc);
+ Tcl_AppendResult(interp, "pltcl: SPI_exec() failed - ",
+ "unknown RC ", buf, NULL);
+ return TCL_ERROR;
+ }
+
+ /************************************************************
+ * Only SELECT queries fall through to here - remember the
+ * tuples we got
+ ************************************************************/
+
+ ntuples = SPI_processed;
+ if (ntuples > 0)
+ {
+ tuples = SPI_tuptable->vals;
+ tupdesc = SPI_tuptable->tupdesc;
+ }
+
+ /************************************************************
+ * Again prepare for elog(ERROR)
+ ************************************************************/
+ if (sigsetjmp(Warn_restart, 1) != 0)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ pltcl_restart_in_progress = 1;
+ Tcl_SetResult(interp, "Transaction abort", TCL_VOLATILE);
return TCL_ERROR;
- }
- arrayname = argv[i++];
- continue;
}
- if (strcmp(argv[i], "-count") == 0) {
- if (++i >= argc) {
- Tcl_SetResult(interp, usage, TCL_VOLATILE);
+ /************************************************************
+ * If there is no loop body given, just set the variables
+ * from the first tuple (if any) and return the number of
+ * tuples selected
+ ************************************************************/
+ if (argc == query_idx + 1)
+ {
+ if (ntuples > 0)
+ {
+ pltcl_set_tuple_values(interp, arrayname, 0, tuples[0], tupdesc);
+ }
+ sprintf(buf, "%d", ntuples);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ return TCL_OK;
+ }
+
+ /************************************************************
+ * There is a loop body - process all tuples and evaluate
+ * the body on each
+ ************************************************************/
+ query_idx++;
+ for (i = 0; i < ntuples; i++)
+ {
+ pltcl_set_tuple_values(interp, arrayname, i, tuples[i], tupdesc);
+
+ loop_rc = Tcl_Eval(interp, argv[query_idx]);
+
+ if (loop_rc == TCL_OK)
+ continue;
+ if (loop_rc == TCL_CONTINUE)
+ continue;
+ if (loop_rc == TCL_RETURN)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ return TCL_RETURN;
+ }
+ if (loop_rc == TCL_BREAK)
+ break;
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
return TCL_ERROR;
- }
- if (Tcl_GetInt(interp, argv[i++], &count) != TCL_OK) {
- return TCL_ERROR;
- }
- continue;
- }
-
- break;
- }
-
- query_idx = i;
- if (query_idx >= argc) {
- Tcl_SetResult(interp, usage, TCL_VOLATILE);
- return TCL_ERROR;
- }
-
- /************************************************************
- * Prepare to start a controlled return through all
- * interpreter levels on transaction abort
- ************************************************************/
- memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
- if (sigsetjmp(Warn_restart, 1) != 0) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- pltcl_restart_in_progress = 1;
- Tcl_SetResult(interp, "Transaction abort", TCL_VOLATILE);
- return TCL_ERROR;
- }
-
- /************************************************************
- * Execute the query and handle return codes
- ************************************************************/
- spi_rc = SPI_exec(argv[query_idx], count);
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
-
- switch (spi_rc) {
- case SPI_OK_UTILITY:
- Tcl_SetResult(interp, "0", TCL_VOLATILE);
- return TCL_OK;
-
- case SPI_OK_SELINTO:
- case SPI_OK_INSERT:
- case SPI_OK_DELETE:
- case SPI_OK_UPDATE:
- sprintf(buf, "%d", SPI_processed);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return TCL_OK;
-
- case SPI_OK_SELECT:
- break;
-
- case SPI_ERROR_ARGUMENT:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_ARGUMENT",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- case SPI_ERROR_UNCONNECTED:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_UNCONNECTED",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- case SPI_ERROR_COPY:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_COPY",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- case SPI_ERROR_CURSOR:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_CURSOR",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- case SPI_ERROR_TRANSACTION:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_TRANSACTION",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- case SPI_ERROR_OPUNKNOWN:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_OPUNKNOWN",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- default:
- sprintf(buf, "%d", spi_rc);
- Tcl_AppendResult(interp, "pltcl: SPI_exec() failed - ",
- "unknown RC ", buf, NULL);
- return TCL_ERROR;
- }
-
- /************************************************************
- * Only SELECT queries fall through to here - remember the
- * tuples we got
- ************************************************************/
-
- ntuples = SPI_processed;
- if (ntuples > 0) {
- tuples = SPI_tuptable->vals;
- tupdesc = SPI_tuptable->tupdesc;
- }
-
- /************************************************************
- * Again prepare for elog(ERROR)
- ************************************************************/
- if (sigsetjmp(Warn_restart, 1) != 0) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- pltcl_restart_in_progress = 1;
- Tcl_SetResult(interp, "Transaction abort", TCL_VOLATILE);
- return TCL_ERROR;
- }
-
- /************************************************************
- * If there is no loop body given, just set the variables
- * from the first tuple (if any) and return the number of
- * tuples selected
- ************************************************************/
- if (argc == query_idx + 1) {
- if (ntuples > 0) {
- pltcl_set_tuple_values(interp, arrayname, 0, tuples[0], tupdesc);
- }
- sprintf(buf, "%d", ntuples);
+ }
+
+ /************************************************************
+ * Finally return the number of tuples
+ ************************************************************/
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ sprintf(buf, "%d", ntuples);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
return TCL_OK;
- }
-
- /************************************************************
- * There is a loop body - process all tuples and evaluate
- * the body on each
- ************************************************************/
- query_idx++;
- for (i = 0; i < ntuples; i++) {
- pltcl_set_tuple_values(interp, arrayname, i, tuples[i], tupdesc);
-
- loop_rc = Tcl_Eval(interp, argv[query_idx]);
-
- if (loop_rc == TCL_OK) continue;
- if (loop_rc == TCL_CONTINUE) continue;
- if (loop_rc == TCL_RETURN) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- return TCL_RETURN;
- }
- if (loop_rc == TCL_BREAK) break;
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- return TCL_ERROR;
- }
-
- /************************************************************
- * Finally return the number of tuples
- ************************************************************/
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- sprintf(buf, "%d", ntuples);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return TCL_OK;
}
@@ -1478,682 +1619,744 @@ static int pltcl_SPI_exec(ClientData cdata, Tcl_Interp *interp,
* access. There is no chance to prepare
* and not save the plan currently.
**********************************************************************/
-static int pltcl_SPI_prepare(ClientData cdata, Tcl_Interp *interp,
- int argc, char *argv[])
+static int
+pltcl_SPI_prepare(ClientData cdata, Tcl_Interp * interp,
+ int argc, char *argv[])
{
- int nargs;
- char **args;
- pltcl_query_desc *qdesc;
- void *plan;
- int i;
- HeapTuple typeTup;
- Tcl_HashEntry *hashent;
- int hashnew;
- sigjmp_buf save_restart;
-
- /************************************************************
- * Don't do anything if we are already in restart mode
- ************************************************************/
- if (pltcl_restart_in_progress)
- return TCL_ERROR;
-
- /************************************************************
- * Check the call syntax
- ************************************************************/
- if (argc != 3) {
- Tcl_SetResult(interp, "syntax error - 'SPI_prepare query argtypes'",
- TCL_VOLATILE);
- return TCL_ERROR;
- }
-
- /************************************************************
- * Split the argument type list
- ************************************************************/
- if (Tcl_SplitList(interp, argv[2], &nargs, &args) != TCL_OK) {
- return TCL_ERROR;
- }
-
- /************************************************************
- * Allocate the new querydesc structure
- ************************************************************/
- qdesc = (pltcl_query_desc *)malloc(sizeof(pltcl_query_desc));
- sprintf(qdesc->qname, "%lx", (long)qdesc);
- qdesc->nargs = nargs;
- qdesc->argtypes = (Oid *)malloc(nargs * sizeof(Oid));
- qdesc->arginfuncs = (FmgrInfo *)malloc(nargs * sizeof(FmgrInfo));
- qdesc->argtypelems = (Oid *)malloc(nargs * sizeof(Oid));
- qdesc->argvalues = (Datum *)malloc(nargs * sizeof(Datum));
- qdesc->arglen = (int *)malloc(nargs * sizeof(int));
-
- /************************************************************
- * Prepare to start a controlled return through all
- * interpreter levels on transaction abort
- ************************************************************/
- memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
- if (sigsetjmp(Warn_restart, 1) != 0) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- pltcl_restart_in_progress = 1;
- free(qdesc->argtypes);
- free(qdesc->arginfuncs);
- free(qdesc->argtypelems);
- free(qdesc->argvalues);
- free(qdesc->arglen);
- free(qdesc);
- ckfree(args);
- return TCL_ERROR;
- }
-
- /************************************************************
- * Lookup the argument types by name in the system cache
- * and remember the required information for input conversion
- ************************************************************/
- for (i = 0; i < nargs; i++) {
- typeTup = SearchSysCacheTuple(TYPNAME,
- PointerGetDatum(args[i]),
- 0, 0, 0);
- if (!HeapTupleIsValid(typeTup)) {
- elog(ERROR, "pltcl: Cache lookup of type %s failed", args[i]);
- }
- qdesc->argtypes[i] = typeTup->t_oid;
- fmgr_info(((TypeTupleForm) GETSTRUCT(typeTup))->typinput,
- &(qdesc->arginfuncs[i]));
- qdesc->argtypelems[i] = ((TypeTupleForm) GETSTRUCT(typeTup))->typelem;
- qdesc->argvalues[i] = (Datum)NULL;
- qdesc->arglen[i] = (int)(((TypeTupleForm) GETSTRUCT(typeTup))->typlen);
- }
-
- /************************************************************
- * Prepare the plan and check for errors
- ************************************************************/
- plan = SPI_prepare(argv[1], nargs, qdesc->argtypes);
-
- if (plan == NULL) {
- char buf[128];
- char *reason;
+ int nargs;
+ char **args;
+ pltcl_query_desc *qdesc;
+ void *plan;
+ int i;
+ HeapTuple typeTup;
+ Tcl_HashEntry *hashent;
+ int hashnew;
+ sigjmp_buf save_restart;
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ /************************************************************
+ * Don't do anything if we are already in restart mode
+ ************************************************************/
+ if (pltcl_restart_in_progress)
+ return TCL_ERROR;
- switch(SPI_result) {
- case SPI_ERROR_ARGUMENT:
- reason = "SPI_ERROR_ARGUMENT";
- break;
+ /************************************************************
+ * Check the call syntax
+ ************************************************************/
+ if (argc != 3)
+ {
+ Tcl_SetResult(interp, "syntax error - 'SPI_prepare query argtypes'",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+ }
- case SPI_ERROR_UNCONNECTED:
- reason = "SPI_ERROR_UNCONNECTED";
- break;
+ /************************************************************
+ * Split the argument type list
+ ************************************************************/
+ if (Tcl_SplitList(interp, argv[2], &nargs, &args) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
- case SPI_ERROR_COPY:
- reason = "SPI_ERROR_COPY";
- break;
+ /************************************************************
+ * Allocate the new querydesc structure
+ ************************************************************/
+ qdesc = (pltcl_query_desc *) malloc(sizeof(pltcl_query_desc));
+ sprintf(qdesc->qname, "%lx", (long) qdesc);
+ qdesc->nargs = nargs;
+ qdesc->argtypes = (Oid *) malloc(nargs * sizeof(Oid));
+ qdesc->arginfuncs = (FmgrInfo *) malloc(nargs * sizeof(FmgrInfo));
+ qdesc->argtypelems = (Oid *) malloc(nargs * sizeof(Oid));
+ qdesc->argvalues = (Datum *) malloc(nargs * sizeof(Datum));
+ qdesc->arglen = (int *) malloc(nargs * sizeof(int));
- case SPI_ERROR_CURSOR:
- reason = "SPI_ERROR_CURSOR";
- break;
+ /************************************************************
+ * Prepare to start a controlled return through all
+ * interpreter levels on transaction abort
+ ************************************************************/
+ memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
+ if (sigsetjmp(Warn_restart, 1) != 0)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ pltcl_restart_in_progress = 1;
+ free(qdesc->argtypes);
+ free(qdesc->arginfuncs);
+ free(qdesc->argtypelems);
+ free(qdesc->argvalues);
+ free(qdesc->arglen);
+ free(qdesc);
+ ckfree(args);
+ return TCL_ERROR;
+ }
- case SPI_ERROR_TRANSACTION:
- reason = "SPI_ERROR_TRANSACTION";
- break;
+ /************************************************************
+ * Lookup the argument types by name in the system cache
+ * and remember the required information for input conversion
+ ************************************************************/
+ for (i = 0; i < nargs; i++)
+ {
+ typeTup = SearchSysCacheTuple(TYPNAME,
+ PointerGetDatum(args[i]),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(typeTup))
+ {
+ elog(ERROR, "pltcl: Cache lookup of type %s failed", args[i]);
+ }
+ qdesc->argtypes[i] = typeTup->t_oid;
+ fmgr_info(((TypeTupleForm) GETSTRUCT(typeTup))->typinput,
+ &(qdesc->arginfuncs[i]));
+ qdesc->argtypelems[i] = ((TypeTupleForm) GETSTRUCT(typeTup))->typelem;
+ qdesc->argvalues[i] = (Datum) NULL;
+ qdesc->arglen[i] = (int) (((TypeTupleForm) GETSTRUCT(typeTup))->typlen);
+ }
- case SPI_ERROR_OPUNKNOWN:
- reason = "SPI_ERROR_OPUNKNOWN";
- break;
+ /************************************************************
+ * Prepare the plan and check for errors
+ ************************************************************/
+ plan = SPI_prepare(argv[1], nargs, qdesc->argtypes);
- default:
- sprintf(buf, "unknown RC %d", SPI_result);
- reason = buf;
- break;
-
- }
+ if (plan == NULL)
+ {
+ char buf[128];
+ char *reason;
- elog(ERROR, "pltcl: SPI_prepare() failed - %s", reason);
- }
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- /************************************************************
- * Save the plan
- ************************************************************/
- qdesc->plan = SPI_saveplan(plan);
- if (qdesc->plan == NULL) {
- char buf[128];
- char *reason;
+ switch (SPI_result)
+ {
+ case SPI_ERROR_ARGUMENT:
+ reason = "SPI_ERROR_ARGUMENT";
+ break;
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ case SPI_ERROR_UNCONNECTED:
+ reason = "SPI_ERROR_UNCONNECTED";
+ break;
- switch(SPI_result) {
- case SPI_ERROR_ARGUMENT:
- reason = "SPI_ERROR_ARGUMENT";
- break;
+ case SPI_ERROR_COPY:
+ reason = "SPI_ERROR_COPY";
+ break;
- case SPI_ERROR_UNCONNECTED:
- reason = "SPI_ERROR_UNCONNECTED";
- break;
+ case SPI_ERROR_CURSOR:
+ reason = "SPI_ERROR_CURSOR";
+ break;
- default:
- sprintf(buf, "unknown RC %d", SPI_result);
- reason = buf;
- break;
-
+ case SPI_ERROR_TRANSACTION:
+ reason = "SPI_ERROR_TRANSACTION";
+ break;
+
+ case SPI_ERROR_OPUNKNOWN:
+ reason = "SPI_ERROR_OPUNKNOWN";
+ break;
+
+ default:
+ sprintf(buf, "unknown RC %d", SPI_result);
+ reason = buf;
+ break;
+
+ }
+
+ elog(ERROR, "pltcl: SPI_prepare() failed - %s", reason);
}
- elog(ERROR, "pltcl: SPI_saveplan() failed - %s", reason);
- }
+ /************************************************************
+ * Save the plan
+ ************************************************************/
+ qdesc->plan = SPI_saveplan(plan);
+ if (qdesc->plan == NULL)
+ {
+ char buf[128];
+ char *reason;
+
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+
+ switch (SPI_result)
+ {
+ case SPI_ERROR_ARGUMENT:
+ reason = "SPI_ERROR_ARGUMENT";
+ break;
+
+ case SPI_ERROR_UNCONNECTED:
+ reason = "SPI_ERROR_UNCONNECTED";
+ break;
+
+ default:
+ sprintf(buf, "unknown RC %d", SPI_result);
+ reason = buf;
+ break;
+
+ }
- /************************************************************
- * Insert a hashtable entry for the plan and return
- * the key to the caller
- ************************************************************/
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- hashent = Tcl_CreateHashEntry(pltcl_query_hash, qdesc->qname, &hashnew);
- Tcl_SetHashValue(hashent, (ClientData)qdesc);
+ elog(ERROR, "pltcl: SPI_saveplan() failed - %s", reason);
+ }
+
+ /************************************************************
+ * Insert a hashtable entry for the plan and return
+ * the key to the caller
+ ************************************************************/
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ hashent = Tcl_CreateHashEntry(pltcl_query_hash, qdesc->qname, &hashnew);
+ Tcl_SetHashValue(hashent, (ClientData) qdesc);
- Tcl_SetResult(interp, qdesc->qname, TCL_VOLATILE);
- return TCL_OK;
+ Tcl_SetResult(interp, qdesc->qname, TCL_VOLATILE);
+ return TCL_OK;
}
/**********************************************************************
* pltcl_SPI_execp() - Execute a prepared plan
**********************************************************************/
-static int pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
- int argc, char *argv[])
+static int
+pltcl_SPI_execp(ClientData cdata, Tcl_Interp * interp,
+ int argc, char *argv[])
{
- int spi_rc;
- char buf[64];
- int i, j;
- int loop_body;
- Tcl_HashEntry *hashent;
- pltcl_query_desc *qdesc;
- char *nulls = NULL;
- char *arrayname = NULL;
- int count = 0;
- int callnargs;
- static char **callargs = NULL;
- int loop_rc;
- int ntuples;
- HeapTuple *tuples = NULL;
- TupleDesc tupdesc = NULL;
- sigjmp_buf save_restart;
-
- char *usage = "syntax error - 'SPI_execp "
- "?-nulls string? ?-count n? "
- "?-array name? query ?args? ?loop body?";
-
- /************************************************************
- * Tidy up from an earlier abort
- ************************************************************/
- if (callargs != NULL) {
- ckfree(callargs);
- callargs = NULL;
- }
-
- /************************************************************
- * Don't do anything if we are already in restart mode
- ************************************************************/
- if (pltcl_restart_in_progress)
- return TCL_ERROR;
-
- /************************************************************
- * Get the options and check syntax
- ************************************************************/
- i = 1;
- while (i < argc) {
- if (strcmp(argv[i], "-array") == 0) {
- if (++i >= argc) {
- Tcl_SetResult(interp, usage, TCL_VOLATILE);
- return TCL_ERROR;
- }
- arrayname = argv[i++];
- continue;
+ int spi_rc;
+ char buf[64];
+ int i,
+ j;
+ int loop_body;
+ Tcl_HashEntry *hashent;
+ pltcl_query_desc *qdesc;
+ char *nulls = NULL;
+ char *arrayname = NULL;
+ int count = 0;
+ int callnargs;
+ static char **callargs = NULL;
+ int loop_rc;
+ int ntuples;
+ HeapTuple *tuples = NULL;
+ TupleDesc tupdesc = NULL;
+ sigjmp_buf save_restart;
+
+ char *usage = "syntax error - 'SPI_execp "
+ "?-nulls string? ?-count n? "
+ "?-array name? query ?args? ?loop body?";
+
+ /************************************************************
+ * Tidy up from an earlier abort
+ ************************************************************/
+ if (callargs != NULL)
+ {
+ ckfree(callargs);
+ callargs = NULL;
}
- if (strcmp(argv[i], "-nulls") == 0) {
- if (++i >= argc) {
- Tcl_SetResult(interp, usage, TCL_VOLATILE);
+
+ /************************************************************
+ * Don't do anything if we are already in restart mode
+ ************************************************************/
+ if (pltcl_restart_in_progress)
return TCL_ERROR;
- }
- nulls = argv[i++];
- continue;
+
+ /************************************************************
+ * Get the options and check syntax
+ ************************************************************/
+ i = 1;
+ while (i < argc)
+ {
+ if (strcmp(argv[i], "-array") == 0)
+ {
+ if (++i >= argc)
+ {
+ Tcl_SetResult(interp, usage, TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+ arrayname = argv[i++];
+ continue;
+ }
+ if (strcmp(argv[i], "-nulls") == 0)
+ {
+ if (++i >= argc)
+ {
+ Tcl_SetResult(interp, usage, TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+ nulls = argv[i++];
+ continue;
+ }
+ if (strcmp(argv[i], "-count") == 0)
+ {
+ if (++i >= argc)
+ {
+ Tcl_SetResult(interp, usage, TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+ if (Tcl_GetInt(interp, argv[i++], &count) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
+ continue;
+ }
+
+ break;
}
- if (strcmp(argv[i], "-count") == 0) {
- if (++i >= argc) {
- Tcl_SetResult(interp, usage, TCL_VOLATILE);
+
+ /************************************************************
+ * Check minimum call arguments
+ ************************************************************/
+ if (i >= argc)
+ {
+ Tcl_SetResult(interp, usage, TCL_VOLATILE);
return TCL_ERROR;
- }
- if (Tcl_GetInt(interp, argv[i++], &count) != TCL_OK) {
- return TCL_ERROR;
- }
- continue;
- }
-
- break;
- }
-
- /************************************************************
- * Check minimum call arguments
- ************************************************************/
- if (i >= argc) {
- Tcl_SetResult(interp, usage, TCL_VOLATILE);
- return TCL_ERROR;
- }
-
- /************************************************************
- * Get the prepared plan descriptor by it's key
- ************************************************************/
- hashent = Tcl_FindHashEntry(pltcl_query_hash, argv[i++]);
- if (hashent == NULL) {
- Tcl_AppendResult(interp, "invalid queryid '", argv[--i], "'", NULL);
- return TCL_ERROR;
- }
- qdesc = (pltcl_query_desc *)Tcl_GetHashValue(hashent);
-
- /************************************************************
- * If a nulls string is given, check for correct length
- ************************************************************/
- if (nulls != NULL) {
- if (strlen(nulls) != qdesc->nargs) {
- Tcl_SetResult(interp,
- "length of nulls string doesn't match # of arguments",
- TCL_VOLATILE);
- return TCL_ERROR;
- }
- }
-
- /************************************************************
- * If there was a argtype list on preparation, we need
- * an argument value list now
- ************************************************************/
- if (qdesc->nargs > 0) {
- if (i >= argc) {
- Tcl_SetResult(interp, "missing argument list", TCL_VOLATILE);
- return TCL_ERROR;
- }
-
- /************************************************************
- * Split the argument values
- ************************************************************/
- if (Tcl_SplitList(interp, argv[i++], &callnargs, &callargs) != TCL_OK) {
- return TCL_ERROR;
- }
-
- /************************************************************
- * Check that the # of arguments matches
- ************************************************************/
- if (callnargs != qdesc->nargs) {
- Tcl_SetResult(interp,
- "argument list length doesn't match # of arguments for query",
- TCL_VOLATILE);
- if (callargs != NULL) {
- ckfree(callargs);
- callargs = NULL;
- }
- return TCL_ERROR;
}
/************************************************************
- * Prepare to start a controlled return through all
- * interpreter levels on transaction abort during the
- * parse of the arguments
+ * Get the prepared plan descriptor by it's key
************************************************************/
- memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
- if (sigsetjmp(Warn_restart, 1) != 0) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- for (j = 0; j < callnargs; j++) {
- if (qdesc->arglen[j] < 0 &&
- qdesc->argvalues[j] != (Datum)NULL) {
- pfree((char *)(qdesc->argvalues[j]));
- qdesc->argvalues[j] = (Datum)NULL;
- }
- }
- ckfree(callargs);
- callargs = NULL;
- pltcl_restart_in_progress = 1;
- Tcl_SetResult(interp, "Transaction abort", TCL_VOLATILE);
- return TCL_ERROR;
+ hashent = Tcl_FindHashEntry(pltcl_query_hash, argv[i++]);
+ if (hashent == NULL)
+ {
+ Tcl_AppendResult(interp, "invalid queryid '", argv[--i], "'", NULL);
+ return TCL_ERROR;
}
+ qdesc = (pltcl_query_desc *) Tcl_GetHashValue(hashent);
/************************************************************
- * Setup the value array for the SPI_execp() using
- * the type specific input functions
+ * If a nulls string is given, check for correct length
************************************************************/
- for (j = 0; j < callnargs; j++) {
- qdesc->argvalues[j] = (Datum)(*fmgr_faddr(&qdesc->arginfuncs[j]))
- (callargs[j],
- qdesc->argtypelems[j],
- qdesc->arglen[j]);
+ if (nulls != NULL)
+ {
+ if (strlen(nulls) != qdesc->nargs)
+ {
+ Tcl_SetResult(interp,
+ "length of nulls string doesn't match # of arguments",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+ }
}
/************************************************************
- * Free the splitted argument value list
+ * If there was a argtype list on preparation, we need
+ * an argument value list now
************************************************************/
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- ckfree(callargs);
- callargs = NULL;
- } else {
- callnargs = 0;
- }
-
- /************************************************************
- * Remember the index of the last processed call
- * argument - a loop body for SELECT might follow
- ************************************************************/
- loop_body = i;
-
- /************************************************************
- * Prepare to start a controlled return through all
- * interpreter levels on transaction abort
- ************************************************************/
- memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
- if (sigsetjmp(Warn_restart, 1) != 0) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- for (j = 0; j < callnargs; j++) {
- if (qdesc->arglen[j] < 0 && qdesc->argvalues[j] != (Datum)NULL) {
- pfree((char *)(qdesc->argvalues[j]));
- qdesc->argvalues[j] = (Datum)NULL;
- }
- }
- pltcl_restart_in_progress = 1;
- Tcl_SetResult(interp, "Transaction abort", TCL_VOLATILE);
- return TCL_ERROR;
- }
-
- /************************************************************
- * Execute the plan
- ************************************************************/
- spi_rc = SPI_execp(qdesc->plan, qdesc->argvalues, nulls, count);
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
-
- /************************************************************
- * For varlena data types, free the argument values
- ************************************************************/
- for (j = 0; j < callnargs; j++) {
- if (qdesc->arglen[j] < 0 && qdesc->argvalues[j] != (Datum)NULL) {
- pfree((char *)(qdesc->argvalues[j]));
- qdesc->argvalues[j] = (Datum)NULL;
- }
- }
-
- /************************************************************
- * Check the return code from SPI_execp()
- ************************************************************/
- switch (spi_rc) {
- case SPI_OK_UTILITY:
- Tcl_SetResult(interp, "0", TCL_VOLATILE);
- return TCL_OK;
-
- case SPI_OK_SELINTO:
- case SPI_OK_INSERT:
- case SPI_OK_DELETE:
- case SPI_OK_UPDATE:
- sprintf(buf, "%d", SPI_processed);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return TCL_OK;
-
- case SPI_OK_SELECT:
- break;
-
- case SPI_ERROR_ARGUMENT:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_ARGUMENT",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- case SPI_ERROR_UNCONNECTED:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_UNCONNECTED",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- case SPI_ERROR_COPY:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_COPY",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- case SPI_ERROR_CURSOR:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_CURSOR",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- case SPI_ERROR_TRANSACTION:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_TRANSACTION",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- case SPI_ERROR_OPUNKNOWN:
- Tcl_SetResult(interp,
- "pltcl: SPI_exec() failed - SPI_ERROR_OPUNKNOWN",
- TCL_VOLATILE);
- return TCL_ERROR;
-
- default:
- sprintf(buf, "%d", spi_rc);
- Tcl_AppendResult(interp, "pltcl: SPI_exec() failed - ",
- "unknown RC ", buf, NULL);
- return TCL_ERROR;
- }
-
- /************************************************************
- * Only SELECT queries fall through to here - remember the
- * tuples we got
- ************************************************************/
-
- ntuples = SPI_processed;
- if (ntuples > 0) {
- tuples = SPI_tuptable->vals;
- tupdesc = SPI_tuptable->tupdesc;
- }
-
- /************************************************************
- * Prepare to start a controlled return through all
- * interpreter levels on transaction abort during
- * the ouput conversions of the results
- ************************************************************/
- memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
- if (sigsetjmp(Warn_restart, 1) != 0) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- pltcl_restart_in_progress = 1;
- Tcl_SetResult(interp, "Transaction abort", TCL_VOLATILE);
- return TCL_ERROR;
- }
-
- /************************************************************
- * If there is no loop body given, just set the variables
- * from the first tuple (if any) and return the number of
- * tuples selected
- ************************************************************/
- if (loop_body >= argc) {
- if (ntuples > 0) {
- pltcl_set_tuple_values(interp, arrayname, 0, tuples[0], tupdesc);
- }
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- sprintf(buf, "%d", ntuples);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return TCL_OK;
- }
-
- /************************************************************
- * There is a loop body - process all tuples and evaluate
- * the body on each
- ************************************************************/
- for (i = 0; i < ntuples; i++) {
- pltcl_set_tuple_values(interp, arrayname, i, tuples[i], tupdesc);
-
- loop_rc = Tcl_Eval(interp, argv[loop_body]);
-
- if (loop_rc == TCL_OK) continue;
- if (loop_rc == TCL_CONTINUE) continue;
- if (loop_rc == TCL_RETURN) {
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- return TCL_RETURN;
- }
- if (loop_rc == TCL_BREAK) break;
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- return TCL_ERROR;
- }
-
- /************************************************************
- * Finally return the number of tuples
- ************************************************************/
- memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
- sprintf(buf, "%d", ntuples);
- Tcl_SetResult(interp, buf, TCL_VOLATILE);
- return TCL_OK;
-}
+ if (qdesc->nargs > 0)
+ {
+ if (i >= argc)
+ {
+ Tcl_SetResult(interp, "missing argument list", TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+ /************************************************************
+ * Split the argument values
+ ************************************************************/
+ if (Tcl_SplitList(interp, argv[i++], &callnargs, &callargs) != TCL_OK)
+ {
+ return TCL_ERROR;
+ }
-/**********************************************************************
- * pltcl_set_tuple_values() - Set variables for all attributes
- * of a given tuple
- **********************************************************************/
-static void pltcl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
- int tupno, HeapTuple tuple, TupleDesc tupdesc)
-{
- int i;
- char *outputstr;
- char buf[64];
- Datum attr;
- bool isnull;
+ /************************************************************
+ * Check that the # of arguments matches
+ ************************************************************/
+ if (callnargs != qdesc->nargs)
+ {
+ Tcl_SetResult(interp,
+ "argument list length doesn't match # of arguments for query",
+ TCL_VOLATILE);
+ if (callargs != NULL)
+ {
+ ckfree(callargs);
+ callargs = NULL;
+ }
+ return TCL_ERROR;
+ }
- char *attname;
- HeapTuple typeTup;
- Oid typoutput;
- Oid typelem;
+ /************************************************************
+ * Prepare to start a controlled return through all
+ * interpreter levels on transaction abort during the
+ * parse of the arguments
+ ************************************************************/
+ memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
+ if (sigsetjmp(Warn_restart, 1) != 0)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ for (j = 0; j < callnargs; j++)
+ {
+ if (qdesc->arglen[j] < 0 &&
+ qdesc->argvalues[j] != (Datum) NULL)
+ {
+ pfree((char *) (qdesc->argvalues[j]));
+ qdesc->argvalues[j] = (Datum) NULL;
+ }
+ }
+ ckfree(callargs);
+ callargs = NULL;
+ pltcl_restart_in_progress = 1;
+ Tcl_SetResult(interp, "Transaction abort", TCL_VOLATILE);
+ return TCL_ERROR;
+ }
- char **arrptr;
- char **nameptr;
- char *nullname = NULL;
+ /************************************************************
+ * Setup the value array for the SPI_execp() using
+ * the type specific input functions
+ ************************************************************/
+ for (j = 0; j < callnargs; j++)
+ {
+ qdesc->argvalues[j] = (Datum) (*fmgr_faddr(&qdesc->arginfuncs[j]))
+ (callargs[j],
+ qdesc->argtypelems[j],
+ qdesc->arglen[j]);
+ }
- /************************************************************
- * Prepare pointers for Tcl_SetVar2() below and in array
- * mode set the .tupno element
- ************************************************************/
- if (arrayname == NULL) {
- arrptr = &attname;
- nameptr = &nullname;
- } else {
- arrptr = &arrayname;
- nameptr = &attname;
- sprintf(buf, "%d", tupno);
- Tcl_SetVar2(interp, arrayname, ".tupno", buf, 0);
- }
+ /************************************************************
+ * Free the splitted argument value list
+ ************************************************************/
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ ckfree(callargs);
+ callargs = NULL;
+ }
+ else
+ {
+ callnargs = 0;
+ }
- for (i = 0; i < tupdesc->natts; i++) {
/************************************************************
- * Get the attribute name
+ * Remember the index of the last processed call
+ * argument - a loop body for SELECT might follow
************************************************************/
- attname = tupdesc->attrs[i]->attname.data;
+ loop_body = i;
/************************************************************
- * Get the attributes value
+ * Prepare to start a controlled return through all
+ * interpreter levels on transaction abort
************************************************************/
- attr = heap_getattr(tuple, i + 1, tupdesc, &isnull);
-
+ memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
+ if (sigsetjmp(Warn_restart, 1) != 0)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ for (j = 0; j < callnargs; j++)
+ {
+ if (qdesc->arglen[j] < 0 && qdesc->argvalues[j] != (Datum) NULL)
+ {
+ pfree((char *) (qdesc->argvalues[j]));
+ qdesc->argvalues[j] = (Datum) NULL;
+ }
+ }
+ pltcl_restart_in_progress = 1;
+ Tcl_SetResult(interp, "Transaction abort", TCL_VOLATILE);
+ return TCL_ERROR;
+ }
+
+ /************************************************************
+ * Execute the plan
+ ************************************************************/
+ spi_rc = SPI_execp(qdesc->plan, qdesc->argvalues, nulls, count);
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+
/************************************************************
- * Lookup the attribute type in the syscache
- * for the output function
+ * For varlena data types, free the argument values
************************************************************/
- typeTup = SearchSysCacheTuple(TYPOID,
- ObjectIdGetDatum(tupdesc->attrs[i]->atttypid),
- 0, 0, 0);
- if (!HeapTupleIsValid(typeTup)) {
- elog(ERROR, "pltcl: Cache lookup for attribute '%s' type %ld failed",
- attname, ObjectIdGetDatum(tupdesc->attrs[i]->atttypid));
+ for (j = 0; j < callnargs; j++)
+ {
+ if (qdesc->arglen[j] < 0 && qdesc->argvalues[j] != (Datum) NULL)
+ {
+ pfree((char *) (qdesc->argvalues[j]));
+ qdesc->argvalues[j] = (Datum) NULL;
+ }
}
- typoutput = (Oid) (((TypeTupleForm)GETSTRUCT(typeTup))->typoutput);
- typelem = (Oid) (((TypeTupleForm)GETSTRUCT(typeTup))->typelem);
+ /************************************************************
+ * Check the return code from SPI_execp()
+ ************************************************************/
+ switch (spi_rc)
+ {
+ case SPI_OK_UTILITY:
+ Tcl_SetResult(interp, "0", TCL_VOLATILE);
+ return TCL_OK;
+
+ case SPI_OK_SELINTO:
+ case SPI_OK_INSERT:
+ case SPI_OK_DELETE:
+ case SPI_OK_UPDATE:
+ sprintf(buf, "%d", SPI_processed);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_OK;
+
+ case SPI_OK_SELECT:
+ break;
+
+ case SPI_ERROR_ARGUMENT:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_ARGUMENT",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ case SPI_ERROR_UNCONNECTED:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_UNCONNECTED",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ case SPI_ERROR_COPY:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_COPY",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ case SPI_ERROR_CURSOR:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_CURSOR",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ case SPI_ERROR_TRANSACTION:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_TRANSACTION",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ case SPI_ERROR_OPUNKNOWN:
+ Tcl_SetResult(interp,
+ "pltcl: SPI_exec() failed - SPI_ERROR_OPUNKNOWN",
+ TCL_VOLATILE);
+ return TCL_ERROR;
+
+ default:
+ sprintf(buf, "%d", spi_rc);
+ Tcl_AppendResult(interp, "pltcl: SPI_exec() failed - ",
+ "unknown RC ", buf, NULL);
+ return TCL_ERROR;
+ }
/************************************************************
- * If there is a value, set the variable
- * If not, unset it
- *
- * Hmmm - Null attributes will cause functions to
- * crash if they don't expect them - need something
- * smarter here.
+ * Only SELECT queries fall through to here - remember the
+ * tuples we got
************************************************************/
- if (!isnull && OidIsValid(typoutput)) {
- FmgrInfo finfo;
- fmgr_info(typoutput, &finfo);
+ ntuples = SPI_processed;
+ if (ntuples > 0)
+ {
+ tuples = SPI_tuptable->vals;
+ tupdesc = SPI_tuptable->tupdesc;
+ }
+
+ /************************************************************
+ * Prepare to start a controlled return through all
+ * interpreter levels on transaction abort during
+ * the ouput conversions of the results
+ ************************************************************/
+ memcpy(&save_restart, &Warn_restart, sizeof(save_restart));
+ if (sigsetjmp(Warn_restart, 1) != 0)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ pltcl_restart_in_progress = 1;
+ Tcl_SetResult(interp, "Transaction abort", TCL_VOLATILE);
+ return TCL_ERROR;
+ }
- outputstr = (*fmgr_faddr(&finfo))
- (attr, typelem,
- tupdesc->attrs[i]->attlen);
+ /************************************************************
+ * If there is no loop body given, just set the variables
+ * from the first tuple (if any) and return the number of
+ * tuples selected
+ ************************************************************/
+ if (loop_body >= argc)
+ {
+ if (ntuples > 0)
+ {
+ pltcl_set_tuple_values(interp, arrayname, 0, tuples[0], tupdesc);
+ }
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ sprintf(buf, "%d", ntuples);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_OK;
+ }
- Tcl_SetVar2(interp, *arrptr, *nameptr, outputstr, 0);
- pfree(outputstr);
- } else {
- Tcl_UnsetVar2(interp, *arrptr, *nameptr, 0);
+ /************************************************************
+ * There is a loop body - process all tuples and evaluate
+ * the body on each
+ ************************************************************/
+ for (i = 0; i < ntuples; i++)
+ {
+ pltcl_set_tuple_values(interp, arrayname, i, tuples[i], tupdesc);
+
+ loop_rc = Tcl_Eval(interp, argv[loop_body]);
+
+ if (loop_rc == TCL_OK)
+ continue;
+ if (loop_rc == TCL_CONTINUE)
+ continue;
+ if (loop_rc == TCL_RETURN)
+ {
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ return TCL_RETURN;
+ }
+ if (loop_rc == TCL_BREAK)
+ break;
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ return TCL_ERROR;
}
- }
+
+ /************************************************************
+ * Finally return the number of tuples
+ ************************************************************/
+ memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart));
+ sprintf(buf, "%d", ntuples);
+ Tcl_SetResult(interp, buf, TCL_VOLATILE);
+ return TCL_OK;
}
/**********************************************************************
- * pltcl_build_tuple_argument() - Build a string usable for 'array set'
- * from all attributes of a given tuple
+ * pltcl_set_tuple_values() - Set variables for all attributes
+ * of a given tuple
**********************************************************************/
-static void pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
- Tcl_DString *retval)
+static void
+pltcl_set_tuple_values(Tcl_Interp * interp, char *arrayname,
+ int tupno, HeapTuple tuple, TupleDesc tupdesc)
{
- int i;
- char *outputstr;
- Datum attr;
- bool isnull;
+ int i;
+ char *outputstr;
+ char buf[64];
+ Datum attr;
+ bool isnull;
- char *attname;
- HeapTuple typeTup;
- Oid typoutput;
- Oid typelem;
+ char *attname;
+ HeapTuple typeTup;
+ Oid typoutput;
+ Oid typelem;
- for (i = 0; i < tupdesc->natts; i++) {
- /************************************************************
- * Get the attribute name
- ************************************************************/
- attname = tupdesc->attrs[i]->attname.data;
+ char **arrptr;
+ char **nameptr;
+ char *nullname = NULL;
/************************************************************
- * Get the attributes value
- ************************************************************/
- attr = heap_getattr(tuple, i + 1, tupdesc, &isnull);
-
- /************************************************************
- * Lookup the attribute type in the syscache
- * for the output function
+ * Prepare pointers for Tcl_SetVar2() below and in array
+ * mode set the .tupno element
************************************************************/
- typeTup = SearchSysCacheTuple(TYPOID,
- ObjectIdGetDatum(tupdesc->attrs[i]->atttypid),
- 0, 0, 0);
- if (!HeapTupleIsValid(typeTup)) {
- elog(ERROR, "pltcl: Cache lookup for attribute '%s' type %ld failed",
- attname, ObjectIdGetDatum(tupdesc->attrs[i]->atttypid));
+ if (arrayname == NULL)
+ {
+ arrptr = &attname;
+ nameptr = &nullname;
+ }
+ else
+ {
+ arrptr = &arrayname;
+ nameptr = &attname;
+ sprintf(buf, "%d", tupno);
+ Tcl_SetVar2(interp, arrayname, ".tupno", buf, 0);
}
- typoutput = (Oid) (((TypeTupleForm)GETSTRUCT(typeTup))->typoutput);
- typelem = (Oid) (((TypeTupleForm)GETSTRUCT(typeTup))->typelem);
+ for (i = 0; i < tupdesc->natts; i++)
+ {
+ /************************************************************
+ * Get the attribute name
+ ************************************************************/
+ attname = tupdesc->attrs[i]->attname.data;
+
+ /************************************************************
+ * Get the attributes value
+ ************************************************************/
+ attr = heap_getattr(tuple, i + 1, tupdesc, &isnull);
+
+ /************************************************************
+ * Lookup the attribute type in the syscache
+ * for the output function
+ ************************************************************/
+ typeTup = SearchSysCacheTuple(TYPOID,
+ ObjectIdGetDatum(tupdesc->attrs[i]->atttypid),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(typeTup))
+ {
+ elog(ERROR, "pltcl: Cache lookup for attribute '%s' type %ld failed",
+ attname, ObjectIdGetDatum(tupdesc->attrs[i]->atttypid));
+ }
- /************************************************************
- * If there is a value, append the attribute name and the
- * value to the list
- *
- * Hmmm - Null attributes will cause functions to
- * crash if they don't expect them - need something
- * smarter here.
- ************************************************************/
- if (!isnull && OidIsValid(typoutput)) {
- FmgrInfo finfo;
+ typoutput = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typoutput);
+ typelem = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typelem);
+
+ /************************************************************
+ * If there is a value, set the variable
+ * If not, unset it
+ *
+ * Hmmm - Null attributes will cause functions to
+ * crash if they don't expect them - need something
+ * smarter here.
+ ************************************************************/
+ if (!isnull && OidIsValid(typoutput))
+ {
+ FmgrInfo finfo;
+
+ fmgr_info(typoutput, &finfo);
+
+ outputstr = (*fmgr_faddr(&finfo))
+ (attr, typelem,
+ tupdesc->attrs[i]->attlen);
+
+ Tcl_SetVar2(interp, *arrptr, *nameptr, outputstr, 0);
+ pfree(outputstr);
+ }
+ else
+ {
+ Tcl_UnsetVar2(interp, *arrptr, *nameptr, 0);
+ }
+ }
+}
- fmgr_info(typoutput, &finfo);
- outputstr = (*fmgr_faddr(&finfo))
- (attr, typelem,
- tupdesc->attrs[i]->attlen);
+/**********************************************************************
+ * pltcl_build_tuple_argument() - Build a string usable for 'array set'
+ * from all attributes of a given tuple
+ **********************************************************************/
+static void
+pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
+ Tcl_DString * retval)
+{
+ int i;
+ char *outputstr;
+ Datum attr;
+ bool isnull;
+
+ char *attname;
+ HeapTuple typeTup;
+ Oid typoutput;
+ Oid typelem;
+
+ for (i = 0; i < tupdesc->natts; i++)
+ {
+ /************************************************************
+ * Get the attribute name
+ ************************************************************/
+ attname = tupdesc->attrs[i]->attname.data;
+
+ /************************************************************
+ * Get the attributes value
+ ************************************************************/
+ attr = heap_getattr(tuple, i + 1, tupdesc, &isnull);
+
+ /************************************************************
+ * Lookup the attribute type in the syscache
+ * for the output function
+ ************************************************************/
+ typeTup = SearchSysCacheTuple(TYPOID,
+ ObjectIdGetDatum(tupdesc->attrs[i]->atttypid),
+ 0, 0, 0);
+ if (!HeapTupleIsValid(typeTup))
+ {
+ elog(ERROR, "pltcl: Cache lookup for attribute '%s' type %ld failed",
+ attname, ObjectIdGetDatum(tupdesc->attrs[i]->atttypid));
+ }
- Tcl_DStringAppendElement(retval, attname);
- Tcl_DStringAppendElement(retval, outputstr);
- pfree(outputstr);
+ typoutput = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typoutput);
+ typelem = (Oid) (((TypeTupleForm) GETSTRUCT(typeTup))->typelem);
+
+ /************************************************************
+ * If there is a value, append the attribute name and the
+ * value to the list
+ *
+ * Hmmm - Null attributes will cause functions to
+ * crash if they don't expect them - need something
+ * smarter here.
+ ************************************************************/
+ if (!isnull && OidIsValid(typoutput))
+ {
+ FmgrInfo finfo;
+
+ fmgr_info(typoutput, &finfo);
+
+ outputstr = (*fmgr_faddr(&finfo))
+ (attr, typelem,
+ tupdesc->attrs[i]->attlen);
+
+ Tcl_DStringAppendElement(retval, attname);
+ Tcl_DStringAppendElement(retval, outputstr);
+ pfree(outputstr);
+ }
}
- }
}
-
-
diff --git a/src/test/examples/testlibpq2.c b/src/test/examples/testlibpq2.c
index 214a3cbc150..540ed91cbfe 100644
--- a/src/test/examples/testlibpq2.c
+++ b/src/test/examples/testlibpq2.c
@@ -37,9 +37,9 @@ main()
*pgoptions,
*pgtty;
char *dbName;
- /* int nFields;
- * int i,
- * j;
+
+ /*
+ * int nFields; int i, j;
*/
PGconn *conn;
@@ -106,5 +106,6 @@ main()
/* close the connection to the database and cleanup */
PQfinish(conn);
- return 0; /* Though PQfinish(conn1) has called exit(1) */
+ return 0; /* Though PQfinish(conn1) has called
+ * exit(1) */
}
diff --git a/src/test/examples/testlibpq3.c b/src/test/examples/testlibpq3.c
index 8051da58cff..cb5d35bacf6 100644
--- a/src/test/examples/testlibpq3.c
+++ b/src/test/examples/testlibpq3.c
@@ -28,7 +28,7 @@ tuple 1: got
*/
#include <stdio.h>
#include <string.h>
-#include "postgres.h" /* -> "c.h" -> int16, in access/attnum.h */
+#include "postgres.h" /* -> "c.h" -> int16, in access/attnum.h */
#include "libpq-fe.h"
#include "utils/geo_decls.h" /* for the POLYGON type */
@@ -47,9 +47,9 @@ main()
*pgoptions,
*pgtty;
char *dbName;
- /* int nFields;
- * int i,
- * j;
+
+ /*
+ * int nFields; int i, j;
*/
int i;
int i_fnum,
@@ -180,5 +180,6 @@ main()
/* close the connection to the database and cleanup */
PQfinish(conn);
- return 0; /* Though PQfinish(conn1) has called exit(1) */
+ return 0; /* Though PQfinish(conn1) has called
+ * exit(1) */
}
diff --git a/src/test/examples/testlibpq4.c b/src/test/examples/testlibpq4.c
index 7f211dbe544..2cbe622f9b4 100644
--- a/src/test/examples/testlibpq4.c
+++ b/src/test/examples/testlibpq4.c
@@ -19,7 +19,7 @@ exit_nicely(PGconn *conn1, PGconn *conn2)
}
static void
-check_conn(PGconn *conn, const char* dbName)
+check_conn(PGconn *conn, const char *dbName)
{
/* check to see that the backend connection was successfully made */
if (PQstatus(conn) == CONNECTION_BAD)
@@ -31,23 +31,24 @@ check_conn(PGconn *conn, const char* dbName)
}
int
-main(int argc, char** argv)
+main(int argc, char **argv)
{
char *pghost,
*pgport,
*pgoptions,
*pgtty;
char *dbName1,
- *dbName2;
+ *dbName2;
char *tblName;
int nFields;
int i,
j;
PGconn *conn1,
- *conn2;
- /* PGresult *res1,
- * *res2;
+ *conn2;
+
+ /*
+ * PGresult *res1, *res2;
*/
PGresult *res1;
@@ -105,7 +106,7 @@ main(int argc, char** argv)
{
fprintf(stderr, "DECLARE CURSOR command failed\n");
PQclear(res1);
- exit_nicely(conn1,(PGconn*)NULL);
+ exit_nicely(conn1, (PGconn *) NULL);
}
PQclear(res1);
@@ -114,7 +115,7 @@ main(int argc, char** argv)
{
fprintf(stderr, "FETCH ALL command didn't return tuples properly\n");
PQclear(res1);
- exit_nicely(conn1,(PGconn*)NULL);
+ exit_nicely(conn1, (PGconn *) NULL);
}
/* first, print out the attribute names */
@@ -149,5 +150,6 @@ main(int argc, char** argv)
PQfinish(conn1);
/* fclose(debug); */
- return 0; /* Though PQfinish(conn1) has called exit(1) */
+ return 0; /* Though PQfinish(conn1) has called
+ * exit(1) */
}
diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c
index dfbeedfd488..9867d6e85b7 100644
--- a/src/test/regress/regress.c
+++ b/src/test/regress/regress.c
@@ -1,5 +1,5 @@
/*
- * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.22 1998/02/11 19:14:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.23 1998/02/26 04:46:30 momjian Exp $
*/
#include <float.h> /* faked on sunos */
@@ -30,7 +30,7 @@ extern char *reverse_c16(char *string);
/*
** Distance from a point to a path
*/
-double *
+double *
regress_dist_ptpath(pt, path)
Point *pt;
PATH *path;
@@ -73,7 +73,7 @@ PATH *path;
/* this essentially does a cartesian product of the lsegs in the
two paths, and finds the min distance between any two lsegs */
-double *
+double *
regress_path_dist(p1, p2)
PATH *p1;
PATH *p2;
@@ -103,7 +103,7 @@ PATH *p2;
return (min);
}
-PATH *
+PATH *
poly2path(poly)
POLYGON *poly;
{
@@ -125,7 +125,7 @@ POLYGON *poly;
}
/* return the point where two paths intersect. Assumes that they do. */
-Point *
+Point *
interpt_pp(p1, p2)
PATH *p1;
PATH *p2;
@@ -207,7 +207,7 @@ int pt_in_widget(Point *point, WIDGET * widget);
#define NARGS 3
-WIDGET *
+WIDGET *
widget_in(str)
char *str;
{
@@ -234,7 +234,7 @@ char *str;
return (result);
}
-char *
+char *
widget_out(widget)
WIDGET *widget;
{
@@ -275,7 +275,7 @@ BOX *box;
return (width * height);
}
-char *
+char *
reverse_c16(string)
char *string;
{
@@ -412,15 +412,15 @@ funny_dup17()
return (tuple);
}
-HeapTuple ttdummy(void);
-int32 set_ttdummy(int32 on);
+HeapTuple ttdummy(void);
+int32 set_ttdummy(int32 on);
-extern int4 nextval(struct varlena * seqin);
+extern int4 nextval(struct varlena * seqin);
#define TTDUMMY_INFINITY 999999
-static void *splan = NULL;
-static bool ttoff = false;
+static void *splan = NULL;
+static bool ttoff = false;
HeapTuple
ttdummy()
@@ -428,8 +428,10 @@ ttdummy()
Trigger *trigger; /* to get trigger name */
char **args; /* arguments */
int attnum[2]; /* fnumbers of start/stop columns */
- Datum oldon, oldoff;
- Datum newon, newoff;
+ Datum oldon,
+ oldoff;
+ Datum newon,
+ newoff;
Datum *cvals; /* column values */
char *cnulls; /* column nulls */
char *relname; /* triggered relation name */
@@ -450,166 +452,167 @@ ttdummy()
if (TRIGGER_FIRED_AFTER(CurrentTriggerData->tg_event))
elog(ERROR, "ttdummy: must be fired before event");
if (TRIGGER_FIRED_BY_INSERT(CurrentTriggerData->tg_event))
- elog (ERROR, "ttdummy: can't process INSERT event");
+ elog(ERROR, "ttdummy: can't process INSERT event");
if (TRIGGER_FIRED_BY_UPDATE(CurrentTriggerData->tg_event))
newtuple = CurrentTriggerData->tg_newtuple;
-
+
trigtuple = CurrentTriggerData->tg_trigtuple;
-
+
rel = CurrentTriggerData->tg_relation;
relname = SPI_getrelname(rel);
-
+
/* check if TT is OFF for this relation */
- if (ttoff) /* OFF - nothing to do */
+ if (ttoff) /* OFF - nothing to do */
{
- pfree (relname);
+ pfree(relname);
return ((newtuple != NULL) ? newtuple : trigtuple);
}
-
+
trigger = CurrentTriggerData->tg_trigger;
if (trigger->tgnargs != 2)
- elog(ERROR, "ttdummy (%s): invalid (!= 2) number of arguments %d",
- relname, trigger->tgnargs);
-
+ elog(ERROR, "ttdummy (%s): invalid (!= 2) number of arguments %d",
+ relname, trigger->tgnargs);
+
args = trigger->tgargs;
tupdesc = rel->rd_att;
natts = tupdesc->natts;
-
+
CurrentTriggerData = NULL;
-
- for (i = 0; i < 2; i++ )
+
+ for (i = 0; i < 2; i++)
{
- attnum[i] = SPI_fnumber (tupdesc, args[i]);
- if ( attnum[i] < 0 )
+ attnum[i] = SPI_fnumber(tupdesc, args[i]);
+ if (attnum[i] < 0)
elog(ERROR, "ttdummy (%s): there is no attribute %s", relname, args[i]);
- if (SPI_gettypeid (tupdesc, attnum[i]) != INT4OID)
- elog(ERROR, "ttdummy (%s): attributes %s and %s must be of abstime type",
- relname, args[0], args[1]);
+ if (SPI_gettypeid(tupdesc, attnum[i]) != INT4OID)
+ elog(ERROR, "ttdummy (%s): attributes %s and %s must be of abstime type",
+ relname, args[0], args[1]);
}
-
- oldon = SPI_getbinval (trigtuple, tupdesc, attnum[0], &isnull);
+
+ oldon = SPI_getbinval(trigtuple, tupdesc, attnum[0], &isnull);
if (isnull)
elog(ERROR, "ttdummy (%s): %s must be NOT NULL", relname, args[0]);
-
- oldoff = SPI_getbinval (trigtuple, tupdesc, attnum[1], &isnull);
+
+ oldoff = SPI_getbinval(trigtuple, tupdesc, attnum[1], &isnull);
if (isnull)
elog(ERROR, "ttdummy (%s): %s must be NOT NULL", relname, args[1]);
-
- if (newtuple != NULL) /* UPDATE */
+
+ if (newtuple != NULL) /* UPDATE */
{
- newon = SPI_getbinval (newtuple, tupdesc, attnum[0], &isnull);
+ newon = SPI_getbinval(newtuple, tupdesc, attnum[0], &isnull);
if (isnull)
elog(ERROR, "ttdummy (%s): %s must be NOT NULL", relname, args[0]);
- newoff = SPI_getbinval (newtuple, tupdesc, attnum[1], &isnull);
+ newoff = SPI_getbinval(newtuple, tupdesc, attnum[1], &isnull);
if (isnull)
elog(ERROR, "ttdummy (%s): %s must be NOT NULL", relname, args[1]);
-
- if ( oldon != newon || oldoff != newoff )
- elog (ERROR, "ttdummy (%s): you can't change %s and/or %s columns (use set_ttdummy)",
- relname, args[0], args[1]);
-
- if ( newoff != TTDUMMY_INFINITY )
+
+ if (oldon != newon || oldoff != newoff)
+ elog(ERROR, "ttdummy (%s): you can't change %s and/or %s columns (use set_ttdummy)",
+ relname, args[0], args[1]);
+
+ if (newoff != TTDUMMY_INFINITY)
{
- pfree (relname); /* allocated in upper executor context */
+ pfree(relname); /* allocated in upper executor context */
return (NULL);
}
}
else if (oldoff != TTDUMMY_INFINITY) /* DELETE */
{
- pfree (relname);
+ pfree(relname);
return (NULL);
}
-
+
{
- struct varlena *seqname = textin ("ttdummy_seq");
-
- newoff = nextval (seqname);
- pfree (seqname);
+ struct varlena *seqname = textin("ttdummy_seq");
+
+ newoff = nextval(seqname);
+ pfree(seqname);
}
-
+
/* Connect to SPI manager */
if ((ret = SPI_connect()) < 0)
elog(ERROR, "ttdummy (%s): SPI_connect returned %d", relname, ret);
-
+
/* Fetch tuple values and nulls */
- cvals = (Datum *) palloc (natts * sizeof (Datum));
- cnulls = (char *) palloc (natts * sizeof (char));
+ cvals = (Datum *) palloc(natts * sizeof(Datum));
+ cnulls = (char *) palloc(natts * sizeof(char));
for (i = 0; i < natts; i++)
{
- cvals[i] = SPI_getbinval ((newtuple != NULL) ? newtuple : trigtuple,
- tupdesc, i + 1, &isnull);
+ cvals[i] = SPI_getbinval((newtuple != NULL) ? newtuple : trigtuple,
+ tupdesc, i + 1, &isnull);
cnulls[i] = (isnull) ? 'n' : ' ';
}
-
+
/* change date column(s) */
- if (newtuple) /* UPDATE */
+ if (newtuple) /* UPDATE */
{
- cvals[attnum[0] - 1] = newoff; /* start_date eq current date */
+ cvals[attnum[0] - 1] = newoff; /* start_date eq current date */
cnulls[attnum[0] - 1] = ' ';
- cvals[attnum[1] - 1] = TTDUMMY_INFINITY; /* stop_date eq INFINITY */
+ cvals[attnum[1] - 1] = TTDUMMY_INFINITY; /* stop_date eq INFINITY */
cnulls[attnum[1] - 1] = ' ';
}
- else /* DELETE */
+ else
+/* DELETE */
{
- cvals[attnum[1] - 1] = newoff; /* stop_date eq current date */
+ cvals[attnum[1] - 1] = newoff; /* stop_date eq current date */
cnulls[attnum[1] - 1] = ' ';
}
-
+
/* if there is no plan ... */
if (splan == NULL)
{
void *pplan;
Oid *ctypes;
char sql[8192];
-
+
/* allocate ctypes for preparation */
ctypes = (Oid *) palloc(natts * sizeof(Oid));
-
+
/*
- * Construct query:
- * INSERT INTO _relation_ VALUES ($1, ...)
+ * Construct query: INSERT INTO _relation_ VALUES ($1, ...)
*/
sprintf(sql, "INSERT INTO %s VALUES (", relname);
for (i = 1; i <= natts; i++)
{
sprintf(sql + strlen(sql), "$%d%s",
- i, (i < natts) ? ", " : ")");
+ i, (i < natts) ? ", " : ")");
ctypes[i - 1] = SPI_gettypeid(tupdesc, i);
}
-
+
/* Prepare plan for query */
pplan = SPI_prepare(sql, natts, ctypes);
if (pplan == NULL)
elog(ERROR, "ttdummy (%s): SPI_prepare returned %d", relname, SPI_result);
-
+
pplan = SPI_saveplan(pplan);
if (pplan == NULL)
elog(ERROR, "ttdummy (%s): SPI_saveplan returned %d", relname, SPI_result);
-
+
splan = pplan;
}
-
+
ret = SPI_execp(splan, cvals, cnulls, 0);
-
+
if (ret < 0)
elog(ERROR, "ttdummy (%s): SPI_execp returned %d", relname, ret);
-
+
/* Tuple to return to upper Executor ... */
- if (newtuple) /* UPDATE */
+ if (newtuple) /* UPDATE */
{
HeapTuple tmptuple;
-
- tmptuple = SPI_copytuple (trigtuple);
- rettuple = SPI_modifytuple (rel, tmptuple, 1, &(attnum[1]), &newoff, NULL);
- SPI_pfree (tmptuple);
+
+ tmptuple = SPI_copytuple(trigtuple);
+ rettuple = SPI_modifytuple(rel, tmptuple, 1, &(attnum[1]), &newoff, NULL);
+ SPI_pfree(tmptuple);
}
- else /* DELETE */
+ else
+/* DELETE */
rettuple = trigtuple;
-
- SPI_finish(); /* don't forget say Bye to SPI mgr */
-
- pfree (relname);
+
+ SPI_finish(); /* don't forget say Bye to SPI mgr */
+
+ pfree(relname);
return (rettuple);
}
@@ -617,24 +620,24 @@ ttdummy()
int32
set_ttdummy(int32 on)
{
-
- if (ttoff) /* OFF currently */
+
+ if (ttoff) /* OFF currently */
{
if (on == 0)
return (0);
-
+
/* turn ON */
ttoff = false;
return (0);
}
-
+
/* ON currently */
if (on != 0)
return (1);
-
+
/* turn OFF */
ttoff = true;
-
+
return (1);
}
diff --git a/src/tutorial/C-code/complex.c b/src/tutorial/C-code/complex.c
index 8efbf553918..e5bea2d1134 100644
--- a/src/tutorial/C-code/complex.c
+++ b/src/tutorial/C-code/complex.c
@@ -62,7 +62,7 @@ complex_in(char *str)
* pointer. POSTGRES thinks all output functions are:
* char *out_func(char *);
*/
-char *
+char *
complex_out(Complex * complex)
{
char *result;
diff --git a/src/tutorial/C-code/funcs.c b/src/tutorial/C-code/funcs.c
index 5a70262f070..71371f51609 100644
--- a/src/tutorial/C-code/funcs.c
+++ b/src/tutorial/C-code/funcs.c
@@ -33,7 +33,7 @@ add_one(int arg)
return (arg + 1);
}
-char16 *
+char16 *
concat16(char16 *arg1, char16 *arg2)
{
char16 *new_c16 = (char16 *) palloc(sizeof(char16));
@@ -43,7 +43,7 @@ concat16(char16 *arg1, char16 *arg2)
return (char16 *) (strncat((char *) new_c16, (char *) arg2, 16));
}
-text *
+text *
copytext(text *t)
{
diff --git a/src/utils/strdup.c b/src/utils/strdup.c
index 1330b977129..83b4919c494 100644
--- a/src/utils/strdup.c
+++ b/src/utils/strdup.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/utils/Attic/strdup.c,v 1.4 1997/09/08 02:41:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/utils/Attic/strdup.c,v 1.5 1998/02/26 04:46:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@
#include <stdlib.h>
#include "strdup.h"
-char *
+char *
strdup(char const * string)
{
char *nstr;