OSDN Git Service

pgindent run.
authorBruce Momjian <bruce@momjian.us>
Wed, 4 Sep 2002 20:31:48 +0000 (20:31 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 4 Sep 2002 20:31:48 +0000 (20:31 +0000)
446 files changed:
contrib/btree_gist/btree_gist.c
contrib/cube/cube.c
contrib/dbase/dbf2pg.c
contrib/dblink/dblink.c
contrib/dblink/dblink.h
contrib/dbmirror/pending.c
contrib/dbsize/dbsize.c
contrib/findoidjoins/findoidjoins.c
contrib/intagg/int_aggregate.c
contrib/intarray/_int.c
contrib/ltree/_ltree_gist.c
contrib/ltree/_ltree_op.c
contrib/ltree/crc32.c
contrib/ltree/lquery_op.c
contrib/ltree/ltree.h
contrib/ltree/ltree_gist.c
contrib/ltree/ltree_io.c
contrib/ltree/ltree_op.c
contrib/ltree/ltxtquery_io.c
contrib/ltree/ltxtquery_op.c
contrib/mSQL-interface/mpgsql.c
contrib/pg_dumplo/lo_export.c
contrib/pg_dumplo/lo_import.c
contrib/pg_dumplo/main.c
contrib/pgbench/pgbench.c
contrib/pgstattuple/pgstattuple.c
contrib/rserv/rserv.c
contrib/rtree_gist/rtree_gist.c
contrib/spi/refint.c
contrib/spi/timetravel.c
contrib/tablefunc/tablefunc.c
contrib/tablefunc/tablefunc.h
contrib/tsearch/deflex.h
contrib/tsearch/gistidx.c
contrib/tsearch/morph.c
contrib/tsearch/query.c
contrib/tsearch/txtidx.c
contrib/vacuumlo/vacuumlo.c
src/backend/access/common/heaptuple.c
src/backend/access/common/indextuple.c
src/backend/access/common/printtup.c
src/backend/access/common/tupdesc.c
src/backend/access/gist/gist.c
src/backend/access/gist/gistget.c
src/backend/access/hash/hash.c
src/backend/access/hash/hashfunc.c
src/backend/access/hash/hashscan.c
src/backend/access/heap/heapam.c
src/backend/access/heap/tuptoaster.c
src/backend/access/index/genam.c
src/backend/access/index/indexam.c
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtutils.c
src/backend/access/rtree/rtget.c
src/backend/access/rtree/rtree.c
src/backend/access/transam/transam.c
src/backend/access/transam/varsup.c
src/backend/access/transam/xact.c
src/backend/access/transam/xlog.c
src/backend/bootstrap/bootstrap.c
src/backend/catalog/aclchk.c
src/backend/catalog/catalog.c
src/backend/catalog/dependency.c
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/indexing.c
src/backend/catalog/namespace.c
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_constraint.c
src/backend/catalog/pg_conversion.c
src/backend/catalog/pg_depend.c
src/backend/catalog/pg_operator.c
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_type.c
src/backend/commands/aggregatecmds.c
src/backend/commands/analyze.c
src/backend/commands/cluster.c
src/backend/commands/comment.c
src/backend/commands/conversioncmds.c
src/backend/commands/copy.c
src/backend/commands/dbcommands.c
src/backend/commands/define.c
src/backend/commands/explain.c
src/backend/commands/functioncmds.c
src/backend/commands/indexcmds.c
src/backend/commands/lockcmds.c
src/backend/commands/opclasscmds.c
src/backend/commands/operatorcmds.c
src/backend/commands/portalcmds.c
src/backend/commands/prepare.c
src/backend/commands/proclang.c
src/backend/commands/schemacmds.c
src/backend/commands/sequence.c
src/backend/commands/tablecmds.c
src/backend/commands/trigger.c
src/backend/commands/typecmds.c
src/backend/commands/user.c
src/backend/commands/vacuum.c
src/backend/commands/vacuumlazy.c
src/backend/commands/variable.c
src/backend/commands/view.c
src/backend/executor/execJunk.c
src/backend/executor/execMain.c
src/backend/executor/execQual.c
src/backend/executor/execTuples.c
src/backend/executor/execUtils.c
src/backend/executor/functions.c
src/backend/executor/nodeAgg.c
src/backend/executor/nodeFunctionscan.c
src/backend/executor/nodeHash.c
src/backend/executor/nodeIndexscan.c
src/backend/executor/nodeMergejoin.c
src/backend/executor/nodeSeqscan.c
src/backend/executor/nodeTidscan.c
src/backend/executor/spi.c
src/backend/lib/stringinfo.c
src/backend/libpq/auth.c
src/backend/libpq/be-secure.c
src/backend/libpq/crypt.c
src/backend/libpq/hba.c
src/backend/libpq/md5.c
src/backend/libpq/pqcomm.c
src/backend/main/main.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/makefuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/print.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/geqo/geqo_misc.c
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/prep/preptlist.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/relnode.c
src/backend/optimizer/util/var.c
src/backend/parser/analyze.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_coerce.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/backend/parser/parse_node.c
src/backend/parser/parse_oper.c
src/backend/parser/parse_relation.c
src/backend/parser/parse_target.c
src/backend/parser/parse_type.c
src/backend/parser/parser.c
src/backend/port/dynloader/bsdi.h
src/backend/port/ipc_test.c
src/backend/port/posix_sema.c
src/backend/port/qnx4/tstsem.c
src/backend/port/sysv_sema.c
src/backend/port/sysv_shmem.c
src/backend/postmaster/pgstat.c
src/backend/postmaster/postmaster.c
src/backend/regex/regcomp.c
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteHandler.c
src/backend/rewrite/rewriteManip.c
src/backend/rewrite/rewriteRemove.c
src/backend/storage/buffer/buf_init.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/localbuf.c
src/backend/storage/freespace/freespace.c
src/backend/storage/ipc/ipc.c
src/backend/storage/ipc/shmem.c
src/backend/storage/ipc/sinval.c
src/backend/storage/lmgr/deadlock.c
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/lwlock.c
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/spin.c
src/backend/storage/page/bufpage.c
src/backend/storage/smgr/smgr.c
src/backend/tcop/postgres.c
src/backend/tcop/pquery.c
src/backend/tcop/utility.c
src/backend/utils/adt/acl.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/cash.c
src/backend/utils/adt/date.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/datum.c
src/backend/utils/adt/float.c
src/backend/utils/adt/format_type.c
src/backend/utils/adt/formatting.c
src/backend/utils/adt/geo_ops.c
src/backend/utils/adt/int8.c
src/backend/utils/adt/lockfuncs.c
src/backend/utils/adt/mac.c
src/backend/utils/adt/misc.c
src/backend/utils/adt/nabstime.c
src/backend/utils/adt/name.c
src/backend/utils/adt/not_in.c
src/backend/utils/adt/numeric.c
src/backend/utils/adt/numutils.c
src/backend/utils/adt/oracle_compat.c
src/backend/utils/adt/pg_locale.c
src/backend/utils/adt/pg_lzcompress.c
src/backend/utils/adt/pseudotypes.c
src/backend/utils/adt/regexp.c
src/backend/utils/adt/regproc.c
src/backend/utils/adt/ri_triggers.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/sets.c
src/backend/utils/adt/tid.c
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/varbit.c
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varlena.c
src/backend/utils/cache/catcache.c
src/backend/utils/cache/inval.c
src/backend/utils/cache/lsyscache.c
src/backend/utils/cache/relcache.c
src/backend/utils/cache/syscache.c
src/backend/utils/error/assert.c
src/backend/utils/error/elog.c
src/backend/utils/fmgr/fmgr.c
src/backend/utils/fmgr/funcapi.c
src/backend/utils/init/findbe.c
src/backend/utils/init/globals.c
src/backend/utils/init/miscinit.c
src/backend/utils/init/postinit.c
src/backend/utils/mb/conv.c
src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c
src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c
src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c
src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
src/backend/utils/mb/conversion_procs/utf8_and_tcvn/utf8_and_tcvn.c
src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c
src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c
src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c
src/backend/utils/mb/encnames.c
src/backend/utils/mb/mbutils.c
src/backend/utils/mb/wchar.c
src/backend/utils/misc/database.c
src/backend/utils/misc/guc.c
src/backend/utils/misc/ps_status.c
src/backend/utils/mmgr/aset.c
src/backend/utils/sort/tuplesort.c
src/backend/utils/time/tqual.c
src/bin/pg_controldata/pg_controldata.c
src/bin/pg_dump/common.c
src/bin/pg_dump/dumputils.c
src/bin/pg_dump/dumputils.h
src/bin/pg_dump/pg_backup.h
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_custom.c
src/bin/pg_dump/pg_backup_db.c
src/bin/pg_dump/pg_backup_files.c
src/bin/pg_dump/pg_backup_null.c
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/pg_dumpall.c
src/bin/pg_dump/pg_restore.c
src/bin/pg_dump/sprompt.c
src/bin/pg_resetxlog/pg_resetxlog.c
src/bin/psql/command.c
src/bin/psql/common.c
src/bin/psql/copy.c
src/bin/psql/describe.c
src/bin/psql/help.c
src/bin/psql/input.h
src/bin/psql/large_obj.c
src/bin/psql/mainloop.c
src/bin/psql/print.h
src/bin/psql/sprompt.c
src/bin/psql/startup.c
src/bin/psql/tab-complete.c
src/include/access/genam.h
src/include/access/heapam.h
src/include/access/htup.h
src/include/access/istrat.h
src/include/access/printtup.h
src/include/access/relscan.h
src/include/access/tupdesc.h
src/include/access/tuptoaster.h
src/include/access/valid.h
src/include/access/xlog.h
src/include/c.h
src/include/catalog/dependency.h
src/include/catalog/heap.h
src/include/catalog/indexing.h
src/include/catalog/namespace.h
src/include/catalog/pg_aggregate.h
src/include/catalog/pg_attribute.h
src/include/catalog/pg_cast.h
src/include/catalog/pg_class.h
src/include/catalog/pg_constraint.h
src/include/catalog/pg_control.h
src/include/catalog/pg_conversion.h
src/include/catalog/pg_language.h
src/include/catalog/pg_namespace.h
src/include/catalog/pg_opclass.h
src/include/catalog/pg_operator.h
src/include/catalog/pg_proc.h
src/include/catalog/pg_shadow.h
src/include/catalog/pg_statistic.h
src/include/catalog/pg_type.h
src/include/commands/conversioncmds.h
src/include/commands/copy.h
src/include/commands/defrem.h
src/include/commands/lockcmds.h
src/include/commands/portalcmds.h
src/include/commands/prepare.h
src/include/commands/schemacmds.h
src/include/commands/tablecmds.h
src/include/commands/trigger.h
src/include/commands/user.h
src/include/commands/variable.h
src/include/executor/execdesc.h
src/include/executor/executor.h
src/include/fmgr.h
src/include/funcapi.h
src/include/libpq/crypt.h
src/include/libpq/pqcomm.h
src/include/mb/pg_wchar.h
src/include/miscadmin.h
src/include/nodes/execnodes.h
src/include/nodes/makefuncs.h
src/include/nodes/parsenodes.h
src/include/nodes/plannodes.h
src/include/nodes/primnodes.h
src/include/nodes/print.h
src/include/nodes/relation.h
src/include/optimizer/cost.h
src/include/optimizer/geqo_misc.h
src/include/optimizer/planmain.h
src/include/parser/gramparse.h
src/include/parser/parse_coerce.h
src/include/parser/parse_func.h
src/include/parser/parse_oper.h
src/include/parser/parse_relation.h
src/include/parser/parse_target.h
src/include/parser/parsetree.h
src/include/port/hpux.h
src/include/postgres.h
src/include/regex/regex.h
src/include/rewrite/rewriteDefine.h
src/include/rewrite/rewriteRemove.h
src/include/storage/buf_internals.h
src/include/storage/bufmgr.h
src/include/storage/bufpage.h
src/include/storage/ipc.h
src/include/storage/lock.h
src/include/storage/pg_sema.h
src/include/storage/pg_shmem.h
src/include/storage/pmsignal.h
src/include/storage/proc.h
src/include/storage/sinval.h
src/include/tcop/dest.h
src/include/tcop/pquery.h
src/include/tcop/utility.h
src/include/utils/acl.h
src/include/utils/array.h
src/include/utils/builtins.h
src/include/utils/catcache.h
src/include/utils/date.h
src/include/utils/datetime.h
src/include/utils/elog.h
src/include/utils/guc.h
src/include/utils/inval.h
src/include/utils/lsyscache.h
src/include/utils/memutils.h
src/include/utils/pg_locale.h
src/include/utils/portal.h
src/include/utils/rel.h
src/include/utils/selfuncs.h
src/include/utils/syscache.h
src/include/utils/timestamp.h
src/include/utils/tqual.h
src/interfaces/cli/example1.c
src/interfaces/cli/example2.c
src/interfaces/cli/sqlcli.h
src/interfaces/ecpg/include/ecpgerrno.h
src/interfaces/ecpg/include/ecpglib.h
src/interfaces/ecpg/include/ecpgtype.h
src/interfaces/ecpg/lib/connect.c
src/interfaces/ecpg/lib/data.c
src/interfaces/ecpg/lib/descriptor.c
src/interfaces/ecpg/lib/error.c
src/interfaces/ecpg/lib/execute.c
src/interfaces/ecpg/lib/extern.h
src/interfaces/ecpg/lib/memory.c
src/interfaces/ecpg/lib/misc.c
src/interfaces/ecpg/preproc/ecpg.c
src/interfaces/ecpg/preproc/extern.h
src/interfaces/ecpg/preproc/type.c
src/interfaces/ecpg/preproc/type.h
src/interfaces/ecpg/preproc/variable.c
src/interfaces/libpgtcl/pgtcl.c
src/interfaces/libpgtcl/pgtclCmds.c
src/interfaces/libpgtcl/pgtclCmds.h
src/interfaces/libpgtcl/pgtclId.c
src/interfaces/libpq/fe-auth.c
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-misc.c
src/interfaces/libpq/fe-secure.c
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-int.h
src/interfaces/libpq/win32.c
src/interfaces/python/pgmodule.c
src/pl/plperl/eloglvl.c
src/pl/plperl/eloglvl.h
src/pl/plperl/plperl.c
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/pl_funcs.c
src/pl/plpgsql/src/plpgsql.h
src/pl/plpython/plpython.c
src/pl/tcl/pltcl.c
src/port/memcmp.c
src/port/qsort.c

index c4eb852..ec84ec5 100644 (file)
@@ -299,11 +299,12 @@ gts_compress(PG_FUNCTION_ARGS)
        if (entry->leafkey)
        {
                TSKEY      *r = (TSKEY *) palloc(sizeof(TSKEY));
+
                retval = palloc(sizeof(GISTENTRY));
                r->lower = r->upper = *(Timestamp *) (entry->key);
                gistentryinit(*retval, PointerGetDatum(r),
-                         entry->rel, entry->page,
-                         entry->offset, sizeof(TSKEY), FALSE);
+                                         entry->rel, entry->page,
+                                         entry->offset, sizeof(TSKEY), FALSE);
        }
        else
                retval = entry;
@@ -398,8 +399,8 @@ gts_penalty(PG_FUNCTION_ARGS)
 
        intr = DatumGetIntervalP(DirectFunctionCall2(
                                                                                                 timestamp_mi,
-                                                                         TimestampGetDatumFast(newentry->upper),
-                                                                  TimestampGetDatumFast(origentry->upper)));
+                                                                 TimestampGetDatumFast(newentry->upper),
+                                                          TimestampGetDatumFast(origentry->upper)));
 
        /* see interval_larger */
        *result = Max(intr->time + intr->month * (30.0 * 86400), 0);
@@ -407,8 +408,8 @@ gts_penalty(PG_FUNCTION_ARGS)
 
        intr = DatumGetIntervalP(DirectFunctionCall2(
                                                                                                 timestamp_mi,
-                                                                        TimestampGetDatumFast(origentry->lower),
-                                                                       TimestampGetDatumFast(newentry->lower)));
+                                                                TimestampGetDatumFast(origentry->lower),
+                                                               TimestampGetDatumFast(newentry->lower)));
 
        /* see interval_larger */
        *result += Max(intr->time + intr->month * (30.0 * 86400), 0);
@@ -473,8 +474,8 @@ tskey_cmp(const void *a, const void *b)
        return DatumGetInt32(
                                                 DirectFunctionCall2(
                                                                                         timestamp_cmp,
-                                 TimestampGetDatumFast(((TSKEY *) (((RIX *) a)->r))->lower),
-                                  TimestampGetDatumFast(((TSKEY *) (((RIX *) b)->r))->lower)
+                         TimestampGetDatumFast(((TSKEY *) (((RIX *) a)->r))->lower),
+                          TimestampGetDatumFast(((TSKEY *) (((RIX *) b)->r))->lower)
                                                                                         )
                );
 }
index ddf6fb0..bf3dd8d 100644 (file)
@@ -73,11 +73,11 @@ bool                cube_right(NDBOX * a, NDBOX * b);
 bool           cube_lt(NDBOX * a, NDBOX * b);
 bool           cube_gt(NDBOX * a, NDBOX * b);
 double    *cube_distance(NDBOX * a, NDBOX * b);
-int    cube_dim(NDBOX *a);
-double *cube_ll_coord(NDBOX * a, int n);
-double *cube_ur_coord(NDBOX * a, int n);
-bool   cube_is_point(NDBOX * a);
-NDBOX     *cube_enlarge(NDBOX * a, double * r, int n);
+int                    cube_dim(NDBOX * a);
+double    *cube_ll_coord(NDBOX * a, int n);
+double    *cube_ur_coord(NDBOX * a, int n);
+bool           cube_is_point(NDBOX * a);
+NDBOX     *cube_enlarge(NDBOX * a, double *r, int n);
 
 
 /*
@@ -111,11 +111,11 @@ NDBOX *
 cube(text *str)
 {
        return cube_in(DatumGetCString(DirectFunctionCall1(textout,
-           PointerGetDatum(str))));
+                                                                                                PointerGetDatum(str))));
 }
 
 char *
-cube_out(NDBOX *cube)
+cube_out(NDBOX * cube)
 {
        StringInfoData buf;
        bool            equal = true;
@@ -542,14 +542,14 @@ cube_union(NDBOX * a, NDBOX * b)
        if (a->dim >= b->dim)
        {
                result = palloc(a->size);
-                memset(result, 0, a->size);
+               memset(result, 0, a->size);
                result->size = a->size;
                result->dim = a->dim;
        }
        else
        {
                result = palloc(b->size);
-                memset(result, 0, b->size);
+               memset(result, 0, b->size);
                result->size = b->size;
                result->dim = b->dim;
        }
@@ -580,12 +580,12 @@ cube_union(NDBOX * a, NDBOX * b)
 
        /* compute the union */
        for (i = 0; i < a->dim; i++)
-        {
+       {
                result->x[i] =
-                  min(min(a->x[i], a->x[i + a->dim]), result->x[i]);
+                       min(min(a->x[i], a->x[i + a->dim]), result->x[i]);
                result->x[i + a->dim] = max(max(a->x[i],
-                  a->x[i + a->dim]), result->x[i + a->dim]);
-        }
+                                                          a->x[i + a->dim]), result->x[i + a->dim]);
+       }
 
        return (result);
 }
@@ -600,14 +600,14 @@ cube_inter(NDBOX * a, NDBOX * b)
        if (a->dim >= b->dim)
        {
                result = palloc(a->size);
-                memset(result, 0, a->size);
+               memset(result, 0, a->size);
                result->size = a->size;
                result->dim = a->dim;
        }
        else
        {
                result = palloc(b->size);
-                memset(result, 0, b->size);
+               memset(result, 0, b->size);
                result->size = b->size;
                result->dim = b->dim;
        }
@@ -638,12 +638,12 @@ cube_inter(NDBOX * a, NDBOX * b)
 
        /* compute the intersection */
        for (i = 0; i < a->dim; i++)
-        {
+       {
                result->x[i] =
-                  max(min(a->x[i], a->x[i + a->dim]), result->x[i]);
+                       max(min(a->x[i], a->x[i + a->dim]), result->x[i]);
                result->x[i + a->dim] = min(max(a->x[i],
-                  a->x[i + a->dim]), result->x[i + a->dim]);
-        }
+                                                          a->x[i + a->dim]), result->x[i + a->dim]);
+       }
 
        /*
         * Is it OK to return a non-null intersection for non-overlapping
@@ -700,8 +700,8 @@ cube_over_left(NDBOX * a, NDBOX * b)
                return (FALSE);
 
        return (min(a->x[a->dim - 1], a->x[2 * a->dim - 1]) <=
-          min(b->x[b->dim - 1], b->x[2 * b->dim - 1]) &&
-          !cube_left(a, b) && !cube_right(a, b));
+                       min(b->x[b->dim - 1], b->x[2 * b->dim - 1]) &&
+                       !cube_left(a, b) && !cube_right(a, b));
 }
 
 /*     is the left edge of (a) located to the right of
@@ -713,8 +713,8 @@ cube_over_right(NDBOX * a, NDBOX * b)
                return (FALSE);
 
        return (min(a->x[a->dim - 1], a->x[2 * a->dim - 1]) >=
-          min(b->x[b->dim - 1], b->x[2 * b->dim - 1]) &&
-          !cube_left(a, b) && !cube_right(a, b));
+                       min(b->x[b->dim - 1], b->x[2 * b->dim - 1]) &&
+                       !cube_left(a, b) && !cube_right(a, b));
 }
 
 
@@ -727,7 +727,7 @@ cube_left(NDBOX * a, NDBOX * b)
                return (FALSE);
 
        return (min(a->x[a->dim - 1], a->x[2 * a->dim - 1]) <
-          min(b->x[0], b->x[b->dim]));
+                       min(b->x[0], b->x[b->dim]));
 }
 
 /* return 'true' if the projection of 'a' is
@@ -739,7 +739,7 @@ cube_right(NDBOX * a, NDBOX * b)
                return (FALSE);
 
        return (min(a->x[0], a->x[a->dim]) >
-          min(b->x[b->dim - 1], b->x[2 * b->dim - 1]));
+                       min(b->x[b->dim - 1], b->x[2 * b->dim - 1]));
 }
 
 /* make up a metric in which one box will be 'lower' than the other
@@ -759,19 +759,19 @@ cube_lt(NDBOX * a, NDBOX * b)
        for (i = 0; i < dim; i++)
        {
                if (min(a->x[i], a->x[a->dim + i]) >
-                    min(b->x[i], b->x[b->dim + i]))
+                       min(b->x[i], b->x[b->dim + i]))
                        return (FALSE);
                if (min(a->x[i], a->x[a->dim + i]) <
-                    min(b->x[i], b->x[b->dim + i]))
+                       min(b->x[i], b->x[b->dim + i]))
                        return (TRUE);
        }
        for (i = 0; i < dim; i++)
        {
                if (max(a->x[i], a->x[a->dim + i]) >
-                    max(b->x[i], b->x[b->dim + i]))
+                       max(b->x[i], b->x[b->dim + i]))
                        return (FALSE);
                if (max(a->x[i], a->x[a->dim + i]) <
-                    max(b->x[i], b->x[b->dim + i]))
+                       max(b->x[i], b->x[b->dim + i]))
                        return (TRUE);
        }
 
@@ -792,11 +792,12 @@ cube_lt(NDBOX * a, NDBOX * b)
                        if (max(a->x[i], a->x[a->dim + i]) < 0)
                                return (TRUE);
                }
-               /*
-                * if all common dimensions are equal, the cube with more
-                * dimensions wins
-                */
-                return (FALSE);
+
+               /*
+                * if all common dimensions are equal, the cube with more
+                * dimensions wins
+                */
+               return (FALSE);
        }
        if (a->dim < b->dim)
        {
@@ -814,11 +815,12 @@ cube_lt(NDBOX * a, NDBOX * b)
                        if (max(b->x[i], b->x[b->dim + i]) < 0)
                                return (FALSE);
                }
-               /*
-                * if all common dimensions are equal, the cube with more
-                * dimensions wins
-                */
-                return (TRUE);
+
+               /*
+                * if all common dimensions are equal, the cube with more
+                * dimensions wins
+                */
+               return (TRUE);
        }
 
        return (FALSE);
@@ -840,19 +842,19 @@ cube_gt(NDBOX * a, NDBOX * b)
        for (i = 0; i < dim; i++)
        {
                if (min(a->x[i], a->x[a->dim + i]) <
-                    min(b->x[i], b->x[b->dim + i]))
+                       min(b->x[i], b->x[b->dim + i]))
                        return (FALSE);
                if (min(a->x[i], a->x[a->dim + i]) >
-                    min(b->x[i], b->x[b->dim + i]))
+                       min(b->x[i], b->x[b->dim + i]))
                        return (TRUE);
        }
        for (i = 0; i < dim; i++)
        {
                if (max(a->x[i], a->x[a->dim + i]) <
-                    max(b->x[i], b->x[b->dim + i]))
+                       max(b->x[i], b->x[b->dim + i]))
                        return (FALSE);
                if (max(a->x[i], a->x[a->dim + i]) >
-                    max(b->x[i], b->x[b->dim + i]))
+                       max(b->x[i], b->x[b->dim + i]))
                        return (TRUE);
        }
 
@@ -874,11 +876,12 @@ cube_gt(NDBOX * a, NDBOX * b)
                        if (max(a->x[i], a->x[a->dim + i]) > 0)
                                return (TRUE);
                }
-               /*
-                * if all common dimensions are equal, the cube with more
-                * dimensions wins
-                */
-                return (TRUE);
+
+               /*
+                * if all common dimensions are equal, the cube with more
+                * dimensions wins
+                */
+               return (TRUE);
        }
        if (a->dim < b->dim)
        {
@@ -896,11 +899,12 @@ cube_gt(NDBOX * a, NDBOX * b)
                        if (max(b->x[i], b->x[b->dim + i]) > 0)
                                return (FALSE);
                }
-               /*
-                * if all common dimensions are equal, the cube with more
-                * dimensions wins
-                */
-                return (FALSE);
+
+               /*
+                * if all common dimensions are equal, the cube with more
+                * dimensions wins
+                */
+               return (FALSE);
        }
 
        return (FALSE);
@@ -928,18 +932,18 @@ cube_same(NDBOX * a, NDBOX * b)
        for (i = 0; i < b->dim; i++)
        {
                if (min(a->x[i], a->x[a->dim + i]) !=
-                  min(b->x[i], b->x[b->dim + i]))
+                       min(b->x[i], b->x[b->dim + i]))
                        return (FALSE);
                if (max(a->x[i], a->x[a->dim + i]) !=
-                  max(b->x[i], b->x[b->dim + i]))
+                       max(b->x[i], b->x[b->dim + i]))
                        return (FALSE);
        }
 
        /*
         * all dimensions of (b) are compared to those of (a); instead of
-        * those in (a) absent in (b), compare (a) to zero
-         * Since both LL and UR coordinates are compared to zero, we can
-         * just check them all without worrying about which is which.
+        * those in (a) absent in (b), compare (a) to zero Since both LL and
+        * UR coordinates are compared to zero, we can just check them all
+        * without worrying about which is which.
         */
        for (i = b->dim; i < a->dim; i++)
        {
@@ -974,9 +978,9 @@ cube_contains(NDBOX * a, NDBOX * b)
        {
                /*
                 * the further comparisons will make sense if the excess
-                * dimensions of (b) were zeroes
-                 * Since both UL and UR coordinates must be zero, we can
-                 * check them all without worrying about which is which.
+                * dimensions of (b) were zeroes Since both UL and UR coordinates
+                * must be zero, we can check them all without worrying about
+                * which is which.
                 */
                for (i = a->dim; i < b->dim; i++)
                {
@@ -991,10 +995,10 @@ cube_contains(NDBOX * a, NDBOX * b)
        for (i = 0; i < min(a->dim, b->dim); i++)
        {
                if (min(a->x[i], a->x[a->dim + i]) >
-                  min(b->x[i], b->x[b->dim + i]))
+                       min(b->x[i], b->x[b->dim + i]))
                        return (FALSE);
                if (max(a->x[i], a->x[a->dim + i]) <
-                  max(b->x[i], b->x[b->dim + i]))
+                       max(b->x[i], b->x[b->dim + i]))
                        return (FALSE);
        }
 
@@ -1039,10 +1043,10 @@ cube_overlap(NDBOX * a, NDBOX * b)
        for (i = 0; i < b->dim; i++)
        {
                if (min(a->x[i], a->x[a->dim + i]) >
-                  max(b->x[i], b->x[b->dim + i]))
+                       max(b->x[i], b->x[b->dim + i]))
                        return (FALSE);
                if (max(a->x[i], a->x[a->dim + i]) <
-                  min(b->x[i], b->x[b->dim + i]))
+                       min(b->x[i], b->x[b->dim + i]))
                        return (FALSE);
        }
 
@@ -1122,87 +1126,94 @@ distance_1D(double a1, double a2, double b1, double b2)
 bool
 cube_is_point(NDBOX * a)
 {
-        int i,
-            j;
+       int                     i,
+                               j;
+
        for (i = 0, j = a->dim; i < a->dim; i++, j++)
-        {
-                if (a->x[i] != a->x[j]) return FALSE;
-        }
+       {
+               if (a->x[i] != a->x[j])
+                       return FALSE;
+       }
 
-        return TRUE;
+       return TRUE;
 }
 
 /* Return dimensions in use in the data structure */
 int
 cube_dim(NDBOX * a)
 {
-        /* Other things will break before unsigned int doesn't fit. */
-        return a->dim;
+       /* Other things will break before unsigned int doesn't fit. */
+       return a->dim;
 }
 
 /* Return a specific normalized LL coordinate */
 double *
 cube_ll_coord(NDBOX * a, int n)
 {
-        double *result;
+       double     *result;
+
        result = (double *) palloc(sizeof(double));
-        *result = 0;
-        if (a->dim >= n && n > 0)
-               *result = min(a->x[n-1], a->x[a->dim + n-1]);
-        return result;
+       *result = 0;
+       if (a->dim >= n && n > 0)
+               *result = min(a->x[n - 1], a->x[a->dim + n - 1]);
+       return result;
 }
 
 /* Return a specific normalized UR coordinate */
 double *
 cube_ur_coord(NDBOX * a, int n)
 {
-        double *result;
+       double     *result;
+
        result = (double *) palloc(sizeof(double));
-        *result = 0;
-        if (a->dim >= n && n > 0)
-                *result = max(a->x[n-1], a->x[a->dim + n-1]);
-        return result;
+       *result = 0;
+       if (a->dim >= n && n > 0)
+               *result = max(a->x[n - 1], a->x[a->dim + n - 1]);
+       return result;
 }
 
 /* Increase or decrease box size by a radius in at least n dimensions. */
 NDBOX *
-cube_enlarge(NDBOX * a, double * r, int n)
+cube_enlarge(NDBOX * a, double *r, int n)
 {
-        NDBOX *result;
-        int dim = 0;
-        int size;
-        int i,
-            j;
-        if (*r > 0 && n > 0) dim = n;
-        if (a->dim > dim) dim = a->dim;
-        size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2;
-        result = (NDBOX *) palloc(size);
-        memset(result, 0, size);
-        result->size = size;
-        result->dim = dim;
+       NDBOX      *result;
+       int                     dim = 0;
+       int                     size;
+       int                     i,
+                               j;
+
+       if (*r > 0 && n > 0)
+               dim = n;
+       if (a->dim > dim)
+               dim = a->dim;
+       size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2;
+       result = (NDBOX *) palloc(size);
+       memset(result, 0, size);
+       result->size = size;
+       result->dim = dim;
        for (i = 0, j = dim; i < a->dim; i++, j++)
-        {
-                if (a->x[i] >= a->x[j])
-                {
-                        result->x[i] = a->x[j] - *r;
-                        result->x[j] = a->x[i] + *r;
-                }
-                else
-                {
-                        result->x[i] = a->x[i] - *r;
-                        result->x[j] = a->x[j] + *r;
-                }
-                if (result->x[i] > result->x[j])
-                {
-                        result->x[i] = (result->x[i] + result->x[j]) / 2;
-                        result->x[j] = result->x[i];
-                }
-        }
-        /* dim > a->dim only if r > 0 */
+       {
+               if (a->x[i] >= a->x[j])
+               {
+                       result->x[i] = a->x[j] - *r;
+                       result->x[j] = a->x[i] + *r;
+               }
+               else
+               {
+                       result->x[i] = a->x[i] - *r;
+                       result->x[j] = a->x[j] + *r;
+               }
+               if (result->x[i] > result->x[j])
+               {
+                       result->x[i] = (result->x[i] + result->x[j]) / 2;
+                       result->x[j] = result->x[i];
+               }
+       }
+       /* dim > a->dim only if r > 0 */
        for (; i < dim; i++, j++)
-        {
-                result->x[i] = -*r;
-                result->x[j] = *r;
-        }
-        return result;
+       {
+               result->x[i] = -*r;
+               result->x[j] = *r;
+       }
+       return result;
 }
index 4522368..e179226 100644 (file)
@@ -309,7 +309,7 @@ do_create(PGconn *conn, char *table, dbhead * dbh)
                                {
                                        strcat(query, " varchar");
                                        snprintf(t, 20, "(%d)",
-                                                       dbh->db_fields[i].db_flen);
+                                                        dbh->db_fields[i].db_flen);
                                        strcat(query, t);
                                }
                                else
@@ -468,8 +468,8 @@ do_inserts(PGconn *conn, char *table, dbhead * dbh)
                                        if ((strlen(foo) == 8) && isinteger(foo))
                                        {
                                                snprintf(pgdate, 11, "%c%c%c%c-%c%c-%c%c",
-                                                               foo[0], foo[1], foo[2], foo[3],
-                                                               foo[4], foo[5], foo[6], foo[7]);
+                                                                foo[0], foo[1], foo[2], foo[3],
+                                                                foo[4], foo[5], foo[6], foo[7]);
                                                strcat(query, pgdate);
                                        }
                                        else
index 44d5bf9..899143a 100644 (file)
@@ -67,10 +67,10 @@ static char *quote_literal_cstr(char *rawstr);
 static char *quote_ident_cstr(char *rawstr);
 static int16 get_attnum_pk_pos(int16 *pkattnums, int16 pknumatts, int16 key);
 static HeapTuple get_tuple_of_interest(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_pkattvals);
-static Oid get_relid_from_relname(text *relname_text);
+static Oid     get_relid_from_relname(text *relname_text);
 static dblink_results *get_res_ptr(int32 res_id_index);
-static void append_res_ptr(dblink_results *results);
-static void remove_res_ptr(dblink_results *results);
+static void append_res_ptr(dblink_results * results);
+static void remove_res_ptr(dblink_results * results);
 static TupleDesc pgresultGetTupleDesc(PGresult *res);
 
 /* Global */
@@ -97,10 +97,10 @@ PG_FUNCTION_INFO_V1(dblink_connect);
 Datum
 dblink_connect(PG_FUNCTION_ARGS)
 {
-       char               *connstr = GET_STR(PG_GETARG_TEXT_P(0));
-       char               *msg;
-       text               *result_text;
-       MemoryContext   oldcontext;
+       char       *connstr = GET_STR(PG_GETARG_TEXT_P(0));
+       char       *msg;
+       text       *result_text;
+       MemoryContext oldcontext;
 
        if (persistent_conn != NULL)
                PQfinish(persistent_conn);
@@ -128,7 +128,7 @@ PG_FUNCTION_INFO_V1(dblink_disconnect);
 Datum
 dblink_disconnect(PG_FUNCTION_ARGS)
 {
-       text               *result_text;
+       text       *result_text;
 
        if (persistent_conn != NULL)
                PQfinish(persistent_conn);
@@ -146,13 +146,13 @@ PG_FUNCTION_INFO_V1(dblink_open);
 Datum
 dblink_open(PG_FUNCTION_ARGS)
 {
-       char               *msg;
-       PGresult           *res = NULL;
-       PGconn             *conn = NULL;
-       text               *result_text;
-       char               *curname = GET_STR(PG_GETARG_TEXT_P(0));
-       char               *sql = GET_STR(PG_GETARG_TEXT_P(1));
-       StringInfo              str = makeStringInfo();
+       char       *msg;
+       PGresult   *res = NULL;
+       PGconn     *conn = NULL;
+       text       *result_text;
+       char       *curname = GET_STR(PG_GETARG_TEXT_P(0));
+       char       *sql = GET_STR(PG_GETARG_TEXT_P(1));
+       StringInfo      str = makeStringInfo();
 
        if (persistent_conn != NULL)
                conn = persistent_conn;
@@ -199,12 +199,12 @@ PG_FUNCTION_INFO_V1(dblink_close);
 Datum
 dblink_close(PG_FUNCTION_ARGS)
 {
-       PGconn             *conn = NULL;
-       PGresult           *res = NULL;
-       char               *curname = GET_STR(PG_GETARG_TEXT_P(0));
-       StringInfo              str = makeStringInfo();
-       text               *result_text;
-       char               *msg;
+       PGconn     *conn = NULL;
+       PGresult   *res = NULL;
+       char       *curname = GET_STR(PG_GETARG_TEXT_P(0));
+       StringInfo      str = makeStringInfo();
+       text       *result_text;
+       char       *msg;
 
        if (persistent_conn != NULL)
                conn = persistent_conn;
@@ -215,7 +215,7 @@ dblink_close(PG_FUNCTION_ARGS)
 
        /* close the cursor */
        res = PQexec(conn, str->data);
-       if (!res ||     PQresultStatus(res) != PGRES_COMMAND_OK)
+       if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
        {
                msg = pstrdup(PQerrorMessage(conn));
                PQclear(res);
@@ -253,31 +253,34 @@ PG_FUNCTION_INFO_V1(dblink_fetch);
 Datum
 dblink_fetch(PG_FUNCTION_ARGS)
 {
-       FuncCallContext    *funcctx;
-       TupleDesc                       tupdesc = NULL;
-       int                                     call_cntr;
-       int                                     max_calls;
-       TupleTableSlot     *slot;
-       AttInMetadata      *attinmeta;
-       char                       *msg;
-       PGresult                   *res = NULL;
-       MemoryContext           oldcontext;
+       FuncCallContext *funcctx;
+       TupleDesc       tupdesc = NULL;
+       int                     call_cntr;
+       int                     max_calls;
+       TupleTableSlot *slot;
+       AttInMetadata *attinmeta;
+       char       *msg;
+       PGresult   *res = NULL;
+       MemoryContext oldcontext;
 
        /* stuff done only on the first call of the function */
-       if(SRF_IS_FIRSTCALL())
-       {
-               Oid                     functypeid;
-               char                    functyptype;
-               Oid                     funcid = fcinfo->flinfo->fn_oid;
-               PGconn             *conn = NULL;
-               StringInfo              str = makeStringInfo();
-               char               *curname = GET_STR(PG_GETARG_TEXT_P(0));
-               int                             howmany = PG_GETARG_INT32(1);
+       if (SRF_IS_FIRSTCALL())
+       {
+               Oid                     functypeid;
+               char            functyptype;
+               Oid                     funcid = fcinfo->flinfo->fn_oid;
+               PGconn     *conn = NULL;
+               StringInfo      str = makeStringInfo();
+               char       *curname = GET_STR(PG_GETARG_TEXT_P(0));
+               int                     howmany = PG_GETARG_INT32(1);
 
                /* create a function context for cross-call persistence */
-               funcctx = SRF_FIRSTCALL_INIT();
+               funcctx = SRF_FIRSTCALL_INIT();
 
-               /* switch to memory context appropriate for multiple function calls */
+               /*
+                * switch to memory context appropriate for multiple function
+                * calls
+                */
                oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
 
                if (persistent_conn != NULL)
@@ -314,7 +317,7 @@ dblink_fetch(PG_FUNCTION_ARGS)
 
                /* fast track when no results */
                if (funcctx->max_calls < 1)
-                       SRF_RETURN_DONE(funcctx);
+                       SRF_RETURN_DONE(funcctx);
 
                /* check typtype to see if we have a predetermined return type */
                functypeid = get_func_rettype(funcid);
@@ -336,10 +339,10 @@ dblink_fetch(PG_FUNCTION_ARGS)
                funcctx->attinmeta = attinmeta;
 
                MemoryContextSwitchTo(oldcontext);
-    }
+       }
 
        /* stuff done on every call of the function */
-       funcctx = SRF_PERCALL_SETUP();
+       funcctx = SRF_PERCALL_SETUP();
 
        /*
         * initialize per-call variables
@@ -354,12 +357,12 @@ dblink_fetch(PG_FUNCTION_ARGS)
        tupdesc = attinmeta->tupdesc;
 
        if (call_cntr < max_calls)      /* do when there is more left to send */
-       {
+       {
                char      **values;
                HeapTuple       tuple;
                Datum           result;
-               int             i;
-               int             nfields = PQnfields(res);
+               int                     i;
+               int                     nfields = PQnfields(res);
 
                values = (char **) palloc(nfields * sizeof(char *));
                for (i = 0; i < nfields; i++)
@@ -376,12 +379,13 @@ dblink_fetch(PG_FUNCTION_ARGS)
                /* make the tuple into a datum */
                result = TupleGetDatum(slot, tuple);
 
-               SRF_RETURN_NEXT(funcctx, result);
+               SRF_RETURN_NEXT(funcctx, result);
        }
-       else    /* do when there is no more left */
+       else
+/* do when there is no more left */
        {
                PQclear(res);
-               SRF_RETURN_DONE(funcctx);
+               SRF_RETURN_DONE(funcctx);
        }
 }
 
@@ -392,32 +396,35 @@ PG_FUNCTION_INFO_V1(dblink_record);
 Datum
 dblink_record(PG_FUNCTION_ARGS)
 {
-       FuncCallContext    *funcctx;
-       TupleDesc                       tupdesc = NULL;
-       int                                     call_cntr;
-       int                                     max_calls;
-       TupleTableSlot     *slot;
-       AttInMetadata      *attinmeta;
-       char                       *msg;
-       PGresult                   *res = NULL;
-       bool                            is_sql_cmd = false;
-       char                       *sql_cmd_status = NULL;
-       MemoryContext           oldcontext;
+       FuncCallContext *funcctx;
+       TupleDesc       tupdesc = NULL;
+       int                     call_cntr;
+       int                     max_calls;
+       TupleTableSlot *slot;
+       AttInMetadata *attinmeta;
+       char       *msg;
+       PGresult   *res = NULL;
+       bool            is_sql_cmd = false;
+       char       *sql_cmd_status = NULL;
+       MemoryContext oldcontext;
 
        /* stuff done only on the first call of the function */
-       if(SRF_IS_FIRSTCALL())
-       {
-               Oid                     functypeid;
-               char                    functyptype;
-               Oid                     funcid = fcinfo->flinfo->fn_oid;
-               PGconn             *conn = NULL;
-               char               *connstr = NULL;
-               char               *sql = NULL;
+       if (SRF_IS_FIRSTCALL())
+       {
+               Oid                     functypeid;
+               char            functyptype;
+               Oid                     funcid = fcinfo->flinfo->fn_oid;
+               PGconn     *conn = NULL;
+               char       *connstr = NULL;
+               char       *sql = NULL;
 
                /* create a function context for cross-call persistence */
-               funcctx = SRF_FIRSTCALL_INIT();
+               funcctx = SRF_FIRSTCALL_INIT();
 
-               /* switch to memory context appropriate for multiple function calls */
+               /*
+                * switch to memory context appropriate for multiple function
+                * calls
+                */
                oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
 
                if (fcinfo->nargs == 2)
@@ -487,7 +494,7 @@ dblink_record(PG_FUNCTION_ARGS)
 
                /* fast track when no results */
                if (funcctx->max_calls < 1)
-                       SRF_RETURN_DONE(funcctx);
+                       SRF_RETURN_DONE(funcctx);
 
                /* check typtype to see if we have a predetermined return type */
                functypeid = get_func_rettype(funcid);
@@ -512,10 +519,10 @@ dblink_record(PG_FUNCTION_ARGS)
                funcctx->attinmeta = attinmeta;
 
                MemoryContextSwitchTo(oldcontext);
-    }
+       }
 
        /* stuff done on every call of the function */
-       funcctx = SRF_PERCALL_SETUP();
+       funcctx = SRF_PERCALL_SETUP();
 
        /*
         * initialize per-call variables
@@ -530,15 +537,15 @@ dblink_record(PG_FUNCTION_ARGS)
        tupdesc = attinmeta->tupdesc;
 
        if (call_cntr < max_calls)      /* do when there is more left to send */
-       {
+       {
                char      **values;
                HeapTuple       tuple;
                Datum           result;
 
                if (!is_sql_cmd)
                {
-                       int             i;
-                       int             nfields = PQnfields(res);
+                       int                     i;
+                       int                     nfields = PQnfields(res);
 
                        values = (char **) palloc(nfields * sizeof(char *));
                        for (i = 0; i < nfields; i++)
@@ -561,12 +568,13 @@ dblink_record(PG_FUNCTION_ARGS)
                /* make the tuple into a datum */
                result = TupleGetDatum(slot, tuple);
 
-               SRF_RETURN_NEXT(funcctx, result);
+               SRF_RETURN_NEXT(funcctx, result);
        }
-       else    /* do when there is no more left */
+       else
+/* do when there is no more left */
        {
                PQclear(res);
-               SRF_RETURN_DONE(funcctx);
+               SRF_RETURN_DONE(funcctx);
        }
 }
 
@@ -577,14 +585,14 @@ PG_FUNCTION_INFO_V1(dblink_exec);
 Datum
 dblink_exec(PG_FUNCTION_ARGS)
 {
-       char               *msg;
-       PGresult           *res = NULL;
-       char               *sql_cmd_status = NULL;
-       TupleDesc               tupdesc = NULL;
-       text               *result_text;
-       PGconn             *conn = NULL;
-       char               *connstr = NULL;
-       char               *sql = NULL;
+       char       *msg;
+       PGresult   *res = NULL;
+       char       *sql_cmd_status = NULL;
+       TupleDesc       tupdesc = NULL;
+       text       *result_text;
+       PGconn     *conn = NULL;
+       char       *connstr = NULL;
+       char       *sql = NULL;
 
        if (fcinfo->nargs == 2)
        {
@@ -633,8 +641,8 @@ dblink_exec(PG_FUNCTION_ARGS)
                                                           TEXTOID, -1, 0, false);
 
                        /*
-                        * and save a copy of the command status string to return
-                        * as our result tuple
+                        * and save a copy of the command status string to return as
+                        * our result tuple
                         */
                        sql_cmd_status = PQcmdStatus(res);
                }
@@ -659,15 +667,15 @@ PG_FUNCTION_INFO_V1(dblink);
 Datum
 dblink(PG_FUNCTION_ARGS)
 {
-       PGconn                  *conn = NULL;
-       PGresult                *res = NULL;
-       dblink_results  *results;
-       char                    *optstr;
-       char                    *sqlstatement;
-       char                    *execstatement;
-       char                    *msg;
-       int                             ntuples = 0;
-       ReturnSetInfo   *rsi;
+       PGconn     *conn = NULL;
+       PGresult   *res = NULL;
+       dblink_results *results;
+       char       *optstr;
+       char       *sqlstatement;
+       char       *execstatement;
+       char       *msg;
+       int                     ntuples = 0;
+       ReturnSetInfo *rsi;
 
        if (fcinfo->resultinfo == NULL || !IsA(fcinfo->resultinfo, ReturnSetInfo))
                elog(ERROR, "dblink: function called in context that does not accept a set result");
@@ -721,8 +729,8 @@ dblink(PG_FUNCTION_ARGS)
                        results->res = res;
 
                        /*
-                        * Append node to res_id to hold pointer to results.
-                        * Needed by dblink_tok to access the data
+                        * Append node to res_id to hold pointer to results. Needed by
+                        * dblink_tok to access the data
                         */
                        append_res_ptr(results);
 
@@ -797,11 +805,11 @@ Datum
 dblink_tok(PG_FUNCTION_ARGS)
 {
        dblink_results *results;
-       int                             fldnum;
-       text                    *result_text;
-       char                    *result;
-       int                             nfields = 0;
-       int                             text_len = 0;
+       int                     fldnum;
+       text       *result_text;
+       char       *result;
+       int                     nfields = 0;
+       int                     text_len = 0;
 
        results = get_res_ptr(PG_GETARG_INT32(0));
        if (results == NULL)
@@ -848,7 +856,7 @@ dblink_tok(PG_FUNCTION_ARGS)
 
 /*
  * dblink_get_pkey
- * 
+ *
  * Return list of primary key fields for the supplied relation,
  * or NULL if none exists.
  */
@@ -856,25 +864,28 @@ PG_FUNCTION_INFO_V1(dblink_get_pkey);
 Datum
 dblink_get_pkey(PG_FUNCTION_ARGS)
 {
-       int16                           numatts;
-       Oid                                     relid;
-       char                      **results;
-       FuncCallContext    *funcctx;
-       int32                           call_cntr;
-       int32                           max_calls;
-       TupleTableSlot     *slot;
-       AttInMetadata      *attinmeta;
-       MemoryContext           oldcontext;
+       int16           numatts;
+       Oid                     relid;
+       char      **results;
+       FuncCallContext *funcctx;
+       int32           call_cntr;
+       int32           max_calls;
+       TupleTableSlot *slot;
+       AttInMetadata *attinmeta;
+       MemoryContext oldcontext;
 
        /* stuff done only on the first call of the function */
-       if(SRF_IS_FIRSTCALL())
-       {
-               TupleDesc               tupdesc = NULL;
+       if (SRF_IS_FIRSTCALL())
+       {
+               TupleDesc       tupdesc = NULL;
 
                /* create a function context for cross-call persistence */
-               funcctx = SRF_FIRSTCALL_INIT();
+               funcctx = SRF_FIRSTCALL_INIT();
 
-               /* switch to memory context appropriate for multiple function calls */
+               /*
+                * switch to memory context appropriate for multiple function
+                * calls
+                */
                oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
 
                /* convert relname to rel Oid */
@@ -882,7 +893,10 @@ dblink_get_pkey(PG_FUNCTION_ARGS)
                if (!OidIsValid(relid))
                        elog(ERROR, "dblink_get_pkey: relation does not exist");
 
-               /* need a tuple descriptor representing one INT and one TEXT column */
+               /*
+                * need a tuple descriptor representing one INT and one TEXT
+                * column
+                */
                tupdesc = CreateTemplateTupleDesc(2, false);
                TupleDescInitEntry(tupdesc, (AttrNumber) 1, "position",
                                                   INT4OID, -1, 0, false);
@@ -896,8 +910,8 @@ dblink_get_pkey(PG_FUNCTION_ARGS)
                funcctx->slot = slot;
 
                /*
-                * Generate attribute metadata needed later to produce tuples from raw
-                * C strings
+                * Generate attribute metadata needed later to produce tuples from
+                * raw C strings
                 */
                attinmeta = TupleDescGetAttInMetadata(tupdesc);
                funcctx->attinmeta = attinmeta;
@@ -912,14 +926,15 @@ dblink_get_pkey(PG_FUNCTION_ARGS)
                        /* got results, keep track of them */
                        funcctx->user_fctx = results;
                }
-               else    /* fast track when no results */
-                       SRF_RETURN_DONE(funcctx);
+               else
+/* fast track when no results */
+                       SRF_RETURN_DONE(funcctx);
 
                MemoryContextSwitchTo(oldcontext);
-    }
+       }
 
        /* stuff done on every call of the function */
-       funcctx = SRF_PERCALL_SETUP();
+       funcctx = SRF_PERCALL_SETUP();
 
        /*
         * initialize per-call variables
@@ -933,13 +948,13 @@ dblink_get_pkey(PG_FUNCTION_ARGS)
        attinmeta = funcctx->attinmeta;
 
        if (call_cntr < max_calls)      /* do when there is more left to send */
-       {
+       {
                char      **values;
                HeapTuple       tuple;
                Datum           result;
 
                values = (char **) palloc(2 * sizeof(char *));
-               values[0] = (char *) palloc(12);        /* sign, 10 digits, '\0' */
+               values[0] = (char *) palloc(12);                /* sign, 10 digits, '\0' */
 
                sprintf(values[0], "%d", call_cntr + 1);
 
@@ -951,10 +966,11 @@ dblink_get_pkey(PG_FUNCTION_ARGS)
                /* make the tuple into a datum */
                result = TupleGetDatum(slot, tuple);
 
-               SRF_RETURN_NEXT(funcctx, result);
+               SRF_RETURN_NEXT(funcctx, result);
        }
-       else    /* do when there is no more left */
-               SRF_RETURN_DONE(funcctx);
+       else
+/* do when there is no more left */
+               SRF_RETURN_DONE(funcctx);
 }
 
 /*
@@ -989,7 +1005,7 @@ dblink_last_oid(PG_FUNCTION_ARGS)
 
 /*
  * dblink_build_sql_insert
- * 
+ *
  * Used to generate an SQL insert statement
  * based on an existing tuple in a local relation.
  * This is useful for selectively replicating data
@@ -1022,7 +1038,7 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS)
        int                *src_dim;
        int                     src_nitems;
        int                     tgt_ndim;
-       int                     *tgt_dim;
+       int                *tgt_dim;
        int                     tgt_nitems;
        int                     i;
        char       *ptr;
@@ -1043,6 +1059,7 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS)
 
        pkattnums = (int16 *) PG_GETARG_POINTER(1);
        pknumatts = PG_GETARG_INT16(2);
+
        /*
         * There should be at least one key attribute
         */
@@ -1053,8 +1070,8 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS)
        tgt_pkattvals_arry = PG_GETARG_ARRAYTYPE_P(4);
 
        /*
-        * Source array is made up of key values that will be used to
-        * locate the tuple of interest from the local system.
+        * Source array is made up of key values that will be used to locate
+        * the tuple of interest from the local system.
         */
        src_ndim = ARR_NDIM(src_pkattvals_arry);
        src_dim = ARR_DIMS(src_pkattvals_arry);
@@ -1071,7 +1088,7 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS)
         */
        Assert(ARR_ELEMTYPE(src_pkattvals_arry) == TEXTOID);
        get_typlenbyvalalign(ARR_ELEMTYPE(src_pkattvals_arry),
-                                                                       &typlen, &typbyval, &typalign);
+                                                &typlen, &typbyval, &typalign);
 
        src_pkattvals = (char **) palloc(src_nitems * sizeof(char *));
        ptr = ARR_DATA_PTR(src_pkattvals_arry);
@@ -1083,8 +1100,8 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS)
        }
 
        /*
-        * Target array is made up of key values that will be used to
-        * build the SQL string for use on the remote system.
+        * Target array is made up of key values that will be used to build
+        * the SQL string for use on the remote system.
         */
        tgt_ndim = ARR_NDIM(tgt_pkattvals_arry);
        tgt_dim = ARR_DIMS(tgt_pkattvals_arry);
@@ -1101,7 +1118,7 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS)
         */
        Assert(ARR_ELEMTYPE(tgt_pkattvals_arry) == TEXTOID);
        get_typlenbyvalalign(ARR_ELEMTYPE(tgt_pkattvals_arry),
-                                                                       &typlen, &typbyval, &typalign);
+                                                &typlen, &typbyval, &typalign);
 
        tgt_pkattvals = (char **) palloc(tgt_nitems * sizeof(char *));
        ptr = ARR_DATA_PTR(tgt_pkattvals_arry);
@@ -1131,7 +1148,7 @@ dblink_build_sql_insert(PG_FUNCTION_ARGS)
 
 /*
  * dblink_build_sql_delete
- * 
+ *
  * Used to generate an SQL delete statement.
  * This is useful for selectively replicating a
  * delete to another server via dblink.
@@ -1149,18 +1166,18 @@ Datum
 dblink_build_sql_delete(PG_FUNCTION_ARGS)
 {
        Oid                     relid;
-       text            *relname_text;
-       int16           *pkattnums;
+       text       *relname_text;
+       int16      *pkattnums;
        int16           pknumatts;
-       char            **tgt_pkattvals;
-       ArrayType       *tgt_pkattvals_arry;
+       char      **tgt_pkattvals;
+       ArrayType  *tgt_pkattvals_arry;
        int                     tgt_ndim;
-       int                     *tgt_dim;
+       int                *tgt_dim;
        int                     tgt_nitems;
        int                     i;
-       char            *ptr;
-       char            *sql;
-       text            *sql_text;
+       char       *ptr;
+       char       *sql;
+       text       *sql_text;
        int16           typlen;
        bool            typbyval;
        char            typalign;
@@ -1176,6 +1193,7 @@ dblink_build_sql_delete(PG_FUNCTION_ARGS)
 
        pkattnums = (int16 *) PG_GETARG_POINTER(1);
        pknumatts = PG_GETARG_INT16(2);
+
        /*
         * There should be at least one key attribute
         */
@@ -1185,8 +1203,8 @@ dblink_build_sql_delete(PG_FUNCTION_ARGS)
        tgt_pkattvals_arry = PG_GETARG_ARRAYTYPE_P(3);
 
        /*
-        * Target array is made up of key values that will be used to
-        * build the SQL string for use on the remote system.
+        * Target array is made up of key values that will be used to build
+        * the SQL string for use on the remote system.
         */
        tgt_ndim = ARR_NDIM(tgt_pkattvals_arry);
        tgt_dim = ARR_DIMS(tgt_pkattvals_arry);
@@ -1203,7 +1221,7 @@ dblink_build_sql_delete(PG_FUNCTION_ARGS)
         */
        Assert(ARR_ELEMTYPE(tgt_pkattvals_arry) == TEXTOID);
        get_typlenbyvalalign(ARR_ELEMTYPE(tgt_pkattvals_arry),
-                                                                       &typlen, &typbyval, &typalign);
+                                                &typlen, &typbyval, &typalign);
 
        tgt_pkattvals = (char **) palloc(tgt_nitems * sizeof(char *));
        ptr = ARR_DATA_PTR(tgt_pkattvals_arry);
@@ -1233,7 +1251,7 @@ dblink_build_sql_delete(PG_FUNCTION_ARGS)
 
 /*
  * dblink_build_sql_update
- * 
+ *
  * Used to generate an SQL update statement
  * based on an existing tuple in a local relation.
  * This is useful for selectively replicating data
@@ -1255,23 +1273,23 @@ Datum
 dblink_build_sql_update(PG_FUNCTION_ARGS)
 {
        Oid                     relid;
-       text            *relname_text;
-       int16           *pkattnums;
+       text       *relname_text;
+       int16      *pkattnums;
        int16           pknumatts;
-       char            **src_pkattvals;
-       char            **tgt_pkattvals;
-       ArrayType       *src_pkattvals_arry;
-       ArrayType       *tgt_pkattvals_arry;
+       char      **src_pkattvals;
+       char      **tgt_pkattvals;
+       ArrayType  *src_pkattvals_arry;
+       ArrayType  *tgt_pkattvals_arry;
        int                     src_ndim;
-       int                     *src_dim;
+       int                *src_dim;
        int                     src_nitems;
        int                     tgt_ndim;
-       int                     *tgt_dim;
+       int                *tgt_dim;
        int                     tgt_nitems;
        int                     i;
-       char            *ptr;
-       char            *sql;
-       text            *sql_text;
+       char       *ptr;
+       char       *sql;
+       text       *sql_text;
        int16           typlen;
        bool            typbyval;
        char            typalign;
@@ -1287,6 +1305,7 @@ dblink_build_sql_update(PG_FUNCTION_ARGS)
 
        pkattnums = (int16 *) PG_GETARG_POINTER(1);
        pknumatts = PG_GETARG_INT16(2);
+
        /*
         * There should be one source array key values for each key attnum
         */
@@ -1297,8 +1316,8 @@ dblink_build_sql_update(PG_FUNCTION_ARGS)
        tgt_pkattvals_arry = PG_GETARG_ARRAYTYPE_P(4);
 
        /*
-        * Source array is made up of key values that will be used to
-        * locate the tuple of interest from the local system.
+        * Source array is made up of key values that will be used to locate
+        * the tuple of interest from the local system.
         */
        src_ndim = ARR_NDIM(src_pkattvals_arry);
        src_dim = ARR_DIMS(src_pkattvals_arry);
@@ -1315,7 +1334,7 @@ dblink_build_sql_update(PG_FUNCTION_ARGS)
         */
        Assert(ARR_ELEMTYPE(src_pkattvals_arry) == TEXTOID);
        get_typlenbyvalalign(ARR_ELEMTYPE(src_pkattvals_arry),
-                                                                       &typlen, &typbyval, &typalign);
+                                                &typlen, &typbyval, &typalign);
 
        src_pkattvals = (char **) palloc(src_nitems * sizeof(char *));
        ptr = ARR_DATA_PTR(src_pkattvals_arry);
@@ -1327,8 +1346,8 @@ dblink_build_sql_update(PG_FUNCTION_ARGS)
        }
 
        /*
-        * Target array is made up of key values that will be used to
-        * build the SQL string for use on the remote system.
+        * Target array is made up of key values that will be used to build
+        * the SQL string for use on the remote system.
         */
        tgt_ndim = ARR_NDIM(tgt_pkattvals_arry);
        tgt_dim = ARR_DIMS(tgt_pkattvals_arry);
@@ -1345,7 +1364,7 @@ dblink_build_sql_update(PG_FUNCTION_ARGS)
         */
        Assert(ARR_ELEMTYPE(tgt_pkattvals_arry) == TEXTOID);
        get_typlenbyvalalign(ARR_ELEMTYPE(tgt_pkattvals_arry),
-                                                                       &typlen, &typbyval, &typalign);
+                                                &typlen, &typbyval, &typalign);
 
        tgt_pkattvals = (char **) palloc(tgt_nitems * sizeof(char *));
        ptr = ARR_DATA_PTR(tgt_pkattvals_arry);
@@ -1382,7 +1401,7 @@ PG_FUNCTION_INFO_V1(dblink_current_query);
 Datum
 dblink_current_query(PG_FUNCTION_ARGS)
 {
-       text            *result_text;
+       text       *result_text;
 
        result_text = DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(debug_query_string)));
        PG_RETURN_TEXT_P(result_text);
@@ -1410,7 +1429,7 @@ init_dblink_results(MemoryContext fn_mcxt)
        MemSet(retval, 0, sizeof(dblink_results));
 
        retval->tup_num = -1;
-       retval->res_id_index =-1;
+       retval->res_id_index = -1;
        retval->res = NULL;
 
        MemoryContextSwitchTo(oldcontext);
@@ -1420,21 +1439,21 @@ init_dblink_results(MemoryContext fn_mcxt)
 
 /*
  * get_pkey_attnames
- * 
+ *
  * Get the primary key attnames for the given relation.
  * Return NULL, and set numatts = 0, if no primary key exists.
  */
 static char **
 get_pkey_attnames(Oid relid, int16 *numatts)
 {
-       Relation                indexRelation;
-       ScanKeyData             entry;
-       HeapScanDesc    scan;
-       HeapTuple               indexTuple;
-       int                             i;
-       char                    **result = NULL;
-       Relation                rel;
-       TupleDesc               tupdesc;
+       Relation        indexRelation;
+       ScanKeyData entry;
+       HeapScanDesc scan;
+       HeapTuple       indexTuple;
+       int                     i;
+       char      **result = NULL;
+       Relation        rel;
+       TupleDesc       tupdesc;
 
        /* open relation using relid, get tupdesc */
        rel = relation_open(relid, AccessShareLock);
@@ -1451,7 +1470,7 @@ get_pkey_attnames(Oid relid, int16 *numatts)
 
        while ((indexTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
        {
-               Form_pg_index   index = (Form_pg_index) GETSTRUCT(indexTuple);
+               Form_pg_index index = (Form_pg_index) GETSTRUCT(indexTuple);
 
                /* we're only interested if it is the primary key */
                if (index->indisprimary == TRUE)
@@ -1480,23 +1499,23 @@ get_pkey_attnames(Oid relid, int16 *numatts)
 static char *
 get_sql_insert(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_pkattvals, char **tgt_pkattvals)
 {
-       Relation                rel;
-       char                    *relname;
-       HeapTuple               tuple;
-       TupleDesc               tupdesc;
-       int                             natts;
-       StringInfo              str = makeStringInfo();
-       char                    *sql;
-       char                    *val;
-       int16                   key;
-       int                             i;
-       bool                    needComma;
+       Relation        rel;
+       char       *relname;
+       HeapTuple       tuple;
+       TupleDesc       tupdesc;
+       int                     natts;
+       StringInfo      str = makeStringInfo();
+       char       *sql;
+       char       *val;
+       int16           key;
+       int                     i;
+       bool            needComma;
 
        /*
         * Open relation using relid
         */
        rel = relation_open(relid, AccessShareLock);
-       relname =  RelationGetRelationName(rel);
+       relname = RelationGetRelationName(rel);
        tupdesc = rel->rd_att;
        natts = tupdesc->natts;
 
@@ -1516,7 +1535,7 @@ get_sql_insert(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_pkattval
                        appendStringInfo(str, ",");
 
                appendStringInfo(str, "%s",
-                                                quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname)));
+                                 quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname)));
                needComma = true;
        }
 
@@ -1566,33 +1585,33 @@ get_sql_insert(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_pkattval
 static char *
 get_sql_delete(Oid relid, int16 *pkattnums, int16 pknumatts, char **tgt_pkattvals)
 {
-       Relation                rel;
-       char                    *relname;
-       TupleDesc               tupdesc;
-       int                             natts;
-       StringInfo              str = makeStringInfo();
-       char                    *sql;
-       char                    *val;
-       int                             i;
+       Relation        rel;
+       char       *relname;
+       TupleDesc       tupdesc;
+       int                     natts;
+       StringInfo      str = makeStringInfo();
+       char       *sql;
+       char       *val;
+       int                     i;
 
        /*
         * Open relation using relid
         */
        rel = relation_open(relid, AccessShareLock);
-       relname =  RelationGetRelationName(rel);
+       relname = RelationGetRelationName(rel);
        tupdesc = rel->rd_att;
        natts = tupdesc->natts;
 
        appendStringInfo(str, "DELETE FROM %s WHERE ", quote_ident_cstr(relname));
        for (i = 0; i < pknumatts; i++)
        {
-               int16   pkattnum = pkattnums[i];
+               int16           pkattnum = pkattnums[i];
 
                if (i > 0)
                        appendStringInfo(str, " AND ");
 
                appendStringInfo(str, "%s",
-                                                quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum - 1]->attname)));
+               quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum - 1]->attname)));
 
                if (tgt_pkattvals != NULL)
                        val = pstrdup(tgt_pkattvals[i]);
@@ -1622,23 +1641,23 @@ get_sql_delete(Oid relid, int16 *pkattnums, int16 pknumatts, char **tgt_pkattval
 static char *
 get_sql_update(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_pkattvals, char **tgt_pkattvals)
 {
-       Relation                rel;
-       char                    *relname;
-       HeapTuple               tuple;
-       TupleDesc               tupdesc;
-       int                             natts;
-       StringInfo              str = makeStringInfo();
-       char                    *sql;
-       char                    *val;
-       int16                   key;
-       int                             i;
-       bool                    needComma;
+       Relation        rel;
+       char       *relname;
+       HeapTuple       tuple;
+       TupleDesc       tupdesc;
+       int                     natts;
+       StringInfo      str = makeStringInfo();
+       char       *sql;
+       char       *val;
+       int16           key;
+       int                     i;
+       bool            needComma;
 
        /*
         * Open relation using relid
         */
        rel = relation_open(relid, AccessShareLock);
-       relname =  RelationGetRelationName(rel);
+       relname = RelationGetRelationName(rel);
        tupdesc = rel->rd_att;
        natts = tupdesc->natts;
 
@@ -1658,7 +1677,7 @@ get_sql_update(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_pkattval
                        appendStringInfo(str, ", ");
 
                appendStringInfo(str, "%s = ",
-                                                quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname)));
+                                 quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname)));
 
                if (tgt_pkattvals != NULL)
                        key = get_attnum_pk_pos(pkattnums, pknumatts, i + 1);
@@ -1684,13 +1703,13 @@ get_sql_update(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_pkattval
 
        for (i = 0; i < pknumatts; i++)
        {
-               int16   pkattnum = pkattnums[i];
+               int16           pkattnum = pkattnums[i];
 
                if (i > 0)
                        appendStringInfo(str, " AND ");
 
                appendStringInfo(str, "%s",
-                                                quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum - 1]->attname)));
+               quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum - 1]->attname)));
 
                if (tgt_pkattvals != NULL)
                        val = pstrdup(tgt_pkattvals[i]);
@@ -1721,9 +1740,9 @@ get_sql_update(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_pkattval
 static char *
 quote_literal_cstr(char *rawstr)
 {
-       text            *rawstr_text;
-       text            *result_text;
-       char            *result;
+       text       *rawstr_text;
+       text       *result_text;
+       char       *result;
 
        rawstr_text = DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(rawstr)));
        result_text = DatumGetTextP(DirectFunctionCall1(quote_literal, PointerGetDatum(rawstr_text)));
@@ -1739,9 +1758,9 @@ quote_literal_cstr(char *rawstr)
 static char *
 quote_ident_cstr(char *rawstr)
 {
-       text            *rawstr_text;
-       text            *result_text;
-       char            *result;
+       text       *rawstr_text;
+       text       *result_text;
+       char       *result;
 
        rawstr_text = DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(rawstr)));
        result_text = DatumGetTextP(DirectFunctionCall1(quote_ident, PointerGetDatum(rawstr_text)));
@@ -1753,11 +1772,10 @@ quote_ident_cstr(char *rawstr)
 static int16
 get_attnum_pk_pos(int16 *pkattnums, int16 pknumatts, int16 key)
 {
-       int             i;
+       int                     i;
 
        /*
-        * Not likely a long list anyway, so just scan for
-        * the value
+        * Not likely a long list anyway, so just scan for the value
         */
        for (i = 0; i < pknumatts; i++)
                if (key == pkattnums[i])
@@ -1769,21 +1787,21 @@ get_attnum_pk_pos(int16 *pkattnums, int16 pknumatts, int16 key)
 static HeapTuple
 get_tuple_of_interest(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_pkattvals)
 {
-       Relation                rel;
-       char                    *relname;
-       TupleDesc               tupdesc;
-       StringInfo              str = makeStringInfo();
-       char                    *sql = NULL;
-       int                             ret;
-       HeapTuple               tuple;
-       int                             i;
-       char                    *val = NULL;
+       Relation        rel;
+       char       *relname;
+       TupleDesc       tupdesc;
+       StringInfo      str = makeStringInfo();
+       char       *sql = NULL;
+       int                     ret;
+       HeapTuple       tuple;
+       int                     i;
+       char       *val = NULL;
 
        /*
         * Open relation using relid
         */
        rel = relation_open(relid, AccessShareLock);
-       relname =  RelationGetRelationName(rel);
+       relname = RelationGetRelationName(rel);
        tupdesc = CreateTupleDescCopy(rel->rd_att);
        relation_close(rel, AccessShareLock);
 
@@ -1794,20 +1812,20 @@ get_tuple_of_interest(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_p
                elog(ERROR, "get_tuple_of_interest: SPI_connect returned %d", ret);
 
        /*
-        * Build sql statement to look up tuple of interest
-        * Use src_pkattvals as the criteria.
+        * Build sql statement to look up tuple of interest Use src_pkattvals
+        * as the criteria.
         */
        appendStringInfo(str, "SELECT * FROM %s WHERE ", quote_ident_cstr(relname));
 
        for (i = 0; i < pknumatts; i++)
        {
-               int16   pkattnum = pkattnums[i];
+               int16           pkattnum = pkattnums[i];
 
                if (i > 0)
                        appendStringInfo(str, " AND ");
 
                appendStringInfo(str, "%s",
-                                                quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum - 1]->attname)));
+               quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum - 1]->attname)));
 
                val = pstrdup(src_pkattvals[i]);
                if (val != NULL)
@@ -1822,6 +1840,7 @@ get_tuple_of_interest(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_p
        sql = pstrdup(str->data);
        pfree(str->data);
        pfree(str);
+
        /*
         * Retrieve the desired tuple
         */
@@ -1832,12 +1851,11 @@ get_tuple_of_interest(Oid relid, int16 *pkattnums, int16 pknumatts, char **src_p
         * Only allow one qualifying tuple
         */
        if ((ret == SPI_OK_SELECT) && (SPI_processed > 1))
-       {
                elog(ERROR, "get_tuple_of_interest: Source criteria may not match more than one record.");
-       }
        else if (ret == SPI_OK_SELECT && SPI_processed == 1)
        {
                SPITupleTable *tuptable = SPI_tuptable;
+
                tuple = SPI_copytuple(tuptable->vals[0]);
 
                return tuple;
@@ -1871,15 +1889,15 @@ get_relid_from_relname(text *relname_text)
        return relid;
 }
 
-static dblink_results  *
+static dblink_results *
 get_res_ptr(int32 res_id_index)
 {
-       List    *ptr;
+       List       *ptr;
 
        /*
         * short circuit empty list
         */
-       if(res_id == NIL)
+       if (res_id == NIL)
                return NULL;
 
        /*
@@ -1887,7 +1905,8 @@ get_res_ptr(int32 res_id_index)
         */
        foreach(ptr, res_id)
        {
-               dblink_results  *this_res_id = (dblink_results *) lfirst(ptr);
+               dblink_results *this_res_id = (dblink_results *) lfirst(ptr);
+
                if (this_res_id->res_id_index == res_id_index)
                        return this_res_id;
        }
@@ -1898,7 +1917,7 @@ get_res_ptr(int32 res_id_index)
  * Add node to global List res_id
  */
 static void
-append_res_ptr(dblink_results *results)
+append_res_ptr(dblink_results * results)
 {
        res_id = lappend(res_id, results);
 }
@@ -1908,7 +1927,7 @@ append_res_ptr(dblink_results *results)
  * using res_id_index
  */
 static void
-remove_res_ptr(dblink_results *results)
+remove_res_ptr(dblink_results * results)
 {
        res_id = lremove(results, res_id);
 
@@ -1919,15 +1938,15 @@ remove_res_ptr(dblink_results *results)
 static TupleDesc
 pgresultGetTupleDesc(PGresult *res)
 {
-       int                             natts;
-       AttrNumber              attnum;
-       TupleDesc               desc;
-       char               *attname;
-       int32                   atttypmod;
-       int                             attdim;
-       bool                    attisset;
-       Oid                             atttypid;
-       int                             i;
+       int                     natts;
+       AttrNumber      attnum;
+       TupleDesc       desc;
+       char       *attname;
+       int32           atttypmod;
+       int                     attdim;
+       bool            attisset;
+       Oid                     atttypid;
+       int                     i;
 
        /*
         * allocate a new tuple descriptor
@@ -1943,8 +1962,8 @@ pgresultGetTupleDesc(PGresult *res)
        for (i = 0; i < natts; i++)
        {
                /*
-                * for each field, get the name and type information from the query
-                * result and have TupleDescInitEntry fill in the attribute
+                * for each field, get the name and type information from the
+                * query result and have TupleDescInitEntry fill in the attribute
                 * information we need.
                 */
                attnum++;
@@ -1955,9 +1974,9 @@ pgresultGetTupleDesc(PGresult *res)
 
                if (PQfsize(res, i) != get_typlen(atttypid))
                        elog(ERROR, "Size of remote field \"%s\" does not match size "
-                               "of local type \"%s\"",
-                               attname,
-                               format_type_with_typemod(atttypid, atttypmod));
+                                "of local type \"%s\"",
+                                attname,
+                                format_type_with_typemod(atttypid, atttypmod));
 
                attdim = 0;
                attisset = false;
index ddca624..09f9321 100644 (file)
@@ -74,6 +74,6 @@ extern Datum dblink_build_sql_delete(PG_FUNCTION_ARGS);
 extern Datum dblink_build_sql_update(PG_FUNCTION_ARGS);
 extern Datum dblink_current_query(PG_FUNCTION_ARGS);
 
-extern char    *debug_query_string;
+extern char *debug_query_string;
 
 #endif   /* DBLINK_H */
index a9027db..82aaffa 100644 (file)
@@ -1,20 +1,20 @@
 /****************************************************************************
  * pending.c
- * $Id: pending.c,v 1.1 2002/06/23 21:58:08 momjian Exp $ 
+ * $Id: pending.c,v 1.2 2002/09/04 20:31:06 momjian Exp $
  *
  * This file contains a trigger for Postgresql-7.x to record changes to tables
  * to a pending table for mirroring.
  * All tables that should be mirrored should have this trigger hooked up to it.
  *
- *   Written by Steven Singer (ssinger@navtechinc.com)
- *   (c) 2001-2002 Navtech Systems Support Inc.
- *   Released under the GNU Public License version 2. See COPYING.
+ *      Written by Steven Singer (ssinger@navtechinc.com)
+ *      (c) 2001-2002 Navtech Systems Support Inc.
+ *      Released under the GNU Public License version 2. See COPYING.
  *
  *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
+ *      This program is distributed in the hope that it will be useful,
+ *      but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *      GNU General Public License for more details.
  *
  *
  ***************************************************************************/
 #include <commands/trigger.h>
 #include <postgres.h>
 
-enum FieldUsage  {PRIMARY=0,NONPRIMARY,ALL,NUM_FIELDUSAGE};
+enum FieldUsage
+{
+       PRIMARY = 0, NONPRIMARY, ALL, NUM_FIELDUSAGE
+};
 
-int storePending(char * cpTableName, HeapTuple  tBeforeTuple, 
-                HeapTuple tAfterTuple,
-                 TupleDesc tTupdesc,
-                TriggerData * tpTrigdata,char cOp);
+int storePending(char *cpTableName, HeapTuple tBeforeTuple,
+                        HeapTuple tAfterTuple,
+                        TupleDesc tTupdesc,
+                        TriggerData *tpTrigdata, char cOp);
 
-int storeKeyInfo(char * cpTableName, HeapTuple tTupleData, TupleDesc tTuplDesc,
-                TriggerData * tpTrigdata);
-int storeData(char * cpTableName,HeapTuple tTupleData,TupleDesc tTupleDesc,
-             TriggerData * tpTrigData,int iIncludeKeyData);
-     
-int2vector * getPrimaryKey(Oid tblOid);
+int storeKeyInfo(char *cpTableName, HeapTuple tTupleData, TupleDesc tTuplDesc,
+                        TriggerData *tpTrigdata);
+int storeData(char *cpTableName, HeapTuple tTupleData, TupleDesc tTupleDesc,
+                 TriggerData *tpTrigData, int iIncludeKeyData);
 
-char * packageData(HeapTuple tTupleData, TupleDesc tTupleDecs,
-                  TriggerData * tTrigData,
-                  enum FieldUsage eKeyUsage );
+int2vector *getPrimaryKey(Oid tblOid);
+
+char *packageData(HeapTuple tTupleData, TupleDesc tTupleDecs,
+                       TriggerData *tTrigData,
+                       enum FieldUsage eKeyUsage);
 
 #define BUFFER_SIZE 256
 #define MAX_OID_LEN 10
 
 
 extern Datum recordchange(PG_FUNCTION_ARGS);
+
 PG_FUNCTION_INFO_V1(recordchange);
 
 
@@ -54,394 +58,430 @@ PG_FUNCTION_INFO_V1(recordchange);
  * table the trigger was applied to.  If this name is incorrect so will the
  * mirroring.
  ****************************************************************************/
-Datum recordchange(PG_FUNCTION_ARGS) {
-  TriggerData * trigdata; 
-  TupleDesc tupdesc;
-  HeapTuple beforeTuple=NULL;
-  HeapTuple afterTuple=NULL;
-  HeapTuple retTuple=NULL;
-  char * tblname;
-  char op;
-  if(fcinfo->context!=NULL) {
-    
-    if(SPI_connect() < 0) {
-      elog(NOTICE,"storePending could not connect to SPI");
-      return -1;
-    }
-    trigdata = (TriggerData*)fcinfo->context;
-    /* Extract the table name */
-    tblname = SPI_getrelname(trigdata->tg_relation);
-    tupdesc = trigdata->tg_relation->rd_att;
-    if(TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event)) {
-      retTuple = trigdata->tg_newtuple;
-      beforeTuple = trigdata->tg_trigtuple;
-      afterTuple = trigdata->tg_newtuple;
-      op='u';
-
-    }
-    else if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event)) {
-      retTuple = trigdata->tg_trigtuple;
-      afterTuple = trigdata->tg_trigtuple;
-      op = 'i';
-    }
-    else if (TRIGGER_FIRED_BY_DELETE(trigdata->tg_event)) {
-      retTuple = trigdata->tg_trigtuple;
-      beforeTuple = trigdata->tg_trigtuple;
-      op = 'd';
-    }
-
-    if(storePending(tblname,beforeTuple,afterTuple,tupdesc,trigdata,op)) {
-      /* An error occoured. Skip the operation. */
-      elog(ERROR,"Operation could not be mirrored");
-      return PointerGetDatum(NULL);
-        
-    }
+Datum
+recordchange(PG_FUNCTION_ARGS)
+{
+       TriggerData *trigdata;
+       TupleDesc       tupdesc;
+       HeapTuple       beforeTuple = NULL;
+       HeapTuple       afterTuple = NULL;
+       HeapTuple       retTuple = NULL;
+       char       *tblname;
+       char            op;
+
+       if (fcinfo->context != NULL)
+       {
+
+               if (SPI_connect() < 0)
+               {
+                       elog(NOTICE, "storePending could not connect to SPI");
+                       return -1;
+               }
+               trigdata = (TriggerData *) fcinfo->context;
+               /* Extract the table name */
+               tblname = SPI_getrelname(trigdata->tg_relation);
+               tupdesc = trigdata->tg_relation->rd_att;
+               if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
+               {
+                       retTuple = trigdata->tg_newtuple;
+                       beforeTuple = trigdata->tg_trigtuple;
+                       afterTuple = trigdata->tg_newtuple;
+                       op = 'u';
+
+               }
+               else if (TRIGGER_FIRED_BY_INSERT(trigdata->tg_event))
+               {
+                       retTuple = trigdata->tg_trigtuple;
+                       afterTuple = trigdata->tg_trigtuple;
+                       op = 'i';
+               }
+               else if (TRIGGER_FIRED_BY_DELETE(trigdata->tg_event))
+               {
+                       retTuple = trigdata->tg_trigtuple;
+                       beforeTuple = trigdata->tg_trigtuple;
+                       op = 'd';
+               }
+
+               if (storePending(tblname, beforeTuple, afterTuple, tupdesc, trigdata, op))
+               {
+                       /* An error occoured. Skip the operation. */
+                       elog(ERROR, "Operation could not be mirrored");
+                       return PointerGetDatum(NULL);
+
+               }
 #if defined DEBUG_OUTPUT
-    elog(NOTICE,"Returning on success");
+               elog(NOTICE, "Returning on success");
 #endif
-    SPI_finish();
-    return PointerGetDatum(retTuple);
-  }
-  else {
-    /*
-     * Not being called as a trigger.
-     */
-    return PointerGetDatum(NULL);
-  }
+               SPI_finish();
+               return PointerGetDatum(retTuple);
+       }
+       else
+       {
+               /*
+                * Not being called as a trigger.
+                */
+               return PointerGetDatum(NULL);
+       }
 }
 
 
 /*****************************************************************************
  * Constructs and executes an SQL query to write a record of this tuple change
- * to the pending table. 
+ * to the pending table.
  *****************************************************************************/
-int storePending(char * cpTableName, HeapTuple  tBeforeTuple, 
-                HeapTuple tAfterTuple,
-                 TupleDesc tTupDesc,
-                 TriggerData * tpTrigData,char cOp) {
-  char * cpQueryBase = "INSERT INTO \"Pending\" (\"TableName\",\"Op\",\"XID\") VALUES ($1,$2,$3)";
-
-  int iResult=0;
-  HeapTuple tCurTuple; // Points the current tuple(before or after)
-  Datum saPlanData[4];
-  Oid taPlanArgTypes[3] = {NAMEOID,CHAROID,INT4OID};
-  void * vpPlan;
-
-  tCurTuple = tBeforeTuple ? tBeforeTuple : tAfterTuple;
-
-  
-
-  
-  vpPlan = SPI_prepare(cpQueryBase,3,taPlanArgTypes);
-  if(vpPlan==NULL) {
-    elog(NOTICE,"Error creating plan");
-  }
-  //  SPI_saveplan(vpPlan);
-
-  saPlanData[0] = PointerGetDatum(cpTableName);
-  saPlanData[1] = CharGetDatum(cOp);
-  saPlanData[2] = Int32GetDatum(GetCurrentTransactionId());
-  
-  
-  iResult = SPI_execp(vpPlan,saPlanData,NULL,1);
-  if(iResult < 0) {
-    elog(NOTICE,"storedPending fired (%s) returned %d",cpQueryBase,iResult);
-  }
-  
+int
+storePending(char *cpTableName, HeapTuple tBeforeTuple,
+                        HeapTuple tAfterTuple,
+                        TupleDesc tTupDesc,
+                        TriggerData *tpTrigData, char cOp)
+{
+       char       *cpQueryBase = "INSERT INTO \"Pending\" (\"TableName\",\"Op\",\"XID\") VALUES ($1,$2,$3)";
+
+       int                     iResult = 0;
+       HeapTuple       tCurTuple;
+
+       //Points the current tuple(before or after)
+               Datum           saPlanData[4];
+       Oid                     taPlanArgTypes[3] = {NAMEOID, CHAROID, INT4OID};
+       void       *vpPlan;
+
+       tCurTuple = tBeforeTuple ? tBeforeTuple : tAfterTuple;
+
+
+
+
+       vpPlan = SPI_prepare(cpQueryBase, 3, taPlanArgTypes);
+       if (vpPlan == NULL)
+               elog(NOTICE, "Error creating plan");
+       /* SPI_saveplan(vpPlan); */
+
+       saPlanData[0] = PointerGetDatum(cpTableName);
+       saPlanData[1] = CharGetDatum(cOp);
+       saPlanData[2] = Int32GetDatum(GetCurrentTransactionId());
+
+
+       iResult = SPI_execp(vpPlan, saPlanData, NULL, 1);
+       if (iResult < 0)
+               elog(NOTICE, "storedPending fired (%s) returned %d", cpQueryBase, iResult);
+
 
 #if defined DEBUG_OUTPUT
elog(NOTICE,"row successfully stored in pending table");
      elog(NOTICE, "row successfully stored in pending table");
 #endif
 
-  if(cOp=='d') {
-    /**
-     * This is a record of a delete operation.
-     * Just store the key data.
-     */
-    iResult = storeKeyInfo(cpTableName,tBeforeTuple,tTupDesc,tpTrigData);
-  }
-  else if (cOp=='i') {
-    /**
-     * An Insert operation.
-     * Store all data
-     */
-    iResult = storeData(cpTableName,tAfterTuple,tTupDesc,tpTrigData,TRUE);
-
-  }
-  else {
-    /* op must be an update. */
-    iResult = storeKeyInfo(cpTableName,tBeforeTuple,tTupDesc,tpTrigData);
-    iResult = iResult ? iResult : storeData(cpTableName,tAfterTuple,tTupDesc,
-                                           tpTrigData,TRUE);
-  }
+       if (cOp == 'd')
+       {
+               /**
+                * This is a record of a delete operation.
+                * Just store the key data.
+                */
+               iResult = storeKeyInfo(cpTableName, tBeforeTuple, tTupDesc, tpTrigData);
+       }
+       else if (cOp == 'i')
+       {
+               /**
+                * An Insert operation.
+                * Store all data
+                */
+               iResult = storeData(cpTableName, tAfterTuple, tTupDesc, tpTrigData, TRUE);
+
+       }
+       else
+       {
+               /* op must be an update. */
+               iResult = storeKeyInfo(cpTableName, tBeforeTuple, tTupDesc, tpTrigData);
+               iResult = iResult ? iResult : storeData(cpTableName, tAfterTuple, tTupDesc,
+                                                                                               tpTrigData, TRUE);
+       }
 
 #if defined DEBUG_OUTPUT
-  elog(NOTICE,"DOne storing keyinfo");
+       elog(NOTICE, "DOne storing keyinfo");
 #endif
-  return iResult;
+
+       return iResult;
 
 }
 
-int storeKeyInfo(char * cpTableName, HeapTuple tTupleData, 
-                TupleDesc tTupleDesc,
-                TriggerData * tpTrigData) {
-  Oid saPlanArgTypes[1] = {NAMEOID};
-  char * insQuery = "INSERT INTO \"PendingData\" (\"SeqId\",\"IsKey\",\"Data\") VALUES(currval('\"Pending_SeqId_seq\"'),'t',$1)";
-  void * pplan;
-  Datum saPlanData[1];
-  char * cpKeyData;
-  int iRetCode;
-
-  pplan = SPI_prepare(insQuery,1,saPlanArgTypes);
-    if(pplan==NULL) {
-      elog(NOTICE,"Could not prepare INSERT plan");
-      return -1;
-    }
-    
-    //    pplan = SPI_saveplan(pplan);
-    cpKeyData = packageData(tTupleData, tTupleDesc,tpTrigData,PRIMARY);
+int
+storeKeyInfo(char *cpTableName, HeapTuple tTupleData,
+                        TupleDesc tTupleDesc,
+                        TriggerData *tpTrigData)
+{
+
+       Oid                     saPlanArgTypes[1] = {NAMEOID};
+       char       *insQuery = "INSERT INTO \"PendingData\" (\"SeqId\",\"IsKey\",\"Data\") VALUES(currval('\"Pending_SeqId_seq\"'),'t',$1)";
+       void       *pplan;
+       Datum           saPlanData[1];
+       char       *cpKeyData;
+       int                     iRetCode;
+
+       pplan = SPI_prepare(insQuery, 1, saPlanArgTypes);
+       if (pplan == NULL)
+       {
+               elog(NOTICE, "Could not prepare INSERT plan");
+               return -1;
+       }
+
+       /* pplan = SPI_saveplan(pplan); */
+       cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData, PRIMARY);
 #if defined DEBUG_OUTPUT
-    elog(NOTICE,cpKeyData);
+       elog(NOTICE, cpKeyData);
 #endif
-    saPlanData[0] = PointerGetDatum(cpKeyData);
-    
-    iRetCode = SPI_execp(pplan,saPlanData,NULL,1);    
-
-    if(cpKeyData!=NULL) {
-      SPI_pfree(cpKeyData);
-    }
-
-    if(iRetCode != SPI_OK_INSERT ) {
-      elog(NOTICE,"Error inserting row in pendingDelete");
-      return -1;
-    }
+       saPlanData[0] = PointerGetDatum(cpKeyData);
+
+       iRetCode = SPI_execp(pplan, saPlanData, NULL, 1);
+
+       if (cpKeyData != NULL)
+               SPI_pfree(cpKeyData);
+
+       if (iRetCode != SPI_OK_INSERT)
+       {
+               elog(NOTICE, "Error inserting row in pendingDelete");
+               return -1;
+       }
 #if defined DEBUG_OUTPUT
-    elog(NOTICE,"INSERT SUCCESFULL");
+       elog(NOTICE, "INSERT SUCCESFULL");
 #endif
 
-    return 0;
-    
+       return 0;
+
 }
 
 
 
 
-int2vector * getPrimaryKey(Oid tblOid) {
-  char * queryBase;
-  char * query;
-  bool isNull;
-  int2vector * resultKey;
-  int2vector * tpResultKey;
-  HeapTuple resTuple;
-  Datum resDatum;
-  int ret;
-  queryBase = "SELECT indkey FROM pg_index WHERE indisprimary='t' AND indrelid=";
-  query = SPI_palloc(strlen(queryBase) + MAX_OID_LEN+1);
-  sprintf(query,"%s%d",queryBase,tblOid);
-  ret = SPI_exec(query,1);
-  if(ret != SPI_OK_SELECT || SPI_processed != 1 ) {
-    elog(NOTICE,"Could not select primary index key");
-    return NULL;
-  }
+int2vector *
+getPrimaryKey(Oid tblOid)
+{
+       char       *queryBase;
+       char       *query;
+       bool            isNull;
+       int2vector *resultKey;
+       int2vector *tpResultKey;
+       HeapTuple       resTuple;
+       Datum           resDatum;
+       int                     ret;
+
+       queryBase = "SELECT indkey FROM pg_index WHERE indisprimary='t' AND indrelid=";
+       query = SPI_palloc(strlen(queryBase) + MAX_OID_LEN + 1);
+       sprintf(query, "%s%d", queryBase, tblOid);
+       ret = SPI_exec(query, 1);
+       if (ret != SPI_OK_SELECT || SPI_processed != 1)
+       {
+               elog(NOTICE, "Could not select primary index key");
+               return NULL;
+       }
 
-  resTuple = SPI_tuptable->vals[0];
-  resDatum = SPI_getbinval(resTuple,SPI_tuptable->tupdesc,1,&isNull);
+       resTuple = SPI_tuptable->vals[0];
+       resDatum = SPI_getbinval(resTuple, SPI_tuptable->tupdesc, 1, &isNull);
 
-  tpResultKey = (int2vector*) DatumGetPointer(resDatum);
-  resultKey = SPI_palloc(sizeof(int2vector));
-  memcpy(resultKey,tpResultKey,sizeof(int2vector));
+       tpResultKey = (int2vector *) DatumGetPointer(resDatum);
+       resultKey = SPI_palloc(sizeof(int2vector));
+       memcpy(resultKey, tpResultKey, sizeof(int2vector));
 
-  SPI_pfree(query);
-  return resultKey;
+       SPI_pfree(query);
+       return resultKey;
 }
 
 /******************************************************************************
  * Stores a copy of the non-key data for the row.
  *****************************************************************************/
-int storeData(char * cpTableName,HeapTuple tTupleData,TupleDesc tTupleDesc,
-                    TriggerData * tpTrigData,int iIncludeKeyData) {
-
-  Oid planArgTypes[1] = {NAMEOID};
-  char * insQuery = "INSERT INTO \"PendingData\" (\"SeqId\",\"IsKey\",\"Data\") VALUES(currval('\"Pending_SeqId_seq\"'),'f',$1)";
-  void * pplan;
-  Datum planData[1];
-  char * cpKeyData;
-  int iRetValue;
-
-  pplan = SPI_prepare(insQuery,1,planArgTypes);
-    if(pplan==NULL) {
-      elog(NOTICE,"Could not prepare INSERT plan");
-      return -1;
-    }
-    
-    //    pplan = SPI_saveplan(pplan);
-    if(iIncludeKeyData==0) {
-      cpKeyData = packageData(tTupleData, tTupleDesc,tpTrigData,NONPRIMARY); 
-    }
-    else {
-      cpKeyData = packageData(tTupleData,tTupleDesc,tpTrigData,ALL);
-    }
-    
-    planData[0] = PointerGetDatum(cpKeyData);
-    iRetValue = SPI_execp(pplan,planData,NULL,1);
-    
-    if(cpKeyData!=0) {
-      SPI_pfree(cpKeyData);
-    }
-
-    if(iRetValue != SPI_OK_INSERT ) {
-      elog(NOTICE,"Error inserting row in pendingDelete");
-      return -1;
-    }
+int
+storeData(char *cpTableName, HeapTuple tTupleData, TupleDesc tTupleDesc,
+                 TriggerData *tpTrigData, int iIncludeKeyData)
+{
+
+       Oid                     planArgTypes[1] = {NAMEOID};
+       char       *insQuery = "INSERT INTO \"PendingData\" (\"SeqId\",\"IsKey\",\"Data\") VALUES(currval('\"Pending_SeqId_seq\"'),'f',$1)";
+       void       *pplan;
+       Datum           planData[1];
+       char       *cpKeyData;
+       int                     iRetValue;
+
+       pplan = SPI_prepare(insQuery, 1, planArgTypes);
+       if (pplan == NULL)
+       {
+               elog(NOTICE, "Could not prepare INSERT plan");
+               return -1;
+       }
+
+       /* pplan = SPI_saveplan(pplan); */
+       if (iIncludeKeyData == 0)
+               cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData, NONPRIMARY);
+       else
+               cpKeyData = packageData(tTupleData, tTupleDesc, tpTrigData, ALL);
+
+       planData[0] = PointerGetDatum(cpKeyData);
+       iRetValue = SPI_execp(pplan, planData, NULL, 1);
+
+       if (cpKeyData != 0)
+               SPI_pfree(cpKeyData);
+
+       if (iRetValue != SPI_OK_INSERT)
+       {
+               elog(NOTICE, "Error inserting row in pendingDelete");
+               return -1;
+       }
 #if defined DEBUG_OUTPUT
-    elog(NOTICE,"INSERT SUCCESFULL");
+       elog(NOTICE, "INSERT SUCCESFULL");
 #endif
 
-    return 0;  
-    
+       return 0;
+
 }
 
 /**
- * Packages the data in tTupleData into a string of the format 
+ * Packages the data in tTupleData into a string of the format
  * FieldName='value text'  where any quotes inside of value text
  * are escaped with a backslash and any backslashes in value text
  * are esacped by a second back slash.
  *
- * tTupleDesc should be a description of the tuple stored in 
- * tTupleData.  
+ * tTupleDesc should be a description of the tuple stored in
+ * tTupleData.
  *
  * eFieldUsage specifies which fields to use.
- *  PRIMARY implies include only primary key fields.
- *  NONPRIMARY implies include only non-primary key fields.
- *  ALL implies include all fields.
+ *     PRIMARY implies include only primary key fields.
+ *     NONPRIMARY implies include only non-primary key fields.
+ *     ALL implies include all fields.
  */
-char * packageData(HeapTuple tTupleData, TupleDesc tTupleDesc,
-                  TriggerData *  tpTrigData,
-                  enum FieldUsage eKeyUsage ) {
-  int iNumCols;
-  int2vector * tpPKeys=NULL;
-  int iColumnCounter;
-  char * cpDataBlock;
-  int iDataBlockSize;
-  int  iUsedDataBlock;
-  
-  iNumCols = tTupleDesc->natts;
-
-  if(eKeyUsage!=ALL) {
-    tpPKeys = getPrimaryKey(tpTrigData->tg_relation->rd_id);
-    if(tpPKeys==NULL) {
-      return NULL;
-    }
-  }
-#if defined DEBUG_OUTPUT
-  if(tpPKeys!=NULL) {
-    elog(NOTICE,"Have primary keys");
-  }
-#endif 
-  cpDataBlock = SPI_palloc(BUFFER_SIZE);
-  iDataBlockSize = BUFFER_SIZE;
-  iUsedDataBlock = 0;                   /* To account for the null */
-
-  for(iColumnCounter=1; iColumnCounter <=iNumCols; iColumnCounter++) {
-    int iIsPrimaryKey;
-    int iPrimaryKeyIndex;
-    char * cpUnFormatedPtr;
-    char * cpFormatedPtr;
-
-    char * cpFieldName;
-    char * cpFieldData;
-    if(eKeyUsage!=ALL) {
-      //Determine if this is a primary key or not.
-      iIsPrimaryKey=0;
-      for(iPrimaryKeyIndex=0; (*tpPKeys)[iPrimaryKeyIndex]!=0;
-         iPrimaryKeyIndex++) {
-       if((*tpPKeys)[iPrimaryKeyIndex]==iColumnCounter) {      
-         iIsPrimaryKey=1;
-         break;
+char *
+packageData(HeapTuple tTupleData, TupleDesc tTupleDesc,
+                       TriggerData *tpTrigData,
+                       enum FieldUsage eKeyUsage)
+{
+       int                     iNumCols;
+       int2vector *tpPKeys = NULL;
+       int                     iColumnCounter;
+       char       *cpDataBlock;
+       int                     iDataBlockSize;
+       int                     iUsedDataBlock;
+
+       iNumCols = tTupleDesc->natts;
+
+       if (eKeyUsage != ALL)
+       {
+               tpPKeys = getPrimaryKey(tpTrigData->tg_relation->rd_id);
+               if (tpPKeys == NULL)
+                       return NULL;
        }
-      }
-      if( iIsPrimaryKey ? (eKeyUsage!=PRIMARY) : (eKeyUsage!=NONPRIMARY)) {
-       /**
-        * Don't use.
-        */
 #if defined DEBUG_OUTPUT
-       elog(NOTICE,"Skipping column");
+       if (tpPKeys != NULL)
+               elog(NOTICE, "Have primary keys");
 #endif
-       continue;
-      }
-    }                                   /* KeyUsage!=ALL */
-    cpFieldName = DatumGetPointer(NameGetDatum(&tTupleDesc->attrs
-                                              [iColumnCounter-1]->attname));
+       cpDataBlock = SPI_palloc(BUFFER_SIZE);
+       iDataBlockSize = BUFFER_SIZE;
+       iUsedDataBlock = 0;                     /* To account for the null */
+
+       for (iColumnCounter = 1; iColumnCounter <= iNumCols; iColumnCounter++)
+       {
+               int                     iIsPrimaryKey;
+               int                     iPrimaryKeyIndex;
+               char       *cpUnFormatedPtr;
+               char       *cpFormatedPtr;
+
+               char       *cpFieldName;
+               char       *cpFieldData;
+
+               if (eKeyUsage != ALL)
+               {
+                       /* Determine if this is a primary key or not. */
+                       iIsPrimaryKey = 0;
+                       for (iPrimaryKeyIndex = 0; (*tpPKeys)[iPrimaryKeyIndex] != 0;
+                                iPrimaryKeyIndex++)
+                       {
+                               if ((*tpPKeys)[iPrimaryKeyIndex] == iColumnCounter)
+                               {
+                                       iIsPrimaryKey = 1;
+                                       break;
+                               }
+                       }
+                       if (iIsPrimaryKey ? (eKeyUsage != PRIMARY) : (eKeyUsage != NONPRIMARY))
+                       {
+                               /**
+                                * Don't use.
+                                */
 #if defined DEBUG_OUTPUT
-    elog(NOTICE,cpFieldName);
+                               elog(NOTICE, "Skipping column");
 #endif
-    while(iDataBlockSize - iUsedDataBlock < strlen(cpFieldName) +4) {
-      cpDataBlock = SPI_repalloc(cpDataBlock,iDataBlockSize + BUFFER_SIZE);
-      iDataBlockSize = iDataBlockSize + BUFFER_SIZE;      
-    }
-    sprintf(cpDataBlock+iUsedDataBlock,"\"%s\"=",cpFieldName);
-    iUsedDataBlock = iUsedDataBlock + strlen(cpFieldName)+3;
-    cpFieldData=SPI_getvalue(tTupleData,tTupleDesc,iColumnCounter);
-    
-    cpUnFormatedPtr = cpFieldData;
-    cpFormatedPtr = cpDataBlock + iUsedDataBlock;
-    if(cpFieldData!=NULL) {
-      *cpFormatedPtr='\'';
-      iUsedDataBlock++;
-      cpFormatedPtr++;
-    }
-    else {
-      *cpFormatedPtr=' ';
-      iUsedDataBlock++;
-      cpFormatedPtr++;
-      continue;
-      
-    }
+                               continue;
+                       }
+               }                                               /* KeyUsage!=ALL */
+               cpFieldName = DatumGetPointer(NameGetDatum(&tTupleDesc->attrs
+                                                                                [iColumnCounter - 1]->attname));
 #if defined DEBUG_OUTPUT
-    elog(NOTICE,cpFieldData);
-    elog(NOTICE,"Starting format loop");
+               elog(NOTICE, cpFieldName);
 #endif
-    while(*cpUnFormatedPtr!=0) {
-      while(iDataBlockSize - iUsedDataBlock < 2) {
-       cpDataBlock = SPI_repalloc(cpDataBlock,iDataBlockSize+BUFFER_SIZE);
-       iDataBlockSize = iDataBlockSize + BUFFER_SIZE;
-       cpFormatedPtr = cpDataBlock + iUsedDataBlock;
-      }
-      if(*cpUnFormatedPtr=='\\' || *cpUnFormatedPtr=='\'') {
-       *cpFormatedPtr='\\';
-       cpFormatedPtr++;
-       iUsedDataBlock++;
-      }
-      *cpFormatedPtr=*cpUnFormatedPtr;
-      cpFormatedPtr++;
-      cpUnFormatedPtr++;
-      iUsedDataBlock++;
-    }
-
-    SPI_pfree(cpFieldData);
-
-    while(iDataBlockSize - iUsedDataBlock < 3) {
-      cpDataBlock = SPI_repalloc(cpDataBlock,iDataBlockSize+BUFFER_SIZE);
-      iDataBlockSize = iDataBlockSize + BUFFER_SIZE;
-      cpFormatedPtr = cpDataBlock + iUsedDataBlock;
-    }
-    sprintf(cpFormatedPtr,"' ");
-    iUsedDataBlock = iUsedDataBlock +2;
+               while (iDataBlockSize - iUsedDataBlock < strlen(cpFieldName) + 4)
+               {
+                       cpDataBlock = SPI_repalloc(cpDataBlock, iDataBlockSize + BUFFER_SIZE);
+                       iDataBlockSize = iDataBlockSize + BUFFER_SIZE;
+               }
+               sprintf(cpDataBlock + iUsedDataBlock, "\"%s\"=", cpFieldName);
+               iUsedDataBlock = iUsedDataBlock + strlen(cpFieldName) + 3;
+               cpFieldData = SPI_getvalue(tTupleData, tTupleDesc, iColumnCounter);
+
+               cpUnFormatedPtr = cpFieldData;
+               cpFormatedPtr = cpDataBlock + iUsedDataBlock;
+               if (cpFieldData != NULL)
+               {
+                       *cpFormatedPtr = '\'';
+                       iUsedDataBlock++;
+                       cpFormatedPtr++;
+               }
+               else
+               {
+                       *cpFormatedPtr = ' ';
+                       iUsedDataBlock++;
+                       cpFormatedPtr++;
+                       continue;
+
+               }
 #if defined DEBUG_OUTPUT
-    elog(NOTICE,cpDataBlock);
+               elog(NOTICE, cpFieldData);
+               elog(NOTICE, "Starting format loop");
 #endif
-    
-  }                                     /*  for iColumnCounter  */
-  if(tpPKeys!=NULL) {
-    SPI_pfree(tpPKeys);    
-  }
+               while (*cpUnFormatedPtr != 0)
+               {
+                       while (iDataBlockSize - iUsedDataBlock < 2)
+                       {
+                               cpDataBlock = SPI_repalloc(cpDataBlock, iDataBlockSize + BUFFER_SIZE);
+                               iDataBlockSize = iDataBlockSize + BUFFER_SIZE;
+                               cpFormatedPtr = cpDataBlock + iUsedDataBlock;
+                       }
+                       if (*cpUnFormatedPtr == '\\' || *cpUnFormatedPtr == '\'')
+                       {
+                               *cpFormatedPtr = '\\';
+                               cpFormatedPtr++;
+                               iUsedDataBlock++;
+                       }
+                       *cpFormatedPtr = *cpUnFormatedPtr;
+                       cpFormatedPtr++;
+                       cpUnFormatedPtr++;
+                       iUsedDataBlock++;
+               }
+
+               SPI_pfree(cpFieldData);
+
+               while (iDataBlockSize - iUsedDataBlock < 3)
+               {
+                       cpDataBlock = SPI_repalloc(cpDataBlock, iDataBlockSize + BUFFER_SIZE);
+                       iDataBlockSize = iDataBlockSize + BUFFER_SIZE;
+                       cpFormatedPtr = cpDataBlock + iUsedDataBlock;
+               }
+               sprintf(cpFormatedPtr, "' ");
+               iUsedDataBlock = iUsedDataBlock + 2;
 #if defined DEBUG_OUTPUT
-  elog(NOTICE,"Returning");
+               elog(NOTICE, cpDataBlock);
 #endif
-  memset(cpDataBlock + iUsedDataBlock,0,iDataBlockSize - iUsedDataBlock);
 
-  return cpDataBlock;
-  
+       }                                                       /* for iColumnCounter  */
+       if (tpPKeys != NULL)
+               SPI_pfree(tpPKeys);
+#if defined DEBUG_OUTPUT
+       elog(NOTICE, "Returning");
+#endif
+       memset(cpDataBlock + iUsedDataBlock, 0, iDataBlockSize - iUsedDataBlock);
+
+       return cpDataBlock;
+
 }
index 8bc216b..f97e787 100644 (file)
@@ -37,7 +37,7 @@ psnprintf(size_t len, const char *fmt,...)
 
 PG_FUNCTION_INFO_V1(database_size);
 
-Datum database_size(PG_FUNCTION_ARGS);
+Datum          database_size(PG_FUNCTION_ARGS);
 
 Datum
 database_size(PG_FUNCTION_ARGS)
@@ -97,7 +97,7 @@ database_size(PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1(relation_size);
 
-Datum relation_size(PG_FUNCTION_ARGS);
+Datum          relation_size(PG_FUNCTION_ARGS);
 
 Datum
 relation_size(PG_FUNCTION_ARGS)
@@ -111,7 +111,7 @@ relation_size(PG_FUNCTION_ARGS)
        unsigned int segcount;
 
        relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname,
-                                                                                                                        "relation_size"));
+                                                                                                          "relation_size"));
        relation = heap_openrv(relrv, AccessShareLock);
 
        relnode = relation->rd_rel->relfilenode;
index b3bef4d..f83e5da 100644 (file)
@@ -73,7 +73,7 @@ main(int argc, char **argv)
                                        SELECT  count(*)::int4 \
                                                FROM \"%s\" t1, \"%s\" t2 \
                                        WHERE t1.\"%s\" = t2.oid ",
-                                               relname, relname2, attname);
+                                                relname, relname2, attname);
                        else
                                sprintf(query, 4000, "\
                                        DECLARE c_matches BINARY CURSOR FOR \
index 820ec8d..b9c39d4 100644 (file)
@@ -11,7 +11,7 @@
  * This file is the property of the Digital Music Network (DMN).
  * It is being made available to users of the PostgreSQL system
  * under the BSD license.
- * 
+ *
  * NOTE: This module requires sizeof(void *) to be the same as sizeof(int)
  */
 #include "postgres.h"
 
 typedef struct
 {
-       ArrayType a;
-       int     items;
-       int     lower;
-       int4    array[1];
-}PGARRAY;
+       ArrayType       a;
+       int                     items;
+       int                     lower;
+       int4            array[1];
+}      PGARRAY;
 
 /* This is used to keep track of our position during enumeration */
 typedef struct callContext
 {
-       PGARRAY *p;
-       int num;
-       int flags;
-}CTX;
+       PGARRAY    *p;
+       int                     num;
+       int                     flags;
+}      CTX;
 
 #define TOASTED                1
-#define START_NUM      8
+#define START_NUM      8
 #define PGARRAY_SIZE(n) (sizeof(PGARRAY) + ((n-1)*sizeof(int4)))
 
-static PGARRAY * GetPGArray(int4 state, int fAdd);
-static PGARRAY *ShrinkPGArray(PGARRAY *p);
+static PGARRAY *GetPGArray(int4 state, int fAdd);
+static PGARRAY *ShrinkPGArray(PGARRAY * p);
 
-Datum int_agg_state(PG_FUNCTION_ARGS);
-Datum int_agg_final_count(PG_FUNCTION_ARGS);
-Datum int_agg_final_array(PG_FUNCTION_ARGS);
-Datum int_enum(PG_FUNCTION_ARGS);
+Datum          int_agg_state(PG_FUNCTION_ARGS);
+Datum          int_agg_final_count(PG_FUNCTION_ARGS);
+Datum          int_agg_final_array(PG_FUNCTION_ARGS);
+Datum          int_enum(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(int_agg_state);
 PG_FUNCTION_INFO_V1(int_agg_final_count);
@@ -80,20 +80,21 @@ PG_FUNCTION_INFO_V1(int_enum);
  * Manage the aggregation state of the array
  * You need to specify the correct memory context, or it will vanish!
  */
-static PGARRAY * GetPGArray(int4 state, int fAdd)
+static PGARRAY *
+GetPGArray(int4 state, int fAdd)
 {
-       PGARRAY *p = (PGARRAY *) state;
+       PGARRAY    *p = (PGARRAY *) state;
 
-       if(!state)
+       if (!state)
        {
                /* New array */
-               int cb = PGARRAY_SIZE(START_NUM);
+               int                     cb = PGARRAY_SIZE(START_NUM);
 
                p = (PGARRAY *) MemoryContextAlloc(TopTransactionContext, cb);
 
-               if(!p)
+               if (!p)
                {
-                       elog(ERROR,"Integer aggregator, cant allocate TopTransactionContext memory");
+                       elog(ERROR, "Integer aggregator, cant allocate TopTransactionContext memory");
                        return 0;
                }
 
@@ -104,22 +105,22 @@ static PGARRAY * GetPGArray(int4 state, int fAdd)
                p->a.elemtype = INT4OID;
 #endif
                p->items = 0;
-               p->lower= START_NUM;
+               p->lower = START_NUM;
        }
-       else if(fAdd)
-       {       /* Ensure array has space */
-               if(p->items >= p->lower)
+       else if (fAdd)
+       {                                                       /* Ensure array has space */
+               if (p->items >= p->lower)
                {
-                       PGARRAY *pn;
-                       int n = p->lower + p->lower;
-                       int cbNew = PGARRAY_SIZE(n);
+                       PGARRAY    *pn;
+                       int                     n = p->lower + p->lower;
+                       int                     cbNew = PGARRAY_SIZE(n);
 
                        pn = (PGARRAY *) repalloc(p, cbNew);
 
-                       if(!pn)
-                       {       /* Realloc failed! Reallocate new block. */
+                       if (!pn)
+                       {                                       /* Realloc failed! Reallocate new block. */
                                pn = (PGARRAY *) MemoryContextAlloc(TopTransactionContext, cbNew);
-                               if(!pn)
+                               if (!pn)
                                {
                                        elog(ERROR, "Integer aggregator, REALLY REALLY can't alloc memory");
                                        return (PGARRAY *) NULL;
@@ -136,24 +137,29 @@ static PGARRAY * GetPGArray(int4 state, int fAdd)
 }
 
 /* Shrinks the array to its actual size and moves it into the standard
- * memory allocation context, frees working memory  */
-static PGARRAY *ShrinkPGArray(PGARRAY *p)
+ * memory allocation context, frees working memory     */
+static PGARRAY *
+ShrinkPGArray(PGARRAY * p)
 {
-       PGARRAY *pnew=NULL;
-       if(p)
+       PGARRAY    *pnew = NULL;
+
+       if (p)
        {
                /* get target size */
-               int cb = PGARRAY_SIZE(p->items);
+               int                     cb = PGARRAY_SIZE(p->items);
 
                /* use current transaction context */
                pnew = palloc(cb);
 
-               if(pnew)
+               if (pnew)
                {
-                       /* Fix up the fields in the new structure, so Postgres understands */
+                       /*
+                        * Fix up the fields in the new structure, so Postgres
+                        * understands
+                        */
                        memcpy(pnew, p, cb);
                        pnew->a.size = cb;
-                       pnew->a.ndim=1;
+                       pnew->a.ndim = 1;
                        pnew->a.flags = 0;
 #ifndef PG_7_2
                        pnew->a.elemtype = INT4OID;
@@ -161,79 +167,72 @@ static PGARRAY *ShrinkPGArray(PGARRAY *p)
                        pnew->lower = 0;
                }
                else
-               {
                        elog(ERROR, "Integer aggregator, can't allocate memory");
-               }
                pfree(p);
        }
        return pnew;
 }
 
 /* Called for each iteration during an aggregate function */
-Datum int_agg_state(PG_FUNCTION_ARGS)
+Datum
+int_agg_state(PG_FUNCTION_ARGS)
 {
-       int4 state = PG_GETARG_INT32(0);
-       int4 value = PG_GETARG_INT32(1);
+       int4            state = PG_GETARG_INT32(0);
+       int4            value = PG_GETARG_INT32(1);
 
-       PGARRAY *p = GetPGArray(state, 1);
-       if(!p)
-       {
-               elog(ERROR,"No aggregate storage");
-       }
-       else if(p->items >= p->lower)
-       {
-               elog(ERROR,"aggregate storage too small");
-       }
+       PGARRAY    *p = GetPGArray(state, 1);
+
+       if (!p)
+               elog(ERROR, "No aggregate storage");
+       else if (p->items >= p->lower)
+               elog(ERROR, "aggregate storage too small");
        else
-       {
-               p->array[p->items++]= value;
-       }
+               p->array[p->items++] = value;
        PG_RETURN_INT32(p);
 }
 
 /* This is the final function used for the integer aggregator. It returns all the integers
  * collected as a one dimentional integer array */
-Datum int_agg_final_array(PG_FUNCTION_ARGS)
+Datum
+int_agg_final_array(PG_FUNCTION_ARGS)
 {
-       PGARRAY *pnew = ShrinkPGArray(GetPGArray(PG_GETARG_INT32(0),0));
-       if(pnew)
-       {
+       PGARRAY    *pnew = ShrinkPGArray(GetPGArray(PG_GETARG_INT32(0), 0));
+
+       if (pnew)
                PG_RETURN_POINTER(pnew);
-       }
        else
-       {
                PG_RETURN_NULL();
-       }
 }
 
 /* This function accepts an array, and returns one item for each entry in the array */
-Datum int_enum(PG_FUNCTION_ARGS)
+Datum
+int_enum(PG_FUNCTION_ARGS)
 {
-       PGARRAY *p = (PGARRAY *) PG_GETARG_POINTER(0);
-       CTX *pc;
-       ReturnSetInfo *rsi = (ReturnSetInfo *)fcinfo->resultinfo;
+       PGARRAY    *p = (PGARRAY *) PG_GETARG_POINTER(0);
+       CTX                *pc;
+       ReturnSetInfo *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
 
        if (!rsi || !IsA(rsi, ReturnSetInfo))
                elog(ERROR, "No ReturnSetInfo sent! function must be declared returning a 'setof' integer");
 
-       if(!p)
+       if (!p)
        {
                elog(WARNING, "No data sent");
                PG_RETURN_NULL();
        }
 
-       if(!fcinfo->context)
+       if (!fcinfo->context)
        {
                /* Allocate a working context */
                pc = (CTX *) palloc(sizeof(CTX));
 
                /* Don't copy atribute if you don't need too */
-               if(VARATT_IS_EXTENDED(p) )
+               if (VARATT_IS_EXTENDED(p))
                {
                        /* Toasted!!! */
                        pc->p = (PGARRAY *) PG_DETOAST_DATUM_COPY(p);
                        pc->flags = TOASTED;
-                       if(!pc->p)
+                       if (!pc->p)
                        {
                                elog(ERROR, "Error in toaster!!! no detoasting");
                                PG_RETURN_NULL();
@@ -246,25 +245,26 @@ Datum int_enum(PG_FUNCTION_ARGS)
                        pc->flags = 0;
                }
                fcinfo->context = (Node *) pc;
-               pc->num=0;
+               pc->num = 0;
        }
-       else /* use an existing one */
-       {
+       else
+/* use an existing one */
                pc = (CTX *) fcinfo->context;
-       }
        /* Are we done yet? */
-       if(pc->num >= pc->p->items)
+       if (pc->num >= pc->p->items)
        {
                /* We are done */
-               if(pc->flags & TOASTED)
+               if (pc->flags & TOASTED)
                        pfree(pc->p);
                pfree(fcinfo->context);
                fcinfo->context = NULL;
-               rsi->isDone = ExprEndResult ;
+               rsi->isDone = ExprEndResult;
        }
-       else    /* nope, return the next value */
+       else
+/* nope, return the next value */
        {
-               int val = pc->p->array[pc->num++];
+               int                     val = pc->p->array[pc->num++];
+
                rsi->isDone = ExprMultipleResult;
                PG_RETURN_INT32(val);
        }
index 75ebf5d..09590a2 100644 (file)
@@ -100,7 +100,7 @@ typedef char *BITVECP;
 static void
 printarr(ArrayType *a, int num)
 {
-       StringInfoData  bbb;
+       StringInfoData bbb;
        char       *cur;
        int                     l;
        int                *d;
@@ -108,9 +108,7 @@ printarr(ArrayType *a, int num)
        d = ARRPTR(a);
        initStringInfo(&bbb);
        for (l = 0; l < min(num, ARRNELEMS(a)); l++)
-       {
                appendStringInfo(&bbb, "%d ", d[l]);
-       }
        elog(DEBUG3, "\t\t%s", bbb.data);
        pfree(bbb.data);
 }
@@ -125,7 +123,6 @@ printbitvec(BITVEC bv)
 
        elog(DEBUG3, "BV: %s", str);
 }
-
 #endif
 
 /*
@@ -163,78 +160,78 @@ static ArrayType *_int_common_union(bytea *entryvec,
 /*
 ** GiST support methods
 */
-PG_FUNCTION_INFO_V1( g_int_consistent );
-PG_FUNCTION_INFO_V1( g_int_compress );
-PG_FUNCTION_INFO_V1( g_int_decompress );
-PG_FUNCTION_INFO_V1( g_int_penalty );
-PG_FUNCTION_INFO_V1( g_int_picksplit );
-PG_FUNCTION_INFO_V1( g_int_union );
-PG_FUNCTION_INFO_V1( g_int_same );
-
-Datum  g_int_consistent(PG_FUNCTION_ARGS);
-Datum  g_int_compress(PG_FUNCTION_ARGS);
-Datum  g_int_decompress(PG_FUNCTION_ARGS);
-Datum  g_int_penalty(PG_FUNCTION_ARGS);
-Datum  g_int_picksplit(PG_FUNCTION_ARGS);
-Datum  g_int_union(PG_FUNCTION_ARGS);
-Datum  g_int_same(PG_FUNCTION_ARGS);
+PG_FUNCTION_INFO_V1(g_int_consistent);
+PG_FUNCTION_INFO_V1(g_int_compress);
+PG_FUNCTION_INFO_V1(g_int_decompress);
+PG_FUNCTION_INFO_V1(g_int_penalty);
+PG_FUNCTION_INFO_V1(g_int_picksplit);
+PG_FUNCTION_INFO_V1(g_int_union);
+PG_FUNCTION_INFO_V1(g_int_same);
+
+Datum          g_int_consistent(PG_FUNCTION_ARGS);
+Datum          g_int_compress(PG_FUNCTION_ARGS);
+Datum          g_int_decompress(PG_FUNCTION_ARGS);
+Datum          g_int_penalty(PG_FUNCTION_ARGS);
+Datum          g_int_picksplit(PG_FUNCTION_ARGS);
+Datum          g_int_union(PG_FUNCTION_ARGS);
+Datum          g_int_same(PG_FUNCTION_ARGS);
 
 
 /*
 ** R-tree support functions
 */
-static bool            inner_int_contains(ArrayType *a, ArrayType *b);
-static bool            inner_int_overlap(ArrayType *a, ArrayType *b);
-static ArrayType  *inner_int_union(ArrayType *a, ArrayType *b);
-static ArrayType  *inner_int_inter(ArrayType *a, ArrayType *b);
-static void            rt__int_size(ArrayType *a, float *sz);
-
-PG_FUNCTION_INFO_V1( _int_different );
-PG_FUNCTION_INFO_V1( _int_same );
-PG_FUNCTION_INFO_V1( _int_contains );
-PG_FUNCTION_INFO_V1( _int_contained );
-PG_FUNCTION_INFO_V1( _int_overlap );
-PG_FUNCTION_INFO_V1( _int_union );
-PG_FUNCTION_INFO_V1( _int_inter );
-
-Datum  _int_different(PG_FUNCTION_ARGS);
-Datum  _int_same(PG_FUNCTION_ARGS);
-Datum  _int_contains(PG_FUNCTION_ARGS);
-Datum  _int_contained(PG_FUNCTION_ARGS);
-Datum  _int_overlap(PG_FUNCTION_ARGS);
-Datum  _int_union(PG_FUNCTION_ARGS);
-Datum  _int_inter(PG_FUNCTION_ARGS);
+static bool inner_int_contains(ArrayType *a, ArrayType *b);
+static bool inner_int_overlap(ArrayType *a, ArrayType *b);
+static ArrayType *inner_int_union(ArrayType *a, ArrayType *b);
+static ArrayType *inner_int_inter(ArrayType *a, ArrayType *b);
+static void rt__int_size(ArrayType *a, float *sz);
+
+PG_FUNCTION_INFO_V1(_int_different);
+PG_FUNCTION_INFO_V1(_int_same);
+PG_FUNCTION_INFO_V1(_int_contains);
+PG_FUNCTION_INFO_V1(_int_contained);
+PG_FUNCTION_INFO_V1(_int_overlap);
+PG_FUNCTION_INFO_V1(_int_union);
+PG_FUNCTION_INFO_V1(_int_inter);
+
+Datum          _int_different(PG_FUNCTION_ARGS);
+Datum          _int_same(PG_FUNCTION_ARGS);
+Datum          _int_contains(PG_FUNCTION_ARGS);
+Datum          _int_contained(PG_FUNCTION_ARGS);
+Datum          _int_overlap(PG_FUNCTION_ARGS);
+Datum          _int_union(PG_FUNCTION_ARGS);
+Datum          _int_inter(PG_FUNCTION_ARGS);
 
 /*
 ** _intbig methods
 */
-PG_FUNCTION_INFO_V1( g_intbig_consistent );
-PG_FUNCTION_INFO_V1( g_intbig_compress );
-PG_FUNCTION_INFO_V1( g_intbig_decompress );
-PG_FUNCTION_INFO_V1( g_intbig_penalty );
-PG_FUNCTION_INFO_V1( g_intbig_picksplit );
-PG_FUNCTION_INFO_V1( g_intbig_union );
-PG_FUNCTION_INFO_V1( g_intbig_same );
-
-Datum  g_intbig_consistent(PG_FUNCTION_ARGS);
-Datum  g_intbig_compress(PG_FUNCTION_ARGS);
-Datum  g_intbig_decompress(PG_FUNCTION_ARGS);
-Datum  g_intbig_penalty(PG_FUNCTION_ARGS);
-Datum  g_intbig_picksplit(PG_FUNCTION_ARGS);
-Datum  g_intbig_union(PG_FUNCTION_ARGS);
-Datum  g_intbig_same(PG_FUNCTION_ARGS);
+PG_FUNCTION_INFO_V1(g_intbig_consistent);
+PG_FUNCTION_INFO_V1(g_intbig_compress);
+PG_FUNCTION_INFO_V1(g_intbig_decompress);
+PG_FUNCTION_INFO_V1(g_intbig_penalty);
+PG_FUNCTION_INFO_V1(g_intbig_picksplit);
+PG_FUNCTION_INFO_V1(g_intbig_union);
+PG_FUNCTION_INFO_V1(g_intbig_same);
+
+Datum          g_intbig_consistent(PG_FUNCTION_ARGS);
+Datum          g_intbig_compress(PG_FUNCTION_ARGS);
+Datum          g_intbig_decompress(PG_FUNCTION_ARGS);
+Datum          g_intbig_penalty(PG_FUNCTION_ARGS);
+Datum          g_intbig_picksplit(PG_FUNCTION_ARGS);
+Datum          g_intbig_union(PG_FUNCTION_ARGS);
+Datum          g_intbig_same(PG_FUNCTION_ARGS);
 
 static bool _intbig_contains(ArrayType *a, ArrayType *b);
 static bool _intbig_overlap(ArrayType *a, ArrayType *b);
 static ArrayType *_intbig_union(ArrayType *a, ArrayType *b);
 
-static ArrayType *     _intbig_inter(ArrayType *a, ArrayType *b);
+static ArrayType *_intbig_inter(ArrayType *a, ArrayType *b);
 static void rt__intbig_size(ArrayType *a, float *sz);
 
 
 
 /*****************************************************************************
- *                     Boolean Search
+ *                     Boolean Search
  *****************************************************************************/
 
 #define BooleanSearchStrategy  20
@@ -243,17 +240,19 @@ static void rt__intbig_size(ArrayType *a, float *sz);
  * item in polish notation with back link
  * to left operand
  */
-typedef struct ITEM {
-       int2    type;
-       int2    left;
-       int4    val;
-} ITEM;
-
-typedef struct {
-       int4    len;
-       int4    size;
-       char    data[1];
-} QUERYTYPE;
+typedef struct ITEM
+{
+       int2            type;
+       int2            left;
+       int4            val;
+}      ITEM;
+
+typedef struct
+{
+       int4            len;
+       int4            size;
+       char            data[1];
+}      QUERYTYPE;
 
 #define HDRSIZEQT      ( 2*sizeof(int4) )
 #define COMPUTESIZE(size)      ( HDRSIZEQT + size * sizeof(ITEM) )
@@ -261,20 +260,20 @@ typedef struct {
 
 PG_FUNCTION_INFO_V1(bqarr_in);
 PG_FUNCTION_INFO_V1(bqarr_out);
-Datum   bqarr_in(PG_FUNCTION_ARGS);
-Datum   bqarr_out(PG_FUNCTION_ARGS);
+Datum          bqarr_in(PG_FUNCTION_ARGS);
+Datum          bqarr_out(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(boolop);
-Datum   boolop(PG_FUNCTION_ARGS);
+Datum          boolop(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(rboolop);
-Datum   rboolop(PG_FUNCTION_ARGS);
+Datum          rboolop(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(querytree);
-Datum   querytree(PG_FUNCTION_ARGS);
+Datum          querytree(PG_FUNCTION_ARGS);
 
-static bool signconsistent( QUERYTYPE *query, BITVEC sign, bool leaf );
-static bool execconsistent( QUERYTYPE *query, ArrayType *array, bool leaf );
+static bool signconsistent(QUERYTYPE * query, BITVEC sign, bool leaf);
+static bool execconsistent(QUERYTYPE * query, ArrayType *array, bool leaf);
 
 /*****************************************************************************
  *                                                GiST functions
@@ -287,21 +286,22 @@ static bool execconsistent( QUERYTYPE *query, ArrayType *array, bool leaf );
 ** corresponding to strategy in the pg_amop table.
 */
 Datum
-g_int_consistent(PG_FUNCTION_ARGS) {
-       GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
-       ArrayType *query = ( ArrayType * )PG_GETARG_POINTER(1);
+g_int_consistent(PG_FUNCTION_ARGS)
+{
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
+       ArrayType  *query = (ArrayType *) PG_GETARG_POINTER(1);
        StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
        bool            retval;
 
-       if ( strategy == BooleanSearchStrategy )
-               PG_RETURN_BOOL(execconsistent( (QUERYTYPE*)query,
-                                               (ArrayType *) DatumGetPointer(entry->key),
-                                               ISLEAFKEY( (ArrayType *) DatumGetPointer(entry->key) ) ) );
+       if (strategy == BooleanSearchStrategy)
+               PG_RETURN_BOOL(execconsistent((QUERYTYPE *) query,
+                                                          (ArrayType *) DatumGetPointer(entry->key),
+                                 ISLEAFKEY((ArrayType *) DatumGetPointer(entry->key))));
 
        /* XXX are we sure it's safe to scribble on the query object here? */
        /* XXX what about toasted input? */
        /* sort query for fast search, key is already sorted */
-       if ( ARRISVOID( query ) )
+       if (ARRISVOID(query))
                PG_RETURN_BOOL(false);
        PREPAREARR(query);
 
@@ -312,28 +312,28 @@ g_int_consistent(PG_FUNCTION_ARGS) {
                                                                           query);
                        break;
                case RTSameStrategyNumber:
-                       if ( GIST_LEAF(entry) )
+                       if (GIST_LEAF(entry))
                                DirectFunctionCall3(
-                                       g_int_same,
-                                       entry->key,
-                                       PointerGetDatum(query),
-                                       PointerGetDatum(&retval)
-                               );
+                                                                       g_int_same,
+                                                                       entry->key,
+                                                                       PointerGetDatum(query),
+                                                                       PointerGetDatum(&retval)
+                                       );
                        else
                                retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
-                                                                               query);
+                                                                                       query);
                        break;
                case RTContainsStrategyNumber:
                        retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key),
                                                                                query);
                        break;
                case RTContainedByStrategyNumber:
-                       if ( GIST_LEAF(entry) )
+                       if (GIST_LEAF(entry))
                                retval = inner_int_contains(query,
-                                       (ArrayType *) DatumGetPointer(entry->key) );
+                                                         (ArrayType *) DatumGetPointer(entry->key));
                        else
                                retval = inner_int_overlap((ArrayType *) DatumGetPointer(entry->key),
-                                                                          query);
+                                                                                  query);
                        break;
                default:
                        retval = FALSE;
@@ -344,11 +344,11 @@ g_int_consistent(PG_FUNCTION_ARGS) {
 Datum
 g_int_union(PG_FUNCTION_ARGS)
 {
-       PG_RETURN_POINTER( _int_common_union(
-               (bytea *) PG_GETARG_POINTER(0),
-               (int *) PG_GETARG_POINTER(1),
-               inner_int_union
-       );
+       PG_RETURN_POINTER(_int_common_union(
+                                                                               (bytea *) PG_GETARG_POINTER(0),
+                                                                               (int *) PG_GETARG_POINTER(1),
+                                                                               inner_int_union
+                                                                               ));
 }
 
 /*
@@ -357,7 +357,7 @@ g_int_union(PG_FUNCTION_ARGS)
 Datum
 g_int_compress(PG_FUNCTION_ARGS)
 {
-       GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
        GISTENTRY  *retval;
        ArrayType  *r;
        int                     len;
@@ -366,26 +366,29 @@ g_int_compress(PG_FUNCTION_ARGS)
                                min,
                                cand;
 
-       if (entry->leafkey) {
+       if (entry->leafkey)
+       {
                r = (ArrayType *) PG_DETOAST_DATUM_COPY(entry->key);
                PREPAREARR(r);
                r->flags |= LEAFKEY;
                retval = palloc(sizeof(GISTENTRY));
                gistentryinit(*retval, PointerGetDatum(r),
-                                 entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
+                         entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
 
                PG_RETURN_POINTER(retval);
        }
 
        r = (ArrayType *) PG_DETOAST_DATUM(entry->key);
-       if ( ISLEAFKEY( r ) || ARRISVOID(r) ) {
-               if ( r != (ArrayType*)DatumGetPointer(entry->key) )
+       if (ISLEAFKEY(r) || ARRISVOID(r))
+       {
+               if (r != (ArrayType *) DatumGetPointer(entry->key))
                        pfree(r);
                PG_RETURN_POINTER(entry);
        }
 
-       if ( (len=ARRNELEMS(r)) >= 2 * MAXNUMRANGE) {   /* compress */
-               if ( r == (ArrayType*)DatumGetPointer( entry->key) )
+       if ((len = ARRNELEMS(r)) >= 2 * MAXNUMRANGE)
+       {                                                       /* compress */
+               if (r == (ArrayType *) DatumGetPointer(entry->key))
                        r = (ArrayType *) PG_DETOAST_DATUM_COPY(entry->key);
                r = resize_intArrayType(r, 2 * (len));
 
@@ -411,11 +414,11 @@ g_int_compress(PG_FUNCTION_ARGS)
                r = resize_intArrayType(r, len);
                retval = palloc(sizeof(GISTENTRY));
                gistentryinit(*retval, PointerGetDatum(r),
-                                 entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
+                         entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
                PG_RETURN_POINTER(retval);
-       } else {
-               PG_RETURN_POINTER(entry);
        }
+       else
+               PG_RETURN_POINTER(entry);
 
        PG_RETURN_POINTER(entry);
 }
@@ -423,7 +426,7 @@ g_int_compress(PG_FUNCTION_ARGS)
 Datum
 g_int_decompress(PG_FUNCTION_ARGS)
 {
-       GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
        GISTENTRY  *retval;
        ArrayType  *r;
        int                *dr,
@@ -436,17 +439,18 @@ g_int_decompress(PG_FUNCTION_ARGS)
 
        in = (ArrayType *) PG_DETOAST_DATUM(entry->key);
 
-       if ( ARRISVOID(in) ) {
+       if (ARRISVOID(in))
                PG_RETURN_POINTER(entry);
-       }
 
        lenin = ARRNELEMS(in);
 
-       if (lenin < 2 * MAXNUMRANGE || ISLEAFKEY( in ) ) { /* not comressed value */
-               if ( in != (ArrayType *) DatumGetPointer(entry->key)) {
+       if (lenin < 2 * MAXNUMRANGE || ISLEAFKEY(in))
+       {                                                       /* not comressed value */
+               if (in != (ArrayType *) DatumGetPointer(entry->key))
+               {
                        retval = palloc(sizeof(GISTENTRY));
                        gistentryinit(*retval, PointerGetDatum(in),
-                               entry->rel, entry->page, entry->offset, VARSIZE(in), FALSE);
+                        entry->rel, entry->page, entry->offset, VARSIZE(in), FALSE);
 
                        PG_RETURN_POINTER(retval);
                }
@@ -468,7 +472,7 @@ g_int_decompress(PG_FUNCTION_ARGS)
                pfree(in);
        retval = palloc(sizeof(GISTENTRY));
        gistentryinit(*retval, PointerGetDatum(r),
-               entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
+                         entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
 
        PG_RETURN_POINTER(retval);
 }
@@ -479,26 +483,26 @@ g_int_decompress(PG_FUNCTION_ARGS)
 Datum
 g_int_penalty(PG_FUNCTION_ARGS)
 {
-       PG_RETURN_POINTER( _int_common_penalty(
-               (GISTENTRY *)PG_GETARG_POINTER(0),
-               (GISTENTRY *)PG_GETARG_POINTER(1),
-               (float *)    PG_GETARG_POINTER(2),
-               inner_int_union, rt__int_size
-       );
+       PG_RETURN_POINTER(_int_common_penalty(
+                                                                         (GISTENTRY *) PG_GETARG_POINTER(0),
+                                                                         (GISTENTRY *) PG_GETARG_POINTER(1),
+                                                                                 (float *) PG_GETARG_POINTER(2),
+                                                                                 inner_int_union, rt__int_size
+                                                                                 ));
 }
 
 
 Datum
 g_int_picksplit(PG_FUNCTION_ARGS)
 {
-       PG_RETURN_POINTER( _int_common_picksplit(
-               (bytea *)PG_GETARG_POINTER(0),
-               (GIST_SPLITVEC *)PG_GETARG_POINTER(1),
-               inner_int_union,
-               inner_int_inter,
-               rt__int_size,
-               0.01
-       );
+       PG_RETURN_POINTER(_int_common_picksplit(
+                                                                                 (bytea *) PG_GETARG_POINTER(0),
+                                                                 (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
+                                                                                       inner_int_union,
+                                                                                       inner_int_inter,
+                                                                                       rt__int_size,
+                                                                                       0.01
+                                                                                       ));
 }
 
 /*
@@ -509,21 +513,24 @@ g_int_picksplit(PG_FUNCTION_ARGS)
 Datum
 g_int_same(PG_FUNCTION_ARGS)
 {
-       ArrayType       *a = (ArrayType*)PointerGetDatum(PG_GETARG_POINTER(0));
-       ArrayType       *b = (ArrayType*)PointerGetDatum(PG_GETARG_POINTER(1));
-       bool *result = (bool *)PG_GETARG_POINTER(2);
-       int4 n = ARRNELEMS(a);
-       int4 *da, *db;
+       ArrayType  *a = (ArrayType *) PointerGetDatum(PG_GETARG_POINTER(0));
+       ArrayType  *b = (ArrayType *) PointerGetDatum(PG_GETARG_POINTER(1));
+       bool       *result = (bool *) PG_GETARG_POINTER(2);
+       int4            n = ARRNELEMS(a);
+       int4       *da,
+                          *db;
 
-       if ( n != ARRNELEMS(b) ) {
+       if (n != ARRNELEMS(b))
+       {
                *result = false;
                PG_RETURN_POINTER(result);
        }
        *result = TRUE;
        da = ARRPTR(a);
        db = ARRPTR(b);
-       while(n--)
-               if (*da++ != *db++) {
+       while (n--)
+               if (*da++ != *db++)
+               {
                        *result = FALSE;
                        break;
                }
@@ -534,20 +541,20 @@ g_int_same(PG_FUNCTION_ARGS)
 Datum
 _int_contained(PG_FUNCTION_ARGS)
 {
-       PG_RETURN_BOOL( DatumGetBool(
-               DirectFunctionCall2(
-                       _int_contains,
-                       PointerGetDatum(PG_GETARG_POINTER(1)),
-                       PointerGetDatum(PG_GETARG_POINTER(0))
-               )
-       ));
+       PG_RETURN_BOOL(DatumGetBool(
+                                                               DirectFunctionCall2(
+                                                                                                       _int_contains,
+                                                                  PointerGetDatum(PG_GETARG_POINTER(1)),
+                                                                       PointerGetDatum(PG_GETARG_POINTER(0))
+                                                                                                       )
+                                                               ));
 }
 
 Datum
 _int_contains(PG_FUNCTION_ARGS)
 {
-       ArrayType *a = (ArrayType *)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
-       ArrayType *b = (ArrayType *)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+       ArrayType  *b = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
        bool            res;
 
        if (ARRISVOID(a) || ARRISVOID(b))
@@ -558,7 +565,7 @@ _int_contains(PG_FUNCTION_ARGS)
        res = inner_int_contains(a, b);
        pfree(a);
        pfree(b);
-       PG_RETURN_BOOL( res );
+       PG_RETURN_BOOL(res);
 }
 
 static bool
@@ -607,20 +614,20 @@ inner_int_contains(ArrayType *a, ArrayType *b)
 Datum
 _int_different(PG_FUNCTION_ARGS)
 {
-       PG_RETURN_BOOL( ! DatumGetBool(
-               DirectFunctionCall2(
-                       _int_same,
-                       PointerGetDatum(PG_GETARG_POINTER(0)),
-                       PointerGetDatum(PG_GETARG_POINTER(1))
-               )
-       ));
+       PG_RETURN_BOOL(!DatumGetBool(
+                                                                DirectFunctionCall2(
+                                                                                                        _int_same,
+                                                                  PointerGetDatum(PG_GETARG_POINTER(0)),
+                                                                       PointerGetDatum(PG_GETARG_POINTER(1))
+                                                                                                        )
+                                                                ));
 }
 
 Datum
 _int_same(PG_FUNCTION_ARGS)
 {
-       ArrayType *a = (ArrayType *)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
-       ArrayType *b = (ArrayType *)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+       ArrayType  *b = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
        int                     na,
                                nb;
        int                     n;
@@ -664,8 +671,8 @@ _int_same(PG_FUNCTION_ARGS)
 Datum
 _int_overlap(PG_FUNCTION_ARGS)
 {
-       ArrayType *a = (ArrayType *)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
-       ArrayType *b = (ArrayType *)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+       ArrayType  *b = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
        bool            result;
 
        if (ARRISVOID(a) || ARRISVOID(b))
@@ -679,7 +686,7 @@ _int_overlap(PG_FUNCTION_ARGS)
        pfree(a);
        pfree(b);
 
-       PG_RETURN_BOOL( result );
+       PG_RETURN_BOOL(result);
 }
 
 static bool
@@ -719,8 +726,8 @@ inner_int_overlap(ArrayType *a, ArrayType *b)
 Datum
 _int_union(PG_FUNCTION_ARGS)
 {
-       ArrayType *a = (ArrayType *)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
-       ArrayType *b = (ArrayType *)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+       ArrayType  *b = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
        ArrayType  *result;
 
        if (!ARRISVOID(a))
@@ -735,10 +742,10 @@ _int_union(PG_FUNCTION_ARGS)
        if (b)
                pfree(b);
 
-       PG_RETURN_POINTER( result );
+       PG_RETURN_POINTER(result);
 }
 
-static ArrayType  *
+static ArrayType *
 inner_int_union(ArrayType *a, ArrayType *b)
 {
        ArrayType  *r = NULL;
@@ -794,8 +801,8 @@ inner_int_union(ArrayType *a, ArrayType *b)
 Datum
 _int_inter(PG_FUNCTION_ARGS)
 {
-       ArrayType *a = (ArrayType *)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
-       ArrayType *b = (ArrayType *)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+       ArrayType  *b = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
        ArrayType  *result;
 
        if (ARRISVOID(a) || ARRISVOID(b))
@@ -809,10 +816,10 @@ _int_inter(PG_FUNCTION_ARGS)
        pfree(a);
        pfree(b);
 
-       PG_RETURN_POINTER( result );
+       PG_RETURN_POINTER(result);
 }
 
-static ArrayType  *
+static ArrayType *
 inner_int_inter(ArrayType *a, ArrayType *b)
 {
        ArrayType  *r;
@@ -874,9 +881,9 @@ rt__int_size(ArrayType *a, float *size)
 static bool
 isort(int4 *a, int len)
 {
-       int4                    tmp,
+       int4            tmp,
                                index;
-       int4               *cur,
+       int4       *cur,
                           *end;
        bool            r = FALSE;
 
@@ -1030,16 +1037,16 @@ rt__intbig_size(ArrayType *a, float *sz)
        BITVECP         bv = SIGPTR(a);
 
        LOOPBYTE(
-               len +=
-                       GETBITBYTE(bv,0) +
-                       GETBITBYTE(bv,1) +
-                       GETBITBYTE(bv,2) +
-                       GETBITBYTE(bv,3) +
-                       GETBITBYTE(bv,4) +
-                       GETBITBYTE(bv,5) +
-                       GETBITBYTE(bv,6) +
-                       GETBITBYTE(bv,7) ;
-               bv = (BITVECP) ( ((char*)bv) + 1 );
+                        len +=
+                        GETBITBYTE(bv, 0) +
+                        GETBITBYTE(bv, 1) +
+                        GETBITBYTE(bv, 2) +
+                        GETBITBYTE(bv, 3) +
+                        GETBITBYTE(bv, 4) +
+                        GETBITBYTE(bv, 5) +
+                        GETBITBYTE(bv, 6) +
+                        GETBITBYTE(bv, 7);
+       bv = (BITVECP) (((char *) bv) + 1);
        );
 
        *sz = (float) len;
@@ -1089,9 +1096,9 @@ _intbig_inter(ArrayType *a, ArrayType *b)
 Datum
 g_intbig_same(PG_FUNCTION_ARGS)
 {
-       ArrayType *a = (ArrayType *)PG_GETARG_POINTER(0);
-       ArrayType *b = (ArrayType *)PG_GETARG_POINTER(1);
-       bool *result = (bool *)PG_GETARG_POINTER(2);
+       ArrayType  *a = (ArrayType *) PG_GETARG_POINTER(0);
+       ArrayType  *b = (ArrayType *) PG_GETARG_POINTER(1);
+       bool       *result = (bool *) PG_GETARG_POINTER(2);
        BITVECP         da,
                                db;
        int                     i;
@@ -1100,59 +1107,62 @@ g_intbig_same(PG_FUNCTION_ARGS)
        db = SIGPTR(b);
 
        LOOPBYTE(
-       if (da[i] != db[i])
-       {
+                        if (da[i] != db[i])
+                        {
                *result = FALSE;
-               PG_RETURN_POINTER( result );
+               PG_RETURN_POINTER(result);
        }
        );
 
        *result = TRUE;
-       PG_RETURN_POINTER( result );
+       PG_RETURN_POINTER(result);
 }
 
 Datum
 g_intbig_compress(PG_FUNCTION_ARGS)
 {
-       GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
        GISTENTRY  *retval;
        ArrayType  *r,
                           *in;
-       bool maycompress = true;
-       int i;
+       bool            maycompress = true;
+       int                     i;
 
        if (DatumGetPointer(entry->key) != NULL)
                in = (ArrayType *) PG_DETOAST_DATUM(entry->key);
        else
                in = NULL;
 
-       if (!entry->leafkey) {
+       if (!entry->leafkey)
+       {
                LOOPBYTE(
-                       if ( ( ((char*)ARRPTR(in))[i] & 0xff ) != 0xff ) {
-                               maycompress = false;
-                               break;
-                       }
+                                if ((((char *) ARRPTR(in))[i] & 0xff) != 0xff)
+                                {
+                       maycompress = false;
+                       break;
+               }
                );
-               if ( maycompress ) {
+               if (maycompress)
+               {
                        retval = palloc(sizeof(GISTENTRY));
                        r = new_intArrayType(1);
                        gistentryinit(*retval, PointerGetDatum(r),
-                               entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
-                       PG_RETURN_POINTER( retval );
+                         entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
+                       PG_RETURN_POINTER(retval);
                }
-               PG_RETURN_POINTER( entry );
+               PG_RETURN_POINTER(entry);
        }
 
        retval = palloc(sizeof(GISTENTRY));
-       r = new_intArrayType( SIGLENINT );
+       r = new_intArrayType(SIGLENINT);
 
        if (ARRISVOID(in))
        {
                gistentryinit(*retval, PointerGetDatum(r),
                          entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
                if (in != (ArrayType *) DatumGetPointer(entry->key))
-                               pfree(in);
-               PG_RETURN_POINTER (retval);
+                       pfree(in);
+               PG_RETURN_POINTER(retval);
        }
 
        gensign(SIGPTR(r),
@@ -1160,104 +1170,108 @@ g_intbig_compress(PG_FUNCTION_ARGS)
                        ARRNELEMS(in));
 
        LOOPBYTE(
-               if( ( ((char*)ARRPTR(in))[i] & 0xff ) != 0xff ) {
-                       maycompress = false;
-                       break;
-               }
+                        if ((((char *) ARRPTR(in))[i] & 0xff) != 0xff)
+                        {
+               maycompress = false;
+               break;
+       }
        );
 
-       if ( maycompress ) {
+       if (maycompress)
+       {
                pfree(r);
                r = new_intArrayType(1);
        }
 
        gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, entry->offset, VARSIZE(r), FALSE);
 
-       if ( in != (ArrayType *) DatumGetPointer(entry->key))
-                       pfree(in);
+       if (in != (ArrayType *) DatumGetPointer(entry->key))
+               pfree(in);
 
-       PG_RETURN_POINTER (retval);
+       PG_RETURN_POINTER(retval);
 }
 
 Datum
 g_intbig_decompress(PG_FUNCTION_ARGS)
 {
-       GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
        ArrayType  *key;
 
        key = (ArrayType *) PG_DETOAST_DATUM(entry->key);
 
-       if ( key != (ArrayType *) DatumGetPointer(entry->key))
+       if (key != (ArrayType *) DatumGetPointer(entry->key))
        {
                GISTENTRY  *retval;
 
                retval = palloc(sizeof(GISTENTRY));
 
                gistentryinit(*retval, PointerGetDatum(key),
-                       entry->rel, entry->page, entry->offset, (key) ? VARSIZE(key) : 0, FALSE);
-               PG_RETURN_POINTER( retval );
+                                         entry->rel, entry->page, entry->offset, (key) ? VARSIZE(key) : 0, FALSE);
+               PG_RETURN_POINTER(retval);
        }
-       if ( ARRNELEMS(key) == 1 ) {
+       if (ARRNELEMS(key) == 1)
+       {
                GISTENTRY  *retval;
                ArrayType  *newkey;
 
                retval = palloc(sizeof(GISTENTRY));
                newkey = new_intArrayType(SIGLENINT);
-               MemSet( (void*)ARRPTR(newkey), 0xff, SIGLEN );
+               MemSet((void *) ARRPTR(newkey), 0xff, SIGLEN);
 
                gistentryinit(*retval, PointerGetDatum(newkey),
-                       entry->rel, entry->page, entry->offset, VARSIZE(newkey), FALSE);
-               PG_RETURN_POINTER( retval );
+                entry->rel, entry->page, entry->offset, VARSIZE(newkey), FALSE);
+               PG_RETURN_POINTER(retval);
        }
-       PG_RETURN_POINTER( entry );
+       PG_RETURN_POINTER(entry);
 }
 
 Datum
 g_intbig_picksplit(PG_FUNCTION_ARGS)
 {
-       PG_RETURN_POINTER( _int_common_picksplit(
-               (bytea *)PG_GETARG_POINTER(0),
-               (GIST_SPLITVEC *)PG_GETARG_POINTER(1),
-               _intbig_union,
-               _intbig_inter,
-               rt__intbig_size,
-               0.1
-       );
+       PG_RETURN_POINTER(_int_common_picksplit(
+                                                                                 (bytea *) PG_GETARG_POINTER(0),
+                                                                 (GIST_SPLITVEC *) PG_GETARG_POINTER(1),
+                                                                                       _intbig_union,
+                                                                                       _intbig_inter,
+                                                                                       rt__intbig_size,
+                                                                                       0.1
+                                                                                       ));
 }
 
 Datum
 g_intbig_union(PG_FUNCTION_ARGS)
 {
-               PG_RETURN_POINTER( _int_common_union(
-                               (bytea *) PG_GETARG_POINTER(0),
-                               (int *) PG_GETARG_POINTER(1),
-                               _intbig_union
-               );
+       PG_RETURN_POINTER(_int_common_union(
+                                                                               (bytea *) PG_GETARG_POINTER(0),
+                                                                               (int *) PG_GETARG_POINTER(1),
+                                                                               _intbig_union
+                                                                               ));
 }
 
 Datum
 g_intbig_penalty(PG_FUNCTION_ARGS)
 {
-       PG_RETURN_POINTER( _int_common_penalty(
-               (GISTENTRY *)PG_GETARG_POINTER(0),
-               (GISTENTRY *)PG_GETARG_POINTER(1),
-               (float *)    PG_GETARG_POINTER(2),
-               _intbig_union, rt__intbig_size
-       );
+       PG_RETURN_POINTER(_int_common_penalty(
+                                                                         (GISTENTRY *) PG_GETARG_POINTER(0),
+                                                                         (GISTENTRY *) PG_GETARG_POINTER(1),
+                                                                                 (float *) PG_GETARG_POINTER(2),
+                                                                                 _intbig_union, rt__intbig_size
+                                                                                 ));
 }
 
 Datum
-g_intbig_consistent(PG_FUNCTION_ARGS) {
-               GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
-               ArrayType *query = ( ArrayType * )PG_GETARG_POINTER(1);
-               StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
+g_intbig_consistent(PG_FUNCTION_ARGS)
+{
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
+       ArrayType  *query = (ArrayType *) PG_GETARG_POINTER(1);
+       StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
        bool            retval;
        ArrayType  *q;
 
-       if ( strategy == BooleanSearchStrategy )
-               PG_RETURN_BOOL(signconsistent( (QUERYTYPE*)query,
-                                               SIGPTR((ArrayType *) DatumGetPointer(entry->key)),
-                                               false ) );
+       if (strategy == BooleanSearchStrategy)
+               PG_RETURN_BOOL(signconsistent((QUERYTYPE *) query,
+                                          SIGPTR((ArrayType *) DatumGetPointer(entry->key)),
+                                                                         false));
 
        /* XXX what about toasted input? */
        if (ARRISVOID(query))
@@ -1274,13 +1288,13 @@ g_intbig_consistent(PG_FUNCTION_ARGS) {
                        retval = _intbig_overlap((ArrayType *) DatumGetPointer(entry->key), q);
                        break;
                case RTSameStrategyNumber:
-                       if ( GIST_LEAF(entry) )
+                       if (GIST_LEAF(entry))
                                DirectFunctionCall3(
-                                       g_intbig_same,
-                                       entry->key,
-                                       PointerGetDatum(q),
-                                       PointerGetDatum(&retval)
-                               );
+                                                                       g_intbig_same,
+                                                                       entry->key,
+                                                                       PointerGetDatum(q),
+                                                                       PointerGetDatum(&retval)
+                                       );
                        else
                                retval = _intbig_contains((ArrayType *) DatumGetPointer(entry->key), q);
                        break;
@@ -1305,7 +1319,7 @@ g_intbig_consistent(PG_FUNCTION_ARGS) {
 ** The GiST Union method for _intments
 ** returns the minimal set that encloses all the entries in entryvec
 */
-static ArrayType  *
+static ArrayType *
 _int_common_union(bytea *entryvec, int *sizep, formarray unionf)
 {
        int                     numranges,
@@ -1323,7 +1337,7 @@ _int_common_union(bytea *entryvec, int *sizep, formarray unionf)
        for (i = 1; i < numranges; i++)
        {
                out = (*unionf) (tmp, (ArrayType *)
-                                                DatumGetPointer(((GISTENTRY *) VARDATA(entryvec))[i].key));
+                         DatumGetPointer(((GISTENTRY *) VARDATA(entryvec))[i].key));
                if (i > 1 && tmp)
                        pfree(tmp);
                tmp = out;
@@ -1376,17 +1390,19 @@ _int_common_penalty(GISTENTRY *origentry, GISTENTRY *newentry, float *result,
        return (result);
 }
 
-typedef struct {
-       OffsetNumber    pos;
+typedef struct
+{
+       OffsetNumber pos;
        float           cost;
 } SPLITCOST;
 
 static int
-comparecost( const void *a, const void *b ) {
-       if ( ((SPLITCOST*)a)->cost == ((SPLITCOST*)b)->cost )
+comparecost(const void *a, const void *b)
+{
+       if (((SPLITCOST *) a)->cost == ((SPLITCOST *) b)->cost)
                return 0;
        else
-               return ( ((SPLITCOST*)a)->cost > ((SPLITCOST*)b)->cost ) ? 1 : -1;
+               return (((SPLITCOST *) a)->cost > ((SPLITCOST *) b)->cost) ? 1 : -1;
 }
 
 /*
@@ -1426,7 +1442,7 @@ _int_common_picksplit(bytea *entryvec,
        OffsetNumber *left,
                           *right;
        OffsetNumber maxoff;
-       SPLITCOST       *costvector;
+       SPLITCOST  *costvector;
 
 #ifdef GIST_DEBUG
        elog(DEBUG3, "--------picksplit %d", (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY));
@@ -1478,7 +1494,8 @@ _int_common_picksplit(bytea *entryvec,
        v->spl_nleft = 0;
        right = v->spl_right;
        v->spl_nright = 0;
-       if ( seed_1 == 0 || seed_2 == 0 ) {
+       if (seed_1 == 0 || seed_2 == 0)
+       {
                seed_1 = 1;
                seed_2 = 2;
        }
@@ -1491,22 +1508,24 @@ _int_common_picksplit(bytea *entryvec,
        (*sizef) (datum_r, &size_r);
 
        maxoff = OffsetNumberNext(maxoff);
+
        /*
-                * sort entries
+        * sort entries
         */
-       costvector=(SPLITCOST*)palloc( sizeof(SPLITCOST)*maxoff );
-       for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i)) {
-               costvector[i-1].pos = i;
+       costvector = (SPLITCOST *) palloc(sizeof(SPLITCOST) * maxoff);
+       for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
+       {
+               costvector[i - 1].pos = i;
                datum_alpha = (ArrayType *) DatumGetPointer(((GISTENTRY *) VARDATA(entryvec))[i].key);
-               union_d = (*unionf)(datum_l, datum_alpha);
-               (*sizef)(union_d, &size_alpha);
-               pfree( union_d );
-               union_d = (*unionf)(datum_r, datum_alpha);
-               (*sizef)(union_d, &size_beta);
-               pfree( union_d );
-               costvector[i-1].cost = abs( (size_alpha - size_l) - (size_beta - size_r) );
+               union_d = (*unionf) (datum_l, datum_alpha);
+               (*sizef) (union_d, &size_alpha);
+               pfree(union_d);
+               union_d = (*unionf) (datum_r, datum_alpha);
+               (*sizef) (union_d, &size_beta);
+               pfree(union_d);
+               costvector[i - 1].cost = abs((size_alpha - size_l) - (size_beta - size_r));
        }
-       qsort( (void*)costvector, maxoff, sizeof(SPLITCOST), comparecost );
+       qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
 
        /*
         * Now split up the regions between the two seeds.      An important
@@ -1521,7 +1540,8 @@ _int_common_picksplit(bytea *entryvec,
         */
 
 
-       for (j = 0; j < maxoff; j++) {
+       for (j = 0; j < maxoff; j++)
+       {
                i = costvector[j].pos;
 
                /*
@@ -1574,7 +1594,7 @@ _int_common_picksplit(bytea *entryvec,
                        v->spl_nright++;
                }
        }
-       pfree( costvector );
+       pfree(costvector);
        *right = *left = FirstOffsetNumber;
 
        datum_l->flags &= ~LEAFKEY;
@@ -1589,19 +1609,19 @@ _int_common_picksplit(bytea *entryvec,
 }
 
 /*****************************************************************************
- *             BoolSearch
+ *             BoolSearch
  *****************************************************************************/
 
 
-#define END     0
-#define ERR     1
-#define VAL     2
-#define OPR     3
-#define OPEN    4
-#define CLOSE   5
+#define END            0
+#define ERR            1
+#define VAL            2
+#define OPR            3
+#define OPEN   4
+#define CLOSE  5
 
 /* parser's states */
-#define WAITOPERAND    1
+#define WAITOPERAND 1
 #define WAITENDOPERAND 2
 #define WAITOPERATOR   3
 
@@ -1609,75 +1629,94 @@ _int_common_picksplit(bytea *entryvec,
  * node of query tree, also used
  * for storing polish notation in parser
  */
-typedef struct NODE {
-       int4    type;
-       int4    val;
-       struct NODE     *next;
-} NODE;
-
-typedef struct {
-       char *buf;
-       int4    state;
-       int4  count;
-       /* reverse polish notation in list (for temprorary usage)*/
-       NODE    *str;
+typedef struct NODE
+{
+       int4            type;
+       int4            val;
+       struct NODE *next;
+}      NODE;
+
+typedef struct
+{
+       char       *buf;
+       int4            state;
+       int4            count;
+       /* reverse polish notation in list (for temprorary usage) */
+       NODE       *str;
        /* number in str */
-       int4    num;
-} WORKSTATE;
+       int4            num;
+}      WORKSTATE;
 
 /*
  * get token from query string
  */
 static int4
-gettoken( WORKSTATE* state, int4* val ) {
-       char nnn[16], *curnnn;
+gettoken(WORKSTATE * state, int4 *val)
+{
+       char            nnn[16],
+                          *curnnn;
 
-       curnnn=nnn;
-       while(1) {
-               switch(state->state) {
+       curnnn = nnn;
+       while (1)
+       {
+               switch (state->state)
+               {
                        case WAITOPERAND:
-                               curnnn=nnn;
-                               if ( (*(state->buf)>='0' && *(state->buf)<='9') ||
-                                               *(state->buf)=='-' ) {
+                               curnnn = nnn;
+                               if ((*(state->buf) >= '0' && *(state->buf) <= '9') ||
+                                       *(state->buf) == '-')
+                               {
                                        state->state = WAITENDOPERAND;
                                        *curnnn = *(state->buf);
                                        curnnn++;
-                               } else if ( *(state->buf) == '!' ) {
+                               }
+                               else if (*(state->buf) == '!')
+                               {
                                        (state->buf)++;
-                                       *val = (int4)'!';
+                                       *val = (int4) '!';
                                        return OPR;
-                               } else if ( *(state->buf) == '(' ) {
+                               }
+                               else if (*(state->buf) == '(')
+                               {
                                        state->count++;
                                        (state->buf)++;
                                        return OPEN;
-                               } else if ( *(state->buf) != ' ' )
+                               }
+                               else if (*(state->buf) != ' ')
                                        return ERR;
                                break;
                        case WAITENDOPERAND:
-                               if ( *(state->buf)>='0' && *(state->buf)<='9' ) {
+                               if (*(state->buf) >= '0' && *(state->buf) <= '9')
+                               {
                                        *curnnn = *(state->buf);
                                        curnnn++;
-                               } else {
+                               }
+                               else
+                               {
                                        *curnnn = '\0';
-                                       *val=(int4)atoi( nnn );
+                                       *val = (int4) atoi(nnn);
                                        state->state = WAITOPERATOR;
-                                       return ( state->count && *(state->buf) == '\0' )
+                                       return (state->count && *(state->buf) == '\0')
                                                ? ERR : VAL;
                                }
                                break;
                        case WAITOPERATOR:
-                               if ( *(state->buf) == '&' || *(state->buf) == '|' ) {
+                               if (*(state->buf) == '&' || *(state->buf) == '|')
+                               {
                                        state->state = WAITOPERAND;
                                        *val = (int4) *(state->buf);
                                        (state->buf)++;
                                        return OPR;
-                               } else if ( *(state->buf) == ')' ) {
+                               }
+                               else if (*(state->buf) == ')')
+                               {
                                        (state->buf)++;
                                        state->count--;
-                                       return ( state->count <0 ) ? ERR : CLOSE;
-                               } else if ( *(state->buf) == '\0' ) {
-                                       return ( state->count ) ? ERR : END;
-                               } else if ( *(state->buf) != ' ' )
+                                       return (state->count < 0) ? ERR : CLOSE;
+                               }
+                               else if (*(state->buf) == '\0')
+                                       return (state->count) ? ERR : END;
+                               else if (*(state->buf) != ' ')
                                        return ERR;
                                break;
                        default:
@@ -1693,10 +1732,12 @@ gettoken( WORKSTATE* state, int4* val ) {
  * push new one in polish notation reverse view
  */
 static void
-pushquery( WORKSTATE *state, int4 type, int4 val ) {
-       NODE    *tmp = (NODE*)palloc(sizeof(NODE));
-       tmp->type=type;
-       tmp->val =val;
+pushquery(WORKSTATE * state, int4 type, int4 val)
+{
+       NODE       *tmp = (NODE *) palloc(sizeof(NODE));
+
+       tmp->type = type;
+       tmp->val = val;
        tmp->next = state->str;
        state->str = tmp;
        state->num++;
@@ -1708,82 +1749,95 @@ pushquery( WORKSTATE *state, int4 type, int4 val ) {
  * make polish notaion of query
  */
 static int4
-makepol(WORKSTATE *state) {
-       int4 val,type;
-       int4    stack[STACKDEPTH];
-       int4    lenstack=0;
+makepol(WORKSTATE * state)
+{
+       int4            val,
+                               type;
+       int4            stack[STACKDEPTH];
+       int4            lenstack = 0;
 
-       while( (type=gettoken(state, &val))!=END ) {
-               switch(type) {
+       while ((type = gettoken(state, &val)) != END)
+       {
+               switch (type)
+               {
                        case VAL:
                                pushquery(state, type, val);
-                               while ( lenstack && (stack[ lenstack-1 ] == (int4)'&' ||
-                                               stack[ lenstack-1 ] == (int4)'!') ) {
+                               while (lenstack && (stack[lenstack - 1] == (int4) '&' ||
+                                                                       stack[lenstack - 1] == (int4) '!'))
+                               {
                                        lenstack--;
-                                       pushquery(state, OPR, stack[ lenstack ]);
+                                       pushquery(state, OPR, stack[lenstack]);
                                }
                                break;
                        case OPR:
-                               if ( lenstack && val == (int4) '|' ) {
+                               if (lenstack && val == (int4) '|')
                                        pushquery(state, OPR, val);
-                               } else {
-                                       if ( lenstack == STACKDEPTH )
-                                               elog(ERROR,"Stack too short");
-                                       stack[ lenstack ] = val;
+                               else
+                               {
+                                       if (lenstack == STACKDEPTH)
+                                               elog(ERROR, "Stack too short");
+                                       stack[lenstack] = val;
                                        lenstack++;
                                }
                                break;
                        case OPEN:
-                               if ( makepol( state ) == ERR ) return ERR;
-                               if ( lenstack && (stack[ lenstack-1 ] == (int4)'&' ||
-                                               stack[ lenstack-1 ] == (int4)'!') ) {
+                               if (makepol(state) == ERR)
+                                       return ERR;
+                               if (lenstack && (stack[lenstack - 1] == (int4) '&' ||
+                                                                stack[lenstack - 1] == (int4) '!'))
+                               {
                                        lenstack--;
-                                       pushquery(state, OPR, stack[ lenstack ]);
+                                       pushquery(state, OPR, stack[lenstack]);
                                }
                                break;
                        case CLOSE:
-                               while ( lenstack ) {
+                               while (lenstack)
+                               {
                                        lenstack--;
-                                       pushquery(state, OPR, stack[ lenstack ]);
+                                       pushquery(state, OPR, stack[lenstack]);
                                };
                                return END;
                                break;
                        case ERR:
                        default:
-                               elog(ERROR,"Syntax error");
+                               elog(ERROR, "Syntax error");
                                return ERR;
 
                }
        }
 
-       while (lenstack) {
+       while (lenstack)
+       {
                lenstack--;
-               pushquery(state, OPR, stack[ lenstack ]);
+               pushquery(state, OPR, stack[lenstack]);
        };
        return END;
 }
 
-typedef struct {
-       int4 *arrb;
-       int4 *arre;
-} CHKVAL;
+typedef struct
+{
+       int4       *arrb;
+       int4       *arre;
+}      CHKVAL;
 
 /*
  * is there value 'val' in array or not ?
  */
 static bool
-checkcondition_arr( void *checkval, int4 val ) {
-       int4      *StopLow = ((CHKVAL*)checkval)->arrb;
-       int4      *StopHigh = ((CHKVAL*)checkval)->arre;
-       int4      *StopMiddle;
+checkcondition_arr(void *checkval, int4 val)
+{
+       int4       *StopLow = ((CHKVAL *) checkval)->arrb;
+       int4       *StopHigh = ((CHKVAL *) checkval)->arre;
+       int4       *StopMiddle;
 
        /* Loop invariant: StopLow <= val < StopHigh */
 
-       while (StopLow < StopHigh) {
+       while (StopLow < StopHigh)
+       {
                StopMiddle = StopLow + (StopHigh - StopLow) / 2;
                if (*StopMiddle == val)
                        return (true);
-               else if (*StopMiddle < val )
+               else if (*StopMiddle < val)
                        StopLow = StopMiddle + 1;
                else
                        StopHigh = StopMiddle;
@@ -1792,29 +1846,36 @@ checkcondition_arr( void *checkval, int4 val ) {
 }
 
 static bool
-checkcondition_bit( void *checkval, int4 val ) {
-       return GETBIT( checkval, HASHVAL( val ) );
+checkcondition_bit(void *checkval, int4 val)
+{
+       return GETBIT(checkval, HASHVAL(val));
 }
 
 /*
  * check for boolean condition
  */
 static bool
-execute( ITEM* curitem, void *checkval, bool calcnot, bool (*chkcond)(void *checkval, int4 val )) {
+execute(ITEM * curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, int4 val))
+{
 
-       if (  curitem->type == VAL ) {
-               return (*chkcond)( checkval, curitem->val );
-       } else if ( curitem->val == (int4)'!' ) {
-               return ( calcnot ) ?
-                       ( ( execute(curitem - 1, checkval, calcnot, chkcond) ) ? false : true )
+       if (curitem->type == VAL)
+               return (*chkcond) (checkval, curitem->val);
+       else if (curitem->val == (int4) '!')
+       {
+               return (calcnot) ?
+                       ((execute(curitem - 1, checkval, calcnot, chkcond)) ? false : true)
                        : true;
-       } else if ( curitem->val == (int4)'&' ) {
-               if ( execute(curitem + curitem->left, checkval, calcnot, chkcond) )
+       }
+       else if (curitem->val == (int4) '&')
+       {
+               if (execute(curitem + curitem->left, checkval, calcnot, chkcond))
                        return execute(curitem - 1, checkval, calcnot, chkcond);
                else
                        return false;
-       } else { /* |-operator */
-               if ( execute(curitem + curitem->left, checkval, calcnot, chkcond) )
+       }
+       else
+       {                                                       /* |-operator */
+               if (execute(curitem + curitem->left, checkval, calcnot, chkcond))
                        return true;
                else
                        return execute(curitem - 1, checkval, calcnot, chkcond);
@@ -1826,86 +1887,98 @@ execute( ITEM* curitem, void *checkval, bool calcnot, bool (*chkcond)(void *chec
  * signconsistent & execconsistent called by *_consistent
  */
 static bool
-signconsistent( QUERYTYPE *query, BITVEC sign, bool calcnot ) {
+signconsistent(QUERYTYPE * query, BITVEC sign, bool calcnot)
+{
        return execute(
-               GETQUERY(query) + query->size-1 ,
-               (void*)sign, calcnot,
-               checkcondition_bit
+                                  GETQUERY(query) + query->size - 1,
+                                  (void *) sign, calcnot,
+                                  checkcondition_bit
        );
 }
 
 static bool
-execconsistent( QUERYTYPE *query, ArrayType *array, bool calcnot ) {
-       CHKVAL  chkval;
+execconsistent(QUERYTYPE * query, ArrayType *array, bool calcnot)
+{
+       CHKVAL          chkval;
 
        chkval.arrb = ARRPTR(array);
        chkval.arre = chkval.arrb + ARRNELEMS(array);
        return execute(
-               GETQUERY(query) + query->size-1 ,
-               (void*)&chkval, calcnot,
-               checkcondition_arr
-       );
+                                  GETQUERY(query) + query->size - 1,
+                                  (void *) &chkval, calcnot,
+                                  checkcondition_arr
+               );
 }
 
 /*
  * boolean operations
  */
 Datum
-rboolop(PG_FUNCTION_ARGS) {
+rboolop(PG_FUNCTION_ARGS)
+{
        return DirectFunctionCall2(
-               boolop,
-               PG_GETARG_DATUM(1),
-               PG_GETARG_DATUM(0)
+                                                          boolop,
+                                                          PG_GETARG_DATUM(1),
+                                                          PG_GETARG_DATUM(0)
        );
 }
 
 Datum
-boolop(PG_FUNCTION_ARGS) {
-       ArrayType *val = ( ArrayType * )PG_DETOAST_DATUM_COPY(PG_GETARG_POINTER(0));
-       QUERYTYPE *query = ( QUERYTYPE * )PG_DETOAST_DATUM(PG_GETARG_POINTER(1));
-       CHKVAL  chkval;
-       bool result;
+boolop(PG_FUNCTION_ARGS)
+{
+       ArrayType  *val = (ArrayType *) PG_DETOAST_DATUM_COPY(PG_GETARG_POINTER(0));
+       QUERYTYPE  *query = (QUERYTYPE *) PG_DETOAST_DATUM(PG_GETARG_POINTER(1));
+       CHKVAL          chkval;
+       bool            result;
 
-       if ( ARRISVOID( val ) ) {
+       if (ARRISVOID(val))
+       {
                pfree(val);
-               PG_FREE_IF_COPY(query,1);
-               PG_RETURN_BOOL( false );
+               PG_FREE_IF_COPY(query, 1);
+               PG_RETURN_BOOL(false);
        }
 
        PREPAREARR(val);
        chkval.arrb = ARRPTR(val);
        chkval.arre = chkval.arrb + ARRNELEMS(val);
        result = execute(
-               GETQUERY(query) + query->size-1 ,
-               &chkval, true,
-               checkcondition_arr
-       );
+                                        GETQUERY(query) + query->size - 1,
+                                        &chkval, true,
+                                        checkcondition_arr
+               );
        pfree(val);
 
-       PG_FREE_IF_COPY(query,1);
-       PG_RETURN_BOOL( result );
+       PG_FREE_IF_COPY(query, 1);
+       PG_RETURN_BOOL(result);
 }
 
 static void
-findoprnd( ITEM *ptr, int4 *pos ) {
+findoprnd(ITEM * ptr, int4 *pos)
+{
 #ifdef BS_DEBUG
-       elog(DEBUG3, ( ptr[*pos].type == OPR ) ?
-               "%d  %c" : "%d  %d ", *pos, ptr[*pos].val );
+       elog(DEBUG3, (ptr[*pos].type == OPR) ?
+                "%d  %c" : "%d  %d ", *pos, ptr[*pos].val);
 #endif
-       if ( ptr[*pos].type == VAL ) {
+       if (ptr[*pos].type == VAL)
+       {
                ptr[*pos].left = 0;
                (*pos)--;
-       } else if ( ptr[*pos].val == (int4)'!' ) {
+       }
+       else if (ptr[*pos].val == (int4) '!')
+       {
                ptr[*pos].left = -1;
                (*pos)--;
-               findoprnd( ptr, pos );
-       } else {
-               ITEM *curitem = &ptr[*pos];
-               int4 tmp = *pos;
+               findoprnd(ptr, pos);
+       }
+       else
+       {
+               ITEM       *curitem = &ptr[*pos];
+               int4            tmp = *pos;
+
                (*pos)--;
-               findoprnd(ptr,pos);
+               findoprnd(ptr, pos);
                curitem->left = *pos - tmp;
-               findoprnd(ptr,pos);
+               findoprnd(ptr, pos);
        }
 }
 
@@ -1914,71 +1987,76 @@ findoprnd( ITEM *ptr, int4 *pos ) {
  * input
  */
 Datum
-bqarr_in(PG_FUNCTION_ARGS) {
-       char *buf=(char*)PG_GETARG_POINTER(0);
-       WORKSTATE state;
-       int4 i;
-       QUERYTYPE       *query;
-       int4 commonlen;
-       ITEM *ptr;
-       NODE *tmp;
-       int4 pos=0;
+bqarr_in(PG_FUNCTION_ARGS)
+{
+       char       *buf = (char *) PG_GETARG_POINTER(0);
+       WORKSTATE       state;
+       int4            i;
+       QUERYTYPE  *query;
+       int4            commonlen;
+       ITEM       *ptr;
+       NODE       *tmp;
+       int4            pos = 0;
+
 #ifdef BS_DEBUG
-       StringInfoData  pbuf;
+       StringInfoData pbuf;
 #endif
 
        state.buf = buf;
        state.state = WAITOPERAND;
        state.count = 0;
        state.num = 0;
-       state.str=NULL;
+       state.str = NULL;
 
        /* make polish notation (postfix, but in reverse order) */
-       makepol( &state );
+       makepol(&state);
        if (!state.num)
-               elog( ERROR,"Empty query");
+               elog(ERROR, "Empty query");
 
        commonlen = COMPUTESIZE(state.num);
-       query = (QUERYTYPE*) palloc( commonlen );
+       query = (QUERYTYPE *) palloc(commonlen);
        query->len = commonlen;
        query->size = state.num;
        ptr = GETQUERY(query);
 
-       for(i=state.num-1; i>=0; i-- ) {
+       for (i = state.num - 1; i >= 0; i--)
+       {
                ptr[i].type = state.str->type;
                ptr[i].val = state.str->val;
                tmp = state.str->next;
-               pfree( state.str );
+               pfree(state.str);
                state.str = tmp;
        }
 
-       pos = query->size-1;
-       findoprnd( ptr, &pos );
+       pos = query->size - 1;
+       findoprnd(ptr, &pos);
 #ifdef BS_DEBUG
        initStringInfo(&pbuf);
-       for( i=0;i<query->size;i++ ) {
-               if ( ptr[i].type == OPR )
+       for (i = 0; i < query->size; i++)
+       {
+               if (ptr[i].type == OPR)
                        appendStringInfo(&pbuf, "%c(%d) ", ptr[i].val, ptr[i].left);
                else
-                       appendStringInfo(&pbuf, "%d ", ptr[i].val );
+                       appendStringInfo(&pbuf, "%d ", ptr[i].val);
        }
-       elog(DEBUG3,"POR: %s", pbuf.data);
+       elog(DEBUG3, "POR: %s", pbuf.data);
        pfree(pbuf.data);
 #endif
 
-       PG_RETURN_POINTER( query );
+       PG_RETURN_POINTER(query);
 }
 
 
 /*
  * out function
  */
-typedef struct {
-       ITEM    *curpol;
-       char *buf;
-       char *cur;
-       int4 buflen;
-} INFIX;
+typedef struct
+{
+       ITEM       *curpol;
+       char       *buf;
+       char       *cur;
+       int4            buflen;
+}      INFIX;
 
 #define RESIZEBUF(inf,addsize) while( ( inf->cur - inf->buf ) + addsize + 1 >= inf->buflen ) { \
        int4 len = inf->cur - inf->buf; \
@@ -1988,94 +2066,106 @@ typedef struct {
 }
 
 static void
-infix(INFIX *in, bool first) {
-       if ( in->curpol->type == VAL ) {
+infix(INFIX * in, bool first)
+{
+       if (in->curpol->type == VAL)
+       {
                RESIZEBUF(in, 11);
-               sprintf(in->cur, "%d", in->curpol->val );
-               in->cur = strchr( in->cur, '\0' );
+               sprintf(in->cur, "%d", in->curpol->val);
+               in->cur = strchr(in->cur, '\0');
                in->curpol--;
-       } else if ( in->curpol->val == (int4)'!' ) {
-               bool isopr = false;
+       }
+       else if (in->curpol->val == (int4) '!')
+       {
+               bool            isopr = false;
+
                RESIZEBUF(in, 1);
                *(in->cur) = '!';
                in->cur++;
                *(in->cur) = '\0';
                in->curpol--;
-               if ( in->curpol->type == OPR ) {
+               if (in->curpol->type == OPR)
+               {
                        isopr = true;
                        RESIZEBUF(in, 2);
                        sprintf(in->cur, "( ");
-                       in->cur = strchr( in->cur, '\0' );
+                       in->cur = strchr(in->cur, '\0');
                }
-               infix( in, isopr );
-               if ( isopr ) {
+               infix(in, isopr);
+               if (isopr)
+               {
                        RESIZEBUF(in, 2);
                        sprintf(in->cur, " )");
-                       in->cur = strchr( in->cur, '\0' );
+                       in->cur = strchr(in->cur, '\0');
                }
-       } else {
-               int4 op = in->curpol->val;
-               INFIX   nrm;
+       }
+       else
+       {
+               int4            op = in->curpol->val;
+               INFIX           nrm;
 
                in->curpol--;
-               if ( op == (int4)'|' && ! first) {
+               if (op == (int4) '|' && !first)
+               {
                        RESIZEBUF(in, 2);
                        sprintf(in->cur, "( ");
-                       in->cur = strchr( in->cur, '\0' );
+                       in->cur = strchr(in->cur, '\0');
                }
 
                nrm.curpol = in->curpol;
                nrm.buflen = 16;
-               nrm.cur = nrm.buf = (char*)palloc( sizeof(char) * nrm.buflen );
+               nrm.cur = nrm.buf = (char *) palloc(sizeof(char) * nrm.buflen);
 
                /* get right operand */
-               infix( &nrm, false );
+               infix(&nrm, false);
 
                /* get & print left operand */
                in->curpol = nrm.curpol;
-               infix( in, false );
+               infix(in, false);
 
-               /* print operator & right operand*/
-               RESIZEBUF(in, 3 + (nrm.cur - nrm.buf) );
+               /* print operator & right operand */
+               RESIZEBUF(in, 3 + (nrm.cur - nrm.buf));
                sprintf(in->cur, " %c %s", op, nrm.buf);
-               in->cur = strchr( in->cur, '\0' );
-               pfree( nrm.buf );
+               in->cur = strchr(in->cur, '\0');
+               pfree(nrm.buf);
 
-               if ( op == (int4)'|' && ! first) {
+               if (op == (int4) '|' && !first)
+               {
                        RESIZEBUF(in, 2);
                        sprintf(in->cur, " )");
-                       in->cur = strchr( in->cur, '\0' );
+                       in->cur = strchr(in->cur, '\0');
                }
        }
 }
 
 
 Datum
-bqarr_out(PG_FUNCTION_ARGS) {
-       QUERYTYPE       *query = (QUERYTYPE*)PG_DETOAST_DATUM(PG_GETARG_POINTER(0));
-       INFIX   nrm;
+bqarr_out(PG_FUNCTION_ARGS)
+{
+       QUERYTYPE  *query = (QUERYTYPE *) PG_DETOAST_DATUM(PG_GETARG_POINTER(0));
+       INFIX           nrm;
 
-       if ( query->size == 0 )
-               elog(ERROR,"Empty");
+       if (query->size == 0)
+               elog(ERROR, "Empty");
        nrm.curpol = GETQUERY(query) + query->size - 1;
        nrm.buflen = 32;
-       nrm.cur = nrm.buf = (char*)palloc( sizeof(char) * nrm.buflen );
+       nrm.cur = nrm.buf = (char *) palloc(sizeof(char) * nrm.buflen);
        *(nrm.cur) = '\0';
-       infix( &nrm, true );
+       infix(&nrm, true);
 
-       PG_FREE_IF_COPY(query,0);
-       PG_RETURN_POINTER( nrm.buf );
+       PG_FREE_IF_COPY(query, 0);
+       PG_RETURN_POINTER(nrm.buf);
 }
 
 static int4
-countdroptree( ITEM *q, int4 pos ) {
-       if ( q[pos].type == VAL ) {
+countdroptree(ITEM * q, int4 pos)
+{
+       if (q[pos].type == VAL)
                return 1;
-       } else if ( q[pos].val == (int4)'!' ) {
-               return 1+countdroptree(q, pos-1);
-       } else {
-               return 1 + countdroptree(q, pos-1) + countdroptree(q, pos + q[pos].left);
-       }
+       else if (q[pos].val == (int4) '!')
+               return 1 + countdroptree(q, pos - 1);
+       else
+               return 1 + countdroptree(q, pos - 1) + countdroptree(q, pos + q[pos].left);
 }
 
 /*
@@ -2084,137 +2174,161 @@ countdroptree( ITEM *q, int4 pos ) {
  * we can modify query tree for clearing
  */
 static int4
-shorterquery( ITEM *q, int4 len ) {
-       int4 index,posnot,poscor;
-       bool notisleft = false;
-       int4 drop,i;
+shorterquery(ITEM * q, int4 len)
+{
+       int4            index,
+                               posnot,
+                               poscor;
+       bool            notisleft = false;
+       int4            drop,
+                               i;
 
        /* out all '!' */
-       do {
-               index=0;
-               drop=0;
+       do
+       {
+               index = 0;
+               drop = 0;
                /* find ! */
-               for(posnot=0; posnot < len; posnot++)
-                       if ( q[posnot].type == OPR  && q[posnot].val == (int4)'!') {
-                               index=1;
+               for (posnot = 0; posnot < len; posnot++)
+                       if (q[posnot].type == OPR && q[posnot].val == (int4) '!')
+                       {
+                               index = 1;
                                break;
                        }
 
-               if ( posnot == len )
+               if (posnot == len)
                        return len;
 
                /* last operator is ! */
-               if ( posnot == len-1 )
+               if (posnot == len - 1)
                        return 0;
 
                /* find operator for this operand */
-               for( poscor=posnot+1; poscor<len; poscor++) {
-                       if ( q[poscor].type == OPR ) {
-                               if ( poscor == posnot+1 ) {
+               for (poscor = posnot + 1; poscor < len; poscor++)
+               {
+                       if (q[poscor].type == OPR)
+                       {
+                               if (poscor == posnot + 1)
+                               {
                                        notisleft = false;
                                        break;
-                               } else if ( q[poscor].left + poscor == posnot ) {
+                               }
+                               else if (q[poscor].left + poscor == posnot)
+                               {
                                        notisleft = true;
                                        break;
                                }
                        }
                }
-               if ( q[poscor].val == (int4)'!' ) {
+               if (q[poscor].val == (int4) '!')
+               {
                        drop = countdroptree(q, poscor);
-                       q[poscor-1].type=VAL;
-                       for(i=poscor+1;i<len;i++)
-                               if ( q[i].type == OPR && q[i].left + i <= poscor )
+                       q[poscor - 1].type = VAL;
+                       for (i = poscor + 1; i < len; i++)
+                               if (q[i].type == OPR && q[i].left + i <= poscor)
                                        q[i].left += drop - 2;
-                       memcpy( (void*)&q[poscor-drop+1],
-                               (void*)&q[poscor-1],
-                               sizeof(ITEM) * ( len - (poscor-1) ));
+                       memcpy((void *) &q[poscor - drop + 1],
+                                  (void *) &q[poscor - 1],
+                                  sizeof(ITEM) * (len - (poscor - 1)));
                        len -= drop - 2;
-               } else if ( q[poscor].val == (int4)'|' ) {
+               }
+               else if (q[poscor].val == (int4) '|')
+               {
                        drop = countdroptree(q, poscor);
-                       q[poscor-1].type=VAL;
-                       q[poscor].val=(int4)'!';
-                       q[poscor].left=-1;
-                       for(i=poscor+1;i<len;i++)
-                               if ( q[i].type == OPR && q[i].left + i < poscor )
+                       q[poscor - 1].type = VAL;
+                       q[poscor].val = (int4) '!';
+                       q[poscor].left = -1;
+                       for (i = poscor + 1; i < len; i++)
+                               if (q[i].type == OPR && q[i].left + i < poscor)
                                        q[i].left += drop - 2;
-                       memcpy( (void*)&q[poscor-drop+1],
-                               (void*)&q[poscor-1],
-                               sizeof(ITEM) * ( len - (poscor-1) ));
+                       memcpy((void *) &q[poscor - drop + 1],
+                                  (void *) &q[poscor - 1],
+                                  sizeof(ITEM) * (len - (poscor - 1)));
                        len -= drop - 2;
-               } else { /* &-operator */
+               }
+               else
+               {                                               /* &-operator */
                        if (
-                                       (notisleft && q[poscor-1].type == OPR &&
-                                               q[poscor-1].val == (int4)'!' ) ||
-                                       (!notisleft && q[poscor+q[poscor].left].type == OPR &&
-                                               q[poscor+q[poscor].left].val == (int4)'!' )
-                               ) { /* drop subtree */
+                               (notisleft && q[poscor - 1].type == OPR &&
+                                q[poscor - 1].val == (int4) '!') ||
+                               (!notisleft && q[poscor + q[poscor].left].type == OPR &&
+                                q[poscor + q[poscor].left].val == (int4) '!')
+                               )
+                       {                                       /* drop subtree */
                                drop = countdroptree(q, poscor);
-                               q[poscor-1].type=VAL;
-                               q[poscor].val=(int4)'!';
-                               q[poscor].left=-1;
-                               for(i=poscor+1;i<len;i++)
-                                       if ( q[i].type == OPR && q[i].left + i < poscor )
+                               q[poscor - 1].type = VAL;
+                               q[poscor].val = (int4) '!';
+                               q[poscor].left = -1;
+                               for (i = poscor + 1; i < len; i++)
+                                       if (q[i].type == OPR && q[i].left + i < poscor)
                                                q[i].left += drop - 2;
-                               memcpy( (void*)&q[poscor-drop+1],
-                                       (void*)&q[poscor-1],
-                                       sizeof(ITEM) * ( len - (poscor-1) ));
+                               memcpy((void *) &q[poscor - drop + 1],
+                                          (void *) &q[poscor - 1],
+                                          sizeof(ITEM) * (len - (poscor - 1)));
                                len -= drop - 2;
-                       } else { /* drop only operator */
-                               int4 subtreepos = ( notisleft ) ?
-                                       poscor-1 : poscor+q[poscor].left;
-                               int4 subtreelen = countdroptree( q, subtreepos );
+                       }
+                       else
+                       {                                       /* drop only operator */
+                               int4            subtreepos = (notisleft) ?
+                               poscor - 1 : poscor + q[poscor].left;
+                               int4            subtreelen = countdroptree(q, subtreepos);
+
                                drop = countdroptree(q, poscor);
-                               for(i=poscor+1;i<len;i++)
-                                       if ( q[i].type == OPR && q[i].left + i < poscor )
+                               for (i = poscor + 1; i < len; i++)
+                                       if (q[i].type == OPR && q[i].left + i < poscor)
                                                q[i].left += drop - subtreelen;
-                               memcpy( (void*)&q[ subtreepos+1 ],
-                                       (void*)&q[poscor+1],
-                                       sizeof(ITEM)*( len - (poscor-1) ) );
-                               memcpy( (void*)&q[ poscor-drop+1 ],
-                                       (void*)&q[subtreepos-subtreelen+1],
-                                       sizeof(ITEM)*( len - (drop-subtreelen) ) );
+                               memcpy((void *) &q[subtreepos + 1],
+                                          (void *) &q[poscor + 1],
+                                          sizeof(ITEM) * (len - (poscor - 1)));
+                               memcpy((void *) &q[poscor - drop + 1],
+                                          (void *) &q[subtreepos - subtreelen + 1],
+                                          sizeof(ITEM) * (len - (drop - subtreelen)));
                                len -= drop - subtreelen;
                        }
                }
-       } while( index );
+       } while (index);
        return len;
 }
 
 
 Datum
-querytree(PG_FUNCTION_ARGS) {
-       QUERYTYPE       *query = (QUERYTYPE*)PG_DETOAST_DATUM(PG_GETARG_POINTER(0));
-       INFIX   nrm;
-       text    *res;
-       ITEM    *q;
-       int4    len;
-
-       if ( query->size == 0 )
-               elog(ERROR,"Empty");
-
-       q = (ITEM*)palloc( sizeof(ITEM) * query->size );
-       memcpy( (void*)q, GETQUERY(query), sizeof(ITEM) * query->size );
-       len = shorterquery( q, query->size );
-       PG_FREE_IF_COPY(query,0);
-
-       if ( len == 0 ) {
-               res = (text*) palloc( 1 + VARHDRSZ );
+querytree(PG_FUNCTION_ARGS)
+{
+       QUERYTYPE  *query = (QUERYTYPE *) PG_DETOAST_DATUM(PG_GETARG_POINTER(0));
+       INFIX           nrm;
+       text       *res;
+       ITEM       *q;
+       int4            len;
+
+       if (query->size == 0)
+               elog(ERROR, "Empty");
+
+       q = (ITEM *) palloc(sizeof(ITEM) * query->size);
+       memcpy((void *) q, GETQUERY(query), sizeof(ITEM) * query->size);
+       len = shorterquery(q, query->size);
+       PG_FREE_IF_COPY(query, 0);
+
+       if (len == 0)
+       {
+               res = (text *) palloc(1 + VARHDRSZ);
                VARATT_SIZEP(res) = 1 + VARHDRSZ;
-               *((char*)VARDATA(res)) = 'T';
-       } else {
+               *((char *) VARDATA(res)) = 'T';
+       }
+       else
+       {
                nrm.curpol = q + len - 1;
                nrm.buflen = 32;
-               nrm.cur = nrm.buf = (char*)palloc( sizeof(char) * nrm.buflen );
+               nrm.cur = nrm.buf = (char *) palloc(sizeof(char) * nrm.buflen);
                *(nrm.cur) = '\0';
-               infix( &nrm, true );
+               infix(&nrm, true);
 
-               res = (text*) palloc( nrm.cur-nrm.buf + VARHDRSZ );
-               VARATT_SIZEP(res) = nrm.cur-nrm.buf + VARHDRSZ;
-               strncpy( VARDATA(res), nrm.buf, nrm.cur-nrm.buf );
+               res = (text *) palloc(nrm.cur - nrm.buf + VARHDRSZ);
+               VARATT_SIZEP(res) = nrm.cur - nrm.buf + VARHDRSZ;
+               strncpy(VARDATA(res), nrm.buf, nrm.cur - nrm.buf);
        }
        pfree(q);
 
-       PG_RETURN_POINTER( res );
+       PG_RETURN_POINTER(res);
 }
 
 /*
@@ -2225,72 +2339,84 @@ static ArrayType *intarray_add_elem(ArrayType *a, int32 elem);
 static ArrayType *intarray_concat_arrays(ArrayType *a, ArrayType *b);
 static ArrayType *int_to_intset(int32 elem);
 
-PG_FUNCTION_INFO_V1( intset );
-PG_FUNCTION_INFO_V1( icount );
-PG_FUNCTION_INFO_V1( sort );
-PG_FUNCTION_INFO_V1( sort_asc );
-PG_FUNCTION_INFO_V1( sort_desc );
-PG_FUNCTION_INFO_V1( uniq );
-PG_FUNCTION_INFO_V1( idx );
-PG_FUNCTION_INFO_V1( subarray );
-PG_FUNCTION_INFO_V1( intarray_push_elem );
-PG_FUNCTION_INFO_V1( intarray_push_array );
-PG_FUNCTION_INFO_V1( intarray_del_elem );
-PG_FUNCTION_INFO_V1( intset_union_elem );
-PG_FUNCTION_INFO_V1( intset_subtract );
-Datum intset(PG_FUNCTION_ARGS);
-Datum icount(PG_FUNCTION_ARGS);
-Datum sort(PG_FUNCTION_ARGS);
-Datum sort_asc(PG_FUNCTION_ARGS);
-Datum sort_desc(PG_FUNCTION_ARGS);
-Datum uniq(PG_FUNCTION_ARGS);
-Datum idx(PG_FUNCTION_ARGS);
-Datum subarray(PG_FUNCTION_ARGS);
-Datum intarray_push_elem(PG_FUNCTION_ARGS);
-Datum intarray_push_array(PG_FUNCTION_ARGS);
-Datum intarray_del_elem(PG_FUNCTION_ARGS);
-Datum intset_union_elem(PG_FUNCTION_ARGS);
-Datum intset_subtract(PG_FUNCTION_ARGS);
+PG_FUNCTION_INFO_V1(intset);
+PG_FUNCTION_INFO_V1(icount);
+PG_FUNCTION_INFO_V1(sort);
+PG_FUNCTION_INFO_V1(sort_asc);
+PG_FUNCTION_INFO_V1(sort_desc);
+PG_FUNCTION_INFO_V1(uniq);
+PG_FUNCTION_INFO_V1(idx);
+PG_FUNCTION_INFO_V1(subarray);
+PG_FUNCTION_INFO_V1(intarray_push_elem);
+PG_FUNCTION_INFO_V1(intarray_push_array);
+PG_FUNCTION_INFO_V1(intarray_del_elem);
+PG_FUNCTION_INFO_V1(intset_union_elem);
+PG_FUNCTION_INFO_V1(intset_subtract);
+Datum          intset(PG_FUNCTION_ARGS);
+Datum          icount(PG_FUNCTION_ARGS);
+Datum          sort(PG_FUNCTION_ARGS);
+Datum          sort_asc(PG_FUNCTION_ARGS);
+Datum          sort_desc(PG_FUNCTION_ARGS);
+Datum          uniq(PG_FUNCTION_ARGS);
+Datum          idx(PG_FUNCTION_ARGS);
+Datum          subarray(PG_FUNCTION_ARGS);
+Datum          intarray_push_elem(PG_FUNCTION_ARGS);
+Datum          intarray_push_array(PG_FUNCTION_ARGS);
+Datum          intarray_del_elem(PG_FUNCTION_ARGS);
+Datum          intset_union_elem(PG_FUNCTION_ARGS);
+Datum          intset_subtract(PG_FUNCTION_ARGS);
 
 static int32
-intarray_match_first(ArrayType *a, int32 elem) {
-       int32 *aa, c, i;
-       c  = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
+intarray_match_first(ArrayType *a, int32 elem)
+{
+       int32      *aa,
+                               c,
+                               i;
+
+       c = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
        aa = ARRPTR(a);
        for (i = 0; i < c; i++)
-               if (aa[i] == elem) return (i + 1);
+               if (aa[i] == elem)
+                       return (i + 1);
        return 0;
 }
 
 static ArrayType *
-intarray_add_elem(ArrayType *a, int32 elem) {
-       ArrayType *result;
-       int32 *r;
-       int32 c = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
+intarray_add_elem(ArrayType *a, int32 elem)
+{
+       ArrayType  *result;
+       int32      *r;
+       int32           c = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
+
        result = new_intArrayType(c + 1);
        r = ARRPTR(result);
-       if (c > 0) memcpy(r, ARRPTR(a), c * sizeof(int32));
+       if (c > 0)
+               memcpy(r, ARRPTR(a), c * sizeof(int32));
        r[c] = elem;
        return result;
 }
 
 static ArrayType *
-intarray_concat_arrays(ArrayType *a, ArrayType *b) {
-       ArrayType *result;
-       int32 ac = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
-       int32 bc = (ARRISVOID(b)) ? 0 : ARRNELEMS(b);
-       result = new_intArrayType(ac+bc);
-       if ( ac )
+intarray_concat_arrays(ArrayType *a, ArrayType *b)
+{
+       ArrayType  *result;
+       int32           ac = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
+       int32           bc = (ARRISVOID(b)) ? 0 : ARRNELEMS(b);
+
+       result = new_intArrayType(ac + bc);
+       if (ac)
                memcpy(ARRPTR(result), ARRPTR(a), ac * sizeof(int32));
-       if ( bc )
+       if (bc)
                memcpy(ARRPTR(result) + ac, ARRPTR(b), bc * sizeof(int32));
        return result;
 }
 
 static ArrayType *
-int_to_intset(int32 n) {
-       ArrayType *result;
-       int32 *aa;
+int_to_intset(int32 n)
+{
+       ArrayType  *result;
+       int32      *aa;
+
        result = new_intArrayType(1);
        aa = ARRPTR(result);
        aa[0] = n;
@@ -2298,67 +2424,82 @@ int_to_intset(int32 n) {
 }
 
 static int
-compASC(const void *a, const void *b) {
-       if ( *(int4*)a == *(int4*)b ) return 0;
-       return ( *(int4*)a > *(int4*)b ) ? 1 : -1;
+compASC(const void *a, const void *b)
+{
+       if (*(int4 *) a == *(int4 *) b)
+               return 0;
+       return (*(int4 *) a > *(int4 *) b) ? 1 : -1;
 }
 
 static int
-compDESC(const void *a, const void *b) {
-       if ( *(int4*)a == *(int4*)b ) return 0;
-       return ( *(int4*)a < *(int4*)b ) ? 1 : -1;
+compDESC(const void *a, const void *b)
+{
+       if (*(int4 *) a == *(int4 *) b)
+               return 0;
+       return (*(int4 *) a < *(int4 *) b) ? 1 : -1;
 }
 
-#define QSORT(a, direction)                                    \
+#define QSORT(a, direction)                                            \
 if (ARRNELEMS(a) > 1)                                          \
-       qsort((void*)ARRPTR(a), ARRNELEMS(a),sizeof(int4),      \
+       qsort((void*)ARRPTR(a), ARRNELEMS(a),sizeof(int4),      \
                (direction) ? compASC : compDESC )
 
 #define UNIX_UNIQ(a) a = resize_intArrayType(a, unix_uniq(ARRPTR(a), ARRNELEMS(a)))
 
 static int32
-unix_uniq(int32 *array, int32 count) {
-       register int32 i, k = 0;
+unix_uniq(int32 *array, int32 count)
+{
+       register int32 i,
+                               k = 0;
+
        for (i = 1; i < count; i++)
-               if (array[k] != array[i]) {
+               if (array[k] != array[i])
+               {
                        k++;
-                       if (i > k) array[k] = array[i];
+                       if (i > k)
+                               array[k] = array[i];
                }
-       return (k+1);
+       return (k + 1);
 }
 
 Datum
-intset(PG_FUNCTION_ARGS) {
-  PG_RETURN_POINTER(int_to_intset(PG_GETARG_INT32(0)));
+intset(PG_FUNCTION_ARGS)
+{
+       PG_RETURN_POINTER(int_to_intset(PG_GETARG_INT32(0)));
 }
 
 Datum
-icount(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
-       int32 count = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
+icount(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
+       int32           count = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
+
        PG_FREE_IF_COPY(a, 0);
        PG_RETURN_INT32(count);
 }
 
 Datum
-sort(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
-       text *dirstr = ( fcinfo->nargs==2 ) ? PG_GETARG_TEXT_P(1) : NULL;
-       int32 dc = ( dirstr ) ? VARSIZE(dirstr)-VARHDRSZ : 0;
-       char *d = ( dirstr ) ? VARDATA(dirstr) : NULL;
-       int dir = -1;
-       if (ARRISVOID(a) || ARRNELEMS(a) < 2) PG_RETURN_POINTER(a);
-
-       if (dirstr==NULL || (dc == 3
-        && (d[0] == 'A' || d[0] == 'a')
-        && (d[1] == 'S' || d[1] == 's')
-        && (d[2] == 'C' || d[2] == 'c')))
+sort(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+       text       *dirstr = (fcinfo->nargs == 2) ? PG_GETARG_TEXT_P(1) : NULL;
+       int32           dc = (dirstr) ? VARSIZE(dirstr) - VARHDRSZ : 0;
+       char       *d = (dirstr) ? VARDATA(dirstr) : NULL;
+       int                     dir = -1;
+
+       if (ARRISVOID(a) || ARRNELEMS(a) < 2)
+               PG_RETURN_POINTER(a);
+
+       if (dirstr == NULL || (dc == 3
+                                                  && (d[0] == 'A' || d[0] == 'a')
+                                                  && (d[1] == 'S' || d[1] == 's')
+                                                  && (d[2] == 'C' || d[2] == 'c')))
                dir = 1;
        else if (dc == 4
-        && (d[0] == 'D' || d[0] == 'd')
-        && (d[1] == 'E' || d[1] == 'e')
-        && (d[2] == 'S' || d[2] == 's')
-        && (d[3] == 'C' || d[3] == 'c'))
+                        && (d[0] == 'D' || d[0] == 'd')
+                        && (d[1] == 'E' || d[1] == 'e')
+                        && (d[2] == 'S' || d[2] == 's')
+                        && (d[3] == 'C' || d[3] == 'c'))
                dir = 0;
        if (dir == -1)
                elog(ERROR, "Invalid second parameter in function sort. It must be 'ASC' or 'DESC'.");
@@ -2367,97 +2508,116 @@ sort(PG_FUNCTION_ARGS) {
 }
 
 Datum
-sort_asc(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
-       if (ARRISVOID(a)) PG_RETURN_POINTER(a);
+sort_asc(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+
+       if (ARRISVOID(a))
+               PG_RETURN_POINTER(a);
        QSORT(a, 1);
        PG_RETURN_POINTER(a);
 }
 
 Datum
-sort_desc(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
-       if (ARRISVOID(a)) PG_RETURN_POINTER(a);
+sort_desc(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+
+       if (ARRISVOID(a))
+               PG_RETURN_POINTER(a);
        QSORT(a, 0);
        PG_RETURN_POINTER(a);
 }
 
 Datum
-uniq(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
-       if (ARRISVOID(a) || ARRNELEMS(a) < 2) PG_RETURN_POINTER(a);
+uniq(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+
+       if (ARRISVOID(a) || ARRNELEMS(a) < 2)
+               PG_RETURN_POINTER(a);
        UNIX_UNIQ(a);
        PG_RETURN_POINTER(a);
 }
 
 Datum
-idx(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
-       int32 result = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
-       if (result) result = intarray_match_first(a, PG_GETARG_INT32(1));
+idx(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
+       int32           result = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
+
+       if (result)
+               result = intarray_match_first(a, PG_GETARG_INT32(1));
        PG_FREE_IF_COPY(a, 0);
        PG_RETURN_INT32(result);
 }
 
 Datum
-subarray(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
-       ArrayType *result;
-       int32 start = ( PG_GETARG_INT32(1) > 0 ) ? PG_GETARG_INT32(1)-1 : PG_GETARG_INT32(1);
-       int32 len = ( fcinfo->nargs==3 ) ? PG_GETARG_INT32(2) : 0;
-       int32 end = 0;
-       int32 c;
-
-       if ( ARRISVOID(a) ) {
+subarray(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
+       ArrayType  *result;
+       int32           start = (PG_GETARG_INT32(1) > 0) ? PG_GETARG_INT32(1) - 1 : PG_GETARG_INT32(1);
+       int32           len = (fcinfo->nargs == 3) ? PG_GETARG_INT32(2) : 0;
+       int32           end = 0;
+       int32           c;
+
+       if (ARRISVOID(a))
+       {
                PG_FREE_IF_COPY(a, 0);
-               PG_RETURN_POINTER( new_intArrayType(0) );
+               PG_RETURN_POINTER(new_intArrayType(0));
        }
 
        c = ARRNELEMS(a);
-       
-       if ( start < 0 )
+
+       if (start < 0)
                start = c + start;
 
-       if ( len < 0 )
+       if (len < 0)
                end = c + len;
-       else if ( len == 0 )
+       else if (len == 0)
                end = c;
        else
                end = start + len;
 
-       if ( end > c )
-               end = c; 
+       if (end > c)
+               end = c;
 
-       if ( start < 0 )
+       if (start < 0)
                start = 0;
 
-       if ( start >= end || end <= 0 ) { 
+       if (start >= end || end <= 0)
+       {
                PG_FREE_IF_COPY(a, 0);
-               PG_RETURN_POINTER( new_intArrayType(0) );
+               PG_RETURN_POINTER(new_intArrayType(0));
        }
 
 
-       result = new_intArrayType(end-start);
-       if (end-start > 0) 
-               memcpy(ARRPTR(result), ARRPTR(a) + start, (end-start) * sizeof(int32));
+       result = new_intArrayType(end - start);
+       if (end - start > 0)
+               memcpy(ARRPTR(result), ARRPTR(a) + start, (end - start) * sizeof(int32));
        PG_FREE_IF_COPY(a, 0);
        PG_RETURN_POINTER(result);
 }
 
 Datum
-intarray_push_elem(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
-       ArrayType *result;
+intarray_push_elem(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
+       ArrayType  *result;
+
        result = intarray_add_elem(a, PG_GETARG_INT32(1));
        PG_FREE_IF_COPY(a, 0);
        PG_RETURN_POINTER(result);
 }
 
 Datum
-intarray_push_array(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
-       ArrayType *b = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
-       ArrayType *result;
+intarray_push_array(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
+       ArrayType  *b = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
+       ArrayType  *result;
+
        result = intarray_concat_arrays(a, b);
        PG_FREE_IF_COPY(a, 0);
        PG_FREE_IF_COPY(b, 1);
@@ -2465,25 +2625,34 @@ intarray_push_array(PG_FUNCTION_ARGS) {
 }
 
 Datum
-intarray_del_elem(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
-       int32 c = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
-       int32 *aa = ARRPTR(a);
-       int32 n = 0, i;
-       int32 elem = PG_GETARG_INT32(1);
+intarray_del_elem(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+       int32           c = (ARRISVOID(a)) ? 0 : ARRNELEMS(a);
+       int32      *aa = ARRPTR(a);
+       int32           n = 0,
+                               i;
+       int32           elem = PG_GETARG_INT32(1);
+
        for (i = 0; i < c; i++)
-               if (aa[i] != elem) {
-                       if (i > n) aa[n++] = aa[i];
-                       else n++;
+               if (aa[i] != elem)
+               {
+                       if (i > n)
+                               aa[n++] = aa[i];
+                       else
+                               n++;
                }
-       if (c > 0) a = resize_intArrayType(a, n);
+       if (c > 0)
+               a = resize_intArrayType(a, n);
        PG_RETURN_POINTER(a);
 }
 
 Datum
-intset_union_elem(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
-       ArrayType *result;
+intset_union_elem(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
+       ArrayType  *result;
+
        result = intarray_add_elem(a, PG_GETARG_INT32(1));
        PG_FREE_IF_COPY(a, 0);
        QSORT(result, 1);
@@ -2492,27 +2661,44 @@ intset_union_elem(PG_FUNCTION_ARGS) {
 }
 
 Datum
-intset_subtract(PG_FUNCTION_ARGS) {
-       ArrayType *a = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
-       ArrayType *b = (ArrayType*)DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
-       ArrayType *result;
-       int32 ca = ARRISVOID(a);
-       int32 cb = ARRISVOID(b);
-       int32 *aa, *bb, *r;
-       int32 n = 0, i = 0, k = 0;
-       QSORT(a, 1); UNIX_UNIQ(a); ca = ARRNELEMS(a);
-       QSORT(b, 1); UNIX_UNIQ(b); cb = ARRNELEMS(b);
+intset_subtract(PG_FUNCTION_ARGS)
+{
+       ArrayType  *a = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0)));
+       ArrayType  *b = (ArrayType *) DatumGetPointer(PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(1)));
+       ArrayType  *result;
+       int32           ca = ARRISVOID(a);
+       int32           cb = ARRISVOID(b);
+       int32      *aa,
+                          *bb,
+                          *r;
+       int32           n = 0,
+                               i = 0,
+                               k = 0;
+
+       QSORT(a, 1);
+       UNIX_UNIQ(a);
+       ca = ARRNELEMS(a);
+       QSORT(b, 1);
+       UNIX_UNIQ(b);
+       cb = ARRNELEMS(b);
        result = new_intArrayType(ca);
        aa = ARRPTR(a);
        bb = ARRPTR(b);
        r = ARRPTR(result);
-       while (i < ca) {
-               if (k == cb || aa[i] < bb[k]) r[n++] = aa[i++];
-               else if (aa[i] == bb[k]) { i++; k++; }
-               else k++;
+       while (i < ca)
+       {
+               if (k == cb || aa[i] < bb[k])
+                       r[n++] = aa[i++];
+               else if (aa[i] == bb[k])
+               {
+                       i++;
+                       k++;
+               }
+               else
+                       k++;
        }
        result = resize_intArrayType(result, n);
-       pfree(a); pfree(b);
+       pfree(a);
+       pfree(b);
        PG_RETURN_POINTER(result);
 }
-
index 27bd057..d8efd80 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * GiST support for ltree[] 
+ * GiST support for ltree[]
  * Teodor Sigaev <teodor@stack.net>
  */
 
 
 #include "crc32.h"
 
-PG_FUNCTION_INFO_V1( _ltree_compress );
-Datum   _ltree_compress(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( _ltree_same );
-Datum   _ltree_same(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( _ltree_union );
-Datum   _ltree_union(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( _ltree_penalty );
-Datum   _ltree_penalty(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( _ltree_picksplit );
-Datum   _ltree_picksplit(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( _ltree_consistent );
-Datum   _ltree_consistent(PG_FUNCTION_ARGS);
+PG_FUNCTION_INFO_V1(_ltree_compress);
+Datum          _ltree_compress(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(_ltree_same);
+Datum          _ltree_same(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(_ltree_union);
+Datum          _ltree_union(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(_ltree_penalty);
+Datum          _ltree_penalty(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(_ltree_picksplit);
+Datum          _ltree_picksplit(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(_ltree_consistent);
+Datum          _ltree_consistent(PG_FUNCTION_ARGS);
 
 #define GETENTRY(vec,pos) ((ltree_gist *) DatumGetPointer(((GISTENTRY *) VARDATA(vec))[(pos)].key))
 #define NEXTVAL(x) ( (ltree*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) )
-#define SUMBIT(val) (        \
+#define SUMBIT(val) (           \
        GETBITBYTE(val,0) + \
        GETBITBYTE(val,1) + \
        GETBITBYTE(val,2) + \
@@ -34,235 +39,280 @@ Datum   _ltree_consistent(PG_FUNCTION_ARGS);
        GETBITBYTE(val,4) + \
        GETBITBYTE(val,5) + \
        GETBITBYTE(val,6) + \
-       GETBITBYTE(val,7)   \
+       GETBITBYTE(val,7)       \
 )
 #define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
 
 static void
-hashing(BITVECP sign, ltree *t) {
-       int tlen = t->numlevel;
+hashing(BITVECP sign, ltree * t)
+{
+       int                     tlen = t->numlevel;
        ltree_level *cur = LTREE_FIRST(t);
-       int  hash;
+       int                     hash;
 
-       while(tlen > 0) {
-               hash = ltree_crc32_sz( cur->name, cur->len );
-               AHASH( sign, hash );
+       while (tlen > 0)
+       {
+               hash = ltree_crc32_sz(cur->name, cur->len);
+               AHASH(sign, hash);
                cur = LEVEL_NEXT(cur);
                tlen--;
        }
 }
 
-Datum   
-_ltree_compress(PG_FUNCTION_ARGS) {
-       GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
+Datum
+_ltree_compress(PG_FUNCTION_ARGS)
+{
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
        GISTENTRY  *retval = entry;
 
-       if ( entry->leafkey ) { /* ltree */
-               ltree_gist      *key;
-               ArrayType       *val = DatumGetArrayTypeP(entry->key);
-               int4 len = LTG_HDRSIZE + ASIGLEN;
-               int num=ArrayGetNItems( ARR_NDIM(val), ARR_DIMS(val) );
-               ltree   *item = (ltree*)ARR_DATA_PTR(val);
+       if (entry->leafkey)
+       {                                                       /* ltree */
+               ltree_gist *key;
+               ArrayType  *val = DatumGetArrayTypeP(entry->key);
+               int4            len = LTG_HDRSIZE + ASIGLEN;
+               int                     num = ArrayGetNItems(ARR_NDIM(val), ARR_DIMS(val));
+               ltree      *item = (ltree *) ARR_DATA_PTR(val);
 
-               if ( ARR_NDIM(val) != 1 )
-                        elog(ERROR,"Dimension of array != 1");
+               if (ARR_NDIM(val) != 1)
+                       elog(ERROR, "Dimension of array != 1");
 
-               key = (ltree_gist*)palloc( len );
+               key = (ltree_gist *) palloc(len);
                key->len = len;
                key->flag = 0;
 
-               MemSet( LTG_SIGN(key), 0, sizeof(ASIGLEN) );
-               while( num>0 ) {
+               MemSet(LTG_SIGN(key), 0, sizeof(ASIGLEN));
+               while (num > 0)
+               {
                        hashing(LTG_SIGN(key), item);
                        num--;
                        item = NEXTVAL(item);
                }
 
-               if ( PointerGetDatum(val) != entry->key )
+               if (PointerGetDatum(val) != entry->key)
                        pfree(val);
 
-               retval = (GISTENTRY*)palloc( sizeof(GISTENTRY) );
+               retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
                gistentryinit(*retval, PointerGetDatum(key),
-                       entry->rel, entry->page,
-                       entry->offset, key->len, FALSE);
-       } else {
-               int4 i,len;
-               ltree_gist      *key;
+                                         entry->rel, entry->page,
+                                         entry->offset, key->len, FALSE);
+       }
+       else
+       {
+               int4            i,
+                                       len;
+               ltree_gist *key;
 
-               BITVECP sign = LTG_SIGN(DatumGetPointer( entry->key ) );
+               BITVECP         sign = LTG_SIGN(DatumGetPointer(entry->key));
 
                ALOOPBYTE(
-                       if ( sign[i] != 0xff )
-                               PG_RETURN_POINTER(retval);
+                                 if (sign[i] != 0xff)
+                                 PG_RETURN_POINTER(retval);
                );
 
-               len = LTG_HDRSIZE; 
-               key = (ltree_gist*)palloc( len );
+               len = LTG_HDRSIZE;
+               key = (ltree_gist *) palloc(len);
                key->len = len;
                key->flag = LTG_ALLTRUE;
 
-               retval = (GISTENTRY*)palloc( sizeof(GISTENTRY) );
+               retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
                gistentryinit(*retval, PointerGetDatum(key),
-                       entry->rel, entry->page,
-                       entry->offset, key->len, FALSE);
+                                         entry->rel, entry->page,
+                                         entry->offset, key->len, FALSE);
        }
        PG_RETURN_POINTER(retval);
 }
 
-Datum   
-_ltree_same(PG_FUNCTION_ARGS) {
-       ltree_gist*     a=(ltree_gist*)PG_GETARG_POINTER(0);
-       ltree_gist*     b=(ltree_gist*)PG_GETARG_POINTER(1);
-       bool *result = (bool *)PG_GETARG_POINTER(2);
+Datum
+_ltree_same(PG_FUNCTION_ARGS)
+{
+       ltree_gist *a = (ltree_gist *) PG_GETARG_POINTER(0);
+       ltree_gist *b = (ltree_gist *) PG_GETARG_POINTER(1);
+       bool       *result = (bool *) PG_GETARG_POINTER(2);
 
-       if ( LTG_ISALLTRUE(a) && LTG_ISALLTRUE(b) ) {
+       if (LTG_ISALLTRUE(a) && LTG_ISALLTRUE(b))
                *result = true;
-       } else if ( LTG_ISALLTRUE(a) ) {
+       else if (LTG_ISALLTRUE(a))
                *result = false;
-       } else if ( LTG_ISALLTRUE(b) ) {
+       else if (LTG_ISALLTRUE(b))
                *result = false;
-       } else {
-               int4 i;
-               BITVECP sa=LTG_SIGN(a), sb=LTG_SIGN(b);
+       else
+       {
+               int4            i;
+               BITVECP         sa = LTG_SIGN(a),
+                                       sb = LTG_SIGN(b);
+
                *result = true;
                ALOOPBYTE(
-                       if ( sa[i] != sb[i] ) {
-                               *result = false;
-                               break;
-                       }
+                                 if (sa[i] != sb[i])
+                                 {
+                       *result = false;
+                       break;
+               }
                );
-       } 
-       PG_RETURN_POINTER(result); 
+       }
+       PG_RETURN_POINTER(result);
 }
 
-static int4 
-unionkey( BITVECP sbase, ltree_gist *add ) {
-       int4    i;
-       BITVECP sadd = LTG_SIGN( add );
+static int4
+unionkey(BITVECP sbase, ltree_gist * add)
+{
+       int4            i;
+       BITVECP         sadd = LTG_SIGN(add);
 
-       if ( LTG_ISALLTRUE(add) )
+       if (LTG_ISALLTRUE(add))
                return 1;
 
        ALOOPBYTE(
-               sbase[i] |= sadd[i];
+                         sbase[i] |= sadd[i];
        );
        return 0;
 }
 
-Datum   
-_ltree_union(PG_FUNCTION_ARGS) {
-       bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
-       int *size = (int *) PG_GETARG_POINTER(1);
-       ABITVEC base;
-       int4 len = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
-       int4 i;
-       int4 flag = 0;
-       ltree_gist      *result;
-
-       MemSet( (void*)base, 0, sizeof(ABITVEC) );
-       for(i=0;i<len;i++) {
-               if ( unionkey( base, GETENTRY(entryvec, i) ) ) {
+Datum
+_ltree_union(PG_FUNCTION_ARGS)
+{
+       bytea      *entryvec = (bytea *) PG_GETARG_POINTER(0);
+       int                *size = (int *) PG_GETARG_POINTER(1);
+       ABITVEC         base;
+       int4            len = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
+       int4            i;
+       int4            flag = 0;
+       ltree_gist *result;
+
+       MemSet((void *) base, 0, sizeof(ABITVEC));
+       for (i = 0; i < len; i++)
+       {
+               if (unionkey(base, GETENTRY(entryvec, i)))
+               {
                        flag = LTG_ALLTRUE;
                        break;
                }
        }
 
-       len = LTG_HDRSIZE + ( ( flag & LTG_ALLTRUE ) ? 0 : ASIGLEN );
-       result = (ltree_gist*)palloc( len );
+       len = LTG_HDRSIZE + ((flag & LTG_ALLTRUE) ? 0 : ASIGLEN);
+       result = (ltree_gist *) palloc(len);
        *size = result->len = len;
        result->flag = flag;
-       if ( ! LTG_ISALLTRUE(result) )
-               memcpy((void*)LTG_SIGN(result), (void*)base, sizeof( ABITVEC ) );
+       if (!LTG_ISALLTRUE(result))
+               memcpy((void *) LTG_SIGN(result), (void *) base, sizeof(ABITVEC));
 
-       PG_RETURN_POINTER(result);      
+       PG_RETURN_POINTER(result);
 }
 
 static int4
-sizebitvec( BITVECP sign ) {
-       int4 size=0, i;
+sizebitvec(BITVECP sign)
+{
+       int4            size = 0,
+                               i;
+
        ALOOPBYTE(
-               size += SUMBIT(*(char*)sign);
-               sign = (BITVECP) ( ((char*)sign) + 1 );
+                         size += SUMBIT(*(char *) sign);
+       sign = (BITVECP) (((char *) sign) + 1);
        );
        return size;
 }
 
-Datum   
-_ltree_penalty(PG_FUNCTION_ARGS) {
-       ltree_gist *origval = (ltree_gist*)DatumGetPointer( ( (GISTENTRY *)PG_GETARG_POINTER(0) )->key );
-       ltree_gist *newval  = (ltree_gist*)DatumGetPointer( ( (GISTENTRY *)PG_GETARG_POINTER(1) )->key );
-       float  *penalty = (float *)    PG_GETARG_POINTER(2);
-       BITVECP orig = LTG_SIGN(origval);
+Datum
+_ltree_penalty(PG_FUNCTION_ARGS)
+{
+       ltree_gist *origval = (ltree_gist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key);
+       ltree_gist *newval = (ltree_gist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key);
+       float      *penalty = (float *) PG_GETARG_POINTER(2);
+       BITVECP         orig = LTG_SIGN(origval);
 
-       if ( LTG_ISALLTRUE(origval) ) {
+       if (LTG_ISALLTRUE(origval))
+       {
                *penalty = 0.0;
-               PG_RETURN_POINTER( penalty );
+               PG_RETURN_POINTER(penalty);
        }
 
-       if ( LTG_ISALLTRUE(newval) ) {
-               *penalty = (float) (ASIGLENBIT - sizebitvec( orig ) );
-       } else {
+       if (LTG_ISALLTRUE(newval))
+               *penalty = (float) (ASIGLENBIT - sizebitvec(orig));
+       else
+       {
                unsigned char valtmp;
-               BITVECP nval = LTG_SIGN(newval);
-               int4 i, unionsize=0;
+               BITVECP         nval = LTG_SIGN(newval);
+               int4            i,
+                                       unionsize = 0;
 
                ALOOPBYTE(
-                       valtmp = nval[i] | orig[i];
-                       unionsize += SUMBIT(valtmp) - SUMBIT(orig[i]);
+                                 valtmp = nval[i] | orig[i];
+               unionsize += SUMBIT(valtmp) - SUMBIT(orig[i]);
                );
-               *penalty = (float)unionsize;
+               *penalty = (float) unionsize;
        }
-       PG_RETURN_POINTER( penalty );
+       PG_RETURN_POINTER(penalty);
 }
 
-typedef struct {
-       OffsetNumber    pos;
-       int4           cost;
+typedef struct
+{
+       OffsetNumber pos;
+       int4            cost;
 } SPLITCOST;
 
 static int
-comparecost( const void *a, const void *b ) {
-       return ((SPLITCOST*)a)->cost - ((SPLITCOST*)b)->cost;
+comparecost(const void *a, const void *b)
+{
+       return ((SPLITCOST *) a)->cost - ((SPLITCOST *) b)->cost;
 }
 
-Datum   
-_ltree_picksplit(PG_FUNCTION_ARGS) {
-       bytea *entryvec = (bytea*) PG_GETARG_POINTER(0);
-       GIST_SPLITVEC *v = (GIST_SPLITVEC*) PG_GETARG_POINTER(1);
-       OffsetNumber k,j;
-       ltree_gist      *datum_l, *datum_r;
-       ABITVEC union_l, union_r;
-       bool            firsttime = true;
-       int4    size_alpha,size_beta,sizeu,sizei;
-       int4    size_waste, waste = 0.0;
-       int4    size_l, size_r;
-       int4    nbytes;
-       OffsetNumber seed_1=0, seed_2=0;
-       OffsetNumber    *left, *right;
+Datum
+_ltree_picksplit(PG_FUNCTION_ARGS)
+{
+       bytea      *entryvec = (bytea *) PG_GETARG_POINTER(0);
+       GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
+       OffsetNumber k,
+                               j;
+       ltree_gist *datum_l,
+                          *datum_r;
+       ABITVEC         union_l,
+                               union_r;
+       bool            firsttime = true;
+       int4            size_alpha,
+                               size_beta,
+                               sizeu,
+                               sizei;
+       int4            size_waste,
+                               waste = 0.0;
+       int4            size_l,
+                               size_r;
+       int4            nbytes;
+       OffsetNumber seed_1 = 0,
+                               seed_2 = 0;
+       OffsetNumber *left,
+                          *right;
        OffsetNumber maxoff;
-       BITVECP ptra, ptrb, ptrc;
-       int i;
-       unsigned char    valtmp;
-       SPLITCOST       *costvector;
-       ltree_gist      *_k, *_j;
+       BITVECP         ptra,
+                               ptrb,
+                               ptrc;
+       int                     i;
+       unsigned char valtmp;
+       SPLITCOST  *costvector;
+       ltree_gist *_k,
+                          *_j;
 
        maxoff = ((VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY)) - 2;
        nbytes = (maxoff + 2) * sizeof(OffsetNumber);
        v->spl_left = (OffsetNumber *) palloc(nbytes);
        v->spl_right = (OffsetNumber *) palloc(nbytes);
 
-       for (k = FirstOffsetNumber; k < maxoff; k = OffsetNumberNext(k)) {
-               _k = GETENTRY(entryvec,k); 
-               for (j = OffsetNumberNext(k); j <= maxoff; j = OffsetNumberNext(j)) {
-                       _j = GETENTRY(entryvec,j);
-                       if ( LTG_ISALLTRUE(_k) || LTG_ISALLTRUE(_j) ) {
+       for (k = FirstOffsetNumber; k < maxoff; k = OffsetNumberNext(k))
+       {
+               _k = GETENTRY(entryvec, k);
+               for (j = OffsetNumberNext(k); j <= maxoff; j = OffsetNumberNext(j))
+               {
+                       _j = GETENTRY(entryvec, j);
+                       if (LTG_ISALLTRUE(_k) || LTG_ISALLTRUE(_j))
+                       {
                                sizeu = ASIGLENBIT;
-                               if ( LTG_ISALLTRUE(_k) && LTG_ISALLTRUE(_j) )
+                               if (LTG_ISALLTRUE(_k) && LTG_ISALLTRUE(_j))
                                        sizei = ASIGLENBIT;
                                else
-                                       sizei = ( LTG_ISALLTRUE(_k) ) ? 
-                                               sizebitvec( LTG_SIGN(_j) ) : sizebitvec( LTG_SIGN(_k) ); 
-                       } else {
+                                       sizei = (LTG_ISALLTRUE(_k)) ?
+                                               sizebitvec(LTG_SIGN(_j)) : sizebitvec(LTG_SIGN(_k));
+                       }
+                       else
+                       {
                                sizeu = sizei = 0;
                                ptra = LTG_SIGN(_j);
                                ptrb = LTG_SIGN(_k);
@@ -278,20 +328,21 @@ _ltree_picksplit(PG_FUNCTION_ARGS) {
 } while(0)
 
                                ALOOPBYTE(
-                                       COUNT(0);
-                                       COUNT(1);
-                                       COUNT(2);
-                                       COUNT(3);
-                                       COUNT(4);
-                                       COUNT(5);
-                                       COUNT(6);
-                                       COUNT(7);
-                                       ptra = (BITVECP) ( ((char*)ptra) + 1 );
-                                       ptrb = (BITVECP) ( ((char*)ptrb) + 1 );
+                                                 COUNT(0);
+                               COUNT(1);
+                               COUNT(2);
+                               COUNT(3);
+                               COUNT(4);
+                               COUNT(5);
+                               COUNT(6);
+                               COUNT(7);
+                               ptra = (BITVECP) (((char *) ptra) + 1);
+                               ptrb = (BITVECP) (((char *) ptrb) + 1);
                                );
                        }
                        size_waste = sizeu - sizei;
-                       if (size_waste > waste || firsttime) {
+                       if (size_waste > waste || firsttime)
+                       {
                                waste = size_waste;
                                seed_1 = k;
                                seed_2 = j;
@@ -305,129 +356,166 @@ _ltree_picksplit(PG_FUNCTION_ARGS) {
        right = v->spl_right;
        v->spl_nright = 0;
 
-       if ( seed_1 == 0 || seed_2 == 0 ) {
+       if (seed_1 == 0 || seed_2 == 0)
+       {
                seed_1 = 1;
                seed_2 = 2;
        }
 
        /* form initial .. */
-       if ( LTG_ISALLTRUE(GETENTRY(entryvec,seed_1)) ) {
-               datum_l = (ltree_gist*)palloc( LTG_HDRSIZE );
-               datum_l->len = LTG_HDRSIZE; datum_l->flag = LTG_ALLTRUE;
+       if (LTG_ISALLTRUE(GETENTRY(entryvec, seed_1)))
+       {
+               datum_l = (ltree_gist *) palloc(LTG_HDRSIZE);
+               datum_l->len = LTG_HDRSIZE;
+               datum_l->flag = LTG_ALLTRUE;
                size_l = ASIGLENBIT;
-       } else {
-               datum_l = (ltree_gist*)palloc( LTG_HDRSIZE + ASIGLEN );
-               datum_l->len = LTG_HDRSIZE + ASIGLEN; datum_l->flag = 0;
-               memcpy((void*)LTG_SIGN(datum_l), (void*)LTG_SIGN(GETENTRY(entryvec,seed_1)), sizeof(ABITVEC));
-               size_l = sizebitvec( LTG_SIGN(datum_l) );
        }
-       if ( LTG_ISALLTRUE(GETENTRY(entryvec,seed_2)) ) {
-               datum_r = (ltree_gist*)palloc( LTG_HDRSIZE );
-               datum_r->len = LTG_HDRSIZE; datum_r->flag = LTG_ALLTRUE;
+       else
+       {
+               datum_l = (ltree_gist *) palloc(LTG_HDRSIZE + ASIGLEN);
+               datum_l->len = LTG_HDRSIZE + ASIGLEN;
+               datum_l->flag = 0;
+               memcpy((void *) LTG_SIGN(datum_l), (void *) LTG_SIGN(GETENTRY(entryvec, seed_1)), sizeof(ABITVEC));
+               size_l = sizebitvec(LTG_SIGN(datum_l));
+       }
+       if (LTG_ISALLTRUE(GETENTRY(entryvec, seed_2)))
+       {
+               datum_r = (ltree_gist *) palloc(LTG_HDRSIZE);
+               datum_r->len = LTG_HDRSIZE;
+               datum_r->flag = LTG_ALLTRUE;
                size_r = ASIGLENBIT;
-       } else {
-               datum_r = (ltree_gist*)palloc( LTG_HDRSIZE + ASIGLEN );
-               datum_r->len = LTG_HDRSIZE + ASIGLEN; datum_r->flag = 0;
-               memcpy((void*)LTG_SIGN(datum_r), (void*)LTG_SIGN(GETENTRY(entryvec,seed_2)), sizeof(ABITVEC));
-               size_r = sizebitvec( LTG_SIGN(datum_r) );
+       }
+       else
+       {
+               datum_r = (ltree_gist *) palloc(LTG_HDRSIZE + ASIGLEN);
+               datum_r->len = LTG_HDRSIZE + ASIGLEN;
+               datum_r->flag = 0;
+               memcpy((void *) LTG_SIGN(datum_r), (void *) LTG_SIGN(GETENTRY(entryvec, seed_2)), sizeof(ABITVEC));
+               size_r = sizebitvec(LTG_SIGN(datum_r));
        }
 
        maxoff = OffsetNumberNext(maxoff);
        /* sort before ... */
-       costvector=(SPLITCOST*)palloc( sizeof(SPLITCOST)*maxoff );
-       for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j)) {
-               costvector[j-1].pos = j;
-               _j = GETENTRY(entryvec,j);
-               if ( LTG_ISALLTRUE(_j) ) {
+       costvector = (SPLITCOST *) palloc(sizeof(SPLITCOST) * maxoff);
+       for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j))
+       {
+               costvector[j - 1].pos = j;
+               _j = GETENTRY(entryvec, j);
+               if (LTG_ISALLTRUE(_j))
+               {
                        size_alpha = ASIGLENBIT - size_l;
-                       size_beta  = ASIGLENBIT - size_r;
-               } else {
-                       ptra = LTG_SIGN( datum_l );
-                       ptrb = LTG_SIGN( datum_r );
-                       ptrc = LTG_SIGN( _j );
+                       size_beta = ASIGLENBIT - size_r;
+               }
+               else
+               {
+                       ptra = LTG_SIGN(datum_l);
+                       ptrb = LTG_SIGN(datum_r);
+                       ptrc = LTG_SIGN(_j);
                        size_beta = size_alpha = 0;
-                       if ( LTG_ISALLTRUE(datum_l) ) {
-                               if ( !LTG_ISALLTRUE(datum_r) ) {
+                       if (LTG_ISALLTRUE(datum_l))
+                       {
+                               if (!LTG_ISALLTRUE(datum_r))
+                               {
                                        ALOOPBIT(
-                                               if ( GETBIT(ptrc,i) && ! GETBIT(ptrb,i) )
-                                                       size_beta++;
+                                                        if (GETBIT(ptrc, i) && !GETBIT(ptrb, i))
+                                                        size_beta++;
                                        );
                                }
-                       } else if ( LTG_ISALLTRUE(datum_r) ) {
-                               if ( !LTG_ISALLTRUE(datum_l) ) {
+                       }
+                       else if (LTG_ISALLTRUE(datum_r))
+                       {
+                               if (!LTG_ISALLTRUE(datum_l))
+                               {
                                        ALOOPBIT(
-                                                if ( GETBIT(ptrc,i) && ! GETBIT(ptra,i) )
-                                                       size_alpha++;
+                                                        if (GETBIT(ptrc, i) && !GETBIT(ptra, i))
+                                                        size_alpha++;
                                        );
                                }
-                       } else {
+                       }
+                       else
+                       {
                                ALOOPBIT(
-                                       if ( GETBIT(ptrc,i) && ! GETBIT(ptra,i) )
-                                               size_alpha++;
-                                       if ( GETBIT(ptrc,i) && ! GETBIT(ptrb,i) )
-                                               size_beta++;
+                                                if (GETBIT(ptrc, i) && !GETBIT(ptra, i))
+                                                size_alpha++;
+                               if (GETBIT(ptrc, i) && !GETBIT(ptrb, i))
+                                       size_beta++;
                                );
                        }
                }
-               costvector[j-1].cost = abs( size_alpha - size_beta );
+               costvector[j - 1].cost = abs(size_alpha - size_beta);
        }
-       qsort( (void*)costvector, maxoff, sizeof(SPLITCOST), comparecost );
+       qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
 
-       for (k = 0; k < maxoff; k++) {
+       for (k = 0; k < maxoff; k++)
+       {
                j = costvector[k].pos;
-               _j = GETENTRY(entryvec,j);
-               if ( j == seed_1 ) {
+               _j = GETENTRY(entryvec, j);
+               if (j == seed_1)
+               {
                        *left++ = j;
                        v->spl_nleft++;
                        continue;
-               } else if ( j == seed_2 ) {
+               }
+               else if (j == seed_2)
+               {
                        *right++ = j;
                        v->spl_nright++;
                        continue;
                }
 
-               if ( LTG_ISALLTRUE(datum_l) || LTG_ISALLTRUE(_j) ) {
+               if (LTG_ISALLTRUE(datum_l) || LTG_ISALLTRUE(_j))
                        size_alpha = ASIGLENBIT;
-               } else {
+               else
+               {
                        ptra = LTG_SIGN(_j);
                        ptrb = LTG_SIGN(datum_l);
                        size_alpha = 0;
                        ALOOPBYTE(
-                               valtmp = union_l[i] = ptra[i] | ptrb[i];
-                               size_alpha += SUMBIT( valtmp );
+                                         valtmp = union_l[i] = ptra[i] | ptrb[i];
+                       size_alpha += SUMBIT(valtmp);
                        );
                }
 
-               if ( LTG_ISALLTRUE(datum_r) || LTG_ISALLTRUE(_j) ) {
+               if (LTG_ISALLTRUE(datum_r) || LTG_ISALLTRUE(_j))
                        size_beta = ASIGLENBIT;
-               } else {
+               else
+               {
                        ptra = LTG_SIGN(_j);
                        ptrb = LTG_SIGN(datum_r);
                        size_beta = 0;
                        ALOOPBYTE(
-                               valtmp = union_r[i] = ptra[i] | ptrb[i];
-                               size_beta += SUMBIT( valtmp );
+                                         valtmp = union_r[i] = ptra[i] | ptrb[i];
+                       size_beta += SUMBIT(valtmp);
                        );
                }
 
-               if (size_alpha - size_l < size_beta - size_r + WISH_F(v->spl_nleft, v->spl_nright, 0.1)) {
-                       if ( ! LTG_ISALLTRUE( datum_l ) ) {
-                               if ( size_alpha == ASIGLENBIT ) {
-                                       if ( size_alpha != size_l )
-                                               MemSet( (void*)LTG_SIGN(datum_l),0xff, sizeof(ABITVEC));
-                               } else
-                                       memcpy( (void*)LTG_SIGN(datum_l), (void*)union_l, sizeof(ABITVEC) );
+               if (size_alpha - size_l < size_beta - size_r + WISH_F(v->spl_nleft, v->spl_nright, 0.1))
+               {
+                       if (!LTG_ISALLTRUE(datum_l))
+                       {
+                               if (size_alpha == ASIGLENBIT)
+                               {
+                                       if (size_alpha != size_l)
+                                               MemSet((void *) LTG_SIGN(datum_l), 0xff, sizeof(ABITVEC));
+                               }
+                               else
+                                       memcpy((void *) LTG_SIGN(datum_l), (void *) union_l, sizeof(ABITVEC));
                        }
                        size_l = size_alpha;
                        *left++ = j;
                        v->spl_nleft++;
-               } else {
-                       if ( ! LTG_ISALLTRUE( datum_r ) ) {
-                               if ( size_beta == ASIGLENBIT ) {
-                                       if ( size_beta != size_r )
-                                               MemSet( (void*)LTG_SIGN(datum_r),0xff, sizeof(ABITVEC));
-                               } else
-                                       memcpy( (void*)LTG_SIGN(datum_r), (void*)union_r, sizeof(ABITVEC) );
+               }
+               else
+               {
+                       if (!LTG_ISALLTRUE(datum_r))
+                       {
+                               if (size_beta == ASIGLENBIT)
+                               {
+                                       if (size_beta != size_r)
+                                               MemSet((void *) LTG_SIGN(datum_r), 0xff, sizeof(ABITVEC));
+                               }
+                               else
+                                       memcpy((void *) LTG_SIGN(datum_r), (void *) union_r, sizeof(ABITVEC));
                        }
                        size_r = size_beta;
                        *right++ = j;
@@ -441,23 +529,25 @@ _ltree_picksplit(PG_FUNCTION_ARGS) {
        v->spl_ldatum = PointerGetDatum(datum_l);
        v->spl_rdatum = PointerGetDatum(datum_r);
 
-       PG_RETURN_POINTER( v );
+       PG_RETURN_POINTER(v);
 }
 
 static bool
-gist_te(ltree_gist *key, ltree* query) {
-       ltree_level    *curq = LTREE_FIRST(query);
-       BITVECP sign = LTG_SIGN(key);
-       int     qlen = query->numlevel;
+gist_te(ltree_gist * key, ltree * query)
+{
+       ltree_level *curq = LTREE_FIRST(query);
+       BITVECP         sign = LTG_SIGN(key);
+       int                     qlen = query->numlevel;
        unsigned int hv;
 
-       if ( LTG_ISALLTRUE(key) )
+       if (LTG_ISALLTRUE(key))
                return true;
 
-       while( qlen>0 ) {
-               hv = ltree_crc32_sz(curq->name,curq->len);
-               if ( ! GETBIT( sign, AHASHVAL(hv) ) )
-                       return false; 
+       while (qlen > 0)
+       {
+               hv = ltree_crc32_sz(curq->name, curq->len);
+               if (!GETBIT(sign, AHASHVAL(hv)))
+                       return false;
                curq = LEVEL_NEXT(curq);
                qlen--;
        }
@@ -466,48 +556,56 @@ gist_te(ltree_gist *key, ltree* query) {
 }
 
 static bool
-checkcondition_bit(void *checkval, ITEM* val ) {
-       return ( FLG_CANLOOKSIGN(val->flag) ) ? GETBIT( checkval, AHASHVAL( val->val ) ) : true;
+checkcondition_bit(void *checkval, ITEM * val)
+{
+       return (FLG_CANLOOKSIGN(val->flag)) ? GETBIT(checkval, AHASHVAL(val->val)) : true;
 }
 
 static bool
-gist_qtxt(ltree_gist *key, ltxtquery* query) {
-       if ( LTG_ISALLTRUE(key) )
+gist_qtxt(ltree_gist * key, ltxtquery * query)
+{
+       if (LTG_ISALLTRUE(key))
                return true;
-            
+
        return ltree_execute(
-               GETQUERY(query),
-               (void*)LTG_SIGN(key), false,
-               checkcondition_bit
-       );
+                                                GETQUERY(query),
+                                                (void *) LTG_SIGN(key), false,
+                                                checkcondition_bit
+               );
 }
 
 static bool
-gist_qe(ltree_gist *key, lquery* query) {
-       lquery_level    *curq = LQUERY_FIRST(query);
-       BITVECP sign = LTG_SIGN(key);
-       int     qlen = query->numlevel;
-                                        
-       if ( LTG_ISALLTRUE(key) )
+gist_qe(ltree_gist * key, lquery * query)
+{
+       lquery_level *curq = LQUERY_FIRST(query);
+       BITVECP         sign = LTG_SIGN(key);
+       int                     qlen = query->numlevel;
+
+       if (LTG_ISALLTRUE(key))
                return true;
-                           
-       while( qlen>0 ) {
-               if ( curq->numvar && LQL_CANLOOKSIGN(curq) ) {
-                       bool isexist=false;
-                       int vlen = curq->numvar;
+
+       while (qlen > 0)
+       {
+               if (curq->numvar && LQL_CANLOOKSIGN(curq))
+               {
+                       bool            isexist = false;
+                       int                     vlen = curq->numvar;
                        lquery_variant *curv = LQL_FIRST(curq);
-                       while( vlen>0 ) {
-                               if ( GETBIT( sign, AHASHVAL( curv->val ) ) ) {
-                                       isexist=true;
+
+                       while (vlen > 0)
+                       {
+                               if (GETBIT(sign, AHASHVAL(curv->val)))
+                               {
+                                       isexist = true;
                                        break;
                                }
                                curv = LVAR_NEXT(curv);
                                vlen--;
                        }
-                       if ( !isexist )
+                       if (!isexist)
                                return false;
                }
+
                curq = LQL_NEXT(curq);
                qlen--;
        }
@@ -516,34 +614,35 @@ gist_qe(ltree_gist *key, lquery* query) {
 }
 
 
-Datum   
-_ltree_consistent(PG_FUNCTION_ARGS) {
-       GISTENTRY *entry = (GISTENTRY*)PG_GETARG_POINTER(0);
-       char *query = (char*)DatumGetPointer( PG_DETOAST_DATUM(PG_GETARG_DATUM(1)) );
-       ltree_gist *key = (ltree_gist*)DatumGetPointer( entry->key );
+Datum
+_ltree_consistent(PG_FUNCTION_ARGS)
+{
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
+       char       *query = (char *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
+       ltree_gist *key = (ltree_gist *) DatumGetPointer(entry->key);
        StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-       bool res = false;
+       bool            res = false;
 
-#ifndef assert_enabled 
+#ifndef assert_enabled
 #define assert_enabled 0
 #endif
-       
-       switch( strategy ) {
+
+       switch (strategy)
+       {
                case 10:
                case 11:
-                       res =  gist_te(key, (ltree*)query);
+                       res = gist_te(key, (ltree *) query);
                        break;
                case 12:
                case 13:
-                       res =  gist_qe(key, (lquery*)query);
-                       break; 
+                       res = gist_qe(key, (lquery *) query);
+                       break;
                case 14:
                case 15:
-                       res = gist_qtxt(key, (ltxtquery*)query);
-                       break;  
+                       res = gist_qtxt(key, (ltxtquery *) query);
+                       break;
                default:
-                       elog(ERROR,"Unknown StrategyNumber: %d", strategy);
+                       elog(ERROR, "Unknown StrategyNumber: %d", strategy);
        }
        PG_RETURN_BOOL(res);
 }
-
index 336b838..59de0a5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * op function for ltree[] 
+ * op function for ltree[]
  * Teodor Sigaev <teodor@stack.net>
  */
 
@@ -16,223 +16,253 @@ PG_FUNCTION_INFO_V1(_ltq_rregex);
 PG_FUNCTION_INFO_V1(_ltxtq_exec);
 PG_FUNCTION_INFO_V1(_ltxtq_rexec);
 
-Datum _ltree_r_isparent(PG_FUNCTION_ARGS);
-Datum _ltree_r_risparent(PG_FUNCTION_ARGS);
+Datum          _ltree_r_isparent(PG_FUNCTION_ARGS);
+Datum          _ltree_r_risparent(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(_ltree_extract_isparent);
 PG_FUNCTION_INFO_V1(_ltree_extract_risparent);
 PG_FUNCTION_INFO_V1(_ltq_extract_regex);
 PG_FUNCTION_INFO_V1(_ltxtq_extract_exec);
-Datum _ltree_extract_isparent(PG_FUNCTION_ARGS);
-Datum _ltree_extract_risparent(PG_FUNCTION_ARGS);
-Datum _ltq_extract_regex(PG_FUNCTION_ARGS);
-Datum _ltxtq_extract_exec(PG_FUNCTION_ARGS);
+Datum          _ltree_extract_isparent(PG_FUNCTION_ARGS);
+Datum          _ltree_extract_risparent(PG_FUNCTION_ARGS);
+Datum          _ltq_extract_regex(PG_FUNCTION_ARGS);
+Datum          _ltxtq_extract_exec(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(_lca);
-Datum _lca(PG_FUNCTION_ARGS);
+Datum          _lca(PG_FUNCTION_ARGS);
+
+typedef Datum (*PGCALL2) (PG_FUNCTION_ARGS);
 
-typedef Datum (*PGCALL2)(PG_FUNCTION_ARGS);
 #define NEXTVAL(x) ( (ltree*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) )
 
 static bool
-array_iterator( ArrayType *la, PGCALL2 callback, void* param, ltree ** found) {
-       int num=ArrayGetNItems( ARR_NDIM(la), ARR_DIMS(la));
-       ltree   *item = (ltree*)ARR_DATA_PTR(la);
-
-       if ( ARR_NDIM(la) !=1 )
-               elog(ERROR,"Dimension of array != 1");
-
-       if ( found )
-               *found=NULL;
-       while( num>0 ) {
-               if ( DatumGetBool( DirectFunctionCall2( callback, 
-                       PointerGetDatum(item), PointerGetDatum(param) ) ) ) {
-
-                       if ( found )
+array_iterator(ArrayType *la, PGCALL2 callback, void *param, ltree ** found)
+{
+       int                     num = ArrayGetNItems(ARR_NDIM(la), ARR_DIMS(la));
+       ltree      *item = (ltree *) ARR_DATA_PTR(la);
+
+       if (ARR_NDIM(la) != 1)
+               elog(ERROR, "Dimension of array != 1");
+
+       if (found)
+               *found = NULL;
+       while (num > 0)
+       {
+               if (DatumGetBool(DirectFunctionCall2(callback,
+                                                PointerGetDatum(item), PointerGetDatum(param))))
+               {
+
+                       if (found)
                                *found = item;
                        return true;
                }
                num--;
-               item = NEXTVAL(item); 
+               item = NEXTVAL(item);
        }
 
        return false;
 }
 
 Datum
-_ltree_isparent(PG_FUNCTION_ARGS) {
-       ArrayType       *la = PG_GETARG_ARRAYTYPE_P(0);
-       ltree           *query = PG_GETARG_LTREE(1);
-       bool res = array_iterator( la, ltree_isparent, (void*)query, NULL );
-       PG_FREE_IF_COPY(la,0);
-       PG_FREE_IF_COPY(query,1);
+_ltree_isparent(PG_FUNCTION_ARGS)
+{
+       ArrayType  *la = PG_GETARG_ARRAYTYPE_P(0);
+       ltree      *query = PG_GETARG_LTREE(1);
+       bool            res = array_iterator(la, ltree_isparent, (void *) query, NULL);
+
+       PG_FREE_IF_COPY(la, 0);
+       PG_FREE_IF_COPY(query, 1);
        PG_RETURN_BOOL(res);
 }
 
 Datum
-_ltree_r_isparent(PG_FUNCTION_ARGS) {
-       PG_RETURN_DATUM( DirectFunctionCall2( _ltree_isparent,
-               PG_GETARG_DATUM(1),
-               PG_GETARG_DATUM(0)
-       ) );
+_ltree_r_isparent(PG_FUNCTION_ARGS)
+{
+       PG_RETURN_DATUM(DirectFunctionCall2(_ltree_isparent,
+                                                                               PG_GETARG_DATUM(1),
+                                                                               PG_GETARG_DATUM(0)
+                                                                               ));
 }
 
 Datum
-_ltree_risparent(PG_FUNCTION_ARGS) {
-       ArrayType       *la = PG_GETARG_ARRAYTYPE_P(0);
-       ltree           *query = PG_GETARG_LTREE(1);
-       bool res = array_iterator( la, ltree_risparent, (void*)query, NULL );
-       PG_FREE_IF_COPY(la,0);
-       PG_FREE_IF_COPY(query,1);
+_ltree_risparent(PG_FUNCTION_ARGS)
+{
+       ArrayType  *la = PG_GETARG_ARRAYTYPE_P(0);
+       ltree      *query = PG_GETARG_LTREE(1);
+       bool            res = array_iterator(la, ltree_risparent, (void *) query, NULL);
+
+       PG_FREE_IF_COPY(la, 0);
+       PG_FREE_IF_COPY(query, 1);
        PG_RETURN_BOOL(res);
 }
 
 Datum
-_ltree_r_risparent(PG_FUNCTION_ARGS) {
-       PG_RETURN_DATUM( DirectFunctionCall2( _ltree_risparent,
-               PG_GETARG_DATUM(1),
-               PG_GETARG_DATUM(0)
-       ) );
+_ltree_r_risparent(PG_FUNCTION_ARGS)
+{
+       PG_RETURN_DATUM(DirectFunctionCall2(_ltree_risparent,
+                                                                               PG_GETARG_DATUM(1),
+                                                                               PG_GETARG_DATUM(0)
+                                                                               ));
 }
 
 Datum
-_ltq_regex(PG_FUNCTION_ARGS) {
-       ArrayType       *la = PG_GETARG_ARRAYTYPE_P(0);
-       lquery          *query = PG_GETARG_LQUERY(1);
-       bool res = array_iterator( la, ltq_regex, (void*)query, NULL );
-       PG_FREE_IF_COPY(la,0);
-       PG_FREE_IF_COPY(query,1);
+_ltq_regex(PG_FUNCTION_ARGS)
+{
+       ArrayType  *la = PG_GETARG_ARRAYTYPE_P(0);
+       lquery     *query = PG_GETARG_LQUERY(1);
+       bool            res = array_iterator(la, ltq_regex, (void *) query, NULL);
+
+       PG_FREE_IF_COPY(la, 0);
+       PG_FREE_IF_COPY(query, 1);
        PG_RETURN_BOOL(res);
 }
 
 Datum
-_ltq_rregex(PG_FUNCTION_ARGS) {
-       PG_RETURN_DATUM( DirectFunctionCall2( _ltq_regex,
-               PG_GETARG_DATUM(1),
-               PG_GETARG_DATUM(0)
-       ) );
+_ltq_rregex(PG_FUNCTION_ARGS)
+{
+       PG_RETURN_DATUM(DirectFunctionCall2(_ltq_regex,
+                                                                               PG_GETARG_DATUM(1),
+                                                                               PG_GETARG_DATUM(0)
+                                                                               ));
 }
 
-Datum   
-_ltxtq_exec(PG_FUNCTION_ARGS) {
-       ArrayType       *la = PG_GETARG_ARRAYTYPE_P(0);
-       ltxtquery       *query = PG_GETARG_LTXTQUERY(1);
-       bool res = array_iterator( la, ltxtq_exec, (void*)query, NULL );
-       PG_FREE_IF_COPY(la,0);
-       PG_FREE_IF_COPY(query,1);
+Datum
+_ltxtq_exec(PG_FUNCTION_ARGS)
+{
+       ArrayType  *la = PG_GETARG_ARRAYTYPE_P(0);
+       ltxtquery  *query = PG_GETARG_LTXTQUERY(1);
+       bool            res = array_iterator(la, ltxtq_exec, (void *) query, NULL);
+
+       PG_FREE_IF_COPY(la, 0);
+       PG_FREE_IF_COPY(query, 1);
        PG_RETURN_BOOL(res);
 }
 
 Datum
-_ltxtq_rexec(PG_FUNCTION_ARGS) {
-       PG_RETURN_DATUM( DirectFunctionCall2( _ltxtq_exec,
-               PG_GETARG_DATUM(1),
-               PG_GETARG_DATUM(0)
-       ) );
+_ltxtq_rexec(PG_FUNCTION_ARGS)
+{
+       PG_RETURN_DATUM(DirectFunctionCall2(_ltxtq_exec,
+                                                                               PG_GETARG_DATUM(1),
+                                                                               PG_GETARG_DATUM(0)
+                                                                               ));
 }
 
 
-Datum 
-_ltree_extract_isparent(PG_FUNCTION_ARGS) {
-       ArrayType       *la = PG_GETARG_ARRAYTYPE_P(0);
-       ltree           *query = PG_GETARG_LTREE(1);
-       ltree           *found,*item;
-
-       if ( !array_iterator( la, ltree_isparent, (void*)query, &found )  ) {
-               PG_FREE_IF_COPY(la,0);
-               PG_FREE_IF_COPY(query,1);
+Datum
+_ltree_extract_isparent(PG_FUNCTION_ARGS)
+{
+       ArrayType  *la = PG_GETARG_ARRAYTYPE_P(0);
+       ltree      *query = PG_GETARG_LTREE(1);
+       ltree      *found,
+                          *item;
+
+       if (!array_iterator(la, ltree_isparent, (void *) query, &found))
+       {
+               PG_FREE_IF_COPY(la, 0);
+               PG_FREE_IF_COPY(query, 1);
                PG_RETURN_NULL();
        }
 
-       item = (ltree*)palloc( found->len );
-       memcpy( item, found, found->len );      
-       
-       PG_FREE_IF_COPY(la,0);
-       PG_FREE_IF_COPY(query,1);
+       item = (ltree *) palloc(found->len);
+       memcpy(item, found, found->len);
+
+       PG_FREE_IF_COPY(la, 0);
+       PG_FREE_IF_COPY(query, 1);
        PG_RETURN_POINTER(item);
 }
 
-Datum 
-_ltree_extract_risparent(PG_FUNCTION_ARGS) {
-       ArrayType       *la = PG_GETARG_ARRAYTYPE_P(0);
-       ltree           *query = PG_GETARG_LTREE(1);
-       ltree           *found,*item;
-
-       if ( !array_iterator( la, ltree_risparent, (void*)query, &found )  ) {
-               PG_FREE_IF_COPY(la,0);
-               PG_FREE_IF_COPY(query,1);
+Datum
+_ltree_extract_risparent(PG_FUNCTION_ARGS)
+{
+       ArrayType  *la = PG_GETARG_ARRAYTYPE_P(0);
+       ltree      *query = PG_GETARG_LTREE(1);
+       ltree      *found,
+                          *item;
+
+       if (!array_iterator(la, ltree_risparent, (void *) query, &found))
+       {
+               PG_FREE_IF_COPY(la, 0);
+               PG_FREE_IF_COPY(query, 1);
                PG_RETURN_NULL();
        }
 
-       item = (ltree*)palloc( found->len );
-       memcpy( item, found, found->len );      
-       
-       PG_FREE_IF_COPY(la,0);
-       PG_FREE_IF_COPY(query,1);
+       item = (ltree *) palloc(found->len);
+       memcpy(item, found, found->len);
+
+       PG_FREE_IF_COPY(la, 0);
+       PG_FREE_IF_COPY(query, 1);
        PG_RETURN_POINTER(item);
 }
 
-Datum 
-_ltq_extract_regex(PG_FUNCTION_ARGS) {
-       ArrayType       *la = PG_GETARG_ARRAYTYPE_P(0);
-       lquery          *query = PG_GETARG_LQUERY(1);
-       ltree           *found,*item;
-
-       if ( !array_iterator( la, ltq_regex, (void*)query, &found )  ) {
-               PG_FREE_IF_COPY(la,0);
-               PG_FREE_IF_COPY(query,1);
+Datum
+_ltq_extract_regex(PG_FUNCTION_ARGS)
+{
+       ArrayType  *la = PG_GETARG_ARRAYTYPE_P(0);
+       lquery     *query = PG_GETARG_LQUERY(1);
+       ltree      *found,
+                          *item;
+
+       if (!array_iterator(la, ltq_regex, (void *) query, &found))
+       {
+               PG_FREE_IF_COPY(la, 0);
+               PG_FREE_IF_COPY(query, 1);
                PG_RETURN_NULL();
        }
 
-       item = (ltree*)palloc( found->len );
-       memcpy( item, found, found->len );      
-       
-       PG_FREE_IF_COPY(la,0);
-       PG_FREE_IF_COPY(query,1);
+       item = (ltree *) palloc(found->len);
+       memcpy(item, found, found->len);
+
+       PG_FREE_IF_COPY(la, 0);
+       PG_FREE_IF_COPY(query, 1);
        PG_RETURN_POINTER(item);
 }
 
-Datum 
-_ltxtq_extract_exec(PG_FUNCTION_ARGS) {
-       ArrayType       *la = PG_GETARG_ARRAYTYPE_P(0);
-       ltxtquery       *query = PG_GETARG_LTXTQUERY(1);
-       ltree           *found,*item;
-
-       if ( !array_iterator( la, ltxtq_exec, (void*)query, &found )  ) {
-               PG_FREE_IF_COPY(la,0);
-               PG_FREE_IF_COPY(query,1);
+Datum
+_ltxtq_extract_exec(PG_FUNCTION_ARGS)
+{
+       ArrayType  *la = PG_GETARG_ARRAYTYPE_P(0);
+       ltxtquery  *query = PG_GETARG_LTXTQUERY(1);
+       ltree      *found,
+                          *item;
+
+       if (!array_iterator(la, ltxtq_exec, (void *) query, &found))
+       {
+               PG_FREE_IF_COPY(la, 0);
+               PG_FREE_IF_COPY(query, 1);
                PG_RETURN_NULL();
        }
 
-       item = (ltree*)palloc( found->len );
-       memcpy( item, found, found->len );      
-       
-       PG_FREE_IF_COPY(la,0);
-       PG_FREE_IF_COPY(query,1);
+       item = (ltree *) palloc(found->len);
+       memcpy(item, found, found->len);
+
+       PG_FREE_IF_COPY(la, 0);
+       PG_FREE_IF_COPY(query, 1);
        PG_RETURN_POINTER(item);
 }
 
 Datum
-_lca(PG_FUNCTION_ARGS) {
-       ArrayType       *la = PG_GETARG_ARRAYTYPE_P(0);
-       int num=ArrayGetNItems( ARR_NDIM(la), ARR_DIMS(la));
-       ltree   *item = (ltree*)ARR_DATA_PTR(la);
-        ltree **a,*res;
-
-        a=(ltree**)palloc( sizeof(ltree*) * num );
-       while( num>0 ) {
+_lca(PG_FUNCTION_ARGS)
+{
+       ArrayType  *la = PG_GETARG_ARRAYTYPE_P(0);
+       int                     num = ArrayGetNItems(ARR_NDIM(la), ARR_DIMS(la));
+       ltree      *item = (ltree *) ARR_DATA_PTR(la);
+       ltree     **a,
+                          *res;
+
+       a = (ltree **) palloc(sizeof(ltree *) * num);
+       while (num > 0)
+       {
                num--;
                a[num] = item;
                item = NEXTVAL(item);
        }
-        res = lca_inner(a, ArrayGetNItems( ARR_NDIM(la), ARR_DIMS(la)));
+       res = lca_inner(a, ArrayGetNItems(ARR_NDIM(la), ARR_DIMS(la)));
        pfree(a);
 
-       PG_FREE_IF_COPY(la,0);
+       PG_FREE_IF_COPY(la, 0);
 
-        if ( res )
-                PG_RETURN_POINTER(res);
-        else
-                PG_RETURN_NULL();
+       if (res)
+               PG_RETURN_POINTER(res);
+       else
+               PG_RETURN_NULL();
 }
-
index 5cbde41..8a4f27b 100644 (file)
@@ -105,6 +105,6 @@ ltree_crc32_sz(char *buf, int size)
        len = 0;
        nr = size;
        for (len += nr, p = buf; nr--; ++p)
-               _CRC32_(crc, TOLOWER((unsigned int)*p));
+               _CRC32_(crc, TOLOWER((unsigned int) *p));
        return ~crc;
 }
index 83b380d..e24cc85 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * op function for ltree and lquery 
+ * op function for ltree and lquery
  * Teodor Sigaev <teodor@stack.net>
  */
 
@@ -9,27 +9,29 @@
 PG_FUNCTION_INFO_V1(ltq_regex);
 PG_FUNCTION_INFO_V1(ltq_rregex);
 
-typedef struct {
-       lquery_level    *q;
-       int             nq;
-       ltree_level     *t;
-       int             nt;
-       int             posq;
-       int             post;
-} FieldNot;
+typedef struct
+{
+       lquery_level *q;
+       int                     nq;
+       ltree_level *t;
+       int                     nt;
+       int                     posq;
+       int                     post;
+}      FieldNot;
 
 static char *
-getlexem(char *start, char *end, int *len) {
-       char *ptr;
-       
-       while( start<end && *start == '_' )
+getlexem(char *start, char *end, int *len)
+{
+       char       *ptr;
+
+       while (start < end && *start == '_')
                start++;
 
        ptr = start;
-       if ( ptr == end )
+       if (ptr == end)
                return NULL;
 
-       while( ptr < end && *ptr != '_') 
+       while (ptr < end && *ptr != '_')
                ptr++;
 
        *len = ptr - start;
@@ -37,31 +39,36 @@ getlexem(char *start, char *end, int *len) {
 }
 
 bool
-compare_subnode( ltree_level *t, char *qn, int len, int (*cmpptr)(const char *,const char *,size_t), bool anyend ) {
-       char *endt = t->name + t->len;
-       char *endq = qn + len;
-       char *tn;
-       int lent,lenq;
-       bool    isok;
-
-       while( (qn=getlexem(qn,endq,&lenq)) != NULL ) {
-               tn=t->name;
+                       compare_subnode(ltree_level * t, char *qn, int len, int (*cmpptr) (const char *, const char *, size_t), bool anyend)
+{
+       char       *endt = t->name + t->len;
+       char       *endq = qn + len;
+       char       *tn;
+       int                     lent,
+                               lenq;
+       bool            isok;
+
+       while ((qn = getlexem(qn, endq, &lenq)) != NULL)
+       {
+               tn = t->name;
                isok = false;
-               while( (tn=getlexem(tn,endt,&lent)) != NULL ) {
-                       if ( 
+               while ((tn = getlexem(tn, endt, &lent)) != NULL)
+               {
+                       if (
                                (
-                                       lent == lenq ||
-                                       ( lent > lenq && anyend )
-                               ) &&
-                               (*cmpptr)(qn,tn,lenq) == 0 ) {
-               
-                               isok = true;    
+                                lent == lenq ||
+                                (lent > lenq && anyend)
+                                ) &&
+                               (*cmpptr) (qn, tn, lenq) == 0)
+                       {
+
+                               isok = true;
                                break;
                        }
                        tn += lent;
                }
 
-               if ( !isok )
+               if (!isok)
                        return false;
                qn += lenq;
        }
@@ -70,27 +77,32 @@ compare_subnode( ltree_level *t, char *qn, int len, int (*cmpptr)(const char *,c
 }
 
 static bool
-checkLevel( lquery_level *curq, ltree_level *curt ) {
-       int (*cmpptr)(const char *,const char *,size_t);
+checkLevel(lquery_level * curq, ltree_level * curt)
+{
+       int                     (*cmpptr) (const char *, const char *, size_t);
        lquery_variant *curvar = LQL_FIRST(curq);
-       int i;
-       
-       for(i=0;i<curq->numvar;i++) {
-               cmpptr = ( curvar->flag & LVAR_INCASE ) ? strncasecmp : strncmp;
+       int                     i;
 
-               if ( curvar->flag & LVAR_SUBLEXEM ) {
-                       if ( compare_subnode(curt, curvar->name, curvar->len, cmpptr, (curvar->flag & LVAR_ANYEND) ) )
+       for (i = 0; i < curq->numvar; i++)
+       {
+               cmpptr = (curvar->flag & LVAR_INCASE) ? strncasecmp : strncmp;
+
+               if (curvar->flag & LVAR_SUBLEXEM)
+               {
+                       if (compare_subnode(curt, curvar->name, curvar->len, cmpptr, (curvar->flag & LVAR_ANYEND)))
                                return true;
-               } else if ( 
-                       ( 
-                               curvar->len == curt->len || 
-                               ( curt->len > curvar->len && (curvar->flag & LVAR_ANYEND) )  
-                       ) && 
-                       (*cmpptr)( curvar->name, curt->name, curvar->len) == 0 ) {
+               }
+               else if (
+                                (
+                                 curvar->len == curt->len ||
+                               (curt->len > curvar->len && (curvar->flag & LVAR_ANYEND))
+                                 ) &&
+                                (*cmpptr) (curvar->name, curt->name, curvar->len) == 0)
+               {
 
                        return true;
                }
-               curvar = LVAR_NEXT(curvar); 
+               curvar = LVAR_NEXT(curvar);
        }
        return false;
 }
@@ -102,78 +114,97 @@ printFieldNot(FieldNot *fn ) {
                elog(NOTICE,"posQ:%d lenQ:%d posT:%d lenT:%d", fn->posq,fn->nq,fn->post,fn->nt);
                fn++;
        }
-} 
+}
 */
 
 static bool
-checkCond( lquery_level *curq, int query_numlevel, ltree_level *curt, int tree_numlevel, FieldNot *ptr ) {
-       uint32 low_pos=0,high_pos=0,cur_tpos=0;
-       int tlen = tree_numlevel, qlen = query_numlevel;
-       int isok;
-       lquery_level *prevq=NULL;
-       ltree_level  *prevt=NULL;
-
-       while( tlen >0 && qlen>0 ) {
-               if ( curq->numvar ) {
+checkCond(lquery_level * curq, int query_numlevel, ltree_level * curt, int tree_numlevel, FieldNot * ptr)
+{
+       uint32          low_pos = 0,
+                               high_pos = 0,
+                               cur_tpos = 0;
+       int                     tlen = tree_numlevel,
+                               qlen = query_numlevel;
+       int                     isok;
+       lquery_level *prevq = NULL;
+       ltree_level *prevt = NULL;
+
+       while (tlen > 0 && qlen > 0)
+       {
+               if (curq->numvar)
+               {
                        prevt = curt;
-                       while ( cur_tpos < low_pos ) {
+                       while (cur_tpos < low_pos)
+                       {
                                curt = LEVEL_NEXT(curt);
                                tlen--;
                                cur_tpos++;
-                               if ( tlen==0 )
+                               if (tlen == 0)
                                        return false;
-                               if ( ptr && ptr->q )
+                               if (ptr && ptr->q)
                                        ptr->nt++;
                        }
-                       
-                       if ( ptr && curq->flag & LQL_NOT ) {
-                               if ( !(prevq && prevq->numvar == 0) )
+
+                       if (ptr && curq->flag & LQL_NOT)
+                       {
+                               if (!(prevq && prevq->numvar == 0))
                                        prevq = curq;
-                               if ( ptr->q == NULL ) {
+                               if (ptr->q == NULL)
+                               {
                                        ptr->t = prevt;
                                        ptr->q = prevq;
-                                       ptr->nt=1;
-                                       ptr->nq=1 + ( (prevq==curq) ? 0 : 1 );
-                                       ptr->posq = query_numlevel - qlen - ( (prevq==curq) ? 0 : 1 ); 
+                                       ptr->nt = 1;
+                                       ptr->nq = 1 + ((prevq == curq) ? 0 : 1);
+                                       ptr->posq = query_numlevel - qlen - ((prevq == curq) ? 0 : 1);
                                        ptr->post = cur_tpos;
-                               } else {
+                               }
+                               else
+                               {
                                        ptr->nt++;
                                        ptr->nq++;
                                }
 
-                               if ( qlen == 1 && ptr->q->numvar==0 )
-                                       ptr->nt = tree_numlevel - ptr->post; 
+                               if (qlen == 1 && ptr->q->numvar == 0)
+                                       ptr->nt = tree_numlevel - ptr->post;
                                curt = LEVEL_NEXT(curt);
                                tlen--;
                                cur_tpos++;
-                               if ( high_pos < cur_tpos )
+                               if (high_pos < cur_tpos)
                                        high_pos++;
-                       } else { 
+                       }
+                       else
+                       {
                                isok = false;
-                               while( cur_tpos <= high_pos && tlen > 0 && !isok) {
+                               while (cur_tpos <= high_pos && tlen > 0 && !isok)
+                               {
                                        isok = checkLevel(curq, curt);
                                        curt = LEVEL_NEXT(curt);
                                        tlen--;
                                        cur_tpos++;
-                                       if ( !isok && ptr )
+                                       if (!isok && ptr)
                                                ptr->nt++;
                                }
-                               if ( !isok )
+                               if (!isok)
                                        return false;
 
-                               if (ptr && ptr->q) {
-                                       if ( checkCond(ptr->q,ptr->nq,ptr->t,ptr->nt,NULL) )
+                               if (ptr && ptr->q)
+                               {
+                                       if (checkCond(ptr->q, ptr->nq, ptr->t, ptr->nt, NULL))
                                                return false;
                                        ptr->q = NULL;
                                }
-                               low_pos=cur_tpos; high_pos=cur_tpos;
+                               low_pos = cur_tpos;
+                               high_pos = cur_tpos;
                        }
-               } else {
+               }
+               else
+               {
                        low_pos = cur_tpos + curq->low;
                        high_pos = cur_tpos + curq->high;
-                       if ( ptr && ptr->q ) {
+                       if (ptr && ptr->q)
+                       {
                                ptr->nq++;
-                               if ( qlen==1 )
+                               if (qlen == 1)
                                        ptr->nt = tree_numlevel - ptr->post;
                        }
                }
@@ -181,16 +212,20 @@ checkCond( lquery_level *curq, int query_numlevel, ltree_level *curt, int tree_n
                prevq = curq;
                curq = LQL_NEXT(curq);
                qlen--;
-       }       
+       }
 
-       if ( low_pos > tree_numlevel || tree_numlevel > high_pos )
+       if (low_pos > tree_numlevel || tree_numlevel > high_pos)
                return false;
 
-       while( qlen>0 ) {
-               if ( curq->numvar ) {
-                       if ( ! (curq->flag & LQL_NOT) )
+       while (qlen > 0)
+       {
+               if (curq->numvar)
+               {
+                       if (!(curq->flag & LQL_NOT))
                                return false;
-               } else {
+               }
+               else
+               {
                        low_pos = cur_tpos + curq->low;
                        high_pos = cur_tpos + curq->high;
                }
@@ -199,42 +234,47 @@ checkCond( lquery_level *curq, int query_numlevel, ltree_level *curt, int tree_n
                qlen--;
        }
 
-       if ( low_pos > tree_numlevel || tree_numlevel > high_pos )
+       if (low_pos > tree_numlevel || tree_numlevel > high_pos)
                return false;
-       
-       if ( ptr && ptr->q && checkCond(ptr->q,ptr->nq,ptr->t,ptr->nt,NULL) )
+
+       if (ptr && ptr->q && checkCond(ptr->q, ptr->nq, ptr->t, ptr->nt, NULL))
                return false;
-       
+
        return true;
 }
 
 Datum
-ltq_regex(PG_FUNCTION_ARGS) {
-       ltree *tree = PG_GETARG_LTREE(0);
-       lquery *query = PG_GETARG_LQUERY(1);
-       bool res= false;
+ltq_regex(PG_FUNCTION_ARGS)
+{
+       ltree      *tree = PG_GETARG_LTREE(0);
+       lquery     *query = PG_GETARG_LQUERY(1);
+       bool            res = false;
 
-       if ( query->flag & LQUERY_HASNOT ) {
+       if (query->flag & LQUERY_HASNOT)
+       {
                FieldNot        fn;
 
-               fn.q=NULL;
+               fn.q = NULL;
 
-               res = checkCond( LQUERY_FIRST(query), query->numlevel, 
-                       LTREE_FIRST(tree), tree->numlevel, &fn );
-       } else {
-               res = checkCond( LQUERY_FIRST(query), query->numlevel, 
-                       LTREE_FIRST(tree), tree->numlevel, NULL ); 
+               res = checkCond(LQUERY_FIRST(query), query->numlevel,
+                                               LTREE_FIRST(tree), tree->numlevel, &fn);
+       }
+       else
+       {
+               res = checkCond(LQUERY_FIRST(query), query->numlevel,
+                                               LTREE_FIRST(tree), tree->numlevel, NULL);
        }
 
-        PG_FREE_IF_COPY(tree,0);
-        PG_FREE_IF_COPY(query,1);
-        PG_RETURN_BOOL(res);
+       PG_FREE_IF_COPY(tree, 0);
+       PG_FREE_IF_COPY(query, 1);
+       PG_RETURN_BOOL(res);
 }
 
-Datum 
-ltq_rregex(PG_FUNCTION_ARGS) {
-       PG_RETURN_DATUM( DirectFunctionCall2( ltq_regex,
-               PG_GETARG_DATUM(1),
-               PG_GETARG_DATUM(0)
-       ) );
+Datum
+ltq_rregex(PG_FUNCTION_ARGS)
+{
+       PG_RETURN_DATUM(DirectFunctionCall2(ltq_regex,
+                                                                               PG_GETARG_DATUM(1),
+                                                                               PG_GETARG_DATUM(0)
+                                                                               ));
 }
index 0c92dee..606b3e3 100644 (file)
@@ -6,19 +6,21 @@
 #include "utils/palloc.h"
 #include "utils/builtins.h"
 
-typedef struct {
-       uint8   len;
-       char    name[1];
-} ltree_level;
+typedef struct
+{
+       uint8           len;
+       char            name[1];
+}      ltree_level;
 
-#define LEVEL_HDRSIZE   (sizeof(uint8))
+#define LEVEL_HDRSIZE  (sizeof(uint8))
 #define LEVEL_NEXT(x)  ( (ltree_level*)( ((char*)(x)) + MAXALIGN(((ltree_level*)(x))->len + LEVEL_HDRSIZE) ) )
 
-typedef struct {
-       int32   len;
-       uint16  numlevel;
-       char    data[1];
-} ltree;
+typedef struct
+{
+       int32           len;
+       uint16          numlevel;
+       char            data[1];
+}      ltree;
 
 #define LTREE_HDRSIZE  MAXALIGN( sizeof(int32) + sizeof(uint16) )
 #define LTREE_FIRST(x) ( (ltree_level*)( ((char*)(x))+LTREE_HDRSIZE ) )
@@ -26,31 +28,33 @@ typedef struct {
 
 /* lquery */
 
-typedef struct {
-       int4    val;    
-       uint8   len;
-       uint8   flag;
-       char    name[1];
-} lquery_variant;
+typedef struct
+{
+       int4            val;
+       uint8           len;
+       uint8           flag;
+       char            name[1];
+}      lquery_variant;
 
 #define LVAR_HDRSIZE   MAXALIGN(sizeof(uint8)*2 + sizeof(int4))
 #define LVAR_NEXT(x)   ( (lquery_variant*)( ((char*)(x)) + MAXALIGN(((lquery_variant*)(x))->len) + LVAR_HDRSIZE ) )
 
-#define LVAR_ANYEND    0x01
-#define LVAR_INCASE    0x02
+#define LVAR_ANYEND 0x01
+#define LVAR_INCASE 0x02
 #define LVAR_SUBLEXEM  0x04
 
-typedef struct {
-       uint16  totallen;
-       uint16  flag;
-       uint16  numvar;
-       uint16  low;
-       uint16  high;
-       char    variants[1];
-} lquery_level;
-
-#define LQL_HDRSIZE    MAXALIGN( sizeof(uint16)*5 )
-#define LQL_NEXT(x)    ( (lquery_level*)( ((char*)(x)) + MAXALIGN(((lquery_level*)(x))->totallen) ) )
+typedef struct
+{
+       uint16          totallen;
+       uint16          flag;
+       uint16          numvar;
+       uint16          low;
+       uint16          high;
+       char            variants[1];
+}      lquery_level;
+
+#define LQL_HDRSIZE MAXALIGN( sizeof(uint16)*5 )
+#define LQL_NEXT(x) ( (lquery_level*)( ((char*)(x)) + MAXALIGN(((lquery_level*)(x))->totallen) ) )
 #define LQL_FIRST(x)   ( (lquery_variant*)( ((char*)(x))+LQL_HDRSIZE ) )
 
 #define LQL_NOT                0x10
@@ -59,29 +63,30 @@ typedef struct {
 #else
 #define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEM | LVAR_INCASE ) ) == 0 )
 #endif
-#define LQL_CANLOOKSIGN(x) FLG_CANLOOKSIGN( ((lquery_level*)(x))->flag ) 
-
-typedef struct {
-       int32   len;
-       uint16  numlevel;
-       uint16  firstgood;
-       uint16  flag;
-       char    data[1];
-} lquery; 
+#define LQL_CANLOOKSIGN(x) FLG_CANLOOKSIGN( ((lquery_level*)(x))->flag )
 
-#define LQUERY_HDRSIZE   MAXALIGN( sizeof(int32) + 3*sizeof(uint16) )
+typedef struct
+{
+       int32           len;
+       uint16          numlevel;
+       uint16          firstgood;
+       uint16          flag;
+       char            data[1];
+}      lquery;
+
+#define LQUERY_HDRSIZE  MAXALIGN( sizeof(int32) + 3*sizeof(uint16) )
 #define LQUERY_FIRST(x)   ( (lquery_level*)( ((char*)(x))+LQUERY_HDRSIZE ) )
 
 #define LQUERY_HASNOT          0x01
 
-#ifndef max  
-#define max(a,b)                ((a) >  (b) ? (a) : (b))
+#ifndef max
+#define max(a,b)                               ((a) >  (b) ? (a) : (b))
 #endif
 #ifndef min
-#define min(a,b)                ((a) <= (b) ? (a) : (b))
+#define min(a,b)                               ((a) <= (b) ? (a) : (b))
 #endif
 #ifndef abs
-#define abs(a)                  ((a) <  (0) ? -(a) : (a))
+#define abs(a)                                 ((a) <  (0) ? -(a) : (a))
 #endif
 #define ISALNUM(x)     ( isalnum((unsigned int)(x)) || (x) == '_' )
 
@@ -93,75 +98,75 @@ typedef struct {
  */
 typedef struct ITEM
 {
-        int2            type;
-        int2            left;
-        int4            val;
+       int2            type;
+       int2            left;
+       int4            val;
        uint8           flag;
-        /* user-friendly value */
-        uint8          length;
-        uint16          distance;
-}       ITEM;
+       /* user-friendly value */
+       uint8           length;
+       uint16          distance;
+}      ITEM;
 
 /*
  *Storage:
- *      (len)(size)(array of ITEM)(array of operand in user-friendly form)
+ *             (len)(size)(array of ITEM)(array of operand in user-friendly form)
  */
 typedef struct
 {
-        int4            len;
-        int4            size;
-        char            data[1];
-}       ltxtquery;
+       int4            len;
+       int4            size;
+       char            data[1];
+}      ltxtquery;
 
-#define HDRSIZEQT       MAXALIGN( 2*sizeof(int4) )
-#define COMPUTESIZE(size,lenofoperand)  ( HDRSIZEQT + size * sizeof(ITEM) + lenofoperand )
+#define HDRSIZEQT              MAXALIGN( 2*sizeof(int4) )
+#define COMPUTESIZE(size,lenofoperand) ( HDRSIZEQT + size * sizeof(ITEM) + lenofoperand )
 #define GETQUERY(x)  (ITEM*)( (char*)(x)+HDRSIZEQT )
-#define GETOPERAND(x)   ( (char*)GETQUERY(x) + ((ltxtquery*)x)->size * sizeof(ITEM) )
+#define GETOPERAND(x)  ( (char*)GETQUERY(x) + ((ltxtquery*)x)->size * sizeof(ITEM) )
 
 #define ISOPERATOR(x) ( (x)=='!' || (x)=='&' || (x)=='|' || (x)=='(' || (x)==')' )
 
-#define END                     0
-#define ERR                     1
-#define VAL                     2
-#define OPR                     3
-#define OPEN                    4
-#define CLOSE                   5
-#define VALTRUE                 6               /* for stop words */
-#define VALFALSE                7
+#define END                                            0
+#define ERR                                            1
+#define VAL                                            2
+#define OPR                                            3
+#define OPEN                                   4
+#define CLOSE                                  5
+#define VALTRUE                                        6               /* for stop words */
+#define VALFALSE                               7
 
 
 /* use in array iterator */
-Datum   ltree_isparent(PG_FUNCTION_ARGS);
-Datum   ltree_risparent(PG_FUNCTION_ARGS);
-Datum ltq_regex(PG_FUNCTION_ARGS);
-Datum ltq_rregex(PG_FUNCTION_ARGS);
-Datum      ltxtq_exec(PG_FUNCTION_ARGS);
-Datum      ltxtq_rexec(PG_FUNCTION_ARGS);
-Datum   _ltq_regex(PG_FUNCTION_ARGS);
-Datum   _ltq_rregex(PG_FUNCTION_ARGS);
-Datum   _ltxtq_exec(PG_FUNCTION_ARGS);
-Datum   _ltxtq_rexec(PG_FUNCTION_ARGS);
-Datum   _ltree_isparent(PG_FUNCTION_ARGS);
-Datum   _ltree_risparent(PG_FUNCTION_ARGS);
+Datum          ltree_isparent(PG_FUNCTION_ARGS);
+Datum          ltree_risparent(PG_FUNCTION_ARGS);
+Datum          ltq_regex(PG_FUNCTION_ARGS);
+Datum          ltq_rregex(PG_FUNCTION_ARGS);
+Datum          ltxtq_exec(PG_FUNCTION_ARGS);
+Datum          ltxtq_rexec(PG_FUNCTION_ARGS);
+Datum          _ltq_regex(PG_FUNCTION_ARGS);
+Datum          _ltq_rregex(PG_FUNCTION_ARGS);
+Datum          _ltxtq_exec(PG_FUNCTION_ARGS);
+Datum          _ltxtq_rexec(PG_FUNCTION_ARGS);
+Datum          _ltree_isparent(PG_FUNCTION_ARGS);
+Datum          _ltree_risparent(PG_FUNCTION_ARGS);
 
 /* Concatenation functions */
-Datum   ltree_addltree(PG_FUNCTION_ARGS);
-Datum   ltree_addtext(PG_FUNCTION_ARGS);
-Datum   ltree_textadd(PG_FUNCTION_ARGS);
+Datum          ltree_addltree(PG_FUNCTION_ARGS);
+Datum          ltree_addtext(PG_FUNCTION_ARGS);
+Datum          ltree_textadd(PG_FUNCTION_ARGS);
 
 /* Util function */
-Datum ltree_in(PG_FUNCTION_ARGS);
+Datum          ltree_in(PG_FUNCTION_ARGS);
 
 bool ltree_execute(ITEM * curitem, void *checkval,
-                bool calcnot, bool (*chkcond) (void *checkval, ITEM * val));
+                         bool calcnot, bool (*chkcond) (void *checkval, ITEM * val));
 
-int ltree_compare(const ltree *a, const ltree *b);
-bool inner_isparent(const ltree *c, const ltree *p);
-bool compare_subnode( ltree_level *t, char *q, int len, 
-       int (*cmpptr)(const char *,const char *,size_t), bool anyend );
-ltree* lca_inner(ltree** a, int len);
+int                    ltree_compare(const ltree * a, const ltree * b);
+bool           inner_isparent(const ltree * c, const ltree * p);
+bool compare_subnode(ltree_level * t, char *q, int len,
+               int (*cmpptr) (const char *, const char *, size_t), bool anyend);
+ltree     *lca_inner(ltree ** a, int len);
 
-#define PG_GETARG_LTREE(x)  ((ltree*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(x))))
+#define PG_GETARG_LTREE(x)     ((ltree*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(x))))
 #define PG_GETARG_LQUERY(x) ((lquery*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(x))))
 #define PG_GETARG_LTXTQUERY(x) ((ltxtquery*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(x))))
 
@@ -169,7 +174,7 @@ ltree* lca_inner(ltree** a, int len);
 
 #define BITBYTE 8
 #define SIGLENINT  8
-#define SIGLEN  ( sizeof(int4)*SIGLENINT )
+#define SIGLEN ( sizeof(int4)*SIGLENINT )
 #define SIGLENBIT (SIGLEN*BITBYTE)
 typedef unsigned char BITVEC[SIGLEN];
 typedef unsigned char *BITVECP;
@@ -195,43 +200,44 @@ typedef unsigned char *BITVECP;
 /*
  * type of index key for ltree. Tree are combined B-Tree and R-Tree
  * Storage:
- *     Leaf pages 
+ *     Leaf pages
  *             (len)(flag)(ltree)
  *     Non-Leaf
- *                      (len)(flag)(sign)(left_ltree)(right_ltree)
+ *                              (len)(flag)(sign)(left_ltree)(right_ltree)
  *             ALLTRUE: (len)(flag)(left_ltree)(right_ltree)
- *     
+ *
  */
 
-typedef struct {
-       int4 len;
-       uint32  flag;
-       char    data[1];
-} ltree_gist;
-
-#define        LTG_ONENODE     0x01
-#define        LTG_ALLTRUE     0x02
-#define        LTG_NORIGHT     0x04
-
-#define LTG_HDRSIZE    MAXALIGN( sizeof(int4) + sizeof(uint32) )
-#define LTG_SIGN(x)    ( (BITVECP)( ((char*)(x))+LTG_HDRSIZE ) ) 
-#define LTG_NODE(x)    ( (ltree*)( ((char*)(x))+LTG_HDRSIZE ) )
-#define LTG_ISONENODE(x) ( ((ltree_gist*)(x))->flag & LTG_ONENODE ) 
-#define LTG_ISALLTRUE(x) ( ((ltree_gist*)(x))->flag & LTG_ALLTRUE ) 
-#define LTG_ISNORIGHT(x) ( ((ltree_gist*)(x))->flag & LTG_NORIGHT ) 
+typedef struct
+{
+       int4            len;
+       uint32          flag;
+       char            data[1];
+}      ltree_gist;
+
+#define LTG_ONENODE 0x01
+#define LTG_ALLTRUE 0x02
+#define LTG_NORIGHT 0x04
+
+#define LTG_HDRSIZE MAXALIGN( sizeof(int4) + sizeof(uint32) )
+#define LTG_SIGN(x) ( (BITVECP)( ((char*)(x))+LTG_HDRSIZE ) )
+#define LTG_NODE(x) ( (ltree*)( ((char*)(x))+LTG_HDRSIZE ) )
+#define LTG_ISONENODE(x) ( ((ltree_gist*)(x))->flag & LTG_ONENODE )
+#define LTG_ISALLTRUE(x) ( ((ltree_gist*)(x))->flag & LTG_ALLTRUE )
+#define LTG_ISNORIGHT(x) ( ((ltree_gist*)(x))->flag & LTG_NORIGHT )
 #define LTG_LNODE(x)   ( (ltree*)( ( ((char*)(x))+LTG_HDRSIZE ) + ( LTG_ISALLTRUE(x) ? 0 : SIGLEN ) ) )
 #define LTG_RENODE(x)  ( (ltree*)( ((char*)LTG_LNODE(x)) + LTG_LNODE(x)->len) )
 #define LTG_RNODE(x)   ( LTG_ISNORIGHT(x) ? LTG_LNODE(x) : LTG_RENODE(x) )
 
-#define LTG_GETLNODE(x)        ( LTG_ISONENODE(x) ? LTG_NODE(x) : LTG_LNODE(x) ) 
-#define LTG_GETRNODE(x)        ( LTG_ISONENODE(x) ? LTG_NODE(x) : LTG_RNODE(x) ) 
+#define LTG_GETLNODE(x) ( LTG_ISONENODE(x) ? LTG_NODE(x) : LTG_LNODE(x) )
+#define LTG_GETRNODE(x) ( LTG_ISONENODE(x) ? LTG_NODE(x) : LTG_RNODE(x) )
 
 
 /* GiST support for ltree[] */
 
-#define ASIGLENINT     (2*SIGLENINT)
+#define ASIGLENINT     (2*SIGLENINT)
 #define ASIGLEN                (sizeof(int4)*ASIGLENINT)
-#define        ASIGLENBIT (ASIGLEN*BITBYTE)
+#define ASIGLENBIT (ASIGLEN*BITBYTE)
 typedef unsigned char ABITVEC[ASIGLEN];
 
 #define ALOOPBYTE(a) \
@@ -249,4 +255,3 @@ typedef unsigned char ABITVEC[ASIGLEN];
 /* type of key is the same to ltree_gist */
 
 #endif
-
index 5a4c7bb..5c5f4c7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * GiST support for ltree 
+ * GiST support for ltree
  * Teodor Sigaev <teodor@stack.net>
  */
 
 
 #include "crc32.h"
 
-PG_FUNCTION_INFO_V1( ltree_gist_in );
-Datum   ltree_gist_in(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( ltree_gist_out );
-Datum   ltree_gist_out(PG_FUNCTION_ARGS);
+PG_FUNCTION_INFO_V1(ltree_gist_in);
+Datum          ltree_gist_in(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(ltree_gist_out);
+Datum          ltree_gist_out(PG_FUNCTION_ARGS);
 
 Datum
-ltree_gist_in(PG_FUNCTION_ARGS) {
-       elog(ERROR,"Unimplemented");
+ltree_gist_in(PG_FUNCTION_ARGS)
+{
+       elog(ERROR, "Unimplemented");
        PG_RETURN_DATUM(0);
 }
 
 Datum
-ltree_gist_out(PG_FUNCTION_ARGS) {
-       elog(ERROR,"Unimplemented");
+ltree_gist_out(PG_FUNCTION_ARGS)
+{
+       elog(ERROR, "Unimplemented");
        PG_RETURN_DATUM(0);
 }
 
-PG_FUNCTION_INFO_V1( ltree_compress );
-Datum   ltree_compress(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( ltree_decompress );
-Datum   ltree_decompress(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( ltree_same );
-Datum   ltree_same(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( ltree_union );
-Datum   ltree_union(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( ltree_penalty );
-Datum   ltree_penalty(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( ltree_picksplit );
-Datum   ltree_picksplit(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( ltree_consistent );
-Datum   ltree_consistent(PG_FUNCTION_ARGS);
+PG_FUNCTION_INFO_V1(ltree_compress);
+Datum          ltree_compress(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(ltree_decompress);
+Datum          ltree_decompress(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(ltree_same);
+Datum          ltree_same(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(ltree_union);
+Datum          ltree_union(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(ltree_penalty);
+Datum          ltree_penalty(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(ltree_picksplit);
+Datum          ltree_picksplit(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(ltree_consistent);
+Datum          ltree_consistent(PG_FUNCTION_ARGS);
 
 #define ISEQ(a,b)      ( (a)->numlevel == (b)->numlevel && ltree_compare(a,b)==0 )
 #define GETENTRY(vec,pos) ((ltree_gist *) DatumGetPointer(((GISTENTRY *) VARDATA(vec))[(pos)].key))
 
-Datum   
-ltree_compress(PG_FUNCTION_ARGS) {
-       GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
+Datum
+ltree_compress(PG_FUNCTION_ARGS)
+{
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
        GISTENTRY  *retval = entry;
 
-       if ( entry->leafkey ) { /* ltree */
-               ltree_gist      *key;
-               ltree   *val = (ltree*)DatumGetPointer(PG_DETOAST_DATUM(entry->key));
-               int4 len = LTG_HDRSIZE + val->len;
+       if (entry->leafkey)
+       {                                                       /* ltree */
+               ltree_gist *key;
+               ltree      *val = (ltree *) DatumGetPointer(PG_DETOAST_DATUM(entry->key));
+               int4            len = LTG_HDRSIZE + val->len;
 
-               key = (ltree_gist*)palloc( len );
+               key = (ltree_gist *) palloc(len);
                key->len = len;
                key->flag = LTG_ONENODE;
-               memcpy( (void*)LTG_NODE(key), (void*)val, val->len);
+               memcpy((void *) LTG_NODE(key), (void *) val, val->len);
 
-               if ( PointerGetDatum(val) != entry->key )
+               if (PointerGetDatum(val) != entry->key)
                        pfree(val);
 
-               retval = (GISTENTRY*)palloc( sizeof(GISTENTRY) );
+               retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
                gistentryinit(*retval, PointerGetDatum(key),
-                       entry->rel, entry->page,
-                       entry->offset, key->len, FALSE);
+                                         entry->rel, entry->page,
+                                         entry->offset, key->len, FALSE);
        }
        PG_RETURN_POINTER(retval);
 }
 
-Datum   
-ltree_decompress(PG_FUNCTION_ARGS) {
-       GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
-       ltree_gist *key = (ltree_gist*)DatumGetPointer( PG_DETOAST_DATUM(entry->key) );
+Datum
+ltree_decompress(PG_FUNCTION_ARGS)
+{
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
+       ltree_gist *key = (ltree_gist *) DatumGetPointer(PG_DETOAST_DATUM(entry->key));
+
+       if (PointerGetDatum(key) != entry->key)
+       {
+               GISTENTRY  *retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 
-       if ( PointerGetDatum(key) != entry->key ) {
-               GISTENTRY *retval = (GISTENTRY*)palloc(sizeof(GISTENTRY));
                gistentryinit(*retval, PointerGetDatum(key),
-                       entry->rel, entry->page,
-                       entry->offset, key->len, FALSE);
+                                         entry->rel, entry->page,
+                                         entry->offset, key->len, FALSE);
                PG_RETURN_POINTER(retval);
        }
-        PG_RETURN_POINTER(entry);
+       PG_RETURN_POINTER(entry);
 }
 
-Datum   
-ltree_same(PG_FUNCTION_ARGS) {
-       ltree_gist*     a=(ltree_gist*)PG_GETARG_POINTER(0);
-       ltree_gist*     b=(ltree_gist*)PG_GETARG_POINTER(1);
-       bool *result = (bool *)PG_GETARG_POINTER(2);
+Datum
+ltree_same(PG_FUNCTION_ARGS)
+{
+       ltree_gist *a = (ltree_gist *) PG_GETARG_POINTER(0);
+       ltree_gist *b = (ltree_gist *) PG_GETARG_POINTER(1);
+       bool       *result = (bool *) PG_GETARG_POINTER(2);
 
        *result = false;
-       if ( LTG_ISONENODE(a) != LTG_ISONENODE(b) )
-               PG_RETURN_POINTER(result); 
-               
-       if ( LTG_ISONENODE(a) ) {
-               *result = ( ISEQ(LTG_NODE(a), LTG_NODE(b)) ) ? true : false;
-       } else {
-               int4 i;
-               BITVECP sa=LTG_SIGN(a), sb=LTG_SIGN(b);
-               if ( LTG_ISALLTRUE(a) != LTG_ISALLTRUE(b) ) 
-                        PG_RETURN_POINTER(result);
-
-               if ( !ISEQ(LTG_LNODE(a), LTG_LNODE(b)) ) 
-                       PG_RETURN_POINTER(result); 
-               if ( !ISEQ(LTG_RNODE(a), LTG_RNODE(b)) ) 
+       if (LTG_ISONENODE(a) != LTG_ISONENODE(b))
+               PG_RETURN_POINTER(result);
+
+       if (LTG_ISONENODE(a))
+               *result = (ISEQ(LTG_NODE(a), LTG_NODE(b))) ? true : false;
+       else
+       {
+               int4            i;
+               BITVECP         sa = LTG_SIGN(a),
+                                       sb = LTG_SIGN(b);
+
+               if (LTG_ISALLTRUE(a) != LTG_ISALLTRUE(b))
+                       PG_RETURN_POINTER(result);
+
+               if (!ISEQ(LTG_LNODE(a), LTG_LNODE(b)))
+                       PG_RETURN_POINTER(result);
+               if (!ISEQ(LTG_RNODE(a), LTG_RNODE(b)))
                        PG_RETURN_POINTER(result);
 
                *result = true;
-               if ( !LTG_ISALLTRUE(a) )
+               if (!LTG_ISALLTRUE(a))
                        LOOPBYTE(
-                               if ( sa[i] != sb[i] ) {
-                                       *result = false;
-                                       break;
-                               }
-                       );
+                                        if (sa[i] != sb[i])
+                                        {
+                               *result = false;
+                               break;
+                       }
+               );
        }
-       PG_RETURN_POINTER(result); 
+
+       PG_RETURN_POINTER(result);
 }
 
 static void
-hashing(BITVECP sign, ltree *t) {
-       int tlen = t->numlevel;
+hashing(BITVECP sign, ltree * t)
+{
+       int                     tlen = t->numlevel;
        ltree_level *cur = LTREE_FIRST(t);
-       int  hash;
+       int                     hash;
 
-       while(tlen > 0) {
-               hash = ltree_crc32_sz( cur->name, cur->len );
-               HASH( sign, hash );
+       while (tlen > 0)
+       {
+               hash = ltree_crc32_sz(cur->name, cur->len);
+               HASH(sign, hash);
                cur = LEVEL_NEXT(cur);
                tlen--;
        }
 }
 
-Datum   
-ltree_union(PG_FUNCTION_ARGS) {
-       bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
-       int *size = (int *) PG_GETARG_POINTER(1);
-       BITVEC base;
-       int4 len = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
-       int4 i,j;
-       ltree_gist      *result,*cur;
-       ltree   *left=NULL, *right=NULL, *curtree;
-       bool    isalltrue = false;
-       bool    isleqr;
-
-       MemSet( (void*)base, 0, sizeof(BITVEC) );
-       for(j=0;j<len;j++) {
+Datum
+ltree_union(PG_FUNCTION_ARGS)
+{
+       bytea      *entryvec = (bytea *) PG_GETARG_POINTER(0);
+       int                *size = (int *) PG_GETARG_POINTER(1);
+       BITVEC          base;
+       int4            len = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
+       int4            i,
+                               j;
+       ltree_gist *result,
+                          *cur;
+       ltree      *left = NULL,
+                          *right = NULL,
+                          *curtree;
+       bool            isalltrue = false;
+       bool            isleqr;
+
+       MemSet((void *) base, 0, sizeof(BITVEC));
+       for (j = 0; j < len; j++)
+       {
                cur = GETENTRY(entryvec, j);
-               if ( LTG_ISONENODE(cur) ) {
+               if (LTG_ISONENODE(cur))
+               {
                        curtree = LTG_NODE(cur);
-                       hashing(base,curtree);
-                       if ( !left || ltree_compare( left, curtree ) > 0 )
-                               left =  curtree;
-                       if ( !right || ltree_compare( right, curtree ) < 0 ) 
+                       hashing(base, curtree);
+                       if (!left || ltree_compare(left, curtree) > 0)
+                               left = curtree;
+                       if (!right || ltree_compare(right, curtree) < 0)
                                right = curtree;
-               } else {
-                       if ( isalltrue || LTG_ISALLTRUE(cur) ) 
+               }
+               else
+               {
+                       if (isalltrue || LTG_ISALLTRUE(cur))
                                isalltrue = true;
-                       else { 
-                               BITVECP sc=LTG_SIGN(cur);
+                       else
+                       {
+                               BITVECP         sc = LTG_SIGN(cur);
+
                                LOOPBYTE(
-                                       ((unsigned char*)base)[i] |= sc[i];
+                                                ((unsigned char *) base)[i] |= sc[i];
                                );
                        }
 
                        curtree = LTG_LNODE(cur);
-                       if ( !left || ltree_compare( left, curtree ) > 0 )
-                               left =  curtree;
+                       if (!left || ltree_compare(left, curtree) > 0)
+                               left = curtree;
                        curtree = LTG_RNODE(cur);
-                       if ( !right || ltree_compare( right, curtree ) < 0 ) 
+                       if (!right || ltree_compare(right, curtree) < 0)
                                right = curtree;
-               } 
+               }
        }
-       
-       if ( isalltrue == false ) {
+
+       if (isalltrue == false)
+       {
                isalltrue = true;
                LOOPBYTE(
-                       if ( ((unsigned char*)base)[i] != 0xff ) {
-                               isalltrue = false;
-                               break;
-                       }
-               ); 
+                                if (((unsigned char *) base)[i] != 0xff)
+                                {
+                       isalltrue = false;
+                       break;
+               }
+               );
        }
 
-       isleqr = ( left==right || ISEQ(left,right) ) ? true : false; 
-       *size = LTG_HDRSIZE + ( (isalltrue) ? 0 : SIGLEN ) + left->len + ( (isleqr) ? 0 : right->len );
+       isleqr = (left == right || ISEQ(left, right)) ? true : false;
+       *size = LTG_HDRSIZE + ((isalltrue) ? 0 : SIGLEN) + left->len + ((isleqr) ? 0 : right->len);
 
-       result = (ltree_gist*)palloc( *size );
+       result = (ltree_gist *) palloc(*size);
        result->len = *size;
        result->flag = 0;
 
-       if ( isalltrue )
+       if (isalltrue)
                result->flag |= LTG_ALLTRUE;
        else
-               memcpy( (void*)LTG_SIGN(result), base, SIGLEN );
+               memcpy((void *) LTG_SIGN(result), base, SIGLEN);
 
-       memcpy( (void*)LTG_LNODE(result), (void*)left, left->len );
-       if ( isleqr )
+       memcpy((void *) LTG_LNODE(result), (void *) left, left->len);
+       if (isleqr)
                result->flag |= LTG_NORIGHT;
        else
-               memcpy( (void*)LTG_RNODE(result), (void*)right, right->len );
+               memcpy((void *) LTG_RNODE(result), (void *) right, right->len);
 
-       PG_RETURN_POINTER(result);      
+       PG_RETURN_POINTER(result);
 }
 
-Datum   
-ltree_penalty(PG_FUNCTION_ARGS) {
-       ltree_gist *origval = (ltree_gist*)DatumGetPointer( ( (GISTENTRY *)PG_GETARG_POINTER(0) )->key );
-       ltree_gist *newval  = (ltree_gist*)DatumGetPointer( ( (GISTENTRY *)PG_GETARG_POINTER(1) )->key );
-       float  *penalty = (float *)    PG_GETARG_POINTER(2);
-       int4 cmpr,cmpl;
+Datum
+ltree_penalty(PG_FUNCTION_ARGS)
+{
+       ltree_gist *origval = (ltree_gist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key);
+       ltree_gist *newval = (ltree_gist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key);
+       float      *penalty = (float *) PG_GETARG_POINTER(2);
+       int4            cmpr,
+                               cmpl;
 
-       cmpl = ltree_compare( LTG_GETLNODE(origval), LTG_GETLNODE(newval) );
-       cmpr = ltree_compare( LTG_GETRNODE(newval),  LTG_GETRNODE(origval));
+       cmpl = ltree_compare(LTG_GETLNODE(origval), LTG_GETLNODE(newval));
+       cmpr = ltree_compare(LTG_GETRNODE(newval), LTG_GETRNODE(origval));
 
-       *penalty = max( cmpl, 0 ) + max( cmpr, 0 );
+       *penalty = max(cmpl, 0) + max(cmpr, 0);
 
        PG_RETURN_POINTER(penalty);
 }
 
 /* used for sorting */
-typedef struct rix {
-        int         index;
-        ltree       *r;
-}       RIX;
+typedef struct rix
+{
+       int                     index;
+       ltree      *r;
+}      RIX;
 
 static int
-treekey_cmp(const void *a, const void *b) {
+treekey_cmp(const void *a, const void *b)
+{
        return ltree_compare(
-               ((RIX *) a)->r,
-               ((RIX *) b)->r
+                                                ((RIX *) a)->r,
+                                                ((RIX *) b)->r
        );
 }
 
 
-Datum   
-ltree_picksplit(PG_FUNCTION_ARGS) {
-       bytea *entryvec = (bytea*) PG_GETARG_POINTER(0);
-       GIST_SPLITVEC *v = (GIST_SPLITVEC*) PG_GETARG_POINTER(1);
+Datum
+ltree_picksplit(PG_FUNCTION_ARGS)
+{
+       bytea      *entryvec = (bytea *) PG_GETARG_POINTER(0);
+       GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
        OffsetNumber j;
-       int4 i;
-       RIX *array;
+       int4            i;
+       RIX                *array;
        OffsetNumber maxoff;
-       int     nbytes;
-       int    size;
-       ltree   *lu_l,*lu_r, *ru_l, *ru_r;
-       ltree_gist       *lu, *ru;
-       BITVEC  ls,rs;
-       bool    lisat=false, risat=false, isleqr;
-       
-       memset( (void*)ls,0,sizeof(BITVEC) );   
-       memset( (void*)rs,0,sizeof(BITVEC) );   
+       int                     nbytes;
+       int                     size;
+       ltree      *lu_l,
+                          *lu_r,
+                          *ru_l,
+                          *ru_r;
+       ltree_gist *lu,
+                          *ru;
+       BITVEC          ls,
+                               rs;
+       bool            lisat = false,
+                               risat = false,
+                               isleqr;
+
+       memset((void *) ls, 0, sizeof(BITVEC));
+       memset((void *) rs, 0, sizeof(BITVEC));
        maxoff = ((VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY)) - 1;
        nbytes = (maxoff + 2) * sizeof(OffsetNumber);
        v->spl_left = (OffsetNumber *) palloc(nbytes);
@@ -263,109 +308,124 @@ ltree_picksplit(PG_FUNCTION_ARGS) {
        v->spl_nleft = 0;
        v->spl_nright = 0;
        array = (RIX *) palloc(sizeof(RIX) * (maxoff + 1));
-       
+
        /* copy the data into RIXes, and sort the RIXes */
-       for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j)) {
+       for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j))
+       {
                array[j].index = j;
-               lu = GETENTRY( entryvec, j ); /* use as tmp val */
+               lu = GETENTRY(entryvec, j);             /* use as tmp val */
                array[j].r = LTG_GETLNODE(lu);
        }
 
        qsort((void *) &array[FirstOffsetNumber], maxoff - FirstOffsetNumber + 1,
-               sizeof(RIX), treekey_cmp);
+                 sizeof(RIX), treekey_cmp);
 
        lu_l = lu_r = ru_l = ru_r = NULL;
-       for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j)) {
-               lu = GETENTRY( entryvec, array[j].index ); /* use as tmp val */
-               if (j <= (maxoff - FirstOffsetNumber + 1) / 2) {
+       for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j))
+       {
+               lu = GETENTRY(entryvec, array[j].index);                /* use as tmp val */
+               if (j <= (maxoff - FirstOffsetNumber + 1) / 2)
+               {
                        v->spl_left[v->spl_nleft] = array[j].index;
                        v->spl_nleft++;
-                       if ( lu_r==NULL || ltree_compare( LTG_GETRNODE(lu), lu_r ) > 0 )
+                       if (lu_r == NULL || ltree_compare(LTG_GETRNODE(lu), lu_r) > 0)
                                lu_r = LTG_GETRNODE(lu);
-                       if ( LTG_ISONENODE(lu) )
-                               hashing(ls,LTG_NODE(lu));
-                       else { 
-                               if ( lisat || LTG_ISALLTRUE(lu) ) 
+                       if (LTG_ISONENODE(lu))
+                               hashing(ls, LTG_NODE(lu));
+                       else
+                       {
+                               if (lisat || LTG_ISALLTRUE(lu))
                                        lisat = true;
-                               else { 
-                                       BITVECP sc=LTG_SIGN(lu);
+                               else
+                               {
+                                       BITVECP         sc = LTG_SIGN(lu);
+
                                        LOOPBYTE(
-                                               ((unsigned char*)ls)[i] |= sc[i];
+                                                        ((unsigned char *) ls)[i] |= sc[i];
                                        );
                                }
                        }
-               } else {
+               }
+               else
+               {
                        v->spl_right[v->spl_nright] = array[j].index;
                        v->spl_nright++;
-                       if ( ru_r==NULL || ltree_compare( LTG_GETRNODE(lu), ru_r ) > 0 )
+                       if (ru_r == NULL || ltree_compare(LTG_GETRNODE(lu), ru_r) > 0)
                                ru_r = LTG_GETRNODE(lu);
-                       if ( LTG_ISONENODE(lu) )
-                               hashing(rs,LTG_NODE(lu));
-                       else { 
-                               if ( risat || LTG_ISALLTRUE(lu) ) 
+                       if (LTG_ISONENODE(lu))
+                               hashing(rs, LTG_NODE(lu));
+                       else
+                       {
+                               if (risat || LTG_ISALLTRUE(lu))
                                        risat = true;
-                               else { 
-                                       BITVECP sc=LTG_SIGN(lu);
+                               else
+                               {
+                                       BITVECP         sc = LTG_SIGN(lu);
+
                                        LOOPBYTE(
-                                               ((unsigned char*)rs)[i] |= sc[i];
+                                                        ((unsigned char *) rs)[i] |= sc[i];
                                        );
                                }
                        }
                }
        }
-       
-       if ( lisat == false ) {
+
+       if (lisat == false)
+       {
                lisat = true;
                LOOPBYTE(
-                       if ( ((unsigned char*)ls)[i] != 0xff ) {
-                               lisat = false;
-                               break;
-                       }
-               ); 
+                                if (((unsigned char *) ls)[i] != 0xff)
+                                {
+                       lisat = false;
+                       break;
+               }
+               );
        }
 
-       if ( risat == false ) {
+       if (risat == false)
+       {
                risat = true;
                LOOPBYTE(
-                       if ( ((unsigned char*)rs)[i] != 0xff ) {
-                               risat = false;
-                               break;
-                       }
-               ); 
+                                if (((unsigned char *) rs)[i] != 0xff)
+                                {
+                       risat = false;
+                       break;
+               }
+               );
        }
 
-       lu_l = LTG_GETLNODE( GETENTRY( entryvec, array[FirstOffsetNumber].index ) );
-       isleqr = ( lu_l==lu_r || ISEQ(lu_l,lu_r) ) ? true : false; 
-       size = LTG_HDRSIZE + ( (lisat) ? 0 : SIGLEN ) + lu_l->len + ( (isleqr) ? 0 : lu_r->len );
-       lu = (ltree_gist*)palloc( size );
+       lu_l = LTG_GETLNODE(GETENTRY(entryvec, array[FirstOffsetNumber].index));
+       isleqr = (lu_l == lu_r || ISEQ(lu_l, lu_r)) ? true : false;
+       size = LTG_HDRSIZE + ((lisat) ? 0 : SIGLEN) + lu_l->len + ((isleqr) ? 0 : lu_r->len);
+       lu = (ltree_gist *) palloc(size);
        lu->len = size;
        lu->flag = 0;
-       if ( lisat )
+       if (lisat)
                lu->flag |= LTG_ALLTRUE;
        else
-               memcpy( (void*)LTG_SIGN(lu), ls, SIGLEN );
-       memcpy( (void*)LTG_LNODE(lu), (void*)lu_l, lu_l->len );
-       if ( isleqr )
+               memcpy((void *) LTG_SIGN(lu), ls, SIGLEN);
+       memcpy((void *) LTG_LNODE(lu), (void *) lu_l, lu_l->len);
+       if (isleqr)
                lu->flag |= LTG_NORIGHT;
        else
-               memcpy( (void*)LTG_RNODE(lu), (void*)lu_r, lu_r->len );
+               memcpy((void *) LTG_RNODE(lu), (void *) lu_r, lu_r->len);
 
 
-       ru_l = LTG_GETLNODE( GETENTRY( entryvec, array[ 1 + ((maxoff - FirstOffsetNumber + 1) / 2) ].index ) );
-       isleqr = ( ru_l==ru_r || ISEQ(ru_l,ru_r) ) ? true : false;
-       size = LTG_HDRSIZE + ( (risat) ? 0 : SIGLEN ) + ru_l->len + ( (isleqr) ? 0 : ru_r->len ); 
-       ru = (ltree_gist*)palloc( size );
+       ru_l = LTG_GETLNODE(GETENTRY(entryvec, array[1 + ((maxoff - FirstOffsetNumber + 1) / 2)].index));
+       isleqr = (ru_l == ru_r || ISEQ(ru_l, ru_r)) ? true : false;
+       size = LTG_HDRSIZE + ((risat) ? 0 : SIGLEN) + ru_l->len + ((isleqr) ? 0 : ru_r->len);
+       ru = (ltree_gist *) palloc(size);
        ru->len = size;
        ru->flag = 0;
-       if ( risat )
+       if (risat)
                ru->flag |= LTG_ALLTRUE;
        else
-               memcpy( (void*)LTG_SIGN(ru), rs, SIGLEN );
-       memcpy( (void*)LTG_LNODE(ru), (void*)ru_l, ru_l->len );
-       if ( isleqr )
+               memcpy((void *) LTG_SIGN(ru), rs, SIGLEN);
+       memcpy((void *) LTG_LNODE(ru), (void *) ru_l, ru_l->len);
+       if (isleqr)
                ru->flag |= LTG_NORIGHT;
        else
-               memcpy( (void*)LTG_RNODE(ru), (void*)ru_r, ru_r->len );
+               memcpy((void *) LTG_RNODE(ru), (void *) ru_r, ru_r->len);
 
        pfree(array);
        v->spl_ldatum = PointerGetDatum(lu);
@@ -375,13 +435,16 @@ ltree_picksplit(PG_FUNCTION_ARGS) {
 }
 
 static bool
-gist_isparent(ltree_gist *key, ltree *query) {
-       int4    numlevel = query->numlevel;
-       int     i;
-
-       for(i=query->numlevel;i>=0;i--) {
-               query->numlevel=i;
-               if ( ltree_compare(query,LTG_GETLNODE(key)) >=0 && ltree_compare(query,LTG_GETRNODE(key)) <= 0 ) {
+gist_isparent(ltree_gist * key, ltree * query)
+{
+       int4            numlevel = query->numlevel;
+       int                     i;
+
+       for (i = query->numlevel; i >= 0; i--)
+       {
+               query->numlevel = i;
+               if (ltree_compare(query, LTG_GETLNODE(key)) >= 0 && ltree_compare(query, LTG_GETRNODE(key)) <= 0)
+               {
                        query->numlevel = numlevel;
                        return true;
                }
@@ -392,23 +455,24 @@ gist_isparent(ltree_gist *key, ltree *query) {
 }
 
 static bool
-gist_ischild(ltree_gist *key, ltree *query) {
-       ltree   *left = LTG_GETLNODE(key);
-       ltree   *right = LTG_GETRNODE(key);
-       int4    numlevelL = left->numlevel;
-       int4    numlevelR = right->numlevel;
-       bool res = true;
-
-       if ( numlevelL > query->numlevel )
+gist_ischild(ltree_gist * key, ltree * query)
+{
+       ltree      *left = LTG_GETLNODE(key);
+       ltree      *right = LTG_GETRNODE(key);
+       int4            numlevelL = left->numlevel;
+       int4            numlevelR = right->numlevel;
+       bool            res = true;
+
+       if (numlevelL > query->numlevel)
                left->numlevel = query->numlevel;
 
-       if ( ltree_compare(query,left) < 0 )
+       if (ltree_compare(query, left) < 0)
                res = false;
 
-       if ( numlevelR > query->numlevel )
+       if (numlevelR > query->numlevel)
                right->numlevel = query->numlevel;
 
-       if ( res && ltree_compare(query,right) > 0 )
+       if (res && ltree_compare(query, right) > 0)
                res = false;
 
        left->numlevel = numlevelL;
@@ -417,29 +481,35 @@ gist_ischild(ltree_gist *key, ltree *query) {
 }
 
 static bool
-gist_qe(ltree_gist *key, lquery* query) {
-       lquery_level    *curq = LQUERY_FIRST(query);
-       BITVECP sign = LTG_SIGN(key);
-       int     qlen = query->numlevel;
+gist_qe(ltree_gist * key, lquery * query)
+{
+       lquery_level *curq = LQUERY_FIRST(query);
+       BITVECP         sign = LTG_SIGN(key);
+       int                     qlen = query->numlevel;
 
-       if ( LTG_ISALLTRUE(key) )
+       if (LTG_ISALLTRUE(key))
                return true;
 
-       while( qlen>0 ) {
-               if ( curq->numvar && LQL_CANLOOKSIGN(curq) ) {
-                       bool isexist=false;
-                       int vlen = curq->numvar;
+       while (qlen > 0)
+       {
+               if (curq->numvar && LQL_CANLOOKSIGN(curq))
+               {
+                       bool            isexist = false;
+                       int                     vlen = curq->numvar;
                        lquery_variant *curv = LQL_FIRST(curq);
-                       while( vlen>0 ) {
-                               if ( GETBIT( sign, HASHVAL( curv->val ) ) ) {
-                                       isexist=true;
+
+                       while (vlen > 0)
+                       {
+                               if (GETBIT(sign, HASHVAL(curv->val)))
+                               {
+                                       isexist = true;
                                        break;
                                }
                                curv = LVAR_NEXT(curv);
                                vlen--;
                        }
-                       if ( !isexist )
-                               return false;   
+                       if (!isexist)
+                               return false;
                }
 
                curq = LQL_NEXT(curq);
@@ -450,22 +520,27 @@ gist_qe(ltree_gist *key, lquery* query) {
 }
 
 static int
-gist_tqcmp(ltree* t, lquery* q) {
+gist_tqcmp(ltree * t, lquery * q)
+{
        ltree_level *al = LTREE_FIRST(t);
        lquery_level *ql = LQUERY_FIRST(q);
        lquery_variant *bl;
-       int     an = t->numlevel;
-       int     bn = q->firstgood;
-       int     res = 0;
+       int                     an = t->numlevel;
+       int                     bn = q->firstgood;
+       int                     res = 0;
 
-       while( an>0 && bn>0 ) {
+       while (an > 0 && bn > 0)
+       {
                bl = LQL_FIRST(ql);
-               if ( (res = strncmp( al->name, bl->name, min(al->len, bl->len))) == 0 ) {
-                       if ( al->len != bl->len )
+               if ((res = strncmp(al->name, bl->name, min(al->len, bl->len))) == 0)
+               {
+                       if (al->len != bl->len)
                                return al->len - bl->len;
-               } else
+               }
+               else
                        return res;
-               an--; bn--;
+               an--;
+               bn--;
                al = LEVEL_NEXT(al);
                ql = LQL_NEXT(ql);
        }
@@ -474,26 +549,27 @@ gist_tqcmp(ltree* t, lquery* q) {
 }
 
 static bool
-gist_between(ltree_gist *key, lquery* query) {
-       ltree   *left = LTG_GETLNODE(key);
-       ltree   *right = LTG_GETRNODE(key);
-       int4    numlevelL = left->numlevel;
-       int4    numlevelR = right->numlevel;
-       bool res = true;
-
-       if ( query->firstgood == 0 )
+gist_between(ltree_gist * key, lquery * query)
+{
+       ltree      *left = LTG_GETLNODE(key);
+       ltree      *right = LTG_GETRNODE(key);
+       int4            numlevelL = left->numlevel;
+       int4            numlevelR = right->numlevel;
+       bool            res = true;
+
+       if (query->firstgood == 0)
                return true;
 
-       if ( numlevelL > query->firstgood )
+       if (numlevelL > query->firstgood)
                left->numlevel = query->firstgood;
 
-       if ( gist_tqcmp(left,query) > 0 )
+       if (gist_tqcmp(left, query) > 0)
                res = false;
 
-       if ( numlevelR > query->firstgood )
+       if (numlevelR > query->firstgood)
                right->numlevel = query->firstgood;
 
-       if ( res && gist_tqcmp(right,query) < 0 )
+       if (res && gist_tqcmp(right, query) < 0)
                res = false;
 
        left->numlevel = numlevelL;
@@ -502,99 +578,102 @@ gist_between(ltree_gist *key, lquery* query) {
 }
 
 static bool
-checkcondition_bit(void *checkval, ITEM* val ) {
-       return ( FLG_CANLOOKSIGN(val->flag) ) ? GETBIT( checkval, HASHVAL( val->val ) ) : true;
+checkcondition_bit(void *checkval, ITEM * val)
+{
+       return (FLG_CANLOOKSIGN(val->flag)) ? GETBIT(checkval, HASHVAL(val->val)) : true;
 }
 
 static bool
-gist_qtxt(ltree_gist *key, ltxtquery* query) {
-       if ( LTG_ISALLTRUE(key) )
+gist_qtxt(ltree_gist * key, ltxtquery * query)
+{
+       if (LTG_ISALLTRUE(key))
                return true;
+
        return ltree_execute(
-               GETQUERY(query),
-               (void*)LTG_SIGN(key), false,
-               checkcondition_bit
-       );
+                                                GETQUERY(query),
+                                                (void *) LTG_SIGN(key), false,
+                                                checkcondition_bit
+               );
 }
 
 
-Datum   
-ltree_consistent(PG_FUNCTION_ARGS) {
-       GISTENTRY *entry = (GISTENTRY*)PG_GETARG_POINTER(0);
-       char *query = (char*)DatumGetPointer( PG_DETOAST_DATUM(PG_GETARG_DATUM(1)) );
-       ltree_gist *key = (ltree_gist*)DatumGetPointer( entry->key );
+Datum
+ltree_consistent(PG_FUNCTION_ARGS)
+{
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
+       char       *query = (char *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
+       ltree_gist *key = (ltree_gist *) DatumGetPointer(entry->key);
        StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-       bool res = false;
+       bool            res = false;
 
-#ifndef assert_enabled 
+#ifndef assert_enabled
 #define assert_enabled 0
 #endif
-       
-       switch( strategy ) {
+
+       switch (strategy)
+       {
                case BTLessStrategyNumber:
-                       res = ( GIST_LEAF( entry ) ) ?
-                                       ( ltree_compare((ltree*)query,LTG_NODE(key)) > 0 )
+                       res = (GIST_LEAF(entry)) ?
+                               (ltree_compare((ltree *) query, LTG_NODE(key)) > 0)
                                :
-                                       ( ltree_compare((ltree*)query,LTG_GETLNODE(key)) >= 0 );
+                               (ltree_compare((ltree *) query, LTG_GETLNODE(key)) >= 0);
                        break;
                case BTLessEqualStrategyNumber:
-                       res = ( ltree_compare((ltree*)query,LTG_GETLNODE(key)) >= 0 );
+                       res = (ltree_compare((ltree *) query, LTG_GETLNODE(key)) >= 0);
                        break;
                case BTEqualStrategyNumber:
-                       if ( GIST_LEAF( entry ) )
-                               res = ( ltree_compare((ltree*)query,LTG_NODE(key)) == 0 );
+                       if (GIST_LEAF(entry))
+                               res = (ltree_compare((ltree *) query, LTG_NODE(key)) == 0);
                        else
                                res = (
-                                       ltree_compare((ltree*)query,LTG_GETLNODE(key)) >= 0
-                                       &&
-                                       ltree_compare((ltree*)query,LTG_GETRNODE(key)) <= 0
-                               );
+                                  ltree_compare((ltree *) query, LTG_GETLNODE(key)) >= 0
+                                          &&
+                                  ltree_compare((ltree *) query, LTG_GETRNODE(key)) <= 0
+                                       );
                        break;
                case BTGreaterEqualStrategyNumber:
-                       res = ( ltree_compare((ltree*)query,LTG_GETRNODE(key)) <= 0 );
+                       res = (ltree_compare((ltree *) query, LTG_GETRNODE(key)) <= 0);
                        break;
                case BTGreaterStrategyNumber:
-                       res = ( GIST_LEAF( entry ) ) ?
-                                       ( ltree_compare((ltree*)query,LTG_GETRNODE(key)) < 0 )
+                       res = (GIST_LEAF(entry)) ?
+                               (ltree_compare((ltree *) query, LTG_GETRNODE(key)) < 0)
                                :
-                                       ( ltree_compare((ltree*)query,LTG_GETRNODE(key)) <= 0 );
+                               (ltree_compare((ltree *) query, LTG_GETRNODE(key)) <= 0);
                        break;
                case 10:
-                       res = ( GIST_LEAF( entry ) ) ?
-                                       inner_isparent( (ltree*)query, LTG_NODE(key) )
+                       res = (GIST_LEAF(entry)) ?
+                               inner_isparent((ltree *) query, LTG_NODE(key))
                                :
-                                       gist_isparent( key, (ltree*)query);
+                               gist_isparent(key, (ltree *) query);
                        break;
                case 11:
-                       res = ( GIST_LEAF( entry ) ) ?
-                                       inner_isparent( LTG_NODE(key), (ltree*)query)
+                       res = (GIST_LEAF(entry)) ?
+                               inner_isparent(LTG_NODE(key), (ltree *) query)
                                :
-                                       gist_ischild( key, (ltree*)query);
+                               gist_ischild(key, (ltree *) query);
                        break;
                case 12:
                case 13:
-                       if ( GIST_LEAF( entry ) ) 
-                               res = DatumGetBool( DirectFunctionCall2( ltq_regex,
-                                        PointerGetDatum( LTG_NODE(key) ),
-                                        PointerGetDatum( (lquery*)query )
-                                       );
-                       else 
-                               res = ( gist_qe(key, (lquery*)query) && gist_between(key, (lquery*)query) );
-                       break; 
+                       if (GIST_LEAF(entry))
+                               res = DatumGetBool(DirectFunctionCall2(ltq_regex,
+                                                                                 PointerGetDatum(LTG_NODE(key)),
+                                                                               PointerGetDatum((lquery *) query)
+                                                                                                          ));
+                       else
+                               res = (gist_qe(key, (lquery *) query) && gist_between(key, (lquery *) query));
+                       break;
                case 14:
                case 15:
-                       if ( GIST_LEAF( entry ) ) 
-                               res = DatumGetBool( DirectFunctionCall2( ltxtq_exec,
-                                        PointerGetDatum( LTG_NODE(key) ),
-                                        PointerGetDatum( (lquery*)query )
-                                       );
-                       else 
-                               res = gist_qtxt(key, (ltxtquery*)query);
-                       break;  
+                       if (GIST_LEAF(entry))
+                               res = DatumGetBool(DirectFunctionCall2(ltxtq_exec,
+                                                                                 PointerGetDatum(LTG_NODE(key)),
+                                                                               PointerGetDatum((lquery *) query)
+                                                                                                          ));
+                       else
+                               res = gist_qtxt(key, (ltxtquery *) query);
+                       break;
                default:
-                       elog(ERROR,"Unknown StrategyNumber: %d", strategy);
+                       elog(ERROR, "Unknown StrategyNumber: %d", strategy);
        }
        PG_RETURN_BOOL(res);
 }
-
index 6fb6d3d..5e9dac4 100644 (file)
 
 #include "ltree.h"
 #include <ctype.h>
-#include "crc32.h" 
+#include "crc32.h"
 
 PG_FUNCTION_INFO_V1(ltree_in);
-Datum ltree_in(PG_FUNCTION_ARGS);
+Datum          ltree_in(PG_FUNCTION_ARGS);
+
 PG_FUNCTION_INFO_V1(ltree_out);
-Datum ltree_out(PG_FUNCTION_ARGS);
+Datum          ltree_out(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(lquery_in);
-Datum lquery_in(PG_FUNCTION_ARGS);
+Datum          lquery_in(PG_FUNCTION_ARGS);
+
 PG_FUNCTION_INFO_V1(lquery_out);
-Datum lquery_out(PG_FUNCTION_ARGS);
+Datum          lquery_out(PG_FUNCTION_ARGS);
 
 
 #define UNCHAR elog(ERROR,"Syntax error in position %d near '%c'", (int)(ptr-buf), *ptr)
 
-typedef struct {
-       char*   start;
-       int     len;
-       int     flag;
-} nodeitem;
+typedef struct
+{
+       char       *start;
+       int                     len;
+       int                     flag;
+}      nodeitem;
 
 #define LTPRS_WAITNAME 0
-#define LTPRS_WAITDELIM        1
-
-Datum 
-ltree_in(PG_FUNCTION_ARGS) {
-       char    *buf = (char *) PG_GETARG_POINTER(0);
-       char    *ptr;
-       nodeitem *list, *lptr; 
-       int num=0, totallen = 0;
-       int state = LTPRS_WAITNAME;
-       ltree   *result;
-       ltree_level     *curlevel;
-
-       ptr=buf;
-       while( *ptr ) {
-               if ( *ptr == '.' )
+#define LTPRS_WAITDELIM 1
+
+Datum
+ltree_in(PG_FUNCTION_ARGS)
+{
+       char       *buf = (char *) PG_GETARG_POINTER(0);
+       char       *ptr;
+       nodeitem   *list,
+                          *lptr;
+       int                     num = 0,
+                               totallen = 0;
+       int                     state = LTPRS_WAITNAME;
+       ltree      *result;
+       ltree_level *curlevel;
+
+       ptr = buf;
+       while (*ptr)
+       {
+               if (*ptr == '.')
                        num++;
                ptr++;
        }
 
-       list = lptr = (nodeitem*) palloc( sizeof(nodeitem)*(num+1) );
-       ptr=buf;
-       while( *ptr ) {
-               if ( state == LTPRS_WAITNAME ) {
-                       if ( ISALNUM(*ptr) ) {
+       list = lptr = (nodeitem *) palloc(sizeof(nodeitem) * (num + 1));
+       ptr = buf;
+       while (*ptr)
+       {
+               if (state == LTPRS_WAITNAME)
+               {
+                       if (ISALNUM(*ptr))
+                       {
                                lptr->start = ptr;
                                state = LTPRS_WAITDELIM;
-                       } else
+                       }
+                       else
                                UNCHAR;
-               } else if ( state == LTPRS_WAITDELIM ) {
-                       if ( *ptr == '.' ) {
+               }
+               else if (state == LTPRS_WAITDELIM)
+               {
+                       if (*ptr == '.')
+                       {
                                lptr->len = ptr - lptr->start;
-                               if ( lptr->len > 255 ) 
-                                       elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d", 
-                                               lptr->len, (int)(lptr->start - buf));
+                               if (lptr->len > 255)
+                                       elog(ERROR, "Name of level is too long (%d, must be < 256) in position %d",
+                                                lptr->len, (int) (lptr->start - buf));
                                totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
                                lptr++;
                                state = LTPRS_WAITNAME;
-                       } else if ( !ISALNUM(*ptr) )
+                       }
+                       else if (!ISALNUM(*ptr))
                                UNCHAR;
-               } else
-                       elog(ERROR,"Inner error in parser");
+               }
+               else
+                       elog(ERROR, "Inner error in parser");
                ptr++;
        }
 
-       if ( state == LTPRS_WAITDELIM ) {
+       if (state == LTPRS_WAITDELIM)
+       {
                lptr->len = ptr - lptr->start;
-               if ( lptr->len > 255 ) 
-                       elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d", 
-                               lptr->len, (int)(lptr->start - buf));
+               if (lptr->len > 255)
+                       elog(ERROR, "Name of level is too long (%d, must be < 256) in position %d",
+                                lptr->len, (int) (lptr->start - buf));
                totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE);
                lptr++;
-       } else if ( ! (state == LTPRS_WAITNAME && lptr == list) )
-               elog(ERROR,"Unexpected end of line");
+       }
+       else if (!(state == LTPRS_WAITNAME && lptr == list))
+               elog(ERROR, "Unexpected end of line");
 
-       result = (ltree*)palloc( LTREE_HDRSIZE + totallen );
+       result = (ltree *) palloc(LTREE_HDRSIZE + totallen);
        result->len = LTREE_HDRSIZE + totallen;
-       result->numlevel = lptr-list;
+       result->numlevel = lptr - list;
        curlevel = LTREE_FIRST(result);
-       lptr=list;
-       while( lptr-list < result->numlevel ) {
+       lptr = list;
+       while (lptr - list < result->numlevel)
+       {
                curlevel->len = (uint8) lptr->len;
-               memcpy( curlevel->name, lptr->start, lptr->len);
-               curlevel = LEVEL_NEXT(curlevel); 
+               memcpy(curlevel->name, lptr->start, lptr->len);
+               curlevel = LEVEL_NEXT(curlevel);
                lptr++;
        }
 
@@ -97,254 +116,323 @@ ltree_in(PG_FUNCTION_ARGS) {
        PG_RETURN_POINTER(result);
 }
 
-Datum 
-ltree_out(PG_FUNCTION_ARGS) {
-       ltree *in = PG_GETARG_LTREE(0);
-       char *buf,*ptr;
-       int i;
-       ltree_level     *curlevel;
-       
-       ptr = buf = (char*)palloc( in->len );
+Datum
+ltree_out(PG_FUNCTION_ARGS)
+{
+       ltree      *in = PG_GETARG_LTREE(0);
+       char       *buf,
+                          *ptr;
+       int                     i;
+       ltree_level *curlevel;
+
+       ptr = buf = (char *) palloc(in->len);
        curlevel = LTREE_FIRST(in);
-       for(i=0;i<in->numlevel;i++) {
-               if ( i!=0 ) {
+       for (i = 0; i < in->numlevel; i++)
+       {
+               if (i != 0)
+               {
                        *ptr = '.';
                        ptr++;
                }
-               memcpy( ptr, curlevel->name, curlevel->len );
-               ptr+=curlevel->len;
+               memcpy(ptr, curlevel->name, curlevel->len);
+               ptr += curlevel->len;
                curlevel = LEVEL_NEXT(curlevel);
        }
 
-       *ptr='\0';
-       PG_FREE_IF_COPY(in,0);
+       *ptr = '\0';
+       PG_FREE_IF_COPY(in, 0);
 
        PG_RETURN_POINTER(buf);
 }
 
-#define LQPRS_WAITLEVEL        0
-#define LQPRS_WAITDELIM        1
-#define        LQPRS_WAITOPEN  2
-#define        LQPRS_WAITFNUM  3
-#define        LQPRS_WAITSNUM  4
-#define        LQPRS_WAITND    5
-#define LQPRS_WAITCLOSE        6
+#define LQPRS_WAITLEVEL 0
+#define LQPRS_WAITDELIM 1
+#define LQPRS_WAITOPEN 2
+#define LQPRS_WAITFNUM 3
+#define LQPRS_WAITSNUM 4
+#define LQPRS_WAITND   5
+#define LQPRS_WAITCLOSE 6
 #define LQPRS_WAITEND  7
 #define LQPRS_WAITVAR  8
 
 
-#define GETVAR(x) ( *((nodeitem**)LQL_FIRST(x)) ) 
-#define ITEMSIZE       MAXALIGN(LQL_HDRSIZE+sizeof(nodeitem*)) 
-#define NEXTLEV(x) ( (lquery_level*)( ((char*)(x)) + ITEMSIZE) ) 
-
-Datum 
-lquery_in(PG_FUNCTION_ARGS) {
-       char    *buf = (char *) PG_GETARG_POINTER(0);
-       char    *ptr;
-       int num=0, totallen = 0, numOR=0;
-       int state = LQPRS_WAITLEVEL;
-       lquery  *result;
-       nodeitem  *lptr=NULL;
-       lquery_level    *cur,*curqlevel, *tmpql;
-       lquery_variant  *lrptr=NULL;
-       bool hasnot=false;
-       bool wasbad=false;
-
-       ptr=buf;
-       while( *ptr ) {
-               if ( *ptr == '.' )
+#define GETVAR(x) ( *((nodeitem**)LQL_FIRST(x)) )
+#define ITEMSIZE       MAXALIGN(LQL_HDRSIZE+sizeof(nodeitem*))
+#define NEXTLEV(x) ( (lquery_level*)( ((char*)(x)) + ITEMSIZE) )
+
+Datum
+lquery_in(PG_FUNCTION_ARGS)
+{
+       char       *buf = (char *) PG_GETARG_POINTER(0);
+       char       *ptr;
+       int                     num = 0,
+                               totallen = 0,
+                               numOR = 0;
+       int                     state = LQPRS_WAITLEVEL;
+       lquery     *result;
+       nodeitem   *lptr = NULL;
+       lquery_level *cur,
+                          *curqlevel,
+                          *tmpql;
+       lquery_variant *lrptr = NULL;
+       bool            hasnot = false;
+       bool            wasbad = false;
+
+       ptr = buf;
+       while (*ptr)
+       {
+               if (*ptr == '.')
                        num++;
-               else if ( *ptr == '|' )
+               else if (*ptr == '|')
                        numOR++;
                ptr++;
        }
-       
+
        num++;
-       curqlevel = tmpql = (lquery_level*) palloc( ITEMSIZE*num );
-       memset((void*)tmpql,0, ITEMSIZE*num );
-       ptr=buf;
-       while( *ptr ) {
-               if ( state==LQPRS_WAITLEVEL ) {
-                       if ( ISALNUM(*ptr) ) {
-                               GETVAR(curqlevel) = lptr = (nodeitem*)palloc( sizeof(nodeitem)*(numOR+1) );
-                               memset((void*)GETVAR(curqlevel),  0,sizeof(nodeitem)*(numOR+1) );
+       curqlevel = tmpql = (lquery_level *) palloc(ITEMSIZE * num);
+       memset((void *) tmpql, 0, ITEMSIZE * num);
+       ptr = buf;
+       while (*ptr)
+       {
+               if (state == LQPRS_WAITLEVEL)
+               {
+                       if (ISALNUM(*ptr))
+                       {
+                               GETVAR(curqlevel) = lptr = (nodeitem *) palloc(sizeof(nodeitem) * (numOR + 1));
+                               memset((void *) GETVAR(curqlevel), 0, sizeof(nodeitem) * (numOR + 1));
                                lptr->start = ptr;
                                state = LQPRS_WAITDELIM;
                                curqlevel->numvar = 1;
-                       } else if ( *ptr == '!' ) {
-                               GETVAR(curqlevel) = lptr = (nodeitem*)palloc( sizeof(nodeitem)*(numOR+1) );
-                               memset((void*)GETVAR(curqlevel),  0,sizeof(nodeitem)*(numOR+1) );
-                               lptr->start = ptr+1;
+                       }
+                       else if (*ptr == '!')
+                       {
+                               GETVAR(curqlevel) = lptr = (nodeitem *) palloc(sizeof(nodeitem) * (numOR + 1));
+                               memset((void *) GETVAR(curqlevel), 0, sizeof(nodeitem) * (numOR + 1));
+                               lptr->start = ptr + 1;
                                state = LQPRS_WAITDELIM;
                                curqlevel->numvar = 1;
                                curqlevel->flag |= LQL_NOT;
-                               hasnot=true;
-                       } else if ( *ptr == '*' ) {
+                               hasnot = true;
+                       }
+                       else if (*ptr == '*')
                                state = LQPRS_WAITOPEN;
-                       else
+                       else
                                UNCHAR;
-               } else if ( state==LQPRS_WAITVAR ) {
-                       if ( ISALNUM(*ptr) ) {
+               }
+               else if (state == LQPRS_WAITVAR)
+               {
+                       if (ISALNUM(*ptr))
+                       {
                                lptr++;
                                lptr->start = ptr;
                                state = LQPRS_WAITDELIM;
                                curqlevel->numvar++;
-                       } else
+                       }
+                       else
                                UNCHAR;
-               } else if ( state==LQPRS_WAITDELIM ) {
-                       if ( *ptr == '@' ) {
-                               if ( lptr->start == ptr )
+               }
+               else if (state == LQPRS_WAITDELIM)
+               {
+                       if (*ptr == '@')
+                       {
+                               if (lptr->start == ptr)
                                        UNCHAR;
                                lptr->flag |= LVAR_INCASE;
                                curqlevel->flag |= LVAR_INCASE;
-                       } else if ( *ptr == '*' ) {
-                               if ( lptr->start == ptr )
+                       }
+                       else if (*ptr == '*')
+                       {
+                               if (lptr->start == ptr)
                                        UNCHAR;
                                lptr->flag |= LVAR_ANYEND;
                                curqlevel->flag |= LVAR_ANYEND;
-                       } else if ( *ptr == '%' ) {
-                               if ( lptr->start == ptr )
+                       }
+                       else if (*ptr == '%')
+                       {
+                               if (lptr->start == ptr)
                                        UNCHAR;
                                lptr->flag |= LVAR_SUBLEXEM;
                                curqlevel->flag |= LVAR_SUBLEXEM;
-                       } else if ( *ptr == '|' ) {
-                               lptr->len = ptr - lptr->start - 
-                                       ( ( lptr->flag & LVAR_SUBLEXEM ) ? 1 : 0 ) - 
-                                       ( ( lptr->flag & LVAR_INCASE ) ? 1 : 0 ) - 
-                                       ( ( lptr->flag & LVAR_ANYEND ) ? 1 : 0 );
-                               if ( lptr->len > 255 ) 
-                                       elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d", 
-                                               lptr->len, (int)(lptr->start - buf));
+                       }
+                       else if (*ptr == '|')
+                       {
+                               lptr->len = ptr - lptr->start -
+                                       ((lptr->flag & LVAR_SUBLEXEM) ? 1 : 0) -
+                                       ((lptr->flag & LVAR_INCASE) ? 1 : 0) -
+                                       ((lptr->flag & LVAR_ANYEND) ? 1 : 0);
+                               if (lptr->len > 255)
+                                       elog(ERROR, "Name of level is too long (%d, must be < 256) in position %d",
+                                                lptr->len, (int) (lptr->start - buf));
                                state = LQPRS_WAITVAR;
-                       } else if ( *ptr == '.' ) {
-                               lptr->len = ptr - lptr->start - 
-                                       ( ( lptr->flag & LVAR_SUBLEXEM ) ? 1 : 0 ) - 
-                                       ( ( lptr->flag & LVAR_INCASE ) ? 1 : 0 ) - 
-                                       ( ( lptr->flag & LVAR_ANYEND ) ? 1 : 0 );
-                               if ( lptr->len > 255 ) 
-                                       elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d", 
-                                               lptr->len, (int)(lptr->start - buf));
+                       }
+                       else if (*ptr == '.')
+                       {
+                               lptr->len = ptr - lptr->start -
+                                       ((lptr->flag & LVAR_SUBLEXEM) ? 1 : 0) -
+                                       ((lptr->flag & LVAR_INCASE) ? 1 : 0) -
+                                       ((lptr->flag & LVAR_ANYEND) ? 1 : 0);
+                               if (lptr->len > 255)
+                                       elog(ERROR, "Name of level is too long (%d, must be < 256) in position %d",
+                                                lptr->len, (int) (lptr->start - buf));
                                state = LQPRS_WAITLEVEL;
                                curqlevel = NEXTLEV(curqlevel);
-                       } else if ( ISALNUM(*ptr) ) {
-                               if ( lptr->flag )
+                       }
+                       else if (ISALNUM(*ptr))
+                       {
+                               if (lptr->flag)
                                        UNCHAR;
-                       } else
+                       }
+                       else
                                UNCHAR;
-               } else if ( state == LQPRS_WAITOPEN ) {
-                       if ( *ptr == '{' ) {
+               }
+               else if (state == LQPRS_WAITOPEN)
+               {
+                       if (*ptr == '{')
                                state = LQPRS_WAITFNUM;
-                       } else if ( *ptr == '.' ) {
-                               curqlevel->low=0;
-                               curqlevel->high=0xffff;
+                       else if (*ptr == '.')
+                       {
+                               curqlevel->low = 0;
+                               curqlevel->high = 0xffff;
                                curqlevel = NEXTLEV(curqlevel);
                                state = LQPRS_WAITLEVEL;
-                       } else
+                       }
+                       else
                                UNCHAR;
-               } else if ( state == LQPRS_WAITFNUM ) {
-                       if ( *ptr == ',' ) {
-                               state = LQPRS_WAITSNUM; 
-                       } else if ( isdigit((unsigned int)*ptr) ) {
-                               curqlevel->low = atoi( ptr );
+               }
+               else if (state == LQPRS_WAITFNUM)
+               {
+                       if (*ptr == ',')
+                               state = LQPRS_WAITSNUM;
+                       else if (isdigit((unsigned int) *ptr))
+                       {
+                               curqlevel->low = atoi(ptr);
                                state = LQPRS_WAITND;
-                       } else
-                               UNCHAR; 
-               } else if ( state == LQPRS_WAITSNUM ) {
-                       if ( isdigit((unsigned int)*ptr) ) {
-                               curqlevel->high = atoi( ptr );
-                               state =  LQPRS_WAITCLOSE;
-                       } else if ( *ptr == '}' ) {
+                       }
+                       else
+                               UNCHAR;
+               }
+               else if (state == LQPRS_WAITSNUM)
+               {
+                       if (isdigit((unsigned int) *ptr))
+                       {
+                               curqlevel->high = atoi(ptr);
+                               state = LQPRS_WAITCLOSE;
+                       }
+                       else if (*ptr == '}')
+                       {
                                curqlevel->high = 0xffff;
                                state = LQPRS_WAITEND;
-                       } else
+                       }
+                       else
                                UNCHAR;
-               } else if ( state == LQPRS_WAITCLOSE ) {
-                       if ( *ptr == '}' )
+               }
+               else if (state == LQPRS_WAITCLOSE)
+               {
+                       if (*ptr == '}')
                                state = LQPRS_WAITEND;
-                       else if ( !isdigit((unsigned int)*ptr) )
+                       else if (!isdigit((unsigned int) *ptr))
                                UNCHAR;
-               } else if ( state == LQPRS_WAITND ) { 
-                       if ( *ptr == '}' ) {
+               }
+               else if (state == LQPRS_WAITND)
+               {
+                       if (*ptr == '}')
+                       {
                                curqlevel->high = curqlevel->low;
                                state = LQPRS_WAITEND;
-                       } else if ( *ptr == ',' )
+                       }
+                       else if (*ptr == ',')
                                state = LQPRS_WAITSNUM;
-                       else if ( !isdigit((unsigned int)*ptr) )
+                       else if (!isdigit((unsigned int) *ptr))
                                UNCHAR;
-               } else if ( state == LQPRS_WAITEND ) {
-                       if ( *ptr == '.' ) {
+               }
+               else if (state == LQPRS_WAITEND)
+               {
+                       if (*ptr == '.')
+                       {
                                state = LQPRS_WAITLEVEL;
                                curqlevel = NEXTLEV(curqlevel);
-                       } else
+                       }
+                       else
                                UNCHAR;
-               } else
-                       elog(ERROR,"Inner error in parser");
+               }
+               else
+                       elog(ERROR, "Inner error in parser");
                ptr++;
        }
-                       
-       if ( state==LQPRS_WAITDELIM ) {
-               if ( lptr->start == ptr )
-                       elog(ERROR,"Unexpected end of line");
+
+       if (state == LQPRS_WAITDELIM)
+       {
+               if (lptr->start == ptr)
+                       elog(ERROR, "Unexpected end of line");
                lptr->len = ptr - lptr->start -
-                       ( ( lptr->flag & LVAR_SUBLEXEM ) ? 1 : 0 ) - 
-                       ( ( lptr->flag & LVAR_INCASE ) ? 1 : 0 ) - 
-                       ( ( lptr->flag & LVAR_ANYEND ) ? 1 : 0 );
-               if ( lptr->len==0 )
-                       elog(ERROR,"Unexpected end of line");
-               if ( lptr->len > 255 ) 
-                       elog(ERROR,"Name of level is too long (%d, must be < 256) in position %d", 
-                               lptr->len, (int)(lptr->start - buf));
-       } else if ( state == LQPRS_WAITOPEN ) {
+                       ((lptr->flag & LVAR_SUBLEXEM) ? 1 : 0) -
+                       ((lptr->flag & LVAR_INCASE) ? 1 : 0) -
+                       ((lptr->flag & LVAR_ANYEND) ? 1 : 0);
+               if (lptr->len == 0)
+                       elog(ERROR, "Unexpected end of line");
+               if (lptr->len > 255)
+                       elog(ERROR, "Name of level is too long (%d, must be < 256) in position %d",
+                                lptr->len, (int) (lptr->start - buf));
+       }
+       else if (state == LQPRS_WAITOPEN)
                curqlevel->high = 0xffff;
-       } else if ( state != LQPRS_WAITEND ) 
-               elog(ERROR,"Unexpected end of line");
-                
+       else if (state != LQPRS_WAITEND)
+               elog(ERROR, "Unexpected end of line");
+
        curqlevel = tmpql;
-       totallen = LQUERY_HDRSIZE; 
-       while( (char*)curqlevel-(char*)tmpql < num*ITEMSIZE ) {
-               totallen += LQL_HDRSIZE; 
-               if ( curqlevel->numvar ) {
+       totallen = LQUERY_HDRSIZE;
+       while ((char *) curqlevel - (char *) tmpql < num * ITEMSIZE)
+       {
+               totallen += LQL_HDRSIZE;
+               if (curqlevel->numvar)
+               {
                        lptr = GETVAR(curqlevel);
-                       while( lptr-GETVAR(curqlevel) < curqlevel->numvar ) {
+                       while (lptr - GETVAR(curqlevel) < curqlevel->numvar)
+                       {
                                totallen += MAXALIGN(LVAR_HDRSIZE + lptr->len);
                                lptr++;
                        }
-               } else if ( curqlevel->low > curqlevel->high )
-                       elog(ERROR,"Low limit(%d) is greater than upper(%d)",curqlevel->low,curqlevel->high ); 
+               }
+               else if (curqlevel->low > curqlevel->high)
+                       elog(ERROR, "Low limit(%d) is greater than upper(%d)", curqlevel->low, curqlevel->high);
                curqlevel = NEXTLEV(curqlevel);
        }
 
-       result = (lquery*)palloc( totallen );
+       result = (lquery *) palloc(totallen);
        result->len = totallen;
        result->numlevel = num;
        result->firstgood = 0;
-       result->flag=0;
-       if ( hasnot )
+       result->flag = 0;
+       if (hasnot)
                result->flag |= LQUERY_HASNOT;
        cur = LQUERY_FIRST(result);
        curqlevel = tmpql;
-       while( (char*)curqlevel-(char*)tmpql < num*ITEMSIZE ) {
-               memcpy(cur,curqlevel,LQL_HDRSIZE);
-               cur->totallen=LQL_HDRSIZE;
-               if ( curqlevel->numvar ) {
+       while ((char *) curqlevel - (char *) tmpql < num * ITEMSIZE)
+       {
+               memcpy(cur, curqlevel, LQL_HDRSIZE);
+               cur->totallen = LQL_HDRSIZE;
+               if (curqlevel->numvar)
+               {
                        lrptr = LQL_FIRST(cur);
                        lptr = GETVAR(curqlevel);
-                       while( lptr-GETVAR(curqlevel) < curqlevel->numvar ) {
+                       while (lptr - GETVAR(curqlevel) < curqlevel->numvar)
+                       {
                                cur->totallen += MAXALIGN(LVAR_HDRSIZE + lptr->len);
-                               lrptr->len  = lptr->len;
+                               lrptr->len = lptr->len;
                                lrptr->flag = lptr->flag;
                                lrptr->val = ltree_crc32_sz((uint8 *) lptr->start, lptr->len);
-                               memcpy( lrptr->name, lptr->start, lptr->len);
+                               memcpy(lrptr->name, lptr->start, lptr->len);
                                lptr++;
-                               lrptr = LVAR_NEXT( lrptr );
+                               lrptr = LVAR_NEXT(lrptr);
                        }
-                       pfree( GETVAR(curqlevel) );
-                       if ( cur->numvar > 1 || cur->flag != 0 )
-                               wasbad=true;
-                       else if ( wasbad==false )
-                               (result->firstgood)++;   
-               } else
-                       wasbad=true;
+                       pfree(GETVAR(curqlevel));
+                       if (cur->numvar > 1 || cur->flag != 0)
+                               wasbad = true;
+                       else if (wasbad == false)
+                               (result->firstgood)++;
+               }
+               else
+                       wasbad = true;
                curqlevel = NEXTLEV(curqlevel);
                cur = LQL_NEXT(cur);
        }
@@ -353,82 +441,104 @@ lquery_in(PG_FUNCTION_ARGS) {
        PG_RETURN_POINTER(result);
 }
 
-Datum 
-lquery_out(PG_FUNCTION_ARGS) {
-       lquery *in = PG_GETARG_LQUERY(0);
-       char *buf,*ptr;
-       int i,j,totallen=0;
-       lquery_level     *curqlevel;
-       lquery_variant     *curtlevel;
+Datum
+lquery_out(PG_FUNCTION_ARGS)
+{
+       lquery     *in = PG_GETARG_LQUERY(0);
+       char       *buf,
+                          *ptr;
+       int                     i,
+                               j,
+                               totallen = 0;
+       lquery_level *curqlevel;
+       lquery_variant *curtlevel;
 
        curqlevel = LQUERY_FIRST(in);
-       for(i=0;i<in->numlevel;i++) {
-               if ( curqlevel->numvar )
-                       totallen = (curqlevel->numvar*4) + 1 + curqlevel->totallen;
+       for (i = 0; i < in->numlevel; i++)
+       {
+               if (curqlevel->numvar)
+                       totallen = (curqlevel->numvar * 4) + 1 + curqlevel->totallen;
                else
-                       totallen = 2*11 + 4;
+                       totallen = 2 * 11 + 4;
                totallen++;
                curqlevel = LQL_NEXT(curqlevel);
        }
-       
-       
-       ptr = buf = (char*)palloc( totallen );
+
+
+       ptr = buf = (char *) palloc(totallen);
        curqlevel = LQUERY_FIRST(in);
-       for(i=0;i<in->numlevel;i++) {
-               if ( i!=0 ) {
+       for (i = 0; i < in->numlevel; i++)
+       {
+               if (i != 0)
+               {
                        *ptr = '.';
                        ptr++;
                }
-               if ( curqlevel->numvar ) {
-                       if ( curqlevel->flag & LQL_NOT ) {
+               if (curqlevel->numvar)
+               {
+                       if (curqlevel->flag & LQL_NOT)
+                       {
                                *ptr = '!';
                                ptr++;
                        }
                        curtlevel = LQL_FIRST(curqlevel);
-                       for(j=0;j<curqlevel->numvar;j++) {
-                               if ( j!=0 ) {
+                       for (j = 0; j < curqlevel->numvar; j++)
+                       {
+                               if (j != 0)
+                               {
                                        *ptr = '|';
                                        ptr++;
                                }
-                               memcpy( ptr, curtlevel->name, curtlevel->len );
-                               ptr+=curtlevel->len;
-                               if ( (curtlevel->flag & LVAR_SUBLEXEM) ) {
+                               memcpy(ptr, curtlevel->name, curtlevel->len);
+                               ptr += curtlevel->len;
+                               if ((curtlevel->flag & LVAR_SUBLEXEM))
+                               {
                                        *ptr = '%';
                                        ptr++;
                                }
-                               if ( (curtlevel->flag & LVAR_INCASE) ) {
+                               if ((curtlevel->flag & LVAR_INCASE))
+                               {
                                        *ptr = '@';
                                        ptr++;
                                }
-                               if ( (curtlevel->flag & LVAR_ANYEND) ) {
+                               if ((curtlevel->flag & LVAR_ANYEND))
+                               {
                                        *ptr = '*';
                                        ptr++;
                                }
                                curtlevel = LVAR_NEXT(curtlevel);
                        }
-               } else {
-                       if ( curqlevel->low == curqlevel->high ) {
-                               sprintf(ptr,"*{%d}",curqlevel->low);
-                       } else if ( curqlevel->low == 0 ) {
-                               if ( curqlevel->high == 0xffff ) {
-                                       *ptr='*';
-                                       *(ptr+1)='\0';
-                               } else
-                                       sprintf(ptr,"*{,%d}",curqlevel->high);
-                       } else if ( curqlevel->high == 0xffff ) {
-                               sprintf(ptr,"*{%d,}",curqlevel->low);
-                       } else 
-                               sprintf(ptr,"*{%d,%d}", curqlevel->low, curqlevel->high);
-                       ptr = strchr(ptr,'\0');
+               }
+               else
+               {
+                       if (curqlevel->low == curqlevel->high)
+                       {
+                               sprintf(ptr, "*{%d}", curqlevel->low);
+                       }
+                       else if (curqlevel->low == 0)
+                       {
+                               if (curqlevel->high == 0xffff)
+                               {
+                                       *ptr = '*';
+                                       *(ptr + 1) = '\0';
+                               }
+                               else
+                                       sprintf(ptr, "*{,%d}", curqlevel->high);
+                       }
+                       else if (curqlevel->high == 0xffff)
+                       {
+                               sprintf(ptr, "*{%d,}", curqlevel->low);
+                       }
+                       else
+                               sprintf(ptr, "*{%d,%d}", curqlevel->low, curqlevel->high);
+                       ptr = strchr(ptr, '\0');
                }
 
                curqlevel = LQL_NEXT(curqlevel);
        }
 
-       *ptr='\0';
-       PG_FREE_IF_COPY(in,0);
+       *ptr = '\0';
+       PG_FREE_IF_COPY(in, 0);
 
        PG_RETURN_POINTER(buf);
 }
-
-
index b954908..4dcf6f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * op function for ltree 
+ * op function for ltree
  * Teodor Sigaev <teodor@stack.net>
  */
 
@@ -23,45 +23,50 @@ PG_FUNCTION_INFO_V1(ltree_addltree);
 PG_FUNCTION_INFO_V1(ltree_addtext);
 PG_FUNCTION_INFO_V1(ltree_textadd);
 PG_FUNCTION_INFO_V1(lca);
-Datum   ltree_cmp(PG_FUNCTION_ARGS);
-Datum   ltree_lt(PG_FUNCTION_ARGS);
-Datum   ltree_le(PG_FUNCTION_ARGS);
-Datum   ltree_eq(PG_FUNCTION_ARGS);
-Datum   ltree_ne(PG_FUNCTION_ARGS);
-Datum   ltree_ge(PG_FUNCTION_ARGS);
-Datum   ltree_gt(PG_FUNCTION_ARGS);
-Datum   nlevel(PG_FUNCTION_ARGS);
-Datum   subltree(PG_FUNCTION_ARGS);
-Datum   subpath(PG_FUNCTION_ARGS);
-Datum   ltree_addltree(PG_FUNCTION_ARGS);
-Datum   ltree_addtext(PG_FUNCTION_ARGS);
-Datum   ltree_textadd(PG_FUNCTION_ARGS);
-Datum   lca(PG_FUNCTION_ARGS);
+Datum          ltree_cmp(PG_FUNCTION_ARGS);
+Datum          ltree_lt(PG_FUNCTION_ARGS);
+Datum          ltree_le(PG_FUNCTION_ARGS);
+Datum          ltree_eq(PG_FUNCTION_ARGS);
+Datum          ltree_ne(PG_FUNCTION_ARGS);
+Datum          ltree_ge(PG_FUNCTION_ARGS);
+Datum          ltree_gt(PG_FUNCTION_ARGS);
+Datum          nlevel(PG_FUNCTION_ARGS);
+Datum          subltree(PG_FUNCTION_ARGS);
+Datum          subpath(PG_FUNCTION_ARGS);
+Datum          ltree_addltree(PG_FUNCTION_ARGS);
+Datum          ltree_addtext(PG_FUNCTION_ARGS);
+Datum          ltree_textadd(PG_FUNCTION_ARGS);
+Datum          lca(PG_FUNCTION_ARGS);
 
 int
-ltree_compare(const ltree *a, const ltree *b) {
+ltree_compare(const ltree * a, const ltree * b)
+{
        ltree_level *al = LTREE_FIRST(a);
        ltree_level *bl = LTREE_FIRST(b);
-       int     an = a->numlevel;
-       int     bn = b->numlevel;
-       int     res = 0;
-
-       while( an>0 && bn>0 ) {
-               if ( (res = strncmp( al->name, bl->name, min(al->len, bl->len))) == 0 ) {
-                       if ( al->len != bl->len )
-                               return (al->len - bl->len)*10*(an+1);
-               } else
-                       return res*10*(an+1);
-
-               an--; bn--;
-               al = LEVEL_NEXT(al); 
-               bl = LEVEL_NEXT(bl); 
+       int                     an = a->numlevel;
+       int                     bn = b->numlevel;
+       int                     res = 0;
+
+       while (an > 0 && bn > 0)
+       {
+               if ((res = strncmp(al->name, bl->name, min(al->len, bl->len))) == 0)
+               {
+                       if (al->len != bl->len)
+                               return (al->len - bl->len) * 10 * (an + 1);
+               }
+               else
+                       return res * 10 * (an + 1);
+
+               an--;
+               bn--;
+               al = LEVEL_NEXT(al);
+               bl = LEVEL_NEXT(bl);
        }
 
-       return (a->numlevel - b->numlevel)*10*(an+1);
-} 
+       return (a->numlevel - b->numlevel) * 10 * (an + 1);
+}
 
-#define RUNCMP                                                 \
+#define RUNCMP                                         \
 ltree *a       = PG_GETARG_LTREE(0);                   \
 ltree *b       = PG_GETARG_LTREE(1);                   \
 int res = ltree_compare(a,b);                          \
@@ -69,320 +74,360 @@ PG_FREE_IF_COPY(a,0);                                     \
 PG_FREE_IF_COPY(b,1);                                  \
 
 Datum
-ltree_cmp(PG_FUNCTION_ARGS) {
+ltree_cmp(PG_FUNCTION_ARGS)
+{
        RUNCMP
        PG_RETURN_INT32(res);
 }
 
 Datum
-ltree_lt(PG_FUNCTION_ARGS) {
+ltree_lt(PG_FUNCTION_ARGS)
+{
        RUNCMP
-       PG_RETURN_BOOL( (res<0) ? true : false );
+       PG_RETURN_BOOL((res < 0) ? true : false);
 }
 
 Datum
-ltree_le(PG_FUNCTION_ARGS) {
+ltree_le(PG_FUNCTION_ARGS)
+{
        RUNCMP
-       PG_RETURN_BOOL( (res<=0) ? true : false );
+       PG_RETURN_BOOL((res <= 0) ? true : false);
 }
 
 Datum
-ltree_eq(PG_FUNCTION_ARGS) {
+ltree_eq(PG_FUNCTION_ARGS)
+{
        RUNCMP
-       PG_RETURN_BOOL( (res==0) ? true : false );
+       PG_RETURN_BOOL((res == 0) ? true : false);
 }
 
 Datum
-ltree_ge(PG_FUNCTION_ARGS) {
+ltree_ge(PG_FUNCTION_ARGS)
+{
        RUNCMP
-       PG_RETURN_BOOL( (res>=0) ? true : false );
+       PG_RETURN_BOOL((res >= 0) ? true : false);
 }
 
 Datum
-ltree_gt(PG_FUNCTION_ARGS) {
+ltree_gt(PG_FUNCTION_ARGS)
+{
        RUNCMP
-       PG_RETURN_BOOL( (res>0) ? true : false );
+       PG_RETURN_BOOL((res > 0) ? true : false);
 }
 
 Datum
-ltree_ne(PG_FUNCTION_ARGS) {
+ltree_ne(PG_FUNCTION_ARGS)
+{
        RUNCMP
-       PG_RETURN_BOOL( (res!=0) ? true : false );
+       PG_RETURN_BOOL((res != 0) ? true : false);
 }
 
 Datum
-nlevel(PG_FUNCTION_ARGS) {
-       ltree *a        = PG_GETARG_LTREE(0);
-       int res = a->numlevel;
-       PG_FREE_IF_COPY(a,0);
+nlevel(PG_FUNCTION_ARGS)
+{
+       ltree      *a = PG_GETARG_LTREE(0);
+       int                     res = a->numlevel;
+
+       PG_FREE_IF_COPY(a, 0);
        PG_RETURN_INT32(res);
 }
 
 bool
-inner_isparent(const ltree *c, const ltree *p) {
+inner_isparent(const ltree * c, const ltree * p)
+{
        ltree_level *cl = LTREE_FIRST(c);
        ltree_level *pl = LTREE_FIRST(p);
-       int     pn = p->numlevel;
+       int                     pn = p->numlevel;
 
-       if ( pn > c->numlevel )
+       if (pn > c->numlevel)
                return false;
 
-       while( pn>0 ) {
-               if ( cl->len != pl->len )
+       while (pn > 0)
+       {
+               if (cl->len != pl->len)
                        return false;
-               if ( strncmp( cl->name, pl->name, cl->len ) )
+               if (strncmp(cl->name, pl->name, cl->len))
                        return false;
 
                pn--;
-               cl = LEVEL_NEXT(cl); 
-               pl = LEVEL_NEXT(pl); 
+               cl = LEVEL_NEXT(cl);
+               pl = LEVEL_NEXT(pl);
        }
        return true;
 }
 
-Datum   
-ltree_isparent(PG_FUNCTION_ARGS) {
-       ltree *c        = PG_GETARG_LTREE(1);
-       ltree *p        = PG_GETARG_LTREE(0);
-       bool res = inner_isparent(c,p);
-       PG_FREE_IF_COPY(c,1);
-       PG_FREE_IF_COPY(p,0);
-       PG_RETURN_BOOL( res );
+Datum
+ltree_isparent(PG_FUNCTION_ARGS)
+{
+       ltree      *c = PG_GETARG_LTREE(1);
+       ltree      *p = PG_GETARG_LTREE(0);
+       bool            res = inner_isparent(c, p);
+
+       PG_FREE_IF_COPY(c, 1);
+       PG_FREE_IF_COPY(p, 0);
+       PG_RETURN_BOOL(res);
 }
 
-Datum   
-ltree_risparent(PG_FUNCTION_ARGS) {
-       ltree *c        = PG_GETARG_LTREE(0);
-       ltree *p        = PG_GETARG_LTREE(1);
-       bool res = inner_isparent(c,p);
-       PG_FREE_IF_COPY(c,0);
-       PG_FREE_IF_COPY(p,1);
-       PG_RETURN_BOOL( res );
+Datum
+ltree_risparent(PG_FUNCTION_ARGS)
+{
+       ltree      *c = PG_GETARG_LTREE(0);
+       ltree      *p = PG_GETARG_LTREE(1);
+       bool            res = inner_isparent(c, p);
+
+       PG_FREE_IF_COPY(c, 0);
+       PG_FREE_IF_COPY(p, 1);
+       PG_RETURN_BOOL(res);
 }
 
 
-static ltree*
-inner_subltree(ltree *t, int4 startpos, int4 endpos) {
-       char *start=NULL,*end=NULL;
+static ltree *
+inner_subltree(ltree * t, int4 startpos, int4 endpos)
+{
+       char       *start = NULL,
+                          *end = NULL;
        ltree_level *ptr = LTREE_FIRST(t);
-       ltree   *res;
-       int i;
+       ltree      *res;
+       int                     i;
 
-       if ( startpos <0 || endpos <0 || startpos>=t->numlevel || startpos >= endpos )
-               elog(ERROR,"Wrong positions");
+       if (startpos < 0 || endpos < 0 || startpos >= t->numlevel || startpos >= endpos)
+               elog(ERROR, "Wrong positions");
 
-       if ( endpos > t->numlevel )
+       if (endpos > t->numlevel)
                endpos = t->numlevel;
 
-       for(i=0;i<endpos ;i++) {
-               if ( i==startpos )
-                       start = (char*)ptr;
-               if ( i==endpos-1 ) {
-                       end = (char*)LEVEL_NEXT(ptr);
+       for (i = 0; i < endpos; i++)
+       {
+               if (i == startpos)
+                       start = (char *) ptr;
+               if (i == endpos - 1)
+               {
+                       end = (char *) LEVEL_NEXT(ptr);
                        break;
                }
-               ptr = LEVEL_NEXT(ptr); 
+               ptr = LEVEL_NEXT(ptr);
        }
 
-       res=(ltree*)palloc( LTREE_HDRSIZE + (end-start) );
-       res->len = LTREE_HDRSIZE + (end-start);
-       res->numlevel = endpos-startpos;
+       res = (ltree *) palloc(LTREE_HDRSIZE + (end - start));
+       res->len = LTREE_HDRSIZE + (end - start);
+       res->numlevel = endpos - startpos;
+
+       memcpy(LTREE_FIRST(res), start, end - start);
 
-       memcpy( LTREE_FIRST(res), start, end-start);    
-       
        return res;
 }
 
 Datum
-subltree(PG_FUNCTION_ARGS) {
-       ltree *t = PG_GETARG_LTREE(0);
-       ltree *res = inner_subltree(t,PG_GETARG_INT32(1),PG_GETARG_INT32(2));
+subltree(PG_FUNCTION_ARGS)
+{
+       ltree      *t = PG_GETARG_LTREE(0);
+       ltree      *res = inner_subltree(t, PG_GETARG_INT32(1), PG_GETARG_INT32(2));
 
-       PG_FREE_IF_COPY(t,0);
+       PG_FREE_IF_COPY(t, 0);
        PG_RETURN_POINTER(res);
 }
 
-Datum   
-subpath(PG_FUNCTION_ARGS) {
-       ltree *t = PG_GETARG_LTREE(0);
-       int4 start = PG_GETARG_INT32(1);
-       int4 len   = ( fcinfo->nargs==3 ) ? PG_GETARG_INT32(2) : 0;
-       int4 end;
-       ltree *res;
-
-       end = start+len;
-
-       if ( start < 0 ) { 
+Datum
+subpath(PG_FUNCTION_ARGS)
+{
+       ltree      *t = PG_GETARG_LTREE(0);
+       int4            start = PG_GETARG_INT32(1);
+       int4            len = (fcinfo->nargs == 3) ? PG_GETARG_INT32(2) : 0;
+       int4            end;
+       ltree      *res;
+
+       end = start + len;
+
+       if (start < 0)
+       {
                start = t->numlevel + start;
-               end = start+len;
+               end = start + len;
        }
-       if ( start < 0 ) { /* start > t->numlevel */ 
+       if (start < 0)
+       {                                                       /* start > t->numlevel */
                start = t->numlevel + start;
-               end = start+len;
+               end = start + len;
        }
 
-       if ( len < 0 )
+       if (len < 0)
                end = t->numlevel + len;
-       else if ( len == 0 )
+       else if (len == 0)
                end = 0xffff;
 
-       res = inner_subltree(t,start,end);
+       res = inner_subltree(t, start, end);
 
-       PG_FREE_IF_COPY(t,0);
+       PG_FREE_IF_COPY(t, 0);
        PG_RETURN_POINTER(res);
-} 
-
-static ltree*
-ltree_concat( ltree *a, ltree *b) {
-       ltree *r;
-       r=(ltree*)palloc( a->len + b->len - LTREE_HDRSIZE);
-        r->len = a->len + b->len - LTREE_HDRSIZE;
-        r->numlevel = a->numlevel + b->numlevel;
-
-        memcpy( LTREE_FIRST(r), LTREE_FIRST(a), a->len - LTREE_HDRSIZE);
-        memcpy( ((char*)LTREE_FIRST(r))+ a->len - LTREE_HDRSIZE, LTREE_FIRST(b), b->len -
- LTREE_HDRSIZE);
-    return r;
 }
 
-Datum 
-ltree_addltree(PG_FUNCTION_ARGS) {
-       ltree *a = PG_GETARG_LTREE(0);
-       ltree *b = PG_GETARG_LTREE(1);
-       ltree *r;
+static ltree *
+ltree_concat(ltree * a, ltree * b)
+{
+       ltree      *r;
+
+       r = (ltree *) palloc(a->len + b->len - LTREE_HDRSIZE);
+       r->len = a->len + b->len - LTREE_HDRSIZE;
+       r->numlevel = a->numlevel + b->numlevel;
+
+       memcpy(LTREE_FIRST(r), LTREE_FIRST(a), a->len - LTREE_HDRSIZE);
+       memcpy(((char *) LTREE_FIRST(r)) + a->len - LTREE_HDRSIZE, LTREE_FIRST(b), b->len -
+                  LTREE_HDRSIZE);
+       return r;
+}
+
+Datum
+ltree_addltree(PG_FUNCTION_ARGS)
+{
+       ltree      *a = PG_GETARG_LTREE(0);
+       ltree      *b = PG_GETARG_LTREE(1);
+       ltree      *r;
 
        r = ltree_concat(a, b);
-       PG_FREE_IF_COPY(a,0);
-       PG_FREE_IF_COPY(b,1);
+       PG_FREE_IF_COPY(a, 0);
+       PG_FREE_IF_COPY(b, 1);
        PG_RETURN_POINTER(r);
 }
 
 Datum
-ltree_addtext(PG_FUNCTION_ARGS) {
-       ltree *a = PG_GETARG_LTREE(0);
-       text *b = PG_GETARG_TEXT_P(1);
-       char *s;
-       ltree *r,*tmp;
-
-       s = (char*)palloc( VARSIZE(b) - VARHDRSZ+1 );
-       memcpy(s, VARDATA(b), VARSIZE(b) - VARHDRSZ );
+ltree_addtext(PG_FUNCTION_ARGS)
+{
+       ltree      *a = PG_GETARG_LTREE(0);
+       text       *b = PG_GETARG_TEXT_P(1);
+       char       *s;
+       ltree      *r,
+                          *tmp;
+
+       s = (char *) palloc(VARSIZE(b) - VARHDRSZ + 1);
+       memcpy(s, VARDATA(b), VARSIZE(b) - VARHDRSZ);
        s[VARSIZE(b) - VARHDRSZ] = '\0';
 
-       tmp = (ltree*)DatumGetPointer( DirectFunctionCall1( 
-               ltree_in,
-               PointerGetDatum(s)
-       );
+       tmp = (ltree *) DatumGetPointer(DirectFunctionCall1(
+                                                                                                               ltree_in,
+                                                                                                               PointerGetDatum(s)
+                                                                                                               ));
 
        pfree(s);
 
-       r = ltree_concat(a,tmp);
+       r = ltree_concat(a, tmp);
 
-       pfree( tmp );
-       
-       PG_FREE_IF_COPY(a,0);
-       PG_FREE_IF_COPY(b,1);
+       pfree(tmp);
+
+       PG_FREE_IF_COPY(a, 0);
+       PG_FREE_IF_COPY(b, 1);
        PG_RETURN_POINTER(r);
 }
 
 Datum
-ltree_textadd(PG_FUNCTION_ARGS) {
-        ltree *a = PG_GETARG_LTREE(1);
-        text *b = PG_GETARG_TEXT_P(0);
-        char *s;
-        ltree *r,*tmp;
-
-        s = (char*)palloc( VARSIZE(b) - VARHDRSZ + 1 );
-        memcpy(s, VARDATA(b), VARSIZE(b) - VARHDRSZ );
-        s[VARSIZE(b) - VARHDRSZ] = '\0';
-       
-        tmp = (ltree*)DatumGetPointer( DirectFunctionCall1(
-                ltree_in,
-                PointerGetDatum(s)
-        ) );
-
-        pfree(s);
-
-        r = ltree_concat(tmp,a);
-
-        pfree( tmp );
-       
-        PG_FREE_IF_COPY(a,1);
-        PG_FREE_IF_COPY(b,0);
-        PG_RETURN_POINTER(r);
+ltree_textadd(PG_FUNCTION_ARGS)
+{
+       ltree      *a = PG_GETARG_LTREE(1);
+       text       *b = PG_GETARG_TEXT_P(0);
+       char       *s;
+       ltree      *r,
+                          *tmp;
+
+       s = (char *) palloc(VARSIZE(b) - VARHDRSZ + 1);
+       memcpy(s, VARDATA(b), VARSIZE(b) - VARHDRSZ);
+       s[VARSIZE(b) - VARHDRSZ] = '\0';
+
+       tmp = (ltree *) DatumGetPointer(DirectFunctionCall1(
+                                                                                                               ltree_in,
+                                                                                                               PointerGetDatum(s)
+                                                                                                               ));
+
+       pfree(s);
+
+       r = ltree_concat(tmp, a);
+
+       pfree(tmp);
+
+       PG_FREE_IF_COPY(a, 1);
+       PG_FREE_IF_COPY(b, 0);
+       PG_RETURN_POINTER(r);
 }
 
-ltree*
-lca_inner(ltree** a, int len) {
-       int tmp,num=( (*a)->numlevel ) ? (*a)->numlevel-1 : 0;
-       ltree **ptr=a+1;
-       int i,reslen=LTREE_HDRSIZE;
-       ltree_level *l1, *l2;
-       ltree *res;
-       
+ltree *
+lca_inner(ltree ** a, int len)
+{
+       int                     tmp,
+                               num = ((*a)->numlevel) ? (*a)->numlevel - 1 : 0;
+       ltree     **ptr = a + 1;
+       int                     i,
+                               reslen = LTREE_HDRSIZE;
+       ltree_level *l1,
+                          *l2;
+       ltree      *res;
+
 
-       if ( (*a)->numlevel == 0 )
+       if ((*a)->numlevel == 0)
                return NULL;
 
-       while( ptr-a < len ) {
-               if ( (*ptr)->numlevel == 0 )
+       while (ptr - a < len)
+       {
+               if ((*ptr)->numlevel == 0)
                        return NULL;
-               else if ( (*ptr)->numlevel == 1 )
-                       num=0;
-               else {
+               else if ((*ptr)->numlevel == 1)
+                       num = 0;
+               else
+               {
                        l1 = LTREE_FIRST(*a);
                        l2 = LTREE_FIRST(*ptr);
-                       tmp=num; num=0;
-                       for(i=0;i<min(tmp, (*ptr)->numlevel-1); i++) {
-                               if ( l1->len == l2->len && strncmp(l1->name,l2->name,l1->len) == 0 )
-                                       num=i+1;
+                       tmp = num;
+                       num = 0;
+                       for (i = 0; i < min(tmp, (*ptr)->numlevel - 1); i++)
+                       {
+                               if (l1->len == l2->len && strncmp(l1->name, l2->name, l1->len) == 0)
+                                       num = i + 1;
                                else
                                        break;
-                               l1=LEVEL_NEXT(l1);
-                               l2=LEVEL_NEXT(l2);
+                               l1 = LEVEL_NEXT(l1);
+                               l2 = LEVEL_NEXT(l2);
                        }
                }
                ptr++;
        }
 
        l1 = LTREE_FIRST(*a);
-       for(i=0;i<num;i++) {
+       for (i = 0; i < num; i++)
+       {
                reslen += MAXALIGN(l1->len + LEVEL_HDRSIZE);
-               l1=LEVEL_NEXT(l1);
+               l1 = LEVEL_NEXT(l1);
        }
 
-       res=(ltree*)palloc( reslen );
+       res = (ltree *) palloc(reslen);
        res->len = reslen;
        res->numlevel = num;
 
        l1 = LTREE_FIRST(*a);
        l2 = LTREE_FIRST(res);
 
-       for(i=0;i<num;i++) {
-               memcpy(l2,l1, MAXALIGN(l1->len + LEVEL_HDRSIZE));
-               l1=LEVEL_NEXT(l1);
-               l2=LEVEL_NEXT(l2);
-       }       
+       for (i = 0; i < num; i++)
+       {
+               memcpy(l2, l1, MAXALIGN(l1->len + LEVEL_HDRSIZE));
+               l1 = LEVEL_NEXT(l1);
+               l2 = LEVEL_NEXT(l2);
+       }
 
        return res;
 }
 
 Datum
-lca(PG_FUNCTION_ARGS) {
-       int i;
-       ltree **a,*res;
-
-       a=(ltree**)palloc( sizeof(ltree*) * fcinfo->nargs );
-       for(i=0;i<fcinfo->nargs;i++)
+lca(PG_FUNCTION_ARGS)
+{
+       int                     i;
+       ltree     **a,
+                          *res;
+
+       a = (ltree **) palloc(sizeof(ltree *) * fcinfo->nargs);
+       for (i = 0; i < fcinfo->nargs; i++)
                a[i] = PG_GETARG_LTREE(i);
-       res = lca_inner(a, (int) fcinfo->nargs); 
-       for(i=0;i<fcinfo->nargs;i++)
-               PG_FREE_IF_COPY(a[i],i);
+       res = lca_inner(a, (int) fcinfo->nargs);
+       for (i = 0; i < fcinfo->nargs; i++)
+               PG_FREE_IF_COPY(a[i], i);
        pfree(a);
-                
-       if ( res )
+
+       if (res)
                PG_RETURN_POINTER(res);
        else
                PG_RETURN_NULL();
 }
-
-
index 59bf077..e9be162 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * txtquery io 
+ * txtquery io
  * Teodor Sigaev <teodor@stack.net>
  */
 
@@ -8,44 +8,47 @@
 #include "crc32.h"
 
 PG_FUNCTION_INFO_V1(ltxtq_in);
-Datum     ltxtq_in(PG_FUNCTION_ARGS);
+Datum          ltxtq_in(PG_FUNCTION_ARGS);
+
 PG_FUNCTION_INFO_V1(ltxtq_out);
-Datum     ltxtq_out(PG_FUNCTION_ARGS);
+Datum          ltxtq_out(PG_FUNCTION_ARGS);
 
 
 /* parser's states */
 #define WAITOPERAND 1
 #define INOPERAND 2
-#define WAITOPERATOR    3
+#define WAITOPERATOR   3
 
 /*
  * node of query tree, also used
  * for storing polish notation in parser
  */
-typedef struct NODE {
-       int4        type;
-       int4        val;
-       int2        distance;
-       int2        length;
-       uint16      flag;
+typedef struct NODE
+{
+       int4            type;
+       int4            val;
+       int2            distance;
+       int2            length;
+       uint16          flag;
        struct NODE *next;
-}       NODE;
+}      NODE;
 
-typedef struct {
-       char       *buf;
-       int4        state;
-       int4        count;
+typedef struct
+{
+       char       *buf;
+       int4            state;
+       int4            count;
        /* reverse polish notation in list (for temprorary usage) */
-       NODE       *str;
+       NODE       *str;
        /* number in str */
-       int4        num;
+       int4            num;
 
        /* user-friendly operand */
-       int4        lenop;
-       int4        sumlen;
-       char       *op;
-       char       *curop;
-}       QPRS_STATE;
+       int4            lenop;
+       int4            sumlen;
+       char       *op;
+       char       *curop;
+}      QPRS_STATE;
 
 /*
  * get token from query string
@@ -70,27 +73,31 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint1
                                        (state->buf)++;
                                        return OPEN;
                                }
-                               else if ( ISALNUM(*(state->buf)) )
+                               else if (ISALNUM(*(state->buf)))
                                {
                                        state->state = INOPERAND;
                                        *strval = state->buf;
                                        *lenval = 1;
                                        *flag = 0;
-                               } else if ( !isspace((unsigned int)*(state->buf)) )
-                                       elog(ERROR,"Operand syntax error");
+                               }
+                               else if (!isspace((unsigned int) *(state->buf)))
+                                       elog(ERROR, "Operand syntax error");
                                break;
                        case INOPERAND:
-                               if ( ISALNUM(*(state->buf)) ) {
-                                       if ( *flag )
-                                               elog(ERROR,"Modificators syntax error");
+                               if (ISALNUM(*(state->buf)))
+                               {
+                                       if (*flag)
+                                               elog(ERROR, "Modificators syntax error");
                                        (*lenval)++;
-                               } else if ( *(state->buf) == '%' ) {
+                               }
+                               else if (*(state->buf) == '%')
                                        *flag |= LVAR_SUBLEXEM;
-                               } else if ( *(state->buf) == '@' ) {
+                               else if (*(state->buf) == '@')
                                        *flag |= LVAR_INCASE;
-                               } else if ( *(state->buf) == '*' ) {
+                               else if (*(state->buf) == '*')
                                        *flag |= LVAR_ANYEND;
-                               } else {
+                               else
+                               {
                                        state->state = WAITOPERATOR;
                                        return VAL;
                                }
@@ -129,7 +136,7 @@ gettoken_query(QPRS_STATE * state, int4 *val, int4 *lenval, char **strval, uint1
 static void
 pushquery(QPRS_STATE * state, int4 type, int4 val, int4 distance, int4 lenval, uint16 flag)
 {
-       NODE       *tmp = (NODE *) palloc(sizeof(NODE));
+       NODE       *tmp = (NODE *) palloc(sizeof(NODE));
 
        tmp->type = type;
        tmp->val = val;
@@ -159,7 +166,7 @@ pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, uint16 flag
 
        while (state->curop - state->op + lenval + 1 >= state->lenop)
        {
-               int4        tmp = state->curop - state->op;
+               int4            tmp = state->curop - state->op;
 
                state->lenop *= 2;
                state->op = (char *) repalloc((void *) state->op, state->lenop);
@@ -173,26 +180,27 @@ pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, uint16 flag
        return;
 }
 
-#define STACKDEPTH      32
+#define STACKDEPTH             32
 /*
  * make polish notaion of query
  */
 static int4
 makepol(QPRS_STATE * state)
 {
-       int4        val,
+       int4            val,
                                type;
-       int4        lenval;
-       char       *strval;
-       int4        stack[STACKDEPTH];
-       int4        lenstack = 0;
-       uint16      flag;
+       int4            lenval;
+       char       *strval;
+       int4            stack[STACKDEPTH];
+       int4            lenstack = 0;
+       uint16          flag;
 
-       while ((type = gettoken_query(state, &val, &lenval, &strval,&flag)) != END) {
+       while ((type = gettoken_query(state, &val, &lenval, &strval, &flag)) != END)
+       {
                switch (type)
                {
                        case VAL:
-                               pushval_asis(state, VAL, strval, lenval,flag);
+                               pushval_asis(state, VAL, strval, lenval, flag);
                                while (lenstack && (stack[lenstack - 1] == (int4) '&' ||
                                                                        stack[lenstack - 1] == (int4) '!'))
                                {
@@ -236,7 +244,8 @@ makepol(QPRS_STATE * state)
 
                }
        }
-       while (lenstack) {
+       while (lenstack)
+       {
                lenstack--;
                pushquery(state, OPR, stack[lenstack], 0, 0, 0);
        };
@@ -259,8 +268,8 @@ findoprnd(ITEM * ptr, int4 *pos)
        }
        else
        {
-               ITEM       *curitem = &ptr[*pos];
-               int4        tmp = *pos;
+               ITEM       *curitem = &ptr[*pos];
+               int4            tmp = *pos;
 
                (*pos)++;
                findoprnd(ptr, pos);
@@ -276,16 +285,16 @@ findoprnd(ITEM * ptr, int4 *pos)
 static ltxtquery *
 queryin(char *buf)
 {
-       QPRS_STATE      state;
-       int4        i;
+       QPRS_STATE      state;
+       int4            i;
        ltxtquery  *query;
-       int4        commonlen;
-       ITEM       *ptr;
-       NODE       *tmp;
-       int4        pos = 0;
+       int4            commonlen;
+       ITEM       *ptr;
+       NODE       *tmp;
+       int4            pos = 0;
 
 #ifdef BS_DEBUG
-       char        pbuf[16384],
+       char            pbuf[16384],
                           *cur;
 #endif
 
@@ -351,12 +360,12 @@ ltxtq_in(PG_FUNCTION_ARGS)
  */
 typedef struct
 {
-       ITEM       *curpol;
-       char       *buf;
-       char       *cur;
-       char       *op;
-       int4        buflen;
-}       INFIX;
+       ITEM       *curpol;
+       char       *buf;
+       char       *cur;
+       char       *op;
+       int4            buflen;
+}      INFIX;
 
 #define RESIZEBUF(inf,addsize) \
 while( ( inf->cur - inf->buf ) + addsize + 1 >= inf->buflen ) \
@@ -376,23 +385,27 @@ infix(INFIX * in, bool first)
 {
        if (in->curpol->type == VAL)
        {
-               char       *op = in->op + in->curpol->distance;
+               char       *op = in->op + in->curpol->distance;
 
                RESIZEBUF(in, in->curpol->length * 2 + 5);
-               while (*op) {
+               while (*op)
+               {
                        *(in->cur) = *op;
                        op++;
                        in->cur++;
                }
-               if ( in->curpol->flag & LVAR_SUBLEXEM ) {
+               if (in->curpol->flag & LVAR_SUBLEXEM)
+               {
                        *(in->cur) = '%';
                        in->cur++;
                }
-               if ( in->curpol->flag & LVAR_INCASE ) {
+               if (in->curpol->flag & LVAR_INCASE)
+               {
                        *(in->cur) = '@';
                        in->cur++;
                }
-               if ( in->curpol->flag & LVAR_ANYEND ) {
+               if (in->curpol->flag & LVAR_ANYEND)
+               {
                        *(in->cur) = '*';
                        in->cur++;
                }
@@ -401,7 +414,7 @@ infix(INFIX * in, bool first)
        }
        else if (in->curpol->val == (int4) '!')
        {
-               bool        isopr = false;
+               bool            isopr = false;
 
                RESIZEBUF(in, 1);
                *(in->cur) = '!';
@@ -425,8 +438,8 @@ infix(INFIX * in, bool first)
        }
        else
        {
-               int4        op = in->curpol->val;
-               INFIX      nrm;
+               int4            op = in->curpol->val;
+               INFIX           nrm;
 
                in->curpol++;
                if (op == (int4) '|' && !first)
@@ -467,7 +480,7 @@ Datum
 ltxtq_out(PG_FUNCTION_ARGS)
 {
        ltxtquery  *query = PG_GETARG_LTXTQUERY(0);
-       INFIX      nrm;
+       INFIX           nrm;
 
        if (query->size == 0)
                elog(ERROR, "Empty");
@@ -481,4 +494,3 @@ ltxtq_out(PG_FUNCTION_ARGS)
        PG_FREE_IF_COPY(query, 0);
        PG_RETURN_POINTER(nrm.buf);
 }
-
index 925385f..263f39b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * txtquery operations with ltree 
+ * txtquery operations with ltree
  * Teodor Sigaev <teodor@stack.net>
  */
 
@@ -12,20 +12,26 @@ PG_FUNCTION_INFO_V1(ltxtq_rexec);
 /*
  * check for boolean condition
  */
-bool 
-ltree_execute(ITEM * curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM * val)) {
+bool
+ltree_execute(ITEM * curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM * val))
+{
        if (curitem->type == VAL)
                return (*chkcond) (checkval, curitem);
-       else if (curitem->val == (int4) '!') {
+       else if (curitem->val == (int4) '!')
+       {
                return (calcnot) ?
                        ((ltree_execute(curitem + 1, checkval, calcnot, chkcond)) ? false : true)
                        : true;
-       } else if (curitem->val == (int4) '&') {
-               if (ltree_execute(curitem + curitem->left, checkval, calcnot, chkcond))   
+       }
+       else if (curitem->val == (int4) '&')
+       {
+               if (ltree_execute(curitem + curitem->left, checkval, calcnot, chkcond))
                        return ltree_execute(curitem + 1, checkval, calcnot, chkcond);
                else
                        return false;
-       } else   {                                                     /* |-operator */
+       }
+       else
+       {                                                       /* |-operator */
                if (ltree_execute(curitem + curitem->left, checkval, calcnot, chkcond))
                        return true;
                else
@@ -34,54 +40,60 @@ ltree_execute(ITEM * curitem, void *checkval, bool calcnot, bool (*chkcond) (voi
        return false;
 }
 
-typedef struct {
-       ltree   *node;
-       char       *operand;
-} CHKVAL;
+typedef struct
+{
+       ltree      *node;
+       char       *operand;
+}      CHKVAL;
 
 static bool
-checkcondition_str(void* checkval, ITEM * val) {
-       ltree_level *level = LTREE_FIRST( ((CHKVAL*)checkval)->node );
-       int tlen = ((CHKVAL*)checkval)->node->numlevel;
-       char *op = ((CHKVAL*)checkval)->operand + val->distance;
-        int (*cmpptr)(const char *,const char *,size_t);
+checkcondition_str(void *checkval, ITEM * val)
+{
+       ltree_level *level = LTREE_FIRST(((CHKVAL *) checkval)->node);
+       int                     tlen = ((CHKVAL *) checkval)->node->numlevel;
+       char       *op = ((CHKVAL *) checkval)->operand + val->distance;
+       int                     (*cmpptr) (const char *, const char *, size_t);
 
-       cmpptr = ( val->flag & LVAR_INCASE ) ? strncasecmp : strncmp;
-       while( tlen > 0 ) {
-               if ( val->flag & LVAR_SUBLEXEM ) {
-                       if ( compare_subnode(level, op, val->length, cmpptr, (val->flag & LVAR_ANYEND) ) )
+       cmpptr = (val->flag & LVAR_INCASE) ? strncasecmp : strncmp;
+       while (tlen > 0)
+       {
+               if (val->flag & LVAR_SUBLEXEM)
+               {
+                       if (compare_subnode(level, op, val->length, cmpptr, (val->flag & LVAR_ANYEND)))
                                return true;
-               } else if ( 
-                       (
-                               val->length == level->len ||
-                               ( level->len > val->length && (val->flag & LVAR_ANYEND) )
-                       ) &&
-                               (*cmpptr)( op, level->name, val->length) == 0 )
+               }
+               else if (
+                                (
+                                 val->length == level->len ||
+                                 (level->len > val->length && (val->flag & LVAR_ANYEND))
+                                 ) &&
+                                (*cmpptr) (op, level->name, val->length) == 0)
                        return true;
 
                tlen--;
-               level = LEVEL_NEXT(level); 
+               level = LEVEL_NEXT(level);
        }
 
        return false;
 }
 
 Datum
-ltxtq_exec(PG_FUNCTION_ARGS) {
-       ltree     *val = PG_GETARG_LTREE(0);
+ltxtq_exec(PG_FUNCTION_ARGS)
+{
+       ltree      *val = PG_GETARG_LTREE(0);
        ltxtquery  *query = PG_GETARG_LTXTQUERY(1);
-       CHKVAL    chkval;
-       bool        result;
+       CHKVAL          chkval;
+       bool            result;
 
        chkval.node = val;
        chkval.operand = GETOPERAND(query);
 
        result = ltree_execute(
-               GETQUERY(query),
-               &chkval,
-               true,
-               checkcondition_str
-       );
+                                                  GETQUERY(query),
+                                                  &chkval,
+                                                  true,
+                                                  checkcondition_str
+               );
 
        PG_FREE_IF_COPY(val, 0);
        PG_FREE_IF_COPY(query, 1);
@@ -89,11 +101,10 @@ ltxtq_exec(PG_FUNCTION_ARGS) {
 }
 
 Datum
-ltxtq_rexec(PG_FUNCTION_ARGS) {
-       PG_RETURN_DATUM( DirectFunctionCall2( ltxtq_exec,
-               PG_GETARG_DATUM(1),
-               PG_GETARG_DATUM(0)
-       ) );
+ltxtq_rexec(PG_FUNCTION_ARGS)
+{
+       PG_RETURN_DATUM(DirectFunctionCall2(ltxtq_exec,
+                                                                               PG_GETARG_DATUM(1),
+                                                                               PG_GETARG_DATUM(0)
+                                                                               ));
 }
-
-
index 27639ad..3957c11 100644 (file)
@@ -263,7 +263,7 @@ msqlListTables(int a)
        char            tbuf[BUFSIZ];
 
        snprintf(tbuf, BUFSIZ,
-                        "select relname from pg_class where relkind='r' and relowner=%d",
+               "select relname from pg_class where relkind='r' and relowner=%d",
                         getuid());
        if (msqlQuery(a, tbuf) > 0)
        {
@@ -287,7 +287,7 @@ msqlListIndex(int a, char *b, char *c)
        char            tbuf[BUFSIZ];
 
        snprintf(tbuf, BUFSIZ,
-                        "select relname from pg_class where relkind='i' and relowner=%d",
+               "select relname from pg_class where relkind='i' and relowner=%d",
                         getuid());
        if (msqlQuery(a, tbuf) > 0)
        {
index 3e38b56..702a8a2 100644 (file)
@@ -1,7 +1,7 @@
 /* -------------------------------------------------------------------------
  * pg_dumplo
  *
- * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_export.c,v 1.9 2002/08/15 02:58:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_export.c,v 1.10 2002/09/04 20:31:06 momjian Exp $
  *
  *                                     Karel Zak 1999-2000
  * -------------------------------------------------------------------------
@@ -142,7 +142,7 @@ pglo_export(LODumpMaster * pgLO)
                        {
 
                                snprintf(path, BUFSIZ, "%s/%s/%s", pgLO->space, pgLO->db,
-                                               ll->lo_table);
+                                                ll->lo_table);
 
                                if (mkdir(path, DIR_UMASK) == -1)
                                {
@@ -154,7 +154,7 @@ pglo_export(LODumpMaster * pgLO)
                                }
 
                                snprintf(path, BUFSIZ, "%s/%s/%s/%s", pgLO->space, pgLO->db,
-                                               ll->lo_table, ll->lo_attr);
+                                                ll->lo_table, ll->lo_attr);
 
                                if (mkdir(path, DIR_UMASK) == -1)
                                {
@@ -187,7 +187,7 @@ pglo_export(LODumpMaster * pgLO)
                                }
 
                                snprintf(path, BUFSIZ, "%s/%s/%s/%s/%s", pgLO->space,
-                                               pgLO->db, ll->lo_table, ll->lo_attr, val);
+                                                pgLO->db, ll->lo_table, ll->lo_attr, val);
 
                                if (lo_export(pgLO->conn, lo, path) < 0)
                                        fprintf(stderr, "%s: lo_export failed:\n%s", progname,
index b880e18..953dc10 100644 (file)
@@ -1,7 +1,7 @@
 /* -------------------------------------------------------------------------
  * pg_dumplo
  *
- * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_import.c,v 1.7 2002/08/15 02:58:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_import.c,v 1.8 2002/09/04 20:31:06 momjian Exp $
  *
  *                                     Karel Zak 1999-2000
  * -------------------------------------------------------------------------
@@ -82,7 +82,7 @@ pglo_import(LODumpMaster * pgLO)
                 * UPDATE oid in tab
                 */
                snprintf(Qbuff, QUERY_BUFSIZ,
-                       "UPDATE \"%s\" SET \"%s\"=%u WHERE \"%s\"=%u",
+                                "UPDATE \"%s\" SET \"%s\"=%u WHERE \"%s\"=%u",
                        loa.lo_table, loa.lo_attr, new_oid, loa.lo_attr, loa.lo_oid);
 
                /* fprintf(stderr, Qbuff); */
index 78456e1..41c191a 100644 (file)
@@ -1,7 +1,7 @@
 /* -------------------------------------------------------------------------
  * pg_dumplo
  *
- * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.10 2001/11/12 17:44:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.11 2002/09/04 20:31:07 momjian Exp $
  *
  *                                     Karel Zak 1999-2000
  * -------------------------------------------------------------------------
@@ -284,7 +284,7 @@ usage()
           "-p --password=<password>     password for connection to server\n"
                 "-d --db=<database>           database name\n"
                 "-t --host=<hostname>         server hostname\n"
-                "-o --port=<port>             database server port (default: 5432)\n" 
+       "-o --port=<port>             database server port (default: 5432)\n"
                 "-s --space=<dir>             directory with dump tree (for export/import)\n"
                 "-i --import                  import large obj dump tree to DB\n"
        "-e --export                  export (dump) large obj to dump tree\n"
@@ -301,7 +301,7 @@ usage()
           "-p <password>                password for connection to server\n"
                 "-d <database>                database name\n"
                 "-t <hostname>                server hostname\n"
-                "-o <port>                    database server port (default: 5432)\n" 
+       "-o <port>                    database server port (default: 5432)\n"
                 "-s <dir>                     directory with dump tree (for export/import)\n"
                 "-i                           import large obj dump tree to DB\n"
        "-e                           export (dump) large obj to dump tree\n"
index 6e18137..4eb81ec 100644 (file)
@@ -1,10 +1,10 @@
 /*
- * $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.18 2002/08/15 02:58:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.19 2002/09/04 20:31:08 momjian Exp $
  *
  * pgbench: a simple TPC-B like benchmark program for PostgreSQL
  * written by Tatsuo Ishii
  *
- * Copyright (c) 2000-2002  Tatsuo Ishii
+ * Copyright (c) 2000-2002     Tatsuo Ishii
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose and without fee is hereby
@@ -88,8 +88,8 @@ typedef struct
        int                     state;                  /* state No. */
        int                     cnt;                    /* xacts count */
        int                     ecnt;                   /* error count */
-       int                     listen;                 /* 0 indicates that an async query
-                                                                * has been sent */
+       int                     listen;                 /* 0 indicates that an async query has
+                                                                * been sent */
        int                     aid;                    /* account id for this transaction */
        int                     bid;                    /* branch id for this transaction */
        int                     tid;                    /* teller id for this transaction */
@@ -241,15 +241,19 @@ doOne(CState * state, int n, int debug, int ttype)
                                discard_response(st);
                                break;
                        case 6:                         /* response to "end" */
-                               /* transaction finished: record the time it took in the log */
+
+                               /*
+                                * transaction finished: record the time it took in the
+                                * log
+                                */
                                if (use_log)
                                {
-                                       long long diff;
+                                       long long       diff;
                                        struct timeval now;
 
                                        gettimeofday(&now, 0);
                                        diff = (now.tv_sec - st->txn_begin.tv_sec) * 1000000 +
-                                                  (now.tv_usec - st->txn_begin.tv_usec);
+                                               (now.tv_usec - st->txn_begin.tv_usec);
 
                                        fprintf(LOGFILE, "%d %d %lld\n", st->id, st->cnt, diff);
                                }
@@ -318,19 +322,19 @@ doOne(CState * state, int n, int debug, int ttype)
                case 3:
                        if (ttype == 0)
                        {
-                           snprintf(sql, 256, "update tellers set tbalance = tbalance + %d where tid = %d\n",
-                                   st->delta, st->tid);
-                           break;
+                               snprintf(sql, 256, "update tellers set tbalance = tbalance + %d where tid = %d\n",
+                                                st->delta, st->tid);
+                               break;
                        }
                case 4:
                        if (ttype == 0)
                        {
-                           snprintf(sql, 256, "update branches set bbalance = bbalance + %d where bid = %d", st->delta, st->bid);
-                           break;
+                               snprintf(sql, 256, "update branches set bbalance = bbalance + %d where bid = %d", st->delta, st->bid);
+                               break;
                        }
                case 5:
                        snprintf(sql, 256, "insert into history(tid,bid,aid,delta,mtime) values(%d,%d,%d,%d,'now')",
-                                       st->tid, st->bid, st->aid, st->delta);
+                                        st->tid, st->bid, st->aid, st->delta);
                        break;
                case 6:
                        strcpy(sql, "end");
@@ -513,7 +517,7 @@ init(void)
        for (i = 0; i < ntellers * tps; i++)
        {
                snprintf(sql, 256, "insert into tellers(tid,bid,tbalance) values (%d,%d,0)"
-                               ,i + 1, i / ntellers + 1);
+                                ,i + 1, i / ntellers + 1);
                res = PQexec(con, sql);
                if (PQresultStatus(res) != PGRES_COMMAND_OK)
                {
@@ -577,6 +581,7 @@ init(void)
                        }
 
 #ifdef NOT_USED
+
                        /*
                         * do a checkpoint to purge the old WAL logs
                         */
@@ -586,7 +591,7 @@ init(void)
                                fprintf(stderr, "%s", PQerrorMessage(con));
                                exit(1);
                        }
-#endif /* NOT_USED */
+#endif   /* NOT_USED */
                }
        }
 
@@ -614,7 +619,7 @@ printResults(
                                t2;
        int                     i;
        int                     normal_xacts = 0;
-       char    *s;
+       char       *s;
 
        for (i = 0; i < nclients; i++)
                normal_xacts += state[i].cnt;
@@ -626,11 +631,11 @@ printResults(
        t2 = normal_xacts * 1000000.0 / t2;
 
        if (ttype == 0)
-           s = "TPC-B (sort of)";
+               s = "TPC-B (sort of)";
        else if (ttype == 2)
-           s = "Update only accounts";
+               s = "Update only accounts";
        else
-           s = "SELECT only";
+               s = "SELECT only";
 
        printf("transaction type: %s\n", s);
        printf("scaling factor: %d\n", tps);
@@ -655,8 +660,9 @@ main(int argc, char **argv)
                                                                                 * testing? */
        int                     is_full_vacuum = 0;             /* do full vacuum before testing? */
        int                     debug = 0;              /* debug flag */
-       int                     ttype = 0;              /* transaction type. 0: TPC-B, 1: SELECT only,
-                                                                * 2: skip update of branches and tellers */
+       int                     ttype = 0;              /* transaction type. 0: TPC-B, 1: SELECT
+                                                                * only, 2: skip update of branches and
+                                                                * tellers */
 
        static CState *state;           /* status of clients */
 
@@ -789,7 +795,7 @@ main(int argc, char **argv)
 
        if (use_log)
        {
-               char logpath[64];
+               char            logpath[64];
 
                snprintf(logpath, 64, "pgbench_log.%d", getpid());
                LOGFILE = fopen(logpath, "w");
index 4fbc60b..51cab46 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * $Header: /cvsroot/pgsql/contrib/pgstattuple/pgstattuple.c,v 1.8 2002/08/29 17:14:31 tgl Exp $
+ * $Header: /cvsroot/pgsql/contrib/pgstattuple/pgstattuple.c,v 1.9 2002/09/04 20:31:08 momjian Exp $
  *
- * Copyright (c) 2001,2002  Tatsuo Ishii
+ * Copyright (c) 2001,2002     Tatsuo Ishii
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose, without fee, and without a
@@ -71,12 +71,12 @@ pgstattuple(PG_FUNCTION_ARGS)
        double          dead_tuple_percent;
        uint64          free_space = 0; /* free/reusable space in bytes */
        double          free_percent;   /* free/reusable space in % */
-       TupleDesc                       tupdesc;
-       TupleTableSlot     *slot;
-       AttInMetadata      *attinmeta;
-       char                      **values;
-       int                                     i;
-       Datum                           result;
+       TupleDesc       tupdesc;
+       TupleTableSlot *slot;
+       AttInMetadata *attinmeta;
+       char      **values;
+       int                     i;
+       Datum           result;
 
        /*
         * Build a tuple description for a pgstattupe_type tuple
@@ -94,7 +94,7 @@ pgstattuple(PG_FUNCTION_ARGS)
 
        /* open relation */
        relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname,
-                                                                                                                        "pgstattuple"));
+                                                                                                                "pgstattuple"));
        rel = heap_openrv(relrv, AccessShareLock);
 
        nblocks = RelationGetNumberOfBlocks(rel);
@@ -116,7 +116,7 @@ pgstattuple(PG_FUNCTION_ARGS)
 
                /*
                 * To avoid physically reading the table twice, try to do the
-                * free-space scan in parallel with the heap scan.  However,
+                * free-space scan in parallel with the heap scan.      However,
                 * heap_getnext may find no tuples on a given page, so we cannot
                 * simply examine the pages returned by the heap scan.
                 */
@@ -142,7 +142,7 @@ pgstattuple(PG_FUNCTION_ARGS)
 
        heap_close(rel, AccessShareLock);
 
-       table_len = (uint64)nblocks *BLCKSZ;
+       table_len = (uint64) nblocks *BLCKSZ;
 
        if (nblocks == 0)
        {
@@ -158,15 +158,13 @@ pgstattuple(PG_FUNCTION_ARGS)
        }
 
        /*
-        * Prepare a values array for storage in our slot.
-        * This should be an array of C strings which will
-        * be processed later by the appropriate "in" functions.
+        * Prepare a values array for storage in our slot. This should be an
+        * array of C strings which will be processed later by the appropriate
+        * "in" functions.
         */
        values = (char **) palloc(NCOLUMNS * sizeof(char *));
-       for (i=0;i<NCOLUMNS;i++)
-       {
+       for (i = 0; i < NCOLUMNS; i++)
                values[i] = (char *) palloc(NCHARS * sizeof(char));
-       }
        i = 0;
        snprintf(values[i++], NCHARS, "%lld", table_len);
        snprintf(values[i++], NCHARS, "%lld", tuple_count);
@@ -177,19 +175,17 @@ pgstattuple(PG_FUNCTION_ARGS)
        snprintf(values[i++], NCHARS, "%.2f", dead_tuple_percent);
        snprintf(values[i++], NCHARS, "%lld", free_space);
        snprintf(values[i++], NCHARS, "%.2f", free_percent);
-    
+
        /* build a tuple */
        tuple = BuildTupleFromCStrings(attinmeta, values);
-    
+
        /* make the tuple into a datum */
        result = TupleGetDatum(slot, tuple);
-    
+
        /* Clean up */
-       for (i=0;i<NCOLUMNS;i++)
-       {
+       for (i = 0; i < NCOLUMNS; i++)
                pfree(values[i]);
-       }
        pfree(values);
-    
+
        PG_RETURN_DATUM(result);
 }
index dc5f126..be957a3 100644 (file)
@@ -128,8 +128,8 @@ _rserv_log_()
                okey = key;
 
        snprintf(sql, 8192, "update _RSERV_LOG_ set logid = %d, logtime = now(), "
-                       "deleted = %d where reloid = %u and key = '%s'",
-                       GetCurrentTransactionId(), deleted, rel->rd_id, okey);
+                        "deleted = %d where reloid = %u and key = '%s'",
+                        GetCurrentTransactionId(), deleted, rel->rd_id, okey);
 
        if (debug)
                elog(DEBUG3, sql);
@@ -147,10 +147,10 @@ _rserv_log_()
        else if (SPI_processed == 0)
        {
                snprintf(sql, 8192, "insert into _RSERV_LOG_ "
-                               "(reloid, logid, logtime, deleted, key) "
-                               "values (%u, %d, now(), %d, '%s')",
-                               rel->rd_id, GetCurrentTransactionId(),
-                               deleted, okey);
+                                "(reloid, logid, logtime, deleted, key) "
+                                "values (%u, %d, now(), %d, '%s')",
+                                rel->rd_id, GetCurrentTransactionId(),
+                                deleted, okey);
 
                if (debug)
                        elog(DEBUG3, sql);
@@ -172,9 +172,9 @@ _rserv_log_()
                        okey = newkey;
 
                snprintf(sql, 8192, "insert into _RSERV_LOG_ "
-                               "(reloid, logid, logtime, deleted, key) "
-                               "values (%u, %d, now(), 0, '%s')",
-                               rel->rd_id, GetCurrentTransactionId(), okey);
+                                "(reloid, logid, logtime, deleted, key) "
+                                "values (%u, %d, now(), 0, '%s')",
+                                rel->rd_id, GetCurrentTransactionId(), okey);
 
                if (debug)
                        elog(DEBUG3, sql);
@@ -221,17 +221,17 @@ _rserv_sync_(int32 server)
        for (xcnt = 0; xcnt < SerializableSnapshot->xcnt; xcnt++)
        {
                snprintf(buf + strlen(buf), 8192 - strlen(buf),
-                               "%s%u", (xcnt) ? ", " : "",
-                               SerializableSnapshot->xip[xcnt]);
+                                "%s%u", (xcnt) ? ", " : "",
+                                SerializableSnapshot->xip[xcnt]);
        }
 
        if ((ret = SPI_connect()) < 0)
                elog(ERROR, "_rserv_sync_: SPI_connect returned %d", ret);
 
        snprintf(sql, 8192, "insert into _RSERV_SYNC_ "
-                       "(server, syncid, synctime, status, minid, maxid, active) "
+                        "(server, syncid, synctime, status, minid, maxid, active) "
          "values (%u, currval('_rserv_sync_seq_'), now(), 0, %d, %d, '%s')",
-                       server, SerializableSnapshot->xmin, SerializableSnapshot->xmax, active);
+                        server, SerializableSnapshot->xmin, SerializableSnapshot->xmax, active);
 
        ret = SPI_exec(sql, 0);
 
index 580ca64..5034b9d 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *     $Header: /cvsroot/pgsql/contrib/rtree_gist/Attic/rtree_gist.c,v 1.5 2002/05/28 15:24:53 tgl Exp $
+ *     $Header: /cvsroot/pgsql/contrib/rtree_gist/Attic/rtree_gist.c,v 1.6 2002/09/04 20:31:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -161,20 +161,23 @@ gbox_penalty(PG_FUNCTION_ARGS)
        PG_RETURN_POINTER(result);
 }
 
-typedef struct {
-       BOX     *key;
-       int     pos;
-} KBsort;
+typedef struct
+{
+       BOX                *key;
+       int                     pos;
+}      KBsort;
 
 static int
-compare_KB(const void* a, const void* b) {
-       BOX *abox = ((KBsort*)a)->key; 
-       BOX *bbox = ((KBsort*)b)->key;
-       float sa = (abox->high.x - abox->low.x) * (abox->high.y - abox->low.y);
-       float sb = (bbox->high.x - bbox->low.x) * (bbox->high.y - bbox->low.y);
-
-       if ( sa==sb ) return 0;
-       return ( sa>sb ) ? 1 : -1;
+compare_KB(const void *a, const void *b)
+{
+       BOX                *abox = ((KBsort *) a)->key;
+       BOX                *bbox = ((KBsort *) b)->key;
+       float           sa = (abox->high.x - abox->low.x) * (abox->high.y - abox->low.y);
+       float           sb = (bbox->high.x - bbox->low.x) * (bbox->high.y - bbox->low.y);
+
+       if (sa == sb)
+               return 0;
+       return (sa > sb) ? 1 : -1;
 }
 
 /*
@@ -217,14 +220,14 @@ gbox_picksplit(PG_FUNCTION_ARGS)
        for (i = OffsetNumberNext(FirstOffsetNumber); i <= maxoff; i = OffsetNumberNext(i))
        {
                cur = DatumGetBoxP(((GISTENTRY *) VARDATA(entryvec))[i].key);
-               if ( allisequal == true &&  (
-                               pageunion.high.x != cur->high.x || 
-                               pageunion.high.y != cur->high.y || 
-                               pageunion.low.x != cur->low.x || 
-                               pageunion.low.y != cur->low.y 
-                       ) ) 
+               if (allisequal == true && (
+                                                                  pageunion.high.x != cur->high.x ||
+                                                                  pageunion.high.y != cur->high.y ||
+                                                                  pageunion.low.x != cur->low.x ||
+                                                                  pageunion.low.y != cur->low.y
+                                                                  ))
                        allisequal = false;
+
                if (pageunion.high.x < cur->high.x)
                        pageunion.high.x = cur->high.x;
                if (pageunion.low.x > cur->low.x)
@@ -293,45 +296,53 @@ gbox_picksplit(PG_FUNCTION_ARGS)
        {
                cur = DatumGetBoxP(((GISTENTRY *) VARDATA(entryvec))[i].key);
                if (cur->low.x - pageunion.low.x < pageunion.high.x - cur->high.x)
-                       ADDLIST(listL, unionL, posL,i);
+                       ADDLIST(listL, unionL, posL, i);
                else
-                       ADDLIST(listR, unionR, posR,i);
+                       ADDLIST(listR, unionR, posR, i);
                if (cur->low.y - pageunion.low.y < pageunion.high.y - cur->high.y)
-                       ADDLIST(listB, unionB, posB,i);
+                       ADDLIST(listB, unionB, posB, i);
                else
-                       ADDLIST(listT, unionT, posT,i);
+                       ADDLIST(listT, unionT, posT, i);
        }
 
        /* bad disposition, sort by ascending and resplit */
-       if ( (posR==0 || posL==0) && (posT==0 || posB==0) ) {
-               KBsort *arr = (KBsort*)palloc( sizeof(KBsort) * maxoff );
+       if ((posR == 0 || posL == 0) && (posT == 0 || posB == 0))
+       {
+               KBsort     *arr = (KBsort *) palloc(sizeof(KBsort) * maxoff);
+
                posL = posR = posB = posT = 0;
-               for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i)) {
-                       arr[i-1].key = DatumGetBoxP(((GISTENTRY *) VARDATA(entryvec))[i].key);
-                       arr[i-1].pos = i;
+               for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
+               {
+                       arr[i - 1].key = DatumGetBoxP(((GISTENTRY *) VARDATA(entryvec))[i].key);
+                       arr[i - 1].pos = i;
                }
-               qsort( arr, maxoff, sizeof(KBsort), compare_KB );
-               for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i)) {
-                       cur = arr[i-1].key;
+               qsort(arr, maxoff, sizeof(KBsort), compare_KB);
+               for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
+               {
+                       cur = arr[i - 1].key;
                        if (cur->low.x - pageunion.low.x < pageunion.high.x - cur->high.x)
-                               ADDLIST(listL, unionL, posL,arr[i-1].pos);
-                       else if ( cur->low.x - pageunion.low.x == pageunion.high.x - cur->high.x ) {
-                               if ( posL>posR )
-                                       ADDLIST(listR, unionR, posR,arr[i-1].pos);
+                               ADDLIST(listL, unionL, posL, arr[i - 1].pos);
+                       else if (cur->low.x - pageunion.low.x == pageunion.high.x - cur->high.x)
+                       {
+                               if (posL > posR)
+                                       ADDLIST(listR, unionR, posR, arr[i - 1].pos);
                                else
-                                       ADDLIST(listL, unionL, posL,arr[i-1].pos);
-                       } else
-                               ADDLIST(listR, unionR, posR,arr[i-1].pos);
+                                       ADDLIST(listL, unionL, posL, arr[i - 1].pos);
+                       }
+                       else
+                               ADDLIST(listR, unionR, posR, arr[i - 1].pos);
 
                        if (cur->low.y - pageunion.low.y < pageunion.high.y - cur->high.y)
-                               ADDLIST(listB, unionB, posB,arr[i-1].pos);
-                       else if ( cur->low.y - pageunion.low.y == pageunion.high.y - cur->high.y ) {
-                               if ( posB>posT )
-                                       ADDLIST(listT, unionT, posT,arr[i-1].pos);
+                               ADDLIST(listB, unionB, posB, arr[i - 1].pos);
+                       else if (cur->low.y - pageunion.low.y == pageunion.high.y - cur->high.y)
+                       {
+                               if (posB > posT)
+                                       ADDLIST(listT, unionT, posT, arr[i - 1].pos);
                                else
-                                       ADDLIST(listB, unionB, posB,arr[i-1].pos);
-                       } else
-                               ADDLIST(listT, unionT, posT,arr[i-1].pos);
+                                       ADDLIST(listB, unionB, posB, arr[i - 1].pos);
+                       }
+                       else
+                               ADDLIST(listT, unionT, posT, arr[i - 1].pos);
                }
                pfree(arr);
        }
index e1688c9..61c9e71 100644 (file)
@@ -462,9 +462,9 @@ check_foreign_key(PG_FUNCTION_ARGS)
                                                 * value
                                                 */
                                                snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql),
-                                                               " %s = %s%s%s %s ",
-                                                               args2[k], (is_char_type > 0) ? "'" : "",
-                                                               nv, (is_char_type > 0) ? "'" : "", (k < nkeys) ? ", " : "");
+                                                                " %s = %s%s%s %s ",
+                                                                args2[k], (is_char_type > 0) ? "'" : "",
+                                                                nv, (is_char_type > 0) ? "'" : "", (k < nkeys) ? ", " : "");
                                                is_char_type = 0;
                                        }
                                        strcat(sql, " where ");
@@ -488,8 +488,8 @@ check_foreign_key(PG_FUNCTION_ARGS)
                                for (i = 1; i <= nkeys; i++)
                                {
                                        snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql),
-                                                       "%s = null%s",
-                                                       args2[i], (i < nkeys) ? ", " : "");
+                                                        "%s = null%s",
+                                                        args2[i], (i < nkeys) ? ", " : "");
                                }
                                strcat(sql, " where ");
                        }
@@ -498,7 +498,7 @@ check_foreign_key(PG_FUNCTION_ARGS)
                        for (i = 1; i <= nkeys; i++)
                        {
                                snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%s = $%d %s",
-                                               args2[i], i, (i < nkeys) ? "and " : "");
+                                                args2[i], i, (i < nkeys) ? "and " : "");
                        }
 
                        /* Prepare plan for query */
index 771e924..e992cbe 100644 (file)
@@ -270,7 +270,7 @@ timetravel(PG_FUNCTION_ARGS)
                for (i = 1; i <= natts; i++)
                {
                        snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "$%d%s",
-                                       i, (i < natts) ? ", " : ")");
+                                        i, (i < natts) ? ", " : ")");
                        ctypes[i - 1] = SPI_gettypeid(tupdesc, i);
                }
 
index a87627a..f620e61 100644 (file)
  * 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.
- * 
+ *
  * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS 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 OR DISTRIBUTORS HAVE BEEN ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
- * 
+ *
  * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
@@ -45,42 +45,42 @@ static bool compatCrosstabTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
 static bool compatConnectbyTupleDescs(TupleDesc tupdesc1, TupleDesc tupdesc2);
 static void get_normal_pair(float8 *x1, float8 *x2);
 static TupleDesc make_crosstab_tupledesc(TupleDesc spi_tupdesc,
-                                                               int num_catagories);
+                                               int num_catagories);
 static Tuplestorestate *connectby(char *relname,
-                                                       char *key_fld,
-                                                       char *parent_key_fld,
-                                                       char *branch_delim,
-                                                       char *start_with,
-                                                       int max_depth,
-                                                       bool show_branch,
-                                                       MemoryContext per_query_ctx,
-                                                       AttInMetadata *attinmeta);
+                 char *key_fld,
+                 char *parent_key_fld,
+                 char *branch_delim,
+                 char *start_with,
+                 int max_depth,
+                 bool show_branch,
+                 MemoryContext per_query_ctx,
+                 AttInMetadata *attinmeta);
 static Tuplestorestate *build_tuplestore_recursively(char *key_fld,
-                                                       char *parent_key_fld,
-                                                       char *relname,
-                                                       char *branch_delim,
-                                                       char *start_with,
-                                                       char *branch,
-                                                       int level,
-                                                       int max_depth,
-                                                       bool show_branch,
-                                                       MemoryContext per_query_ctx,
-                                                       AttInMetadata *attinmeta,
-                                                       Tuplestorestate *tupstore);
+                                                        char *parent_key_fld,
+                                                        char *relname,
+                                                        char *branch_delim,
+                                                        char *start_with,
+                                                        char *branch,
+                                                        int level,
+                                                        int max_depth,
+                                                        bool show_branch,
+                                                        MemoryContext per_query_ctx,
+                                                        AttInMetadata *attinmeta,
+                                                        Tuplestorestate *tupstore);
 static char *quote_ident_cstr(char *rawstr);
 
 typedef struct
 {
-       float8  mean;           /* mean of the distribution */
-       float8  stddev;         /* stddev of the distribution */
-       float8  carry_val;      /* hold second generated value */
-       bool    use_carry;      /* use second generated value */
+       float8          mean;                   /* mean of the distribution */
+       float8          stddev;                 /* stddev of the distribution */
+       float8          carry_val;              /* hold second generated value */
+       bool            use_carry;              /* use second generated value */
 }      normal_rand_fctx;
 
 typedef struct
 {
-       SPITupleTable  *spi_tuptable;   /* sql results from user query */
-       char               *lastrowid;          /* rowid of the last tuple sent */
+       SPITupleTable *spi_tuptable;    /* sql results from user query */
+       char       *lastrowid;          /* rowid of the last tuple sent */
 }      crosstab_fctx;
 
 #define GET_TEXT(cstrp) DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(cstrp)))
@@ -108,23 +108,26 @@ PG_FUNCTION_INFO_V1(normal_rand);
 Datum
 normal_rand(PG_FUNCTION_ARGS)
 {
-       FuncCallContext    *funcctx;
-       int                                     call_cntr;
-       int                                     max_calls;
-       normal_rand_fctx   *fctx;
-       float8                          mean;
-       float8                          stddev;
-       float8                          carry_val;
-       bool                            use_carry;
-       MemoryContext           oldcontext;
+       FuncCallContext *funcctx;
+       int                     call_cntr;
+       int                     max_calls;
+       normal_rand_fctx *fctx;
+       float8          mean;
+       float8          stddev;
+       float8          carry_val;
+       bool            use_carry;
+       MemoryContext oldcontext;
 
        /* stuff done only on the first call of the function */
-       if(SRF_IS_FIRSTCALL())
-       {
+       if (SRF_IS_FIRSTCALL())
+       {
                /* create a function context for cross-call persistence */
-               funcctx = SRF_FIRSTCALL_INIT();
+               funcctx = SRF_FIRSTCALL_INIT();
 
-               /* switch to memory context appropriate for multiple function calls */
+               /*
+                * switch to memory context appropriate for multiple function
+                * calls
+                */
                oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
 
                /* total number of tuples to be returned */
@@ -134,11 +137,10 @@ normal_rand(PG_FUNCTION_ARGS)
                fctx = (normal_rand_fctx *) palloc(sizeof(normal_rand_fctx));
 
                /*
-                * Use fctx to keep track of upper and lower bounds
-                * from call to call. It will also be used to carry over
-                * the spare value we get from the Box-Muller algorithm
-                * so that we only actually calculate a new value every
-                * other call.
+                * Use fctx to keep track of upper and lower bounds from call to
+                * call. It will also be used to carry over the spare value we get
+                * from the Box-Muller algorithm so that we only actually
+                * calculate a new value every other call.
                 */
                fctx->mean = PG_GETARG_FLOAT8(1);
                fctx->stddev = PG_GETARG_FLOAT8(2);
@@ -154,10 +156,10 @@ normal_rand(PG_FUNCTION_ARGS)
                srandom(PG_GETARG_UINT32(3));
 
                MemoryContextSwitchTo(oldcontext);
-    }
+       }
 
        /* stuff done on every call of the function */
-       funcctx = SRF_PERCALL_SETUP();
+       funcctx = SRF_PERCALL_SETUP();
 
        call_cntr = funcctx->call_cntr;
        max_calls = funcctx->max_calls;
@@ -166,12 +168,12 @@ normal_rand(PG_FUNCTION_ARGS)
        stddev = fctx->stddev;
        carry_val = fctx->carry_val;
        use_carry = fctx->use_carry;
-       if (call_cntr < max_calls)      /* do when there is more left to send */
-       {
+
+       if (call_cntr < max_calls)      /* do when there is more left to send */
+       {
                float8          result;
 
-               if(use_carry)
+               if (use_carry)
                {
                        /*
                         * reset use_carry and use second value obtained on last pass
@@ -196,12 +198,11 @@ normal_rand(PG_FUNCTION_ARGS)
                }
 
                /* send the result */
-               SRF_RETURN_NEXT(funcctx, Float8GetDatum(result));
-       }
-       else    /* do when there is no more left */
-       {
-               SRF_RETURN_DONE(funcctx);
-       }
+               SRF_RETURN_NEXT(funcctx, Float8GetDatum(result));
+       }
+       else
+/* do when there is no more left */
+               SRF_RETURN_DONE(funcctx);
 }
 
 /*
@@ -218,9 +219,13 @@ normal_rand(PG_FUNCTION_ARGS)
 static void
 get_normal_pair(float8 *x1, float8 *x2)
 {
-       float8  u1, u2, v1, v2, s;
+       float8          u1,
+                               u2,
+                               v1,
+                               v2,
+                               s;
 
-       for(;;)
+       for (;;)
        {
                u1 = (float8) random() / (float8) RAND_MAX;
                u2 = (float8) random() / (float8) RAND_MAX;
@@ -257,65 +262,68 @@ get_normal_pair(float8 *x1, float8 *x2)
  *
  *                     rowid   cat             value
  *                     ------+-------+-------
- *                     row1    cat1    val1
- *                     row1    cat2    val2
- *                     row1    cat3    val3
- *                     row1    cat4    val4
- *                     row2    cat1    val5
- *                     row2    cat2    val6
- *                     row2    cat3    val7
- *                     row2    cat4    val8
+ *                     row1    cat1    val1
+ *                     row1    cat2    val2
+ *                     row1    cat3    val3
+ *                     row1    cat4    val4
+ *                     row2    cat1    val5
+ *                     row2    cat2    val6
+ *                     row2    cat3    val7
+ *                     row2    cat4    val8
  *
  * crosstab returns:
  *                                     <===== values columns =====>
  *                     rowid   cat1    cat2    cat3    cat4
  *                     ------+-------+-------+-------+-------
- *                     row1    val1    val2    val3    val4
- *                     row2    val5    val6    val7    val8
+ *                     row1    val1    val2    val3    val4
+ *                     row2    val5    val6    val7    val8
  *
  * NOTES:
  * 1. SQL result must be ordered by 1,2.
  * 2. The number of values columns depends on the tuple description
- *    of the function's declared return type.
+ *       of the function's declared return type.
  * 2. Missing values (i.e. not enough adjacent rows of same rowid to
- *    fill the number of result values columns) are filled in with nulls.
+ *       fill the number of result values columns) are filled in with nulls.
  * 3. Extra values (i.e. too many adjacent rows of same rowid to fill
- *    the number of result values columns) are skipped.
+ *       the number of result values columns) are skipped.
  * 4. Rows with all nulls in the values columns are skipped.
  */
 PG_FUNCTION_INFO_V1(crosstab);
 Datum
 crosstab(PG_FUNCTION_ARGS)
 {
-       FuncCallContext    *funcctx;
-       TupleDesc                       ret_tupdesc;
-       int                                     call_cntr;
-       int                                     max_calls;
-       TupleTableSlot     *slot;
-       AttInMetadata      *attinmeta;
-       SPITupleTable      *spi_tuptable = NULL;
-       TupleDesc                       spi_tupdesc;
-       char                       *lastrowid = NULL;
-       crosstab_fctx      *fctx;
-       int                                     i;
-       int                                     num_categories;
-       MemoryContext           oldcontext;
+       FuncCallContext *funcctx;
+       TupleDesc       ret_tupdesc;
+       int                     call_cntr;
+       int                     max_calls;
+       TupleTableSlot *slot;
+       AttInMetadata *attinmeta;
+       SPITupleTable *spi_tuptable = NULL;
+       TupleDesc       spi_tupdesc;
+       char       *lastrowid = NULL;
+       crosstab_fctx *fctx;
+       int                     i;
+       int                     num_categories;
+       MemoryContext oldcontext;
 
        /* stuff done only on the first call of the function */
-       if(SRF_IS_FIRSTCALL())
-       {
-               char               *sql = GET_STR(PG_GETARG_TEXT_P(0));
-               Oid                     funcid = fcinfo->flinfo->fn_oid;
-               Oid                     functypeid;
-               char                    functyptype;
-               TupleDesc               tupdesc = NULL;
-               int                             ret;
-               int                             proc;
+       if (SRF_IS_FIRSTCALL())
+       {
+               char       *sql = GET_STR(PG_GETARG_TEXT_P(0));
+               Oid                     funcid = fcinfo->flinfo->fn_oid;
+               Oid                     functypeid;
+               char            functyptype;
+               TupleDesc       tupdesc = NULL;
+               int                     ret;
+               int                     proc;
 
                /* create a function context for cross-call persistence */
-               funcctx = SRF_FIRSTCALL_INIT();
+               funcctx = SRF_FIRSTCALL_INIT();
 
-               /* switch to memory context appropriate for multiple function calls */
+               /*
+                * switch to memory context appropriate for multiple function
+                * calls
+                */
                oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
 
                /* Connect to SPI manager */
@@ -336,20 +344,19 @@ crosstab(PG_FUNCTION_ARGS)
                         * The provided SQL query must always return three columns.
                         *
                         * 1. rowname   the label or identifier for each row in the final
-                        *                              result
-                        * 2. category  the label or identifier for each column in the
-                        *                              final result
-                        * 3. values    the value for each column in the final result
+                        * result 2. category  the label or identifier for each column
+                        * in the final result 3. values        the value for each column
+                        * in the final result
                         */
                        if (spi_tupdesc->natts != 3)
                                elog(ERROR, "crosstab: provided SQL must return 3 columns;"
-                                                               " a rowid, a category, and a values column");
+                                        " a rowid, a category, and a values column");
                }
                else
                {
                        /* no qualifying tuples */
                        SPI_finish();
-                       SRF_RETURN_DONE(funcctx);
+                       SRF_RETURN_DONE(funcctx);
                }
 
                /* SPI switches context on us, so reset it */
@@ -360,7 +367,7 @@ crosstab(PG_FUNCTION_ARGS)
 
                /* check typtype to see if we have a predetermined return type */
                functyptype = get_typtype(functypeid);
-               
+
                if (functyptype == 'c')
                {
                        /* Build a tuple description for a functypeid tuple */
@@ -372,7 +379,7 @@ crosstab(PG_FUNCTION_ARGS)
                                elog(ERROR, "Wrong number of arguments specified for function");
                        else
                        {
-                               int     num_catagories = PG_GETARG_INT32(1);
+                               int                     num_catagories = PG_GETARG_INT32(1);
 
                                tupdesc = make_crosstab_tupledesc(spi_tupdesc, num_catagories);
                        }
@@ -389,7 +396,7 @@ crosstab(PG_FUNCTION_ARGS)
                 */
                if (!compatCrosstabTupleDescs(tupdesc, spi_tupdesc))
                        elog(ERROR, "crosstab: return and sql tuple descriptions are"
-                                                                       " incompatible");
+                                " incompatible");
 
                /* allocate a slot for a tuple with this tupdesc */
                slot = TupleDescGetSlot(tupdesc);
@@ -398,8 +405,8 @@ crosstab(PG_FUNCTION_ARGS)
                funcctx->slot = slot;
 
                /*
-                * Generate attribute metadata needed later to produce tuples from raw
-                * C strings
+                * Generate attribute metadata needed later to produce tuples from
+                * raw C strings
                 */
                attinmeta = TupleDescGetAttInMetadata(tupdesc);
                funcctx->attinmeta = attinmeta;
@@ -418,10 +425,10 @@ crosstab(PG_FUNCTION_ARGS)
                funcctx->max_calls = proc;
 
                MemoryContextSwitchTo(oldcontext);
-    }
+       }
 
        /* stuff done on every call of the function */
-       funcctx = SRF_PERCALL_SETUP();
+       funcctx = SRF_PERCALL_SETUP();
 
        /*
         * initialize per-call variables
@@ -446,9 +453,9 @@ crosstab(PG_FUNCTION_ARGS)
 
        /* the return tuple always must have 1 rowid + num_categories columns */
        num_categories = ret_tupdesc->natts - 1;
+
        if (call_cntr < max_calls)      /* do when there is more left to send */
-       {
+       {
                HeapTuple       tuple;
                Datum           result;
                char      **values;
@@ -463,8 +470,8 @@ crosstab(PG_FUNCTION_ARGS)
                        memset(values, '\0', (1 + num_categories) * sizeof(char *));
 
                        /*
-                        * now loop through the sql results and assign each value
-                        * in sequence to the next category
+                        * now loop through the sql results and assign each value in
+                        * sequence to the next category
                         */
                        for (i = 0; i < num_categories; i++)
                        {
@@ -481,11 +488,12 @@ crosstab(PG_FUNCTION_ARGS)
                                /* get the rowid from the current sql result tuple */
                                rowid = SPI_getvalue(spi_tuple, spi_tupdesc, 1);
 
-                               /* 
-                                * If this is the first pass through the values for this rowid
-                                * set it, otherwise make sure it hasn't changed on us. Also
-                                * check to see if the rowid is the same as that of the last
-                                * tuple sent -- if so, skip this tuple entirely
+                               /*
+                                * If this is the first pass through the values for this
+                                * rowid set it, otherwise make sure it hasn't changed on
+                                * us. Also check to see if the rowid is the same as that
+                                * of the last tuple sent -- if so, skip this tuple
+                                * entirely
                                 */
                                if (i == 0)
                                        values[0] = pstrdup(rowid);
@@ -498,18 +506,19 @@ crosstab(PG_FUNCTION_ARGS)
                                                allnulls = false;
 
                                        /*
-                                        * Get the next category item value, which is alway attribute
-                                        * number three.
+                                        * Get the next category item value, which is alway
+                                        * attribute number three.
                                         *
-                                        * Be careful to sssign the value to the array index based
-                                        * on which category we are presently processing.
+                                        * Be careful to sssign the value to the array index
+                                        * based on which category we are presently
+                                        * processing.
                                         */
                                        values[1 + i] = SPI_getvalue(spi_tuple, spi_tupdesc, 3);
 
                                        /*
-                                        * increment the counter since we consume a row
-                                        * for each category, but not for last pass
-                                        * because the API will do that for us
+                                        * increment the counter since we consume a row for
+                                        * each category, but not for last pass because the
+                                        * API will do that for us
                                         */
                                        if (i < (num_categories - 1))
                                                call_cntr = ++funcctx->call_cntr;
@@ -517,10 +526,9 @@ crosstab(PG_FUNCTION_ARGS)
                                else
                                {
                                        /*
-                                        * We'll fill in NULLs for the missing values,
-                                        * but we need to decrement the counter since
-                                        * this sql result row doesn't belong to the current
-                                        * output tuple.
+                                        * We'll fill in NULLs for the missing values, but we
+                                        * need to decrement the counter since this sql result
+                                        * row doesn't belong to the current output tuple.
                                         */
                                        call_cntr = --funcctx->call_cntr;
                                        break;
@@ -534,7 +542,10 @@ crosstab(PG_FUNCTION_ARGS)
 
                        if (values[0] != NULL)
                        {
-                               /* switch to memory context appropriate for multiple function calls */
+                               /*
+                                * switch to memory context appropriate for multiple
+                                * function calls
+                                */
                                oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
 
                                lastrowid = fctx->lastrowid = pstrdup(values[0]);
@@ -555,14 +566,13 @@ crosstab(PG_FUNCTION_ARGS)
                                                xpfree(values[i]);
                                xpfree(values);
 
-                               SRF_RETURN_NEXT(funcctx, result);
+                               SRF_RETURN_NEXT(funcctx, result);
                        }
                        else
                        {
                                /*
                                 * Skipping this tuple entirely, but we need to advance
-                                * the counter like the API would if we had returned
-                                * one.
+                                * the counter like the API would if we had returned one.
                                 */
                                call_cntr = ++funcctx->call_cntr;
 
@@ -574,17 +584,18 @@ crosstab(PG_FUNCTION_ARGS)
                                {
                                        /* release SPI related resources */
                                        SPI_finish();
-                                       SRF_RETURN_DONE(funcctx);
+                                       SRF_RETURN_DONE(funcctx);
                                }
                        }
                }
        }
-       else    /* do when there is no more left */
-       {
+       else
+/* do when there is no more left */
+       {
                /* release SPI related resources */
                SPI_finish();
-               SRF_RETURN_DONE(funcctx);
-       }
+               SRF_RETURN_DONE(funcctx);
+       }
 }
 
 /*
@@ -595,29 +606,29 @@ crosstab(PG_FUNCTION_ARGS)
  *
  *                     keyid   parent_keyid
  *                     ------+--------------
- *                     row1    NULL
- *                     row2    row1
- *                     row3    row1
- *                     row4    row2
- *                     row5    row2
- *                     row6    row4
- *                     row7    row3
- *                     row8    row6
- *                     row9    row5
+ *                     row1    NULL
+ *                     row2    row1
+ *                     row3    row1
+ *                     row4    row2
+ *                     row5    row2
+ *                     row6    row4
+ *                     row7    row3
+ *                     row8    row6
+ *                     row9    row5
  *
  *
  * connectby(text relname, text keyid_fld, text parent_keyid_fld,
- *                                             text start_with, int max_depth [, text branch_delim])
+ *                                             text start_with, int max_depth [, text branch_delim])
  * connectby('foo', 'keyid', 'parent_keyid', 'row2', 0, '~') returns:
  *
  *             keyid   parent_id       level    branch
  *             ------+-----------+--------+-----------------------
- *             row2    NULL              0               row2
- *             row4    row2              1               row2~row4
- *             row6    row4              2               row2~row4~row6
- *             row8    row6              3               row2~row4~row6~row8
- *             row5    row2              1               row2~row5
- *             row9    row5              2               row2~row5~row9
+ *             row2    NULL              0               row2
+ *             row4    row2              1               row2~row4
+ *             row6    row4              2               row2~row4~row6
+ *             row8    row6              3               row2~row4~row6~row8
+ *             row5    row2              1               row2~row5
+ *             row9    row5              2               row2~row5~row9
  *
  */
 PG_FUNCTION_INFO_V1(connectby_text);
@@ -628,18 +639,18 @@ PG_FUNCTION_INFO_V1(connectby_text);
 Datum
 connectby_text(PG_FUNCTION_ARGS)
 {
-       char               *relname = GET_STR(PG_GETARG_TEXT_P(0));
-       char               *key_fld = GET_STR(PG_GETARG_TEXT_P(1));
-       char               *parent_key_fld = GET_STR(PG_GETARG_TEXT_P(2));
-       char               *start_with = GET_STR(PG_GETARG_TEXT_P(3));
-       int                             max_depth = PG_GETARG_INT32(4);
-       char               *branch_delim = NULL;
-       bool                    show_branch = false;
-       ReturnSetInfo  *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
-       TupleDesc               tupdesc;
-       AttInMetadata  *attinmeta;
-       MemoryContext   per_query_ctx;
-       MemoryContext   oldcontext;
+       char       *relname = GET_STR(PG_GETARG_TEXT_P(0));
+       char       *key_fld = GET_STR(PG_GETARG_TEXT_P(1));
+       char       *parent_key_fld = GET_STR(PG_GETARG_TEXT_P(2));
+       char       *start_with = GET_STR(PG_GETARG_TEXT_P(3));
+       int                     max_depth = PG_GETARG_INT32(4);
+       char       *branch_delim = NULL;
+       bool            show_branch = false;
+       ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
+       TupleDesc       tupdesc;
+       AttInMetadata *attinmeta;
+       MemoryContext per_query_ctx;
+       MemoryContext oldcontext;
 
        if (fcinfo->nargs == 6)
        {
@@ -662,7 +673,7 @@ connectby_text(PG_FUNCTION_ARGS)
        /* check to see if caller supports us returning a tuplestore */
        if (!rsinfo->allowedModes & SFRM_Materialize)
                elog(ERROR, "connectby requires Materialize mode, but it is not "
-                                       "allowed in this context");
+                        "allowed in this context");
 
        /* OK, go to work */
        rsinfo->returnMode = SFRM_Materialize;
@@ -680,8 +691,8 @@ connectby_text(PG_FUNCTION_ARGS)
        MemoryContextSwitchTo(oldcontext);
 
        /*
-        * SFRM_Materialize mode expects us to return a NULL Datum.
-        * The actual tuples are in our tuplestore and passed back through
+        * SFRM_Materialize mode expects us to return a NULL Datum. The actual
+        * tuples are in our tuplestore and passed back through
         * rsinfo->setResult. rsinfo->setDesc is set to the tuple description
         * that we actually used to build our tuples with, so the caller can
         * verify we did what it was expecting.
@@ -703,9 +714,9 @@ connectby(char *relname,
                  MemoryContext per_query_ctx,
                  AttInMetadata *attinmeta)
 {
-       Tuplestorestate    *tupstore = NULL;
-       int                                     ret;
-       MemoryContext           oldcontext;
+       Tuplestorestate *tupstore = NULL;
+       int                     ret;
+       MemoryContext oldcontext;
 
        /* Connect to SPI manager */
        if ((ret = SPI_connect()) < 0)
@@ -721,17 +732,17 @@ connectby(char *relname,
 
        /* now go get the whole tree */
        tupstore = build_tuplestore_recursively(key_fld,
-                                                       parent_key_fld,
-                                                       relname,
-                                                       branch_delim,
-                                                       start_with,
-                                                       start_with,     /* current_branch */
-                                                       0,                      /* initial level is 0 */
-                                                       max_depth,
-                                                   show_branch,
-                                                       per_query_ctx,
-                                                       attinmeta,
-                                                       tupstore);
+                                                                                       parent_key_fld,
+                                                                                       relname,
+                                                                                       branch_delim,
+                                                                                       start_with,
+                                                                                       start_with, /* current_branch */
+                                                                                       0,      /* initial level is 0 */
+                                                                                       max_depth,
+                                                                                       show_branch,
+                                                                                       per_query_ctx,
+                                                                                       attinmeta,
+                                                                                       tupstore);
 
        SPI_finish();
 
@@ -756,23 +767,23 @@ build_tuplestore_recursively(char *key_fld,
                                                         AttInMetadata *attinmeta,
                                                         Tuplestorestate *tupstore)
 {
-       TupleDesc               tupdesc = attinmeta->tupdesc;
-       MemoryContext   oldcontext;
-       StringInfo              sql = makeStringInfo();
-       int                             ret;
-       int                             proc;
+       TupleDesc       tupdesc = attinmeta->tupdesc;
+       MemoryContext oldcontext;
+       StringInfo      sql = makeStringInfo();
+       int                     ret;
+       int                     proc;
 
-       if(max_depth > 0 && level > max_depth)
+       if (max_depth > 0 && level > max_depth)
                return tupstore;
 
        /* Build initial sql statement */
        appendStringInfo(sql, "SELECT %s, %s FROM %s WHERE %s = '%s' AND %s IS NOT NULL",
-                                                       quote_ident_cstr(key_fld),
-                                                       quote_ident_cstr(parent_key_fld),
-                                                       quote_ident_cstr(relname),
-                                                       quote_ident_cstr(parent_key_fld),
-                                                       start_with,
-                                                       quote_ident_cstr(key_fld));
+                                        quote_ident_cstr(key_fld),
+                                        quote_ident_cstr(parent_key_fld),
+                                        quote_ident_cstr(relname),
+                                        quote_ident_cstr(parent_key_fld),
+                                        start_with,
+                                        quote_ident_cstr(key_fld));
 
        /* Retrieve the desired rows */
        ret = SPI_exec(sql->data, 0);
@@ -781,16 +792,16 @@ build_tuplestore_recursively(char *key_fld,
        /* Check for qualifying tuples */
        if ((ret == SPI_OK_SELECT) && (proc > 0))
        {
-               HeapTuple               tuple;
-               HeapTuple               spi_tuple;
-               SPITupleTable  *tuptable = SPI_tuptable;
-               TupleDesc               spi_tupdesc = tuptable->tupdesc;
-               int                             i;
-               char               *current_key;
-               char               *current_key_parent;
-               char                    current_level[INT32_STRLEN];
-               char               *current_branch;
-               char               **values;
+               HeapTuple       tuple;
+               HeapTuple       spi_tuple;
+               SPITupleTable *tuptable = SPI_tuptable;
+               TupleDesc       spi_tupdesc = tuptable->tupdesc;
+               int                     i;
+               char       *current_key;
+               char       *current_key_parent;
+               char            current_level[INT32_STRLEN];
+               char       *current_branch;
+               char      **values;
 
                if (show_branch)
                        values = (char **) palloc(CONNECTBY_NCOLS * sizeof(char *));
@@ -802,13 +813,13 @@ build_tuplestore_recursively(char *key_fld,
                {
                        /*
                         * Check that return tupdesc is compatible with the one we got
-                        * from the query, but only at level 0 -- no need to check more
-                        * than once
+                        * from the query, but only at level 0 -- no need to check
+                        * more than once
                         */
 
                        if (!compatConnectbyTupleDescs(tupdesc, spi_tupdesc))
                                elog(ERROR, "connectby: return and sql tuple descriptions are "
-                                                       "incompatible");
+                                        "incompatible");
 
                        /* root value is the one we initially start with */
                        values[0] = start_with;
@@ -842,7 +853,7 @@ build_tuplestore_recursively(char *key_fld,
 
                for (i = 0; i < proc; i++)
                {
-                       StringInfo              branchstr = NULL;
+                       StringInfo      branchstr = NULL;
 
                        /* start a new branch */
                        if (show_branch)
@@ -895,17 +906,17 @@ build_tuplestore_recursively(char *key_fld,
 
                        /* recurse using current_key_parent as the new start_with */
                        tupstore = build_tuplestore_recursively(key_fld,
-                                                       parent_key_fld,
-                                                       relname,
-                                                       branch_delim,
-                                                       values[0],
-                                                       current_branch,
-                                                       level + 1,
-                                                       max_depth,
-                                                       show_branch,
-                                                       per_query_ctx,
-                                                       attinmeta,
-                                                       tupstore);
+                                                                                                       parent_key_fld,
+                                                                                                       relname,
+                                                                                                       branch_delim,
+                                                                                                       values[0],
+                                                                                                       current_branch,
+                                                                                                       level + 1,
+                                                                                                       max_depth,
+                                                                                                       show_branch,
+                                                                                                       per_query_ctx,
+                                                                                                       attinmeta,
+                                                                                                       tupstore);
                }
        }
 
@@ -923,29 +934,29 @@ validateConnectbyTupleDesc(TupleDesc tupdesc, bool show_branch)
        {
                if (tupdesc->natts != CONNECTBY_NCOLS)
                        elog(ERROR, "Query-specified return tuple not valid for Connectby: "
-                                               "wrong number of columns");
+                                "wrong number of columns");
        }
        else
        {
                if (tupdesc->natts != CONNECTBY_NCOLS_NOBRANCH)
                        elog(ERROR, "Query-specified return tuple not valid for Connectby: "
-                                               "wrong number of columns");
+                                "wrong number of columns");
        }
 
        /* check that the types of the first two columns match */
        if (tupdesc->attrs[0]->atttypid != tupdesc->attrs[1]->atttypid)
                elog(ERROR, "Query-specified return tuple not valid for Connectby: "
-                                       "first two columns must be the same type");
+                        "first two columns must be the same type");
 
        /* check that the type of the third column is INT4 */
        if (tupdesc->attrs[2]->atttypid != INT4OID)
                elog(ERROR, "Query-specified return tuple not valid for Connectby: "
-                                       "third column must be type %s", format_type_be(INT4OID));
+                        "third column must be type %s", format_type_be(INT4OID));
 
        /* check that the type of the forth column is TEXT if applicable */
        if (show_branch && tupdesc->attrs[3]->atttypid != TEXTOID)
                elog(ERROR, "Query-specified return tuple not valid for Connectby: "
-                                       "third column must be type %s", format_type_be(TEXTOID));
+                        "third column must be type %s", format_type_be(TEXTOID));
 
        /* OK, the tupdesc is valid for our purposes */
 }
@@ -956,22 +967,22 @@ validateConnectbyTupleDesc(TupleDesc tupdesc, bool show_branch)
 static bool
 compatConnectbyTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdesc)
 {
-       Oid                                     ret_atttypid;
-       Oid                                     sql_atttypid;
+       Oid                     ret_atttypid;
+       Oid                     sql_atttypid;
 
        /* check the key_fld types match */
        ret_atttypid = ret_tupdesc->attrs[0]->atttypid;
        sql_atttypid = sql_tupdesc->attrs[0]->atttypid;
        if (ret_atttypid != sql_atttypid)
                elog(ERROR, "compatConnectbyTupleDescs: SQL key field datatype does "
-                                               "not match return key field datatype");
+                        "not match return key field datatype");
 
        /* check the parent_key_fld types match */
        ret_atttypid = ret_tupdesc->attrs[1]->atttypid;
        sql_atttypid = sql_tupdesc->attrs[1]->atttypid;
        if (ret_atttypid != sql_atttypid)
                elog(ERROR, "compatConnectbyTupleDescs: SQL parent key field datatype "
-                                               "does not match return parent key field datatype");
+                        "does not match return parent key field datatype");
 
        /* OK, the two tupdescs are compatible for our purposes */
        return true;
@@ -984,23 +995,22 @@ static bool
 compatCrosstabTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdesc)
 {
        int                     i;
-       Form_pg_attribute       ret_attr;
-       Oid                                     ret_atttypid;
-       Form_pg_attribute       sql_attr;
-       Oid                                     sql_atttypid;
+       Form_pg_attribute ret_attr;
+       Oid                     ret_atttypid;
+       Form_pg_attribute sql_attr;
+       Oid                     sql_atttypid;
 
        /* check the rowid types match */
        ret_atttypid = ret_tupdesc->attrs[0]->atttypid;
        sql_atttypid = sql_tupdesc->attrs[0]->atttypid;
        if (ret_atttypid != sql_atttypid)
                elog(ERROR, "compatCrosstabTupleDescs: SQL rowid datatype does not match"
-                                               " return rowid datatype");
+                        " return rowid datatype");
 
        /*
-        *      - attribute [1] of the sql tuple is the category;
-        *              no need to check it
-        *      - attribute [2] of the sql tuple should match
-        *              attributes [1] to [natts] of the return tuple
+        * - attribute [1] of the sql tuple is the category; no need to check
+        * it - attribute [2] of the sql tuple should match attributes [1] to
+        * [natts] of the return tuple
         */
        sql_attr = sql_tupdesc->attrs[2];
        for (i = 1; i < ret_tupdesc->natts; i++)
@@ -1018,19 +1028,18 @@ compatCrosstabTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdesc)
 static TupleDesc
 make_crosstab_tupledesc(TupleDesc spi_tupdesc, int num_catagories)
 {
-       Form_pg_attribute       sql_attr;
-       Oid                                     sql_atttypid;
-       TupleDesc                       tupdesc;
-       int                                     natts;
-       AttrNumber                      attnum;
-       char                            attname[NAMEDATALEN];
-       int                                     i;
+       Form_pg_attribute sql_attr;
+       Oid                     sql_atttypid;
+       TupleDesc       tupdesc;
+       int                     natts;
+       AttrNumber      attnum;
+       char            attname[NAMEDATALEN];
+       int                     i;
 
        /*
-        * We need to build a tuple description with one column
-        * for the rowname, and num_catagories columns for the values.
-        * Each must be of the same type as the corresponding
-        * spi result input column.
+        * We need to build a tuple description with one column for the
+        * rowname, and num_catagories columns for the values. Each must be of
+        * the same type as the corresponding spi result input column.
         */
        natts = num_catagories + 1;
        tupdesc = CreateTemplateTupleDesc(natts, false);
@@ -1069,9 +1078,9 @@ make_crosstab_tupledesc(TupleDesc spi_tupdesc, int num_catagories)
 static char *
 quote_ident_cstr(char *rawstr)
 {
-       text            *rawstr_text;
-       text            *result_text;
-       char            *result;
+       text       *rawstr_text;
+       text       *result_text;
+       char       *result;
 
        rawstr_text = DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(rawstr)));
        result_text = DatumGetTextP(DirectFunctionCall1(quote_ident, PointerGetDatum(rawstr_text)));
index 3002d32..c8ea8ff 100644 (file)
  * 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.
- * 
+ *
  * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS 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 OR DISTRIBUTORS HAVE BEEN ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
- * 
+ *
  * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
index 17c4fdf..9603f98 100644 (file)
 #define HOST           6
 #define SCIENTIFIC     7
 #define VERSIONNUMBER  8
-#define PARTHYPHENWORD         9       
-#define CYRPARTHYPHENWORD      10      
-#define LATPARTHYPHENWORD      11      
-#define SPACE          12
-#define TAG            13
-#define HTTP           14
+#define PARTHYPHENWORD 9
+#define CYRPARTHYPHENWORD      10
+#define LATPARTHYPHENWORD      11
+#define SPACE          12
+#define TAG                    13
+#define HTTP           14
 #define HYPHENWORD     15
 #define LATHYPHENWORD  16
 #define CYRHYPHENWORD  17
 #define FILEPATH       19
 #define DECIMAL                20
 #define SIGNEDINT      21
-#define UNSIGNEDINT    22
+#define UNSIGNEDINT 22
 #define HTMLENTITY     23
 
 extern const char *descr[];
 
 #endif
-
index 61ab1bd..1222c36 100644 (file)
 #include "gistidx.h"
 #include "crc32.h"
 
-PG_FUNCTION_INFO_V1( gtxtidx_in );
-Datum   gtxtidx_in(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( gtxtidx_out );
-Datum   gtxtidx_out(PG_FUNCTION_ARGS);
-
-PG_FUNCTION_INFO_V1( gtxtidx_compress );
-Datum   gtxtidx_compress(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( gtxtidx_decompress );
-Datum   gtxtidx_decompress(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( gtxtidx_consistent );
-Datum   gtxtidx_consistent(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( gtxtidx_union );
-Datum   gtxtidx_union(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( gtxtidx_same );
-Datum   gtxtidx_same(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( gtxtidx_penalty );
-Datum   gtxtidx_penalty(PG_FUNCTION_ARGS);
-PG_FUNCTION_INFO_V1( gtxtidx_picksplit );
-Datum   gtxtidx_picksplit(PG_FUNCTION_ARGS);
+PG_FUNCTION_INFO_V1(gtxtidx_in);
+Datum          gtxtidx_in(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(gtxtidx_out);
+Datum          gtxtidx_out(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(gtxtidx_compress);
+Datum          gtxtidx_compress(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(gtxtidx_decompress);
+Datum          gtxtidx_decompress(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(gtxtidx_consistent);
+Datum          gtxtidx_consistent(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(gtxtidx_union);
+Datum          gtxtidx_union(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(gtxtidx_same);
+Datum          gtxtidx_same(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(gtxtidx_penalty);
+Datum          gtxtidx_penalty(PG_FUNCTION_ARGS);
+
+PG_FUNCTION_INFO_V1(gtxtidx_picksplit);
+Datum          gtxtidx_picksplit(PG_FUNCTION_ARGS);
 
 #define GETENTRY(vec,pos) ((GISTTYPE *) DatumGetPointer(((GISTENTRY *) VARDATA(vec))[(pos)].key))
-#define SUMBIT(val) (        \
+#define SUMBIT(val) (           \
        GETBITBYTE(val,0) + \
        GETBITBYTE(val,1) + \
        GETBITBYTE(val,2) + \
@@ -46,38 +53,44 @@ Datum   gtxtidx_picksplit(PG_FUNCTION_ARGS);
        GETBITBYTE(val,4) + \
        GETBITBYTE(val,5) + \
        GETBITBYTE(val,6) + \
-       GETBITBYTE(val,7)   \
-) 
+       GETBITBYTE(val,7)       \
+)
 
 
 Datum
-gtxtidx_in(PG_FUNCTION_ARGS) {
-       elog(ERROR,"Not implemented");
+gtxtidx_in(PG_FUNCTION_ARGS)
+{
+       elog(ERROR, "Not implemented");
        PG_RETURN_DATUM(0);
 }
 
 Datum
-gtxtidx_out(PG_FUNCTION_ARGS) {
-       elog(ERROR,"Not implemented");
+gtxtidx_out(PG_FUNCTION_ARGS)
+{
+       elog(ERROR, "Not implemented");
        PG_RETURN_DATUM(0);
 }
 
 static int
-compareint( const void * a, const void * b ) {
-       if ( *((int4*)a) == *((int4*)b) ) return 0;
-       return ( *((int4*)a) > *((int4*)b) ) ? 1 : -1;
+compareint(const void *a, const void *b)
+{
+       if (*((int4 *) a) == *((int4 *) b))
+               return 0;
+       return (*((int4 *) a) > *((int4 *) b)) ? 1 : -1;
 }
 
 static int
-uniqueint( int4* a, int4 l ) {
-       int4 *ptr, *res;
+uniqueint(int4 *a, int4 l)
+{
+       int4       *ptr,
+                          *res;
 
-       if ( l == 1 )
+       if (l == 1)
                return l;
 
        ptr = res = a;
 
-       qsort((void*)a, l, sizeof(int4), compareint );
+       qsort((void *) a, l, sizeof(int4), compareint);
 
        while (ptr - a < l)
                if (*ptr != *res)
@@ -88,129 +101,149 @@ uniqueint( int4* a, int4 l ) {
 }
 
 static void
-makesign( BITVECP sign, GISTTYPE *a) {
-       int4 k,len = ARRNELEM( a );
-       int4 *ptr = GETARR( a );
-       MemSet( (void*)sign, 0, sizeof(BITVEC) );
-       for(k=0;k<len;k++)
-               HASH( sign, ptr[k] );
+makesign(BITVECP sign, GISTTYPE * a)
+{
+       int4            k,
+                               len = ARRNELEM(a);
+       int4       *ptr = GETARR(a);
+
+       MemSet((void *) sign, 0, sizeof(BITVEC));
+       for (k = 0; k < len; k++)
+               HASH(sign, ptr[k]);
 }
 
 Datum
-gtxtidx_compress(PG_FUNCTION_ARGS) {
-       GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
+gtxtidx_compress(PG_FUNCTION_ARGS)
+{
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
        GISTENTRY  *retval = entry;
 
-       if ( entry->leafkey ) { /* txtidx */
-               GISTTYPE *res;
-               txtidx  *toastedval = (txtidx*)DatumGetPointer( entry->key );
-               txtidx  *val = (txtidx*)DatumGetPointer( PG_DETOAST_DATUM(entry->key) );
-               int4 len;
-               int4 *arr;
-               WordEntry *ptr = ARRPTR(val);
-               char *words = STRPTR(val);
-               
-               len = CALCGTSIZE( ARRKEY, val->size );
-               res   = (GISTTYPE*)palloc( len );
+       if (entry->leafkey)
+       {                                                       /* txtidx */
+               GISTTYPE   *res;
+               txtidx     *toastedval = (txtidx *) DatumGetPointer(entry->key);
+               txtidx     *val = (txtidx *) DatumGetPointer(PG_DETOAST_DATUM(entry->key));
+               int4            len;
+               int4       *arr;
+               WordEntry  *ptr = ARRPTR(val);
+               char       *words = STRPTR(val);
+
+               len = CALCGTSIZE(ARRKEY, val->size);
+               res = (GISTTYPE *) palloc(len);
                res->len = len;
                res->flag = ARRKEY;
                arr = GETARR(res);
                len = val->size;
-               while( len-- ) {
-                       *arr = crc32_sz( (uint8*)&words[ ptr->pos ], ptr->len );
-                       arr++; ptr++; 
+               while (len--)
+               {
+                       *arr = crc32_sz((uint8 *) &words[ptr->pos], ptr->len);
+                       arr++;
+                       ptr++;
                }
 
-               len = uniqueint( GETARR(res), val->size );
-               if ( len != val->size ) { 
-                       /* there is a collision of hash-function;
-                          len is always less than val->size */
-                       len = CALCGTSIZE( ARRKEY, len );
-                       res = (GISTTYPE*)repalloc( (void*)res, len );
+               len = uniqueint(GETARR(res), val->size);
+               if (len != val->size)
+               {
+                       /*
+                        * there is a collision of hash-function; len is always less
+                        * than val->size
+                        */
+                       len = CALCGTSIZE(ARRKEY, len);
+                       res = (GISTTYPE *) repalloc((void *) res, len);
                        res->len = len;
                }
-               if ( val != toastedval )
+               if (val != toastedval)
                        pfree(val);
 
                /* make signature, if array is too long */
-               if ( res->len > TOAST_INDEX_TARGET ) {
-                       GISTTYPE *ressign;
+               if (res->len > TOAST_INDEX_TARGET)
+               {
+                       GISTTYPE   *ressign;
 
-                       len = CALCGTSIZE( SIGNKEY, 0 );
-                       ressign = (GISTTYPE*)palloc( len );
+                       len = CALCGTSIZE(SIGNKEY, 0);
+                       ressign = (GISTTYPE *) palloc(len);
                        ressign->len = len;
                        ressign->flag = SIGNKEY;
-                       makesign( GETSIGN(ressign), res );
+                       makesign(GETSIGN(ressign), res);
                        pfree(res);
                        res = ressign;
                }
-               
-               retval = (GISTENTRY*)palloc(sizeof(GISTENTRY));
-               gistentryinit(*retval, PointerGetDatum(res), 
-                               entry->rel, entry->page,
-                               entry->offset, res->len, FALSE);
-       } else if ( ISSIGNKEY(DatumGetPointer( entry->key )) && 
-                       ! ISALLTRUE(DatumGetPointer( entry->key )) ){ 
-               int4 i,len;
-               GISTTYPE *res;
-               BITVECP sign = GETSIGN( DatumGetPointer( entry->key ) );
+
+               retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
+               gistentryinit(*retval, PointerGetDatum(res),
+                                         entry->rel, entry->page,
+                                         entry->offset, res->len, FALSE);
+       }
+       else if (ISSIGNKEY(DatumGetPointer(entry->key)) &&
+                        !ISALLTRUE(DatumGetPointer(entry->key)))
+       {
+               int4            i,
+                                       len;
+               GISTTYPE   *res;
+               BITVECP         sign = GETSIGN(DatumGetPointer(entry->key));
 
                LOOPBYTE(
-                       if ( (sign[i] & 0xff) != 0xff )
-                               PG_RETURN_POINTER(retval);
+                                if ((sign[i] & 0xff) != 0xff)
+                                PG_RETURN_POINTER(retval);
                );
 
-               len = CALCGTSIZE( SIGNKEY|ALLISTRUE, 0 );
-               res    = (GISTTYPE*)palloc( len );
+               len = CALCGTSIZE(SIGNKEY | ALLISTRUE, 0);
+               res = (GISTTYPE *) palloc(len);
                res->len = len;
-               res->flag = SIGNKEY | ALLISTRUE; 
-               
-               retval = (GISTENTRY*)palloc(sizeof(GISTENTRY));
-               gistentryinit(*retval, PointerGetDatum(res), 
-                               entry->rel, entry->page,
-                               entry->offset, res->len, FALSE);
+               res->flag = SIGNKEY | ALLISTRUE;
+
+               retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
+               gistentryinit(*retval, PointerGetDatum(res),
+                                         entry->rel, entry->page,
+                                         entry->offset, res->len, FALSE);
        }
        PG_RETURN_POINTER(retval);
 }
 
 Datum
-gtxtidx_decompress(PG_FUNCTION_ARGS) {
-       GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
-       GISTTYPE  *key = (GISTTYPE*)DatumGetPointer( PG_DETOAST_DATUM(entry->key) );
+gtxtidx_decompress(PG_FUNCTION_ARGS)
+{
+       GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
+       GISTTYPE   *key = (GISTTYPE *) DatumGetPointer(PG_DETOAST_DATUM(entry->key));
 
-       if ( key != (GISTTYPE*)DatumGetPointer(entry->key) ) {
-               GISTENTRY *retval = (GISTENTRY*)palloc(sizeof(GISTENTRY));
-               gistentryinit(*retval, PointerGetDatum(key), 
-                               entry->rel, entry->page,
-                               entry->offset, key->len, FALSE);
+       if (key != (GISTTYPE *) DatumGetPointer(entry->key))
+       {
+               GISTENTRY  *retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
+
+               gistentryinit(*retval, PointerGetDatum(key),
+                                         entry->rel, entry->page,
+                                         entry->offset, key->len, FALSE);
 
                PG_RETURN_POINTER(retval);
        }
 
-       PG_RETURN_POINTER(entry);       
+       PG_RETURN_POINTER(entry);
 }
 
-typedef struct {
-       int4 *arrb;
-       int4 *arre;
-} CHKVAL;
+typedef struct
+{
+       int4       *arrb;
+       int4       *arre;
+}      CHKVAL;
+
 /*
  * is there value 'val' in array or not ?
  */
 static bool
-checkcondition_arr( void *checkval, ITEM* val ) {
-       int4      *StopLow = ((CHKVAL*)checkval)->arrb;
-       int4      *StopHigh = ((CHKVAL*)checkval)->arre;
-       int4      *StopMiddle;
+checkcondition_arr(void *checkval, ITEM * val)
+{
+       int4       *StopLow = ((CHKVAL *) checkval)->arrb;
+       int4       *StopHigh = ((CHKVAL *) checkval)->arre;
+       int4       *StopMiddle;
 
        /* Loop invariant: StopLow <= val < StopHigh */
-  
-       while (StopLow < StopHigh) {
+
+       while (StopLow < StopHigh)
+       {
                StopMiddle = StopLow + (StopHigh - StopLow) / 2;
                if (*StopMiddle == val->val)
                        return (true);
-               else if (*StopMiddle < val->val )
+               else if (*StopMiddle < val->val)
                        StopLow = StopMiddle + 1;
                else
                        StopHigh = StopMiddle;
@@ -220,264 +253,321 @@ checkcondition_arr( void *checkval, ITEM* val ) {
 }
 
 static bool
-checkcondition_bit( void *checkval, ITEM* val ) {
-        return GETBIT( checkval, HASHVAL( val->val ) );
+checkcondition_bit(void *checkval, ITEM * val)
+{
+       return GETBIT(checkval, HASHVAL(val->val));
 }
 
-Datum 
-gtxtidx_consistent(PG_FUNCTION_ARGS) {
-       QUERYTYPE *query = (QUERYTYPE *)PG_GETARG_POINTER(1);
-       GISTTYPE  *key   = (GISTTYPE  *)DatumGetPointer(
-               ((GISTENTRY *)PG_GETARG_POINTER(0))->key
+Datum
+gtxtidx_consistent(PG_FUNCTION_ARGS)
+{
+       QUERYTYPE  *query = (QUERYTYPE *) PG_GETARG_POINTER(1);
+       GISTTYPE   *key = (GISTTYPE *) DatumGetPointer(
+                                                               ((GISTENTRY *) PG_GETARG_POINTER(0))->key
        );
 
-       if ( !query->size )
+       if (!query->size)
                PG_RETURN_BOOL(false);
 
-       if ( ISSIGNKEY(key) ) {
-               if ( ISALLTRUE(key) )
+       if (ISSIGNKEY(key))
+       {
+               if (ISALLTRUE(key))
                        PG_RETURN_BOOL(true);
 
-               PG_RETURN_BOOL( execute(
-                       GETQUERY(query),
-                       (void*)GETSIGN(key), false,
-                       checkcondition_bit
-               ));
-       } else { /* only leaf pages */
-               CHKVAL  chkval;
+               PG_RETURN_BOOL(execute(
+                                                          GETQUERY(query),
+                                                          (void *) GETSIGN(key), false,
+                                                          checkcondition_bit
+                                                          ));
+       }
+       else
+       {                                                       /* only leaf pages */
+               CHKVAL          chkval;
 
                chkval.arrb = GETARR(key);
-               chkval.arre = chkval.arrb + ARRNELEM(key);
-               PG_RETURN_BOOL( execute(
-                       GETQUERY(query),
-                       (void*)&chkval, true,
-                       checkcondition_arr
-               );
+               chkval.arre = chkval.arrb + ARRNELEM(key);
+               PG_RETURN_BOOL(execute(
+                                                          GETQUERY(query),
+                                                          (void *) &chkval, true,
+                                                          checkcondition_arr
+                                                          ));
        }
 }
 
 static int4
-unionkey( BITVECP sbase, GISTTYPE *add ) {
-       int4    i;
+unionkey(BITVECP sbase, GISTTYPE * add)
+{
+       int4            i;
+
+       if (ISSIGNKEY(add))
+       {
+               BITVECP         sadd = GETSIGN(add);
 
-       if ( ISSIGNKEY(add) ) {
-               BITVECP sadd = GETSIGN( add );
-               
-               if ( ISALLTRUE(add) )
+               if (ISALLTRUE(add))
                        return 1;
 
                LOOPBYTE(
-                       sbase[i] |= sadd[i];
+                                sbase[i] |= sadd[i];
                );
-       } else {
-               int4 *ptr = GETARR( add );
-               for(i=0;i<ARRNELEM(add);i++)
-                       HASH( sbase, ptr[i] );
+       }
+       else
+       {
+               int4       *ptr = GETARR(add);
+
+               for (i = 0; i < ARRNELEM(add); i++)
+                       HASH(sbase, ptr[i]);
        }
        return 0;
 }
 
 
 Datum
-gtxtidx_union(PG_FUNCTION_ARGS) {
-       bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
-       int *size = (int *) PG_GETARG_POINTER(1);
-       BITVEC base;
-       int4 len = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
-       int4 i;
-       int4 flag = 0;
-       GISTTYPE *result;
-
-       MemSet( (void*)base, 0, sizeof(BITVEC) );
-       for(i=0;i<len;i++) {
-               if ( unionkey( base, GETENTRY(entryvec, i) ) ) {
+gtxtidx_union(PG_FUNCTION_ARGS)
+{
+       bytea      *entryvec = (bytea *) PG_GETARG_POINTER(0);
+       int                *size = (int *) PG_GETARG_POINTER(1);
+       BITVEC          base;
+       int4            len = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
+       int4            i;
+       int4            flag = 0;
+       GISTTYPE   *result;
+
+       MemSet((void *) base, 0, sizeof(BITVEC));
+       for (i = 0; i < len; i++)
+       {
+               if (unionkey(base, GETENTRY(entryvec, i)))
+               {
                        flag = ALLISTRUE;
                        break;
                }
        }
 
        flag |= SIGNKEY;
-       len = CALCGTSIZE( flag, 0 );
-       result = (GISTTYPE*)palloc( len );
+       len = CALCGTSIZE(flag, 0);
+       result = (GISTTYPE *) palloc(len);
        *size = result->len = len;
        result->flag = flag;
-       if ( ! ISALLTRUE(result) )
-               memcpy((void*)GETSIGN(result), (void*)base, sizeof( BITVEC ) );
+       if (!ISALLTRUE(result))
+               memcpy((void *) GETSIGN(result), (void *) base, sizeof(BITVEC));
 
-       PG_RETURN_POINTER( result );
+       PG_RETURN_POINTER(result);
 }
 
 Datum
-gtxtidx_same(PG_FUNCTION_ARGS) {
-       GISTTYPE *a = (GISTTYPE*)PG_GETARG_POINTER(0);
-       GISTTYPE *b = (GISTTYPE*)PG_GETARG_POINTER(1);
-       bool *result = (bool *)PG_GETARG_POINTER(2);
-       
-       if ( ISSIGNKEY(a) ) { /* then b also ISSIGNKEY */
-               if ( ISALLTRUE(a) && ISALLTRUE(b) ) {
+gtxtidx_same(PG_FUNCTION_ARGS)
+{
+       GISTTYPE   *a = (GISTTYPE *) PG_GETARG_POINTER(0);
+       GISTTYPE   *b = (GISTTYPE *) PG_GETARG_POINTER(1);
+       bool       *result = (bool *) PG_GETARG_POINTER(2);
+
+       if (ISSIGNKEY(a))
+       {                                                       /* then b also ISSIGNKEY */
+               if (ISALLTRUE(a) && ISALLTRUE(b))
                        *result = true;
-               } else if ( ISALLTRUE(a) ) {
+               else if (ISALLTRUE(a))
                        *result = false;
-               } else if ( ISALLTRUE(b) ) {
+               else if (ISALLTRUE(b))
                        *result = false;
-               } else {
-                       int4 i;
-                       BITVECP sa=GETSIGN(a), sb=GETSIGN(b);
-                       
+               else
+               {
+                       int4            i;
+                       BITVECP         sa = GETSIGN(a),
+                                               sb = GETSIGN(b);
+
                        *result = true;
                        LOOPBYTE(
-                               if ( sa[i] != sb[i] ) {
-                                       *result = false;
-                                       break;
-                               }
+                                        if (sa[i] != sb[i])
+                                        {
+                               *result = false;
+                               break;
+                       }
                        );
-               } 
-       } else { /* a and b ISARRKEY */
-               int4 lena = ARRNELEM(a), lenb = ARRNELEM(b);
+               }
+       }
+       else
+       {                                                       /* a and b ISARRKEY */
+               int4            lena = ARRNELEM(a),
+                                       lenb = ARRNELEM(b);
 
-               if ( lena != lenb ) {
+               if (lena != lenb)
                        *result = false;
-               } else {
-                       int4 *ptra = GETARR(a), *ptrb = GETARR(b);
-                       int4 i;
+               else
+               {
+                       int4       *ptra = GETARR(a),
+                                          *ptrb = GETARR(b);
+                       int4            i;
 
                        *result = true;
-                       for(i=0;i<lena;i++)
-                               if ( ptra[i] != ptrb[i] ) {
+                       for (i = 0; i < lena; i++)
+                               if (ptra[i] != ptrb[i])
+                               {
                                        *result = false;
                                        break;
                                }
                }
        }
-       
+
        PG_RETURN_POINTER(result);
 }
 
 static int4
-sizebitvec( BITVECP sign ) {
-       int4 size=0, i;
+sizebitvec(BITVECP sign)
+{
+       int4            size = 0,
+                               i;
+
        LOOPBYTE(
-               size += SUMBIT(*(char*)sign);
-               sign = (BITVECP) ( ((char*)sign) + 1 );
+                        size += SUMBIT(*(char *) sign);
+       sign = (BITVECP) (((char *) sign) + 1);
        );
-       return size;    
+       return size;
 }
 
 Datum
-gtxtidx_penalty(PG_FUNCTION_ARGS) {
-       GISTENTRY *origentry = (GISTENTRY *)PG_GETARG_POINTER(0); /*always ISSIGNKEY*/
-       GISTENTRY *newentry  = (GISTENTRY *)PG_GETARG_POINTER(1);
-       float  *penalty = (float *)    PG_GETARG_POINTER(2);
-       GISTTYPE *origval = (GISTTYPE*)DatumGetPointer( origentry->key );
-       GISTTYPE *newval  = (GISTTYPE*)DatumGetPointer( newentry->key );
-       int4 unionsize = 0;
-       BITVECP orig = GETSIGN(origval);
-
-       if ( ISALLTRUE(origval) ) {
+gtxtidx_penalty(PG_FUNCTION_ARGS)
+{
+       GISTENTRY  *origentry = (GISTENTRY *) PG_GETARG_POINTER(0); /* always ISSIGNKEY */
+       GISTENTRY  *newentry = (GISTENTRY *) PG_GETARG_POINTER(1);
+       float      *penalty = (float *) PG_GETARG_POINTER(2);
+       GISTTYPE   *origval = (GISTTYPE *) DatumGetPointer(origentry->key);
+       GISTTYPE   *newval = (GISTTYPE *) DatumGetPointer(newentry->key);
+       int4            unionsize = 0;
+       BITVECP         orig = GETSIGN(origval);
+
+       if (ISALLTRUE(origval))
+       {
                *penalty = 0.0;
-               PG_RETURN_POINTER( penalty );
+               PG_RETURN_POINTER(penalty);
        }
 
-       if ( ISARRKEY(newval) ) {
-               int4 *ptr=GETARR(newval), n=ARRNELEM(newval);
-               while( n-- ) {
-                       if ( GETBIT(orig, HASHVAL( *ptr ) ) == 0 )
+       if (ISARRKEY(newval))
+       {
+               int4       *ptr = GETARR(newval),
+                                       n = ARRNELEM(newval);
+
+               while (n--)
+               {
+                       if (GETBIT(orig, HASHVAL(*ptr)) == 0)
                                unionsize++;
                        ptr++;
                }
-               *penalty = (float)unionsize;
-       } else {
-               if ( ISALLTRUE(newval) ) {
-                       *penalty = (float) (SIGLENBIT - sizebitvec( orig ) );
-               } else {
-                       char valtmp;
-                       BITVECP nval = GETSIGN(newval);
-                       int4 i;
+               *penalty = (float) unionsize;
+       }
+       else
+       {
+               if (ISALLTRUE(newval))
+                       *penalty = (float) (SIGLENBIT - sizebitvec(orig));
+               else
+               {
+                       char            valtmp;
+                       BITVECP         nval = GETSIGN(newval);
+                       int4            i;
 
                        LOOPBYTE(
-                               valtmp = nval[i] | orig[i];
-                               unionsize += SUMBIT(valtmp) - SUMBIT(orig[i]); 
+                                        valtmp = nval[i] | orig[i];
+                       unionsize += SUMBIT(valtmp) - SUMBIT(orig[i]);
                        );
-                       *penalty = (float)unionsize;
-               } 
+                       *penalty = (float) unionsize;
+               }
        }
 
-       PG_RETURN_POINTER( penalty );
+       PG_RETURN_POINTER(penalty);
 }
 
-typedef struct {
-       bool    allistrue;
-       BITVEC  sign;
-} CACHESIGN;
+typedef struct
+{
+       bool            allistrue;
+       BITVEC          sign;
+}      CACHESIGN;
 
 static void
-fillcache( CACHESIGN *item, GISTTYPE *key ) {
+fillcache(CACHESIGN * item, GISTTYPE * key)
+{
        item->allistrue = false;
-       if ( ISARRKEY( key ) ) {
+       if (ISARRKEY(key))
                makesign(item->sign, key);
-       } else if ( ISALLTRUE(key) ) { 
+       else if (ISALLTRUE(key))
                item->allistrue = true;
-       } else {
-               memcpy( (void*)item->sign, (void*)GETSIGN(key), sizeof(BITVEC));
-       } 
-} 
+       else
+               memcpy((void *) item->sign, (void *) GETSIGN(key), sizeof(BITVEC));
+}
 
 #define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
-typedef struct {
-       OffsetNumber    pos;
-       int4           cost;
+typedef struct
+{
+       OffsetNumber pos;
+       int4            cost;
 } SPLITCOST;
 
 static int
-comparecost( const void *a, const void *b ) {
-       if ( ((SPLITCOST*)a)->cost == ((SPLITCOST*)b)->cost )
+comparecost(const void *a, const void *b)
+{
+       if (((SPLITCOST *) a)->cost == ((SPLITCOST *) b)->cost)
                return 0;
        else
-               return ( ((SPLITCOST*)a)->cost > ((SPLITCOST*)b)->cost ) ? 1 : -1;
+               return (((SPLITCOST *) a)->cost > ((SPLITCOST *) b)->cost) ? 1 : -1;
 }
 
 Datum
-gtxtidx_picksplit(PG_FUNCTION_ARGS) {
-       bytea *entryvec = (bytea *)PG_GETARG_POINTER(0);
-       GIST_SPLITVEC *v = (GIST_SPLITVEC *)PG_GETARG_POINTER(1);
-       OffsetNumber k,j;
-       GISTTYPE *datum_l, *datum_r;
-       BITVEC union_l, union_r;
-       bool            firsttime = true;
-       int4    size_alpha,size_beta,sizeu,sizei;
-       int4    size_waste, waste = 0.0;
-       int4    size_l, size_r;
-       int4    nbytes;
-       OffsetNumber seed_1=0, seed_2=0;
-       OffsetNumber    *left, *right;
+gtxtidx_picksplit(PG_FUNCTION_ARGS)
+{
+       bytea      *entryvec = (bytea *) PG_GETARG_POINTER(0);
+       GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
+       OffsetNumber k,
+                               j;
+       GISTTYPE   *datum_l,
+                          *datum_r;
+       BITVEC          union_l,
+                               union_r;
+       bool            firsttime = true;
+       int4            size_alpha,
+                               size_beta,
+                               sizeu,
+                               sizei;
+       int4            size_waste,
+                               waste = 0.0;
+       int4            size_l,
+                               size_r;
+       int4            nbytes;
+       OffsetNumber seed_1 = 0,
+                               seed_2 = 0;
+       OffsetNumber *left,
+                          *right;
        OffsetNumber maxoff;
-       BITVECP ptra, ptrb, ptrc;
-       int i;
+       BITVECP         ptra,
+                               ptrb,
+                               ptrc;
+       int                     i;
        CACHESIGN  *cache;
-       char    valtmp;
-       SPLITCOST       *costvector;
+       char            valtmp;
+       SPLITCOST  *costvector;
 
        maxoff = ((VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY)) - 2;
        nbytes = (maxoff + 2) * sizeof(OffsetNumber);
        v->spl_left = (OffsetNumber *) palloc(nbytes);
        v->spl_right = (OffsetNumber *) palloc(nbytes);
 
-       cache = (CACHESIGN*)palloc(sizeof(CACHESIGN)*(maxoff+2));
-       fillcache( &cache[FirstOffsetNumber], GETENTRY(entryvec,FirstOffsetNumber) ); 
+       cache = (CACHESIGN *) palloc(sizeof(CACHESIGN) * (maxoff + 2));
+       fillcache(&cache[FirstOffsetNumber], GETENTRY(entryvec, FirstOffsetNumber));
 
-       for (k = FirstOffsetNumber; k < maxoff; k = OffsetNumberNext(k)) {
-               for (j = OffsetNumberNext(k); j <= maxoff; j = OffsetNumberNext(j)) {
-                       if ( k==FirstOffsetNumber )
-                               fillcache( &cache[j], GETENTRY(entryvec,j) );
-                       
-                       if ( cache[k].allistrue || cache[j].allistrue ) {
+       for (k = FirstOffsetNumber; k < maxoff; k = OffsetNumberNext(k))
+       {
+               for (j = OffsetNumberNext(k); j <= maxoff; j = OffsetNumberNext(j))
+               {
+                       if (k == FirstOffsetNumber)
+                               fillcache(&cache[j], GETENTRY(entryvec, j));
+
+                       if (cache[k].allistrue || cache[j].allistrue)
+                       {
                                sizeu = SIGLENBIT;
-                               if ( cache[k].allistrue && cache[j].allistrue )
+                               if (cache[k].allistrue && cache[j].allistrue)
                                        sizei = SIGLENBIT;
                                else
-                                       sizei = ( cache[k].allistrue ) ? 
-                                               sizebitvec( cache[j].sign ) : sizebitvec( cache[k].sign );
-                       } else {
+                                       sizei = (cache[k].allistrue) ?
+                                               sizebitvec(cache[j].sign) : sizebitvec(cache[k].sign);
+                       }
+                       else
+                       {
                                sizeu = sizei = 0;
                                ptra = cache[j].sign;
                                ptrb = cache[k].sign;
@@ -492,21 +582,22 @@ gtxtidx_picksplit(PG_FUNCTION_ARGS) {
                sizeu++; \
 } while(0)
                                LOOPBYTE(
-                                       COUNT(0);
-                                       COUNT(1);
-                                       COUNT(2);
-                                       COUNT(3);
-                                       COUNT(4);
-                                       COUNT(5);
-                                       COUNT(6);
-                                       COUNT(7);
-                                       ptra = (BITVECP) ( ((char*)ptra) + 1 );
-                                       ptrb = (BITVECP) ( ((char*)ptrb) + 1 );
+                                                COUNT(0);
+                               COUNT(1);
+                               COUNT(2);
+                               COUNT(3);
+                               COUNT(4);
+                               COUNT(5);
+                               COUNT(6);
+                               COUNT(7);
+                               ptra = (BITVECP) (((char *) ptra) + 1);
+                               ptrb = (BITVECP) (((char *) ptrb) + 1);
                                );
 
                        }
                        size_waste = sizeu - sizei;
-                       if (size_waste > waste || firsttime) {
+                       if (size_waste > waste || firsttime)
+                       {
                                waste = size_waste;
                                seed_1 = k;
                                seed_2 = j;
@@ -520,142 +611,177 @@ gtxtidx_picksplit(PG_FUNCTION_ARGS) {
        right = v->spl_right;
        v->spl_nright = 0;
 
-       if ( seed_1 == 0 || seed_2 == 0 ) {
+       if (seed_1 == 0 || seed_2 == 0)
+       {
                seed_1 = 1;
                seed_2 = 2;
        }
 
-       /* form initial .. */ 
-       if ( cache[seed_1].allistrue ) {
-               datum_l = (GISTTYPE*)palloc( CALCGTSIZE( SIGNKEY|ALLISTRUE, 0 ) );
-               datum_l->len = CALCGTSIZE( SIGNKEY|ALLISTRUE, 0 ); datum_l->flag = SIGNKEY|ALLISTRUE;
+       /* form initial .. */
+       if (cache[seed_1].allistrue)
+       {
+               datum_l = (GISTTYPE *) palloc(CALCGTSIZE(SIGNKEY | ALLISTRUE, 0));
+               datum_l->len = CALCGTSIZE(SIGNKEY | ALLISTRUE, 0);
+               datum_l->flag = SIGNKEY | ALLISTRUE;
                size_l = SIGLENBIT;
-       } else {
-               datum_l = (GISTTYPE*)palloc( CALCGTSIZE( SIGNKEY, 0 ) );
-               datum_l->len = CALCGTSIZE( SIGNKEY, 0 ); datum_l->flag = SIGNKEY;
-               memcpy((void*)GETSIGN(datum_l), (void*)cache[seed_1].sign, sizeof(BITVEC));
-               size_l = sizebitvec( GETSIGN(datum_l) );                
        }
-       if ( cache[seed_2].allistrue ) {
-               datum_r = (GISTTYPE*)palloc( CALCGTSIZE( SIGNKEY|ALLISTRUE, 0 ) );
-               datum_r->len = CALCGTSIZE( SIGNKEY|ALLISTRUE, 0 ); datum_r->flag = SIGNKEY|ALLISTRUE;
+       else
+       {
+               datum_l = (GISTTYPE *) palloc(CALCGTSIZE(SIGNKEY, 0));
+               datum_l->len = CALCGTSIZE(SIGNKEY, 0);
+               datum_l->flag = SIGNKEY;
+               memcpy((void *) GETSIGN(datum_l), (void *) cache[seed_1].sign, sizeof(BITVEC));
+               size_l = sizebitvec(GETSIGN(datum_l));
+       }
+       if (cache[seed_2].allistrue)
+       {
+               datum_r = (GISTTYPE *) palloc(CALCGTSIZE(SIGNKEY | ALLISTRUE, 0));
+               datum_r->len = CALCGTSIZE(SIGNKEY | ALLISTRUE, 0);
+               datum_r->flag = SIGNKEY | ALLISTRUE;
                size_r = SIGLENBIT;
-       } else {
-               datum_r = (GISTTYPE*)palloc( CALCGTSIZE( SIGNKEY, 0 ) );
-               datum_r->len = CALCGTSIZE( SIGNKEY, 0 ); datum_r->flag = SIGNKEY;
-               memcpy((void*)GETSIGN(datum_r), (void*)cache[seed_2].sign, sizeof(BITVEC));
-               size_r = sizebitvec( GETSIGN(datum_r) );                
        }
-       
+       else
+       {
+               datum_r = (GISTTYPE *) palloc(CALCGTSIZE(SIGNKEY, 0));
+               datum_r->len = CALCGTSIZE(SIGNKEY, 0);
+               datum_r->flag = SIGNKEY;
+               memcpy((void *) GETSIGN(datum_r), (void *) cache[seed_2].sign, sizeof(BITVEC));
+               size_r = sizebitvec(GETSIGN(datum_r));
+       }
+
        maxoff = OffsetNumberNext(maxoff);
-       fillcache( &cache[maxoff], GETENTRY(entryvec,maxoff) ); 
+       fillcache(&cache[maxoff], GETENTRY(entryvec, maxoff));
        /* sort before ... */
-       costvector=(SPLITCOST*)palloc( sizeof(SPLITCOST)*maxoff );
-       for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j)) {
-               costvector[j-1].pos = j;
-               if ( cache[j].allistrue ) {
+       costvector = (SPLITCOST *) palloc(sizeof(SPLITCOST) * maxoff);
+       for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j))
+       {
+               costvector[j - 1].pos = j;
+               if (cache[j].allistrue)
+               {
                        size_alpha = SIGLENBIT - size_l;
-                       size_beta  = SIGLENBIT - size_r;
-               } else {
+                       size_beta = SIGLENBIT - size_r;
+               }
+               else
+               {
                        ptra = cache[seed_1].sign;
                        ptrb = cache[seed_2].sign;
                        ptrc = cache[j].sign;
                        size_beta = size_alpha = 0;
-                       if ( cache[seed_1].allistrue ) {
-                               if ( ! cache[seed_2].allistrue ) {
+                       if (cache[seed_1].allistrue)
+                       {
+                               if (!cache[seed_2].allistrue)
+                               {
                                        LOOPBIT(
-                                               if ( GETBIT(ptrc,i) && ! GETBIT(ptrb,i) ) 
+                                                       if (GETBIT(ptrc, i) && !GETBIT(ptrb, i))
                                                        size_beta++;
-                                       ); 
+                                       );
                                }
-                       } else if ( cache[seed_2].allistrue ) {
-                               if ( ! cache[seed_1].allistrue ) {
+                       }
+                       else if (cache[seed_2].allistrue)
+                       {
+                               if (!cache[seed_1].allistrue)
+                               {
                                        LOOPBIT(
-                                               if ( GETBIT(ptrc,i) && ! GETBIT(ptra,i) ) 
+                                                       if (GETBIT(ptrc, i) && !GETBIT(ptra, i))
                                                        size_alpha++;
-                                       ); 
+                                       );
                                }
-                       } else {
+                       }
+                       else
+                       {
                                LOOPBIT(
-                                       if ( GETBIT(ptrc,i) && ! GETBIT(ptra,i) ) 
-                                               size_alpha++; 
-                                       if ( GETBIT(ptrc,i) && ! GETBIT(ptrb,i) ) 
-                                               size_beta++; 
+                                               if (GETBIT(ptrc, i) && !GETBIT(ptra, i))
+                                               size_alpha++;
+                               if (GETBIT(ptrc, i) && !GETBIT(ptrb, i))
+                                       size_beta++;
                                );
                        }
 
                }
-               costvector[j-1].cost = abs( size_alpha - size_beta ); 
+               costvector[j - 1].cost = abs(size_alpha - size_beta);
        }
-       qsort( (void*)costvector, maxoff, sizeof(SPLITCOST), comparecost );     
-       
-       for (k = 0; k < maxoff; k++) {
+       qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
+
+       for (k = 0; k < maxoff; k++)
+       {
                j = costvector[k].pos;
-               if ( j == seed_1 ) {
+               if (j == seed_1)
+               {
                        *left++ = j;
                        v->spl_nleft++;
                        continue;
-               } else if ( j == seed_2 ) {
+               }
+               else if (j == seed_2)
+               {
                        *right++ = j;
                        v->spl_nright++;
                        continue;
                }
 
-               if ( ISALLTRUE( datum_l ) || cache[j].allistrue ) {
+               if (ISALLTRUE(datum_l) || cache[j].allistrue)
                        size_alpha = SIGLENBIT;
-               } else {
+               else
+               {
                        ptra = cache[j].sign;
                        ptrb = GETSIGN(datum_l);
                        size_alpha = 0;
                        LOOPBYTE(
-                               valtmp = union_l[i] = ptra[i] | ptrb[i];
-                               size_alpha += SUMBIT( valtmp );
+                                        valtmp = union_l[i] = ptra[i] | ptrb[i];
+                       size_alpha += SUMBIT(valtmp);
                        );
                }
-               if ( ISALLTRUE( datum_r ) || cache[j].allistrue ) {
+               if (ISALLTRUE(datum_r) || cache[j].allistrue)
                        size_beta = SIGLENBIT;
-               } else {
+               else
+               {
                        ptra = cache[j].sign;
                        ptrb = GETSIGN(datum_r);
                        size_beta = 0;
                        LOOPBYTE(
-                               valtmp = union_r[i] = ptra[i] | ptrb[i];
-                               size_beta += SUMBIT( valtmp );
+                                        valtmp = union_r[i] = ptra[i] | ptrb[i];
+                       size_beta += SUMBIT(valtmp);
                        );
                }
 
-               if (size_alpha - size_l < size_beta - size_r + WISH_F(v->spl_nleft, v->spl_nright, 0.1)) {
-                       if ( ! ISALLTRUE( datum_l ) ) {
-                               if ( size_alpha == SIGLENBIT ) {
-                                       if ( size_alpha != size_l ) 
-                                               MemSet( (void*)GETSIGN(datum_l),0xff, sizeof(BITVEC));
-                               } else 
-                                       memcpy( (void*)GETSIGN(datum_l), (void*)union_l, sizeof(BITVEC) );
+               if (size_alpha - size_l < size_beta - size_r + WISH_F(v->spl_nleft, v->spl_nright, 0.1))
+               {
+                       if (!ISALLTRUE(datum_l))
+                       {
+                               if (size_alpha == SIGLENBIT)
+                               {
+                                       if (size_alpha != size_l)
+                                               MemSet((void *) GETSIGN(datum_l), 0xff, sizeof(BITVEC));
+                               }
+                               else
+                                       memcpy((void *) GETSIGN(datum_l), (void *) union_l, sizeof(BITVEC));
                        }
                        size_l = size_alpha;
                        *left++ = j;
                        v->spl_nleft++;
-               } else {
-                       if ( ! ISALLTRUE( datum_r ) ) {
-                               if ( size_beta == SIGLENBIT ) {
-                                       if ( size_beta != size_r ) 
-                                               MemSet( (void*)GETSIGN(datum_r),0xff, sizeof(BITVEC));
-                               } else 
-                                       memcpy( (void*)GETSIGN(datum_r), (void*)union_r, sizeof(BITVEC) );
+               }
+               else
+               {
+                       if (!ISALLTRUE(datum_r))
+                       {
+                               if (size_beta == SIGLENBIT)
+                               {
+                                       if (size_beta != size_r)
+                                               MemSet((void *) GETSIGN(datum_r), 0xff, sizeof(BITVEC));
+                               }
+                               else
+                                       memcpy((void *) GETSIGN(datum_r), (void *) union_r, sizeof(BITVEC));
                        }
                        size_r = size_beta;
                        *right++ = j;
                        v->spl_nright++;
                }
        }
-       
+
        *right = *left = FirstOffsetNumber;
        pfree(costvector);
        pfree(cache);
        v->spl_ldatum = PointerGetDatum(datum_l);
        v->spl_rdatum = PointerGetDatum(datum_r);
 
-       PG_RETURN_POINTER( v );
+       PG_RETURN_POINTER(v);
 }
-
-
index e8fedc7..477c3bf 100644 (file)
@@ -114,7 +114,7 @@ initmorph(void)
                needinit[i] = false;
 
        PGLC_current(&lc);
-       if ( lc.lc_ctype )
+       if (lc.lc_ctype)
                for (i = 1; i < lengthof(dicts); i++)
                        if (strcmp(dicts[i].localename, lc.lc_ctype) == 0)
                        {
index c3917f2..b69151c 100644 (file)
@@ -593,8 +593,8 @@ mqtxt_in(PG_FUNCTION_ARGS)
        res = clean_fakeval(GETQUERY(query), &len);
        if (!res)
        {
-               query->len=HDRSIZEQT;
-               query->size=0;
+               query->len = HDRSIZEQT;
+               query->size = 0;
                PG_RETURN_POINTER(query);
        }
        memcpy((void *) GETQUERY(query), (void *) res, len * sizeof(ITEM));
@@ -739,11 +739,13 @@ qtxt_out(PG_FUNCTION_ARGS)
        QUERYTYPE  *query = (QUERYTYPE *) DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(0)));
        INFIX           nrm;
 
-       if (query->size == 0) {
-               char *b=palloc(1);
-               *b='\0';
+       if (query->size == 0)
+       {
+               char       *b = palloc(1);
+
+               *b = '\0';
                PG_RETURN_POINTER(b);
-       }       
+       }
        nrm.curpol = GETQUERY(query);
        nrm.buflen = 32;
        nrm.cur = nrm.buf = (char *) palloc(sizeof(char) * nrm.buflen);
@@ -769,11 +771,12 @@ querytree(PG_FUNCTION_ARGS)
        int4            len;
 
 
-       if (query->size == 0) {
+       if (query->size == 0)
+       {
                res = (text *) palloc(VARHDRSZ);
                VARATT_SIZEP(res) = VARHDRSZ;
                PG_RETURN_POINTER(res);
-       }       
+       }
 
        q = clean_NOT(GETQUERY(query), &len);
 
index 14f6991..7be9f79 100644 (file)
@@ -327,7 +327,7 @@ typedef struct
 {
        uint16          len;
        char       *word;
-} WORD;
+}      WORD;
 
 typedef struct
 {
@@ -402,7 +402,7 @@ compareWORD(const void *a, const void *b)
 }
 
 static int
-uniqueWORD(WORD *a, int4 l)
+uniqueWORD(WORD * a, int4 l)
 {
        WORD       *ptr,
                           *res;
index ac80ea3..83b53a9 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.13 2002/08/15 02:58:29 momjian Exp $
+ *       $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.14 2002/09/04 20:31:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #define BUFSIZE                        1024
 
 extern char *optarg;
-extern int optind, opterr, optopt;
-
-struct _param {
-        char *pg_user;
-       int  pg_prompt;
-       char *pg_port;
-       char *pg_host;
-       int  verbose;
-       int  dry_run;
+extern int     optind,
+                       opterr,
+                       optopt;
+
+struct _param
+{
+       char       *pg_user;
+       int                     pg_prompt;
+       char       *pg_port;
+       char       *pg_host;
+       int                     verbose;
+       int                     dry_run;
 };
 
-int    vacuumlo(char *, struct _param *);
-char    *simple_prompt(const char *prompt, int , int);
-void    usage(void);
+int                    vacuumlo(char *, struct _param *);
+char      *simple_prompt(const char *prompt, int, int);
+void           usage(void);
 
 
 /*
@@ -63,7 +66,7 @@ void    usage(void);
  *
  * Returns a malloc()'ed string with the input (w/o trailing newline).
  */
-static int prompt_state = 0;
+static int     prompt_state = 0;
 
 char *
 simple_prompt(const char *prompt, int maxlen, int echo)
@@ -82,7 +85,7 @@ simple_prompt(const char *prompt, int maxlen, int echo)
        if (!destination)
                return NULL;
 
-       prompt_state = 1;               /* disable SIGINT */
+       prompt_state = 1;                       /* disable SIGINT */
 
        /*
         * Do not try to collapse these into one "w+" mode file. Doesn't work
@@ -153,7 +156,7 @@ simple_prompt(const char *prompt, int maxlen, int echo)
                fclose(termout);
        }
 
-       prompt_state = 0;               /* SIGINT okay again */
+       prompt_state = 0;                       /* SIGINT okay again */
 
        return destination;
 }
@@ -164,33 +167,35 @@ simple_prompt(const char *prompt, int maxlen, int echo)
  * This vacuums LOs of one database. It returns 0 on success, -1 on failure.
  */
 int
-vacuumlo(char *database, struct _param *param)
+vacuumlo(char *database, struct _param * param)
 {
        PGconn     *conn;
        PGresult   *res,
-                  *res2;
+                          *res2;
        char            buf[BUFSIZE];
-       int             matched;
-       int             deleted;
-       int             i;
-       char            *password = NULL;
-
-        if(param->pg_prompt) {
-                password = simple_prompt("Password: ", 32, 0);
-               if(!password) {
-                       fprintf(stderr, "failed to get password\n");
-                       exit(1);
+       int                     matched;
+       int                     deleted;
+       int                     i;
+       char       *password = NULL;
+
+       if (param->pg_prompt)
+       {
+               password = simple_prompt("Password: ", 32, 0);
+               if (!password)
+               {
+                       fprintf(stderr, "failed to get password\n");
+                       exit(1);
                }
        }
 
-       conn = PQsetdbLogin( param->pg_host,
-                            param->pg_port,
-                             NULL,
-                            NULL,
-                            database,
-                            param->pg_user,
-                            password
-                          );
+       conn = PQsetdbLogin(param->pg_host,
+                                               param->pg_port,
+                                               NULL,
+                                               NULL,
+                                               database,
+                                               param->pg_user,
+                                               password
+               );
 
        /* check to see that the backend connection was successfully made */
        if (PQstatus(conn) == CONNECTION_BAD)
@@ -201,10 +206,11 @@ vacuumlo(char *database, struct _param *param)
                return -1;
        }
 
-       if (param->verbose) {
+       if (param->verbose)
+       {
                fprintf(stdout, "Connected to %s\n", database);
-                if(param->dry_run)
-                       fprintf(stdout, "Test run: no large objects will be removed!\n");
+               if (param->dry_run)
+                       fprintf(stdout, "Test run: no large objects will be removed!\n");
        }
 
        /*
@@ -289,7 +295,7 @@ vacuumlo(char *database, struct _param *param)
                 * whole program is a Postgres-ism.
                 */
                snprintf(buf, BUFSIZE, "DELETE FROM vacuum_l WHERE lo = \"%s\".\"%s\" ",
-                               table, field);
+                                table, field);
                res2 = PQexec(conn, buf);
                if (PQresultStatus(res2) != PGRES_COMMAND_OK)
                {
@@ -342,16 +348,18 @@ vacuumlo(char *database, struct _param *param)
                        fflush(stdout);
                }
 
-               if(param->dry_run == 0) {
-                       if (lo_unlink(conn, lo) < 0)
-                       {
-                               fprintf(stderr, "\nFailed to remove lo %u: ", lo);
-                               fprintf(stderr, "%s", PQerrorMessage(conn));
-                       }
-                       else
-                               deleted++;
-               } else
-                       deleted++;
+               if (param->dry_run == 0)
+               {
+                       if (lo_unlink(conn, lo) < 0)
+                       {
+                               fprintf(stderr, "\nFailed to remove lo %u: ", lo);
+                               fprintf(stderr, "%s", PQerrorMessage(conn));
+                       }
+                       else
+                               deleted++;
+               }
+               else
+                       deleted++;
        }
        PQclear(res);
 
@@ -365,23 +373,24 @@ vacuumlo(char *database, struct _param *param)
 
        if (param->verbose)
                fprintf(stdout, "\r%s %d large objects from %s.\n",
-                               (param->dry_run?"Would remove":"Removed"), deleted, database);
+               (param->dry_run ? "Would remove" : "Removed"), deleted, database);
 
        return 0;
 }
 
 void
-usage(void) {
-        fprintf(stdout, "vacuumlo removes unreferenced large objects from databases\n\n");
-        fprintf(stdout, "Usage:\n  vacuumlo [options] dbname [dbnames...]\n\n");
-        fprintf(stdout, "Options:\n");
+usage(void)
+{
+       fprintf(stdout, "vacuumlo removes unreferenced large objects from databases\n\n");
+       fprintf(stdout, "Usage:\n  vacuumlo [options] dbname [dbnames...]\n\n");
+       fprintf(stdout, "Options:\n");
        fprintf(stdout, "  -v\t\tWrite a lot of output\n");
        fprintf(stdout, "  -n\t\tDon't remove any large object, just show what would be done\n");
-        fprintf(stdout, "  -U username\tUsername to connect as\n");
-        fprintf(stdout, "  -W\t\tPrompt for password\n");
-        fprintf(stdout, "  -h hostname\tDatabase server host\n");
+       fprintf(stdout, "  -U username\tUsername to connect as\n");
+       fprintf(stdout, "  -W\t\tPrompt for password\n");
+       fprintf(stdout, "  -h hostname\tDatabase server host\n");
        fprintf(stdout, "  -p port\tDatabase server port\n");
-        fprintf(stdout, "  -p port\tDatabase server port\n\n");
+       fprintf(stdout, "  -p port\tDatabase server port\n\n");
 }
 
 
@@ -389,69 +398,75 @@ int
 main(int argc, char **argv)
 {
        int                     rc = 0;
-       struct _param           param;
-       int                     c;
-       int                     port;
+       struct _param param;
+       int                     c;
+       int                     port;
 
        /* Parameter handling */
-        param.pg_user = NULL;
+       param.pg_user = NULL;
        param.pg_prompt = 0;
        param.pg_host = NULL;
        param.pg_port = 0;
-        param.verbose = 0;
+       param.verbose = 0;
        param.dry_run = 0;
 
-        while( 1 ) {
-         c = getopt(argc, argv, "?h:U:p:vnW");
-         if(c == -1)
-           break;
-
-         switch(c) {
-            case '?':
-             if(optopt == '?') {
-               usage();
-               exit(0);
-             }
-             exit(1);
-           case ':':
-             exit(1);
-            case 'v':
-             param.verbose = 1;
-             break;
-           case 'n':
-             param.dry_run = 1;
-             param.verbose = 1;
-             break;
-           case 'U':
-             param.pg_user = strdup(optarg);
-             break;
-           case 'W':
-             param.pg_prompt = 1;
-             break;
-           case 'p':
-              port = strtol(optarg, NULL, 10);
-             if( (port < 1) || (port > 65535)) {
-               fprintf(stderr, "[%s]: invalid port number '%s'\n", argv[0], optarg);
-               exit(1);
-             }
-             param.pg_port = strdup(optarg);
-             break;
-           case 'h':
-             param.pg_host = strdup(optarg);
-             break;
-         }
+       while (1)
+       {
+               c = getopt(argc, argv, "?h:U:p:vnW");
+               if (c == -1)
+                       break;
+
+               switch (c)
+               {
+                       case '?':
+                               if (optopt == '?')
+                               {
+                                       usage();
+                                       exit(0);
+                               }
+                               exit(1);
+                       case ':':
+                               exit(1);
+                       case 'v':
+                               param.verbose = 1;
+                               break;
+                       case 'n':
+                               param.dry_run = 1;
+                               param.verbose = 1;
+                               break;
+                       case 'U':
+                               param.pg_user = strdup(optarg);
+                               break;
+                       case 'W':
+                               param.pg_prompt = 1;
+                               break;
+                       case 'p':
+                               port = strtol(optarg, NULL, 10);
+                               if ((port < 1) || (port > 65535))
+                               {
+                                       fprintf(stderr, "[%s]: invalid port number '%s'\n", argv[0], optarg);
+                                       exit(1);
+                               }
+                               param.pg_port = strdup(optarg);
+                               break;
+                       case 'h':
+                               param.pg_host = strdup(optarg);
+                               break;
+               }
        }
-       
+
        /* No database given? Show usage */
-       if(optind >= argc-1) {
-         fprintf(stderr, "vacuumlo: missing required argument: database name\n");
-         fprintf(stderr, "Try 'vacuumlo -?' for help.\n");
-         exit(1);
+       if (optind >= argc - 1)
+       {
+               fprintf(stderr, "vacuumlo: missing required argument: database name\n");
+               fprintf(stderr, "Try 'vacuumlo -?' for help.\n");
+               exit(1);
        }
 
-        for(c = optind; c < argc; c++) {
-         /* Work on selected database */
-          rc += (vacuumlo(argv[c], &param) != 0);
+       for (c = optind; c < argc; c++)
+       {
+               /* Work on selected database */
+               rc += (vacuumlo(argv[c], &param) != 0);
        }
 
        return rc;
index 884db0a..9901965 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.81 2002/09/02 01:05:03 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.82 2002/09/04 20:31:08 momjian Exp $
  *
  * NOTES
  *       The old interface functions have been converted to macros
@@ -326,9 +326,9 @@ nocachegetattr(HeapTuple tuple,
 
        /*
         * If slow is false, and we got here, we know that we have a tuple
-        * with no nulls or var-widths before the target attribute. If possible,
-        * we also want to initialize the remainder of the attribute cached
-        * offset values.
+        * with no nulls or var-widths before the target attribute. If
+        * possible, we also want to initialize the remainder of the attribute
+        * cached offset values.
         */
        if (!slow)
        {
@@ -702,8 +702,8 @@ heap_modifytuple(HeapTuple tuple,
                                                          nulls);
 
        /*
-        * copy the identification info of the old tuple: t_ctid, t_self,
-        * and OID (if any)
+        * copy the identification info of the old tuple: t_ctid, t_self, and
+        * OID (if any)
         */
        newTuple->t_data->t_ctid = tuple->t_data->t_ctid;
        newTuple->t_self = tuple->t_self;
index 2fbc5dd..30bbc4e 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.59 2002/08/25 17:20:00 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.60 2002/09/04 20:31:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -319,9 +319,9 @@ nocache_index_getattr(IndexTuple tup,
 
        /*
         * If slow is false, and we got here, we know that we have a tuple
-        * with no nulls or var-widths before the target attribute. If possible,
-        * we also want to initialize the remainder of the attribute cached
-        * offset values.
+        * with no nulls or var-widths before the target attribute. If
+        * possible, we also want to initialize the remainder of the attribute
+        * cached offset values.
         */
        if (!slow)
        {
index db4187d..f1f96f1 100644 (file)
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.64 2002/08/24 15:00:46 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.65 2002/09/04 20:31:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -23,7 +23,7 @@
 
 
 static void printtup_setup(DestReceiver *self, int operation,
-                                                  const char *portalName, TupleDesc typeinfo);
+                          const char *portalName, TupleDesc typeinfo);
 static void printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self);
 static void printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self);
 static void printtup_cleanup(DestReceiver *self);
@@ -88,8 +88,8 @@ printtup_setup(DestReceiver *self, int operation,
        pq_puttextmessage('P', portalName);
 
        /*
-        * if this is a retrieve, then we send back the tuple
-        * descriptor of the tuples.
+        * if this is a retrieve, then we send back the tuple descriptor of
+        * the tuples.
         */
        if (operation == CMD_SELECT)
        {
@@ -100,7 +100,7 @@ printtup_setup(DestReceiver *self, int operation,
 
                pq_beginmessage(&buf);
                pq_sendbyte(&buf, 'T'); /* tuple descriptor message type */
-               pq_sendint(&buf, natts, 2);     /* # of attrs in tuples */
+               pq_sendint(&buf, natts, 2);             /* # of attrs in tuples */
 
                for (i = 0; i < natts; ++i)
                {
index 6d6cdf3..ce4452e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.88 2002/09/02 01:05:03 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.89 2002/09/04 20:31:09 momjian Exp $
  *
  * NOTES
  *       some of the executor utility code such as "ExecTypeFromTL" should be
@@ -114,8 +114,8 @@ CreateTupleDescCopy(TupleDesc tupdesc)
        {
                desc->attrs[i] = (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
                memcpy(desc->attrs[i],
-                               tupdesc->attrs[i],
-                               ATTRIBUTE_TUPLE_SIZE);
+                          tupdesc->attrs[i],
+                          ATTRIBUTE_TUPLE_SIZE);
                desc->attrs[i]->attnotnull = false;
                desc->attrs[i]->atthasdef = false;
        }
@@ -148,8 +148,8 @@ CreateTupleDescCopyConstr(TupleDesc tupdesc)
        {
                desc->attrs[i] = (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
                memcpy(desc->attrs[i],
-                               tupdesc->attrs[i],
-                               ATTRIBUTE_TUPLE_SIZE);
+                          tupdesc->attrs[i],
+                          ATTRIBUTE_TUPLE_SIZE);
        }
        if (constr)
        {
@@ -425,9 +425,8 @@ TupleDescInitEntry(TupleDesc desc,
         *
         * (Why not just make the atttypid point to the OID type, instead of the
         * type the query returns?      Because the executor uses the atttypid to
-        * tell the front end what type will be returned,
-        * and in the end the type returned will be the result of the query,
-        * not an OID.)
+        * tell the front end what type will be returned, and in the end the
+        * type returned will be the result of the query, not an OID.)
         *
         * (Why not wait until the return type of the set is known (i.e., the
         * recursive call to the executor to execute the set has returned)
index 2849ca3..c238ea2 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.95 2002/06/20 20:29:24 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.96 2002/09/04 20:31:09 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -294,6 +294,7 @@ gistinsert(PG_FUNCTION_ARGS)
        Datum      *datum = (Datum *) PG_GETARG_POINTER(1);
        char       *nulls = (char *) PG_GETARG_POINTER(2);
        ItemPointer ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
+
 #ifdef NOT_USED
        Relation        heapRel = (Relation) PG_GETARG_POINTER(4);
        bool            checkUnique = PG_GETARG_BOOL(5);
@@ -494,13 +495,13 @@ gistlayerinsert(Relation r, BlockNumber blkno,
                /* key is modified, so old version must be deleted */
                ItemPointerSet(&oldtid, blkno, child);
                gistdelete(r, &oldtid);
-       
+
                /*
-                * if child was splitted, new key for child will be inserted
-                * in the end list of child, so we must say to any scans
-                * that page is changed beginning from 'child' offset
+                * if child was splitted, new key for child will be inserted in
+                * the end list of child, so we must say to any scans that page is
+                * changed beginning from 'child' offset
                 */
-               if ( ret & SPLITED )
+               if (ret & SPLITED)
                        gistadjscans(r, GISTOP_SPLIT, blkno, child);
        }
 
@@ -615,7 +616,7 @@ gistwritebuffer(Relation r, Page page, IndexTuple *itup,
 static int
 gistnospace(Page page, IndexTuple *itvec, int len)
 {
-       unsigned int                    size = 0;
+       unsigned int size = 0;
        int                     i;
 
        for (i = 0; i < len; i++)
@@ -679,7 +680,7 @@ gistunion(Relation r, IndexTuple *itvec, int len, GISTSTATE *giststate)
 
        needfree = (bool *) palloc(((len == 1) ? 2 : len) * sizeof(bool));
        /* workaround for 64-bit: ensure GISTENTRY array is maxaligned */
-       storage = (char*)palloc( ((len == 1) ? 2 : len) * sizeof(GISTENTRY) + MAXALIGN(VARHDRSZ));
+       storage = (char *) palloc(((len == 1) ? 2 : len) * sizeof(GISTENTRY) + MAXALIGN(VARHDRSZ));
        evec = (bytea *) (storage + MAXALIGN(VARHDRSZ) - VARHDRSZ);
 
        for (j = 0; j < r->rd_att->natts; j++)
@@ -786,7 +787,7 @@ gistgetadjusted(Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *gis
        int                     j;
 
        /* workaround for 64-bit: ensure GISTENTRY array is maxaligned */
-       storage = (char*) palloc( 2 * sizeof(GISTENTRY) + MAXALIGN(VARHDRSZ));
+       storage = (char *) palloc(2 * sizeof(GISTENTRY) + MAXALIGN(VARHDRSZ));
        evec = (bytea *) (storage + MAXALIGN(VARHDRSZ) - VARHDRSZ);
        VARATT_SIZEP(evec) = 2 * sizeof(GISTENTRY) + VARHDRSZ;
        ev0p = &((GISTENTRY *) VARDATA(evec))[0];
@@ -911,7 +912,7 @@ gistunionsubkey(Relation r, GISTSTATE *giststate, IndexTuple *itvec, GIST_SPLITV
 
                needfree = (bool *) palloc(((len == 1) ? 2 : len) * sizeof(bool));
                /* workaround for 64-bit: ensure GISTENTRY array is maxaligned */
-               storage = (char*)palloc( ((len == 1) ? 2 : len) * sizeof(GISTENTRY) + MAXALIGN(VARHDRSZ));
+               storage = (char *) palloc(((len == 1) ? 2 : len) * sizeof(GISTENTRY) + MAXALIGN(VARHDRSZ));
                evec = (bytea *) (storage + MAXALIGN(VARHDRSZ) - VARHDRSZ);
 
                for (j = 1; j < r->rd_att->natts; j++)
@@ -1098,7 +1099,7 @@ gistadjsubkey(Relation r,
        v->spl_nright = curlen;
 
        /* workaround for 64-bit: ensure GISTENTRY array is maxaligned */
-       storage = (char*)palloc( 2 * sizeof(GISTENTRY) + MAXALIGN(VARHDRSZ));
+       storage = (char *) palloc(2 * sizeof(GISTENTRY) + MAXALIGN(VARHDRSZ));
        evec = (bytea *) (storage + MAXALIGN(VARHDRSZ) - VARHDRSZ);
        VARATT_SIZEP(evec) = 2 * sizeof(GISTENTRY) + VARHDRSZ;
        ev0p = &((GISTENTRY *) VARDATA(evec))[0];
@@ -1276,7 +1277,7 @@ gistSplit(Relation r,
        /* workaround for 64-bit: ensure GISTENTRY array is maxaligned */
        storage = palloc(MAXALIGN(VARHDRSZ) + (*len + 1) * sizeof(GISTENTRY));
        entryvec = (bytea *) (storage + MAXALIGN(VARHDRSZ) - VARHDRSZ);
-       decompvec = (bool *) palloc( (*len + 1) * sizeof(bool));
+       decompvec = (bool *) palloc((*len + 1) * sizeof(bool));
        VARATT_SIZEP(entryvec) = (*len + 1) * sizeof(GISTENTRY) + VARHDRSZ;
        for (i = 1; i <= *len; i++)
        {
index aaa26b4..2f5801f 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.34 2002/06/20 20:29:24 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/gist/gistget.c,v 1.35 2002/09/04 20:31:09 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,7 +33,7 @@ gistgettuple(PG_FUNCTION_ARGS)
 {
        IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
        ScanDirection dir = (ScanDirection) PG_GETARG_INT32(1);
-       bool res;
+       bool            res;
 
        /* if we have it cached in the scan desc, just return the value */
        if (gistscancache(s, dir))
index 9a6ca25..3a75265 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.59 2002/06/20 20:29:24 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.60 2002/09/04 20:31:09 momjian Exp $
  *
  * NOTES
  *       This file contains only the public interface routines.
@@ -164,6 +164,7 @@ hashinsert(PG_FUNCTION_ARGS)
        Datum      *datum = (Datum *) PG_GETARG_POINTER(1);
        char       *nulls = (char *) PG_GETARG_POINTER(2);
        ItemPointer ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
+
 #ifdef NOT_USED
        Relation        heapRel = (Relation) PG_GETARG_POINTER(4);
        bool            checkUnique = PG_GETARG_BOOL(5);
@@ -213,7 +214,7 @@ hashgettuple(PG_FUNCTION_ARGS)
        HashScanOpaque so = (HashScanOpaque) scan->opaque;
        Page            page;
        OffsetNumber offnum;
-       bool res;
+       bool            res;
 
        /*
         * If we've already initialized this scan, we can just advance it in
@@ -228,18 +229,21 @@ hashgettuple(PG_FUNCTION_ARGS)
                if (scan->kill_prior_tuple)
                {
                        /*
-                        * Yes, so mark it by setting the LP_DELETE bit in the item flags.
+                        * Yes, so mark it by setting the LP_DELETE bit in the item
+                        * flags.
                         */
                        offnum = ItemPointerGetOffsetNumber(&(scan->currentItemData));
                        page = BufferGetPage(so->hashso_curbuf);
                        PageGetItemId(page, offnum)->lp_flags |= LP_DELETE;
+
                        /*
                         * Since this can be redone later if needed, it's treated the
-                        * same as a commit-hint-bit status update for heap tuples:
-                        * we mark the buffer dirty but don't make a WAL log entry.
+                        * same as a commit-hint-bit status update for heap tuples: we
+                        * mark the buffer dirty but don't make a WAL log entry.
                         */
                        SetBufferCommitInfoNeedsSave(so->hashso_curbuf);
                }
+
                /*
                 * Now continue the scan.
                 */
index fb58bcc..e6595de 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.34 2002/06/20 20:29:24 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.35 2002/09/04 20:31:09 momjian Exp $
  *
  * NOTES
  *       These functions are stored in pg_amproc.      For each operator class
@@ -96,7 +96,8 @@ hashname(PG_FUNCTION_ARGS)
        char       *key = NameStr(*PG_GETARG_NAME(0));
        int                     keylen = strlen(key);
 
-       Assert(keylen < NAMEDATALEN); /* else it's not truncated correctly */
+       Assert(keylen < NAMEDATALEN);           /* else it's not truncated
+                                                                                * correctly */
 
        return hash_any((unsigned char *) key, keylen);
 }
@@ -134,9 +135,9 @@ hashvarlena(PG_FUNCTION_ARGS)
  * high bits or all three low bits, whether the original value of a,b,c
  * is almost all zero or is uniformly distributed,
  * - If mix() is run forward or backward, at least 32 bits in a,b,c
- *   have at least 1/4 probability of changing.
+ *      have at least 1/4 probability of changing.
  * - If mix() is run forward, every bit of c will change between 1/3 and
- *   2/3 of the time.  (Well, 22/100 and 78/100 for some 2-bit deltas.)
+ *      2/3 of the time.  (Well, 22/100 and 78/100 for some 2-bit deltas.)
  *----------
  */
 #define mix(a,b,c) \
@@ -147,17 +148,17 @@ hashvarlena(PG_FUNCTION_ARGS)
   a -= b; a -= c; a ^= (c>>12);  \
   b -= c; b -= a; b ^= (a<<16); \
   c -= a; c -= b; c ^= (b>>5); \
-  a -= b; a -= c; a ^= (c>>3);  \
+  a -= b; a -= c; a ^= (c>>3); \
   b -= c; b -= a; b ^= (a<<10); \
   c -= a; c -= b; c ^= (b>>15); \
 }
 
 /*
  * hash_any() -- hash a variable-length key into a 32-bit value
- *      k       : the key (the unaligned variable-length array of bytes)
- *      len     : the length of the key, counting by bytes
+ *             k               : the key (the unaligned variable-length array of bytes)
+ *             len             : the length of the key, counting by bytes
  *
- * Returns a uint32 value.  Every bit of the key affects every bit of
+ * Returns a uint32 value.     Every bit of the key affects every bit of
  * the return value.  Every 1-bit and 2-bit delta achieves avalanche.
  * About 6*len+35 instructions. The best hash table sizes are powers
  * of 2.  There is no need to do mod a prime (mod is sooo slow!).
@@ -166,7 +167,10 @@ hashvarlena(PG_FUNCTION_ARGS)
 Datum
 hash_any(register const unsigned char *k, register int keylen)
 {
-       register uint32 a,b,c,len;
+       register uint32 a,
+                               b,
+                               c,
+                               len;
 
        /* Set up the internal state */
        len = keylen;
@@ -176,32 +180,44 @@ hash_any(register const unsigned char *k, register int keylen)
        /* handle most of the key */
        while (len >= 12)
        {
-               a += (k[0] +((uint32)k[1]<<8) +((uint32)k[2]<<16) +((uint32)k[3]<<24));
-               b += (k[4] +((uint32)k[5]<<8) +((uint32)k[6]<<16) +((uint32)k[7]<<24));
-               c += (k[8] +((uint32)k[9]<<8) +((uint32)k[10]<<16)+((uint32)k[11]<<24));
-               mix(a,b,c);
-               k += 12; len -= 12;
+               a += (k[0] + ((uint32) k[1] << 8) + ((uint32) k[2] << 16) + ((uint32) k[3] << 24));
+               b += (k[4] + ((uint32) k[5] << 8) + ((uint32) k[6] << 16) + ((uint32) k[7] << 24));
+               c += (k[8] + ((uint32) k[9] << 8) + ((uint32) k[10] << 16) + ((uint32) k[11] << 24));
+               mix(a, b, c);
+               k += 12;
+               len -= 12;
        }
 
        /* handle the last 11 bytes */
        c += keylen;
        switch (len)                            /* all the case statements fall through */
        {
-               case 11: c+=((uint32)k[10]<<24);
-               case 10: c+=((uint32)k[9]<<16);
-               case 9 : c+=((uint32)k[8]<<8);
+               case 11:
+                       c += ((uint32) k[10] << 24);
+               case 10:
+                       c += ((uint32) k[9] << 16);
+               case 9:
+                       c += ((uint32) k[8] << 8);
                        /* the first byte of c is reserved for the length */
-               case 8 : b+=((uint32)k[7]<<24);
-               case 7 : b+=((uint32)k[6]<<16);
-               case 6 : b+=((uint32)k[5]<<8);
-               case 5 : b+=k[4];
-               case 4 : a+=((uint32)k[3]<<24);
-               case 3 : a+=((uint32)k[2]<<16);
-               case 2 : a+=((uint32)k[1]<<8);
-               case 1 : a+=k[0];
+               case 8:
+                       b += ((uint32) k[7] << 24);
+               case 7:
+                       b += ((uint32) k[6] << 16);
+               case 6:
+                       b += ((uint32) k[5] << 8);
+               case 5:
+                       b += k[4];
+               case 4:
+                       a += ((uint32) k[3] << 24);
+               case 3:
+                       a += ((uint32) k[2] << 16);
+               case 2:
+                       a += ((uint32) k[1] << 8);
+               case 1:
+                       a += k[0];
                        /* case 0: nothing left to add */
        }
-       mix(a,b,c);
+       mix(a, b, c);
        /* report the result */
        return UInt32GetDatum(c);
 }
index b597fc1..272e182 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.28 2002/06/20 20:29:24 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.29 2002/09/04 20:31:09 momjian Exp $
  *
  * NOTES
  *       Because we can be doing an index scan on a relation while we
@@ -45,7 +45,7 @@ static HashScanList HashScans = (HashScanList) NULL;
 
 
 static void _hash_scandel(IndexScanDesc scan,
-                                                 BlockNumber blkno, OffsetNumber offno);
+                         BlockNumber blkno, OffsetNumber offno);
 
 
 /*
@@ -158,7 +158,7 @@ _hash_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
                 * then step backwards (affecting current), then exchange again.
                 */
                ItemPointerData tmpitem;
-               Buffer tmpbuf;
+               Buffer          tmpbuf;
 
                tmpitem = *mark;
                *mark = *current;
index 9acd6b3..d7df449 100644 (file)
@@ -8,12 +8,12 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.147 2002/09/02 01:05:03 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.148 2002/09/04 20:31:09 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
  *             relation_open   - open any relation by relation OID
- *             relation_openrv - open any relation specified by a RangeVar
+ *             relation_openrv - open any relation specified by a RangeVar
  *             relation_openr  - open a system relation by name
  *             relation_close  - close any relation
  *             heap_open               - open a heap relation by relation OID
@@ -306,7 +306,7 @@ heapgettup(Relation relation,
                {
                        if (ItemIdIsUsed(lpp))
                        {
-                               bool    valid;
+                               bool            valid;
 
                                tuple->t_datamcxt = NULL;
                                tuple->t_data = (HeapTupleHeader) PageGetItem((Page) dp, lpp);
@@ -985,8 +985,8 @@ heap_fetch(Relation relation,
                *userbuf = buffer;
 
                /*
-                * Count the successful fetch in *pgstat_info if given,
-                * otherwise in the relation's default statistics area.
+                * Count the successful fetch in *pgstat_info if given, otherwise
+                * in the relation's default statistics area.
                 */
                if (pgstat_info != NULL)
                        pgstat_count_heap_fetch(pgstat_info);
@@ -1120,6 +1120,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid)
                /* this is redundant with an Assert in HeapTupleSetOid */
                Assert(tup->t_data->t_infomask & HEAP_HASOID);
 #endif
+
                /*
                 * If the object id of this tuple has already been assigned, trust
                 * the caller.  There are a couple of ways this can happen.  At
@@ -1224,10 +1225,10 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid)
        WriteBuffer(buffer);
 
        /*
-        * If tuple is cachable, mark it for invalidation from the caches in case
-        * we abort.  Note it is OK to do this after WriteBuffer releases the
-        * buffer, because the "tup" data structure is all in local memory,
-        * not in the shared buffer.
+        * If tuple is cachable, mark it for invalidation from the caches in
+        * case we abort.  Note it is OK to do this after WriteBuffer releases
+        * the buffer, because the "tup" data structure is all in local
+        * memory, not in the shared buffer.
         */
        CacheInvalidateHeapTuple(relation, tup);
 
@@ -1379,6 +1380,7 @@ l1:
        LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
 
 #ifdef TUPLE_TOASTER_ACTIVE
+
        /*
         * If the relation has toastable attributes, we need to delete no
         * longer needed items there too.  We have to do this before
@@ -1728,10 +1730,10 @@ l2:
        WriteBuffer(buffer);
 
        /*
-        * If new tuple is cachable, mark it for invalidation from the caches in
-        * case we abort.  Note it is OK to do this after WriteBuffer releases
-        * the buffer, because the "newtup" data structure is all in local
-        * memory, not in the shared buffer.
+        * If new tuple is cachable, mark it for invalidation from the caches
+        * in case we abort.  Note it is OK to do this after WriteBuffer
+        * releases the buffer, because the "newtup" data structure is all in
+        * local memory, not in the shared buffer.
         */
        CacheInvalidateHeapTuple(relation, newtup);
 
@@ -2045,16 +2047,16 @@ log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from,
        xlhdr.hdr.mask = newtup->t_data->t_infomask;
        if (move)                                       /* remember xmin & xmax */
        {
-               TransactionId xid[2];   /* xmax, xmin */
+               TransactionId xid[2];   /* xmax, xmin */
 
                if (newtup->t_data->t_infomask & (HEAP_XMAX_INVALID |
-                                                 HEAP_MARKED_FOR_UPDATE))
+                                                                                 HEAP_MARKED_FOR_UPDATE))
                        xid[0] = InvalidTransactionId;
                else
                        xid[0] = HeapTupleHeaderGetXmax(newtup->t_data);
                xid[1] = HeapTupleHeaderGetXmin(newtup->t_data);
                memcpy((char *) &xlhdr + hsize,
-                      (char *) xid,
+                          (char *) xid,
                           2 * sizeof(TransactionId));
                hsize += 2 * sizeof(TransactionId);
        }
@@ -2143,7 +2145,7 @@ heap_xlog_clean(bool redo, XLogRecPtr lsn, XLogRecord *record)
        PageRepairFragmentation(page, NULL);
 
        PageSetLSN(page, lsn);
-       PageSetSUI(page, ThisStartUpID); /* prev sui */
+       PageSetSUI(page, ThisStartUpID);        /* prev sui */
        UnlockAndWriteBuffer(buffer);
 }
 
@@ -2463,11 +2465,11 @@ newsame:;
 
                if (move)
                {
-                       TransactionId xid[2];   /* xmax, xmin */
-                       
+                       TransactionId xid[2];           /* xmax, xmin */
+
                        hsize = SizeOfHeapUpdate + SizeOfHeapHeader;
                        memcpy((char *) xid,
-                              (char *) xlrec + hsize, 2 * sizeof(TransactionId));
+                                  (char *) xlrec + hsize, 2 * sizeof(TransactionId));
                        htup->t_infomask = xlhdr.mask;
                        htup->t_infomask &= ~(HEAP_XMIN_COMMITTED |
                                                                  HEAP_XMIN_INVALID |
index ab6eff8..f8a883b 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.35 2002/09/02 01:05:03 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.36 2002/09/04 20:31:09 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -46,7 +46,7 @@ static void toast_insert_or_update(Relation rel, HeapTuple newtup,
 static Datum toast_save_datum(Relation rel, Datum value);
 static varattrib *toast_fetch_datum(varattrib *attr);
 static varattrib *toast_fetch_datum_slice(varattrib *attr,
-                                                                                 int32 sliceoffset, int32 length);
+                                               int32 sliceoffset, int32 length);
 
 
 /* ----------
@@ -165,73 +165,68 @@ heap_tuple_untoast_attr(varattrib *attr)
 /* ----------
  * heap_tuple_untoast_attr_slice -
  *
- *      Public entry point to get back part of a toasted value 
- *      from compression or external storage.
+ *             Public entry point to get back part of a toasted value
+ *             from compression or external storage.
  * ----------
  */
-varattrib  *
+varattrib *
 heap_tuple_untoast_attr_slice(varattrib *attr, int32 sliceoffset, int32 slicelength)
 {
        varattrib  *preslice;
        varattrib  *result;
-       int32  attrsize;
-       
+       int32           attrsize;
+
        if (VARATT_IS_COMPRESSED(attr))
        {
-               varattrib *tmp;
-               
+               varattrib  *tmp;
+
                if (VARATT_IS_EXTERNAL(attr))
-               {
                        tmp = toast_fetch_datum(attr);
-               }
                else
                {
-                       tmp = attr; /* compressed in main tuple */
+                       tmp = attr;                     /* compressed in main tuple */
                }
-               
+
                preslice = (varattrib *) palloc(attr->va_content.va_external.va_rawsize
                                                                                + VARHDRSZ);
                VARATT_SIZEP(preslice) = attr->va_content.va_external.va_rawsize + VARHDRSZ;
                pglz_decompress((PGLZ_Header *) tmp, VARATT_DATA(preslice));
-               
-               if (tmp != attr) 
+
+               if (tmp != attr)
                        pfree(tmp);
        }
-       else    
+       else
        {
                /* Plain value */
                if (VARATT_IS_EXTERNAL(attr))
-               {   
+               {
                        /* fast path */
                        return (toast_fetch_datum_slice(attr, sliceoffset, slicelength));
                }
                else
-               {
                        preslice = attr;
-               }
        }
-       
+
        /* slicing of datum for compressed cases and plain value */
-       
+
        attrsize = VARSIZE(preslice) - VARHDRSZ;
-       if (sliceoffset >= attrsize) 
+       if (sliceoffset >= attrsize)
        {
                sliceoffset = 0;
                slicelength = 0;
        }
-       
+
        if (((sliceoffset + slicelength) > attrsize) || slicelength < 0)
-       {
                slicelength = attrsize - sliceoffset;
-       }
-       
+
        result = (varattrib *) palloc(slicelength + VARHDRSZ);
        VARATT_SIZEP(result) = slicelength + VARHDRSZ;
-       
+
        memcpy(VARDATA(result), VARDATA(preslice) + sliceoffset, slicelength);
-       
-       if (preslice != attr) pfree(preslice);
-       
+
+       if (preslice != attr)
+               pfree(preslice);
+
        return result;
 }
 
@@ -1053,9 +1048,9 @@ toast_fetch_datum(varattrib *attr)
        /*
         * Read the chunks by index
         *
-        * Note that because the index is actually on (valueid, chunkidx)
-        * we will see the chunks in chunkidx order, even though we didn't
-        * explicitly ask for it.
+        * Note that because the index is actually on (valueid, chunkidx) we will
+        * see the chunks in chunkidx order, even though we didn't explicitly
+        * ask for it.
         */
        nextidx = 0;
 
@@ -1146,45 +1141,44 @@ toast_fetch_datum_slice(varattrib *attr, int32 sliceoffset, int32 length)
        varattrib  *result;
        int32           attrsize;
        int32           residx;
-       int32       nextidx;
-       int                 numchunks;
-       int                 startchunk;
-       int                 endchunk;
+       int32           nextidx;
+       int                     numchunks;
+       int                     startchunk;
+       int                     endchunk;
        int32           startoffset;
        int32           endoffset;
-       int         totalchunks;
+       int                     totalchunks;
        Pointer         chunk;
        bool            isnull;
        int32           chunksize;
-       int32       chcpystrt;
-       int32       chcpyend;
+       int32           chcpystrt;
+       int32           chcpyend;
 
        attrsize = attr->va_content.va_external.va_extsize;
        totalchunks = ((attrsize - 1) / TOAST_MAX_CHUNK_SIZE) + 1;
 
-       if (sliceoffset >= attrsize) 
+       if (sliceoffset >= attrsize)
        {
-           sliceoffset = 0;
-           length = 0;
+               sliceoffset = 0;
+               length = 0;
        }
 
        if (((sliceoffset + length) > attrsize) || length < 0)
-       {
-           length = attrsize - sliceoffset;
-       }
+               length = attrsize - sliceoffset;
 
        result = (varattrib *) palloc(length + VARHDRSZ);
        VARATT_SIZEP(result) = length + VARHDRSZ;
 
        if (VARATT_IS_COMPRESSED(attr))
                VARATT_SIZEP(result) |= VARATT_FLAG_COMPRESSED;
-       
-       if (length == 0) return (result); /* Can save a lot of work at this point! */
+
+       if (length == 0)
+               return (result);                /* Can save a lot of work at this point! */
 
        startchunk = sliceoffset / TOAST_MAX_CHUNK_SIZE;
        endchunk = (sliceoffset + length - 1) / TOAST_MAX_CHUNK_SIZE;
-       numchunks = (endchunk - startchunk ) + 1;
+       numchunks = (endchunk - startchunk) + 1;
+
        startoffset = sliceoffset % TOAST_MAX_CHUNK_SIZE;
        endoffset = (sliceoffset + length - 1) % TOAST_MAX_CHUNK_SIZE;
 
@@ -1204,33 +1198,34 @@ toast_fetch_datum_slice(varattrib *attr, int32 sliceoffset, int32 length)
                                                   (bits16) 0,
                                                   (AttrNumber) 1,
                                                   (RegProcedure) F_OIDEQ,
-                                                  ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
+                         ObjectIdGetDatum(attr->va_content.va_external.va_valueid));
+
        /*
         * Now dependent on number of chunks:
         */
-       
-       if (numchunks == 1) 
+
+       if (numchunks == 1)
        {
-           ScanKeyEntryInitialize(&toastkey[1],
+               ScanKeyEntryInitialize(&toastkey[1],
                                                           (bits16) 0,
                                                           (AttrNumber) 2,
                                                           (RegProcedure) F_INT4EQ,
                                                           Int32GetDatum(startchunk));
-           nscankeys = 2;
+               nscankeys = 2;
        }
        else
        {
-           ScanKeyEntryInitialize(&toastkey[1],
+               ScanKeyEntryInitialize(&toastkey[1],
                                                           (bits16) 0,
                                                           (AttrNumber) 2,
                                                           (RegProcedure) F_INT4GE,
                                                           Int32GetDatum(startchunk));
-           ScanKeyEntryInitialize(&toastkey[2],
+               ScanKeyEntryInitialize(&toastkey[2],
                                                           (bits16) 0,
                                                           (AttrNumber) 2,
                                                           (RegProcedure) F_INT4LE,
                                                           Int32GetDatum(endchunk));
-           nscankeys = 3;
+               nscankeys = 3;
        }
 
        /*
@@ -1279,21 +1274,23 @@ toast_fetch_datum_slice(varattrib *attr, int32 sliceoffset, int32 length)
                 */
                chcpystrt = 0;
                chcpyend = chunksize - 1;
-               if (residx == startchunk) chcpystrt = startoffset;
-               if (residx == endchunk) chcpyend = endoffset;
-               
-               memcpy(((char *) VARATT_DATA(result)) + 
-                      (residx * TOAST_MAX_CHUNK_SIZE - sliceoffset) +chcpystrt,
+               if (residx == startchunk)
+                       chcpystrt = startoffset;
+               if (residx == endchunk)
+                       chcpyend = endoffset;
+
+               memcpy(((char *) VARATT_DATA(result)) +
+                          (residx * TOAST_MAX_CHUNK_SIZE - sliceoffset) + chcpystrt,
                           VARATT_DATA(chunk) + chcpystrt,
                           (chcpyend - chcpystrt) + 1);
-               
+
                nextidx++;
        }
 
        /*
         * Final checks that we successfully fetched the datum
         */
-       if ( nextidx != (endchunk + 1))
+       if (nextidx != (endchunk + 1))
                elog(ERROR, "missing chunk number %d for toast value %u",
                         nextidx,
                         attr->va_content.va_external.va_valueid);
index 9bf88a7..2a21e29 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.35 2002/06/20 20:29:25 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.36 2002/09/04 20:31:09 momjian Exp $
  *
  * NOTES
  *       many of the old access method routines have been turned into
@@ -77,7 +77,7 @@ RelationGetIndexScan(Relation indexRelation,
 
        scan->heapRelation = NULL;      /* may be set later */
        scan->indexRelation = indexRelation;
-       scan->xs_snapshot = SnapshotNow; /* may be set later */
+       scan->xs_snapshot = SnapshotNow;        /* may be set later */
        scan->numberOfKeys = nkeys;
 
        /*
@@ -90,8 +90,8 @@ RelationGetIndexScan(Relation indexRelation,
                scan->keyData = NULL;
 
        scan->kill_prior_tuple = false;
-       scan->ignore_killed_tuples = true; /* default setting */
-       scan->keys_are_unique = false; /* may be set by amrescan */
+       scan->ignore_killed_tuples = true;      /* default setting */
+       scan->keys_are_unique = false;          /* may be set by amrescan */
        scan->got_tuple = false;
 
        scan->opaque = NULL;
@@ -201,6 +201,7 @@ systable_beginscan(Relation heapRelation,
 
                /* We assume it's a system index, so index_openr is OK */
                sysscan->irel = irel = index_openr(indexRelname);
+
                /*
                 * Change attribute numbers to be index column numbers.
                 *
@@ -210,7 +211,7 @@ systable_beginscan(Relation heapRelation,
                for (i = 0; i < nkeys; i++)
                {
                        Assert(key[i].sk_attno == irel->rd_index->indkey[i]);
-                       key[i].sk_attno = i+1;
+                       key[i].sk_attno = i + 1;
                }
                sysscan->iscan = index_beginscan(heapRelation, irel, snapshot,
                                                                                 nkeys, key);
index fc53aef..d2e11d2 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.61 2002/06/20 20:29:25 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.62 2002/09/04 20:31:09 momjian Exp $
  *
  * INTERFACE ROUTINES
  *             index_open              - open an index relation by relation OID
@@ -272,8 +272,8 @@ index_beginscan(Relation heapRelation,
                                                                                 PointerGetDatum(key)));
 
        /*
-        * Save additional parameters into the scandesc.  Everything else
-        * was set up by RelationGetIndexScan.
+        * Save additional parameters into the scandesc.  Everything else was
+        * set up by RelationGetIndexScan.
         */
        scan->heapRelation = heapRelation;
        scan->xs_snapshot = snapshot;
@@ -293,7 +293,7 @@ index_beginscan(Relation heapRelation,
  *             index_rescan  - (re)start a scan of an index
  *
  * The caller may specify a new set of scankeys (but the number of keys
- * cannot change).  Note that this is also called when first starting
+ * cannot change).     Note that this is also called when first starting
  * an indexscan; see RelationGetIndexScan.
  * ----------------
  */
@@ -305,8 +305,8 @@ index_rescan(IndexScanDesc scan, ScanKey key)
        SCAN_CHECKS;
        GET_SCAN_PROCEDURE(rescan, amrescan);
 
-       scan->kill_prior_tuple = false; /* for safety */
-       scan->keys_are_unique = false; /* may be set by amrescan */
+       scan->kill_prior_tuple = false;         /* for safety */
+       scan->keys_are_unique = false;          /* may be set by amrescan */
        scan->got_tuple = false;
 
        OidFunctionCall2(procedure,
@@ -375,7 +375,7 @@ index_restrpos(IndexScanDesc scan)
        SCAN_CHECKS;
        GET_SCAN_PROCEDURE(restrpos, amrestrpos);
 
-       scan->kill_prior_tuple = false; /* for safety */
+       scan->kill_prior_tuple = false;         /* for safety */
        scan->got_tuple = false;
 
        OidFunctionCall1(procedure, PointerGetDatum(scan));
@@ -385,7 +385,7 @@ index_restrpos(IndexScanDesc scan)
  *             index_getnext - get the next heap tuple from a scan
  *
  * The result is the next heap tuple satisfying the scan keys and the
- * snapshot, or NULL if no more matching tuples exist.  On success,
+ * snapshot, or NULL if no more matching tuples exist. On success,
  * the buffer containing the heap tuple is pinned (the pin will be dropped
  * at the next index_getnext or index_endscan).  The index TID corresponding
  * to the heap tuple can be obtained if needed from scan->currentItemData.
@@ -409,8 +409,8 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
        scan->kill_prior_tuple = false;
 
        /*
-        * Can skip entering the index AM if we already got a tuple
-        * and it must be unique.
+        * Can skip entering the index AM if we already got a tuple and it
+        * must be unique.
         */
        if (scan->keys_are_unique && scan->got_tuple)
                return NULL;
@@ -454,9 +454,9 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
                 * index AM to not return it on future indexscans.
                 *
                 * We told heap_fetch to keep a pin on the buffer, so we can
-                * re-access the tuple here.  But we must re-lock the buffer first.
-                * Also, it's just barely possible for an update of hint bits to
-                * occur here.
+                * re-access the tuple here.  But we must re-lock the buffer
+                * first. Also, it's just barely possible for an update of hint
+                * bits to occur here.
                 */
                LockBuffer(scan->xs_cbuf, BUFFER_LOCK_SHARE);
                sv_infomask = heapTuple->t_data->t_infomask;
@@ -497,7 +497,7 @@ bool
 index_getnext_indexitem(IndexScanDesc scan,
                                                ScanDirection direction)
 {
-       bool found;
+       bool            found;
 
        SCAN_CHECKS;
 
@@ -642,10 +642,11 @@ index_getprocinfo(Relation irel,
                procId = loc[procindex];
 
                /*
-                * Complain if function was not found during IndexSupportInitialize.
-                * This should not happen unless the system tables contain bogus
-                * entries for the index opclass.  (If an AM wants to allow a
-                * support function to be optional, it can use index_getprocid.)
+                * Complain if function was not found during
+                * IndexSupportInitialize. This should not happen unless the
+                * system tables contain bogus entries for the index opclass.  (If
+                * an AM wants to allow a support function to be optional, it can
+                * use index_getprocid.)
                 */
                if (!RegProcedureIsValid(procId))
                        elog(ERROR, "Missing support function %d for attribute %d of index %s",
index 16d63e0..99011a5 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.95 2002/08/06 02:36:33 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.96 2002/09/04 20:31:09 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -119,14 +119,14 @@ top:
         *
         * NOTE: obviously, _bt_check_unique can only detect keys that are
         * already in the index; so it cannot defend against concurrent
-        * insertions of the same key.  We protect against that by means
-        * of holding a write lock on the target page.  Any other would-be
+        * insertions of the same key.  We protect against that by means of
+        * holding a write lock on the target page.  Any other would-be
         * inserter of the same key must acquire a write lock on the same
         * target page, so only one would-be inserter can be making the check
-        * at one time.  Furthermore, once we are past the check we hold
-        * write locks continuously until we have performed our insertion,
-        * so no later inserter can fail to see our insertion.  (This
-        * requires some care in _bt_insertonpg.)
+        * at one time.  Furthermore, once we are past the check we hold write
+        * locks continuously until we have performed our insertion, so no
+        * later inserter can fail to see our insertion.  (This requires some
+        * care in _bt_insertonpg.)
         *
         * If we must wait for another xact, we release the lock while waiting,
         * and then must start over completely.
@@ -205,15 +205,16 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
                if (offset <= maxoff)
                {
                        /*
-                        * _bt_compare returns 0 for (1,NULL) and (1,NULL) - this's how we
-                        * handling NULLs - and so we must not use _bt_compare in real
-                        * comparison, but only for ordering/finding items on pages. -
-                        * vadim 03/24/97
+                        * _bt_compare returns 0 for (1,NULL) and (1,NULL) - this's
+                        * how we handling NULLs - and so we must not use _bt_compare
+                        * in real comparison, but only for ordering/finding items on
+                        * pages. - vadim 03/24/97
                         */
                        if (!_bt_isequal(itupdesc, page, offset, natts, itup_scankey))
                                break;                  /* we're past all the equal tuples */
 
                        curitemid = PageGetItemId(page, offset);
+
                        /*
                         * We can skip the heap fetch if the item is marked killed.
                         */
@@ -226,10 +227,11 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
                                {
                                        /* it is a duplicate */
                                        TransactionId xwait =
-                                               (TransactionIdIsValid(SnapshotDirty->xmin)) ?
-                                               SnapshotDirty->xmin : SnapshotDirty->xmax;
+                                       (TransactionIdIsValid(SnapshotDirty->xmin)) ?
+                                       SnapshotDirty->xmin : SnapshotDirty->xmax;
 
                                        ReleaseBuffer(hbuffer);
+
                                        /*
                                         * If this tuple is being updated by other transaction
                                         * then we have to wait for its commit/abort.
@@ -252,8 +254,8 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
                                {
                                        /*
                                         * Hmm, if we can't see the tuple, maybe it can be
-                                        * marked killed.  This logic should match index_getnext
-                                        * and btgettuple.
+                                        * marked killed.  This logic should match
+                                        * index_getnext and btgettuple.
                                         */
                                        uint16          sv_infomask;
 
@@ -421,7 +423,7 @@ _bt_insertonpg(Relation rel,
                {
                        /* step right one page */
                        BlockNumber rblkno = lpageop->btpo_next;
-                       Buffer  rbuf;
+                       Buffer          rbuf;
 
                        /*
                         * must write-lock next page before releasing write lock on
index 46787e5..ac46681 100644 (file)
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.91 2002/06/20 20:29:25 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.92 2002/09/04 20:31:10 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -315,24 +315,28 @@ btgettuple(PG_FUNCTION_ARGS)
                 * buffer, too.
                 */
                _bt_restscan(scan);
+
                /*
                 * Check to see if we should kill the previously-fetched tuple.
                 */
                if (scan->kill_prior_tuple)
                {
                        /*
-                        * Yes, so mark it by setting the LP_DELETE bit in the item flags.
+                        * Yes, so mark it by setting the LP_DELETE bit in the item
+                        * flags.
                         */
                        offnum = ItemPointerGetOffsetNumber(&(scan->currentItemData));
                        page = BufferGetPage(so->btso_curbuf);
                        PageGetItemId(page, offnum)->lp_flags |= LP_DELETE;
+
                        /*
                         * Since this can be redone later if needed, it's treated the
-                        * same as a commit-hint-bit status update for heap tuples:
-                        * we mark the buffer dirty but don't make a WAL log entry.
+                        * same as a commit-hint-bit status update for heap tuples: we
+                        * mark the buffer dirty but don't make a WAL log entry.
                         */
                        SetBufferCommitInfoNeedsSave(so->btso_curbuf);
                }
+
                /*
                 * Now continue the scan.
                 */
@@ -645,15 +649,15 @@ btbulkdelete(PG_FUNCTION_ARGS)
                                /*
                                 * If this is first deletion on this page, trade in read
                                 * lock for a really-exclusive write lock.      Then, step
-                                * back one and re-examine the item, because other backends
-                                * might have inserted item(s) while we weren't holding
-                                * the lock!
+                                * back one and re-examine the item, because other
+                                * backends might have inserted item(s) while we weren't
+                                * holding the lock!
                                 *
                                 * We assume that only concurrent insertions, not deletions,
-                                * can occur while we're not holding the page lock (the caller
-                                * should hold a suitable relation lock to ensure this).
-                                * Therefore, the item we want to delete is either in the
-                                * same slot as before, or some slot to its right.
+                                * can occur while we're not holding the page lock (the
+                                * caller should hold a suitable relation lock to ensure
+                                * this). Therefore, the item we want to delete is either
+                                * in the same slot as before, or some slot to its right.
                                 * Rechecking the same slot is necessary and sufficient to
                                 * get back in sync after any insertions.
                                 */
@@ -675,19 +679,19 @@ btbulkdelete(PG_FUNCTION_ARGS)
                                }
 
                                /*
-                                * In either case, we now need to back up the scan one item,
-                                * so that the next cycle will re-examine the same offnum on
-                                * this page.
+                                * In either case, we now need to back up the scan one
+                                * item, so that the next cycle will re-examine the same
+                                * offnum on this page.
                                 *
                                 * For now, just hack the current-item index.  Will need to
                                 * be smarter when deletion includes removal of empty
                                 * index pages.
                                 *
                                 * We must decrement ip_posid in all cases but one: if the
-                                * page was formerly rightmost but was split while we didn't
-                                * hold the lock, and ip_posid is pointing to item 1, then
-                                * ip_posid now points at the high key not a valid data item.
-                                * In this case we do want to step forward.
+                                * page was formerly rightmost but was split while we
+                                * didn't hold the lock, and ip_posid is pointing to item
+                                * 1, then ip_posid now points at the high key not a valid
+                                * data item. In this case we do want to step forward.
                                 */
                                opaque = (BTPageOpaque) PageGetSpecialPointer(page);
                                if (current->ip_posid >= P_FIRSTDATAKEY(opaque))
index 999c3ba..50fe331 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.50 2002/06/20 20:29:25 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.51 2002/09/04 20:31:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -22,7 +22,7 @@
 #include "executor/execdebug.h"
 
 
-static int _bt_getstrategynumber(RegProcedure sk_procedure, StrategyMap map);
+static int     _bt_getstrategynumber(RegProcedure sk_procedure, StrategyMap map);
 
 
 /*
@@ -178,7 +178,7 @@ _bt_formitem(IndexTuple itup)
  * example.
  *
  * Furthermore, we detect the case where the index is unique and we have
- * equality quals for all columns.  In this case there can be at most one
+ * equality quals for all columns.     In this case there can be at most one
  * (visible) matching tuple.  index_getnext uses this to avoid uselessly
  * continuing the scan after finding one match.
  *
@@ -439,8 +439,8 @@ _bt_orderkeys(IndexScanDesc scan)
        so->numberOfKeys = new_numberOfKeys;
 
        /*
-        * If unique index and we have equality keys for all columns,
-        * set keys_are_unique flag for higher levels.
+        * If unique index and we have equality keys for all columns, set
+        * keys_are_unique flag for higher levels.
         */
        if (allEqualSoFar && relation->rd_index->indisunique &&
                relation->rd_rel->relnatts == new_numberOfKeys)
index 87ebb60..9a21954 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.27 2002/06/20 20:29:25 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.28 2002/09/04 20:31:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,7 +31,7 @@ rtgettuple(PG_FUNCTION_ARGS)
 {
        IndexScanDesc s = (IndexScanDesc) PG_GETARG_POINTER(0);
        ScanDirection dir = (ScanDirection) PG_GETARG_INT32(1);
-       bool res;
+       bool            res;
 
        /* if we have it cached in the scan desc, just return the value */
        if (rtscancache(s, dir))
index 957b986..6508200 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.74 2002/06/25 17:26:11 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.75 2002/09/04 20:31:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -223,6 +223,7 @@ rtinsert(PG_FUNCTION_ARGS)
        Datum      *datum = (Datum *) PG_GETARG_POINTER(1);
        char       *nulls = (char *) PG_GETARG_POINTER(2);
        ItemPointer ht_ctid = (ItemPointer) PG_GETARG_POINTER(3);
+
 #ifdef NOT_USED
        Relation        heapRel = (Relation) PG_GETARG_POINTER(4);
        bool            checkUnique = PG_GETARG_BOOL(5);
index c4ca0c7..3d38164 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.53 2002/06/20 20:29:25 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.54 2002/09/04 20:31:13 momjian Exp $
  *
  * NOTES
  *       This file contains the high level access-method interface to the
@@ -27,7 +27,7 @@
  *             Flag indicating that we are bootstrapping.
  *
  * Transaction ID generation is disabled during bootstrap; we just use
- * BootstrapTransactionId.  Also, the transaction ID status-check routines
+ * BootstrapTransactionId.     Also, the transaction ID status-check routines
  * are short-circuited; they claim that BootstrapTransactionId has already
  * committed, allowing tuples already inserted to be seen immediately.
  * ----------------
index 4b8e760..6453bad 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (c) 2000, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.50 2002/06/11 13:40:50 wieck Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.51 2002/09/04 20:31:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -68,12 +68,12 @@ GetNewTransactionId(void)
         * might see a partially-set xid here.  But holding both locks at once
         * would be a nasty concurrency hit (and in fact could cause a
         * deadlock against GetSnapshotData).  So for now, assume atomicity.
-        * Note that readers of PGPROC xid field should be careful to fetch the
-        * value only once, rather than assume they can read it multiple times
-        * and get the same answer each time.
+        * Note that readers of PGPROC xid field should be careful to fetch
+        * the value only once, rather than assume they can read it multiple
+        * times and get the same answer each time.
         *
-        * A solution to the atomic-store problem would be to give each PGPROC its
-        * own spinlock used only for fetching/storing that PGPROC's xid.
+        * A solution to the atomic-store problem would be to give each PGPROC
+        * its own spinlock used only for fetching/storing that PGPROC's xid.
         * (SInvalLock would then mean primarily that PROCs couldn't be added/
         * removed while holding the lock.)
         */
index 1c1121e..fd401e9 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.131 2002/08/30 22:18:05 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.132 2002/09/04 20:31:13 momjian Exp $
  *
  * NOTES
  *             Transaction aborts can now occur two ways:
@@ -265,7 +265,6 @@ SetTransactionFlushEnabled(bool state)
 {
        TransactionFlushState = (state == true);
 }
-
 #endif
 
 
@@ -421,7 +420,7 @@ CommandCounterIncrement(void)
        TransactionState s = CurrentTransactionState;
 
        s->commandId += 1;
-       if (s->commandId == FirstCommandId)     /* check for overflow */
+       if (s->commandId == FirstCommandId) /* check for overflow */
                elog(ERROR, "You may only have 2^32-1 commands per transaction");
 
        /* Propagate new command ID into query snapshots, if set */
@@ -517,8 +516,8 @@ void
 RecordTransactionCommit(void)
 {
        /*
-        * If we made neither any XLOG entries nor any temp-rel updates,
-        * we can omit recording the transaction commit at all.
+        * If we made neither any XLOG entries nor any temp-rel updates, we
+        * can omit recording the transaction commit at all.
         */
        if (MyXactMadeXLogEntry || MyXactMadeTempRelUpdate)
        {
@@ -531,10 +530,10 @@ RecordTransactionCommit(void)
                START_CRIT_SECTION();
 
                /*
-                * We only need to log the commit in xlog if the transaction made any
-                * transaction-controlled XLOG entries.  (Otherwise, its XID appears
-                * nowhere in permanent storage, so no one else will ever care if it
-                * committed.)
+                * We only need to log the commit in xlog if the transaction made
+                * any transaction-controlled XLOG entries.  (Otherwise, its XID
+                * appears nowhere in permanent storage, so no one else will ever
+                * care if it committed.)
                 */
                if (MyLastRecPtr.xrecoff != 0)
                {
@@ -560,20 +559,20 @@ RecordTransactionCommit(void)
                }
 
                /*
-                * We must flush our XLOG entries to disk if we made any XLOG entries,
-                * whether in or out of transaction control.  For example, if we
-                * reported a nextval() result to the client, this ensures that any
-                * XLOG record generated by nextval will hit the disk before we report
-                * the transaction committed.
+                * We must flush our XLOG entries to disk if we made any XLOG
+                * entries, whether in or out of transaction control.  For
+                * example, if we reported a nextval() result to the client, this
+                * ensures that any XLOG record generated by nextval will hit the
+                * disk before we report the transaction committed.
                 */
                if (MyXactMadeXLogEntry)
                {
                        /*
                         * Sleep before flush! So we can flush more than one commit
-                        * records per single fsync.  (The idea is some other backend may
-                        * do the XLogFlush while we're sleeping.  This needs work still,
-                        * because on most Unixen, the minimum select() delay is 10msec or
-                        * more, which is way too long.)
+                        * records per single fsync.  (The idea is some other backend
+                        * may do the XLogFlush while we're sleeping.  This needs work
+                        * still, because on most Unixen, the minimum select() delay
+                        * is 10msec or more, which is way too long.)
                         *
                         * We do not sleep if enableFsync is not turned on, nor if there
                         * are fewer than CommitSiblings other backends with active
@@ -593,13 +592,14 @@ RecordTransactionCommit(void)
                }
 
                /*
-                * We must mark the transaction committed in clog if its XID appears
-                * either in permanent rels or in local temporary rels.  We test
-                * this by seeing if we made transaction-controlled entries *OR*
-                * local-rel tuple updates.  Note that if we made only the latter,
-                * we have not emitted an XLOG record for our commit, and so in the
-                * event of a crash the clog update might be lost.  This is okay
-                * because no one else will ever care whether we committed.
+                * We must mark the transaction committed in clog if its XID
+                * appears either in permanent rels or in local temporary rels.
+                * We test this by seeing if we made transaction-controlled
+                * entries *OR* local-rel tuple updates.  Note that if we made
+                * only the latter, we have not emitted an XLOG record for our
+                * commit, and so in the event of a crash the clog update might be
+                * lost.  This is okay because no one else will ever care whether
+                * we committed.
                 */
                if (MyLastRecPtr.xrecoff != 0 || MyXactMadeTempRelUpdate)
                        TransactionIdCommit(xid);
@@ -628,6 +628,7 @@ AtCommit_Cache(void)
         * Clean up the relation cache.
         */
        AtEOXact_RelationCache(true);
+
        /*
         * Make catalog changes visible to all backends.
         */
@@ -698,8 +699,8 @@ RecordTransactionAbort(void)
 {
        /*
         * If we made neither any transaction-controlled XLOG entries nor any
-        * temp-rel updates, we can omit recording the transaction abort at all.
-        * No one will ever care that it aborted.
+        * temp-rel updates, we can omit recording the transaction abort at
+        * all. No one will ever care that it aborted.
         */
        if (MyLastRecPtr.xrecoff != 0 || MyXactMadeTempRelUpdate)
        {
@@ -716,11 +717,12 @@ RecordTransactionAbort(void)
                START_CRIT_SECTION();
 
                /*
-                * We only need to log the abort in XLOG if the transaction made any
-                * transaction-controlled XLOG entries.  (Otherwise, its XID appears
-                * nowhere in permanent storage, so no one else will ever care if it
-                * committed.)  We do not flush XLOG to disk in any case, since the
-                * default assumption after a crash would be that we aborted, anyway.
+                * We only need to log the abort in XLOG if the transaction made
+                * any transaction-controlled XLOG entries.  (Otherwise, its XID
+                * appears nowhere in permanent storage, so no one else will ever
+                * care if it committed.)  We do not flush XLOG to disk in any
+                * case, since the default assumption after a crash would be that
+                * we aborted, anyway.
                 */
                if (MyLastRecPtr.xrecoff != 0)
                {
@@ -1165,8 +1167,8 @@ StartTransactionCommand(bool preventChain)
        TransactionState s = CurrentTransactionState;
 
        /*
-        * Remember if caller wants to prevent autocommit-off chaining.
-        * This is only allowed if not already in a transaction block.
+        * Remember if caller wants to prevent autocommit-off chaining. This
+        * is only allowed if not already in a transaction block.
         */
        suppressChain = preventChain;
        if (preventChain && s->blockState != TBLOCK_DEFAULT)
@@ -1260,16 +1262,18 @@ CommitTransactionCommand(bool forceCommit)
        {
                        /*
                         * If we aren't in a transaction block, and we are doing
-                        * autocommit, just do our usual transaction commit.  But
-                        * if we aren't doing autocommit, start a transaction block
-                        * automatically by switching to INPROGRESS state.  (We handle
-                        * this choice here, and not earlier, so that an explicit BEGIN
-                        * issued in autocommit-off mode won't issue strange warnings.)
+                        * autocommit, just do our usual transaction commit.  But if
+                        * we aren't doing autocommit, start a transaction block
+                        * automatically by switching to INPROGRESS state.      (We handle
+                        * this choice here, and not earlier, so that an explicit
+                        * BEGIN issued in autocommit-off mode won't issue strange
+                        * warnings.)
                         *
-                        * Autocommit mode is forced by either a true forceCommit parameter
-                        * to me, or a true preventChain parameter to the preceding
-                        * StartTransactionCommand call.  This is needed so that commands
-                        * like VACUUM can ensure that the right things happen.
+                        * Autocommit mode is forced by either a true forceCommit
+                        * parameter to me, or a true preventChain parameter to the
+                        * preceding StartTransactionCommand call.      This is needed so
+                        * that commands like VACUUM can ensure that the right things
+                        * happen.
                         */
                case TBLOCK_DEFAULT:
                        if (autocommit || forceCommit || suppressChain)
@@ -1442,9 +1446,9 @@ BeginTransactionBlock(void)
        s->blockState = TBLOCK_BEGIN;
 
        /*
-        * do begin processing.  NOTE: if you put anything here, check that
-        * it behaves properly in both autocommit-on and autocommit-off modes.
-        * In the latter case we will already have done some work in the new
+        * do begin processing.  NOTE: if you put anything here, check that it
+        * behaves properly in both autocommit-on and autocommit-off modes. In
+        * the latter case we will already have done some work in the new
         * transaction.
         */
 
index d2955d4..0ff6029 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.105 2002/09/02 02:47:01 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.106 2002/09/04 20:31:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -131,13 +131,13 @@ bool              InRecovery = false;
  *
  * Note that XLOG records inserted outside transaction control are not
  * reflected into MyLastRecPtr.  They do, however, cause MyXactMadeXLogEntry
- * to be set true.  The latter can be used to test whether the current xact
+ * to be set true.     The latter can be used to test whether the current xact
  * made any loggable changes (including out-of-xact changes, such as
  * sequence updates).
  *
  * When we insert/update/delete a tuple in a temporary relation, we do not
  * make any XLOG record, since we don't care about recovering the state of
- * the temp rel after a crash.  However, we will still need to remember
+ * the temp rel after a crash. However, we will still need to remember
  * whether our transaction committed or aborted in that case.  So, we must
  * set MyXactMadeTempRelUpdate true to indicate that the XID will be of
  * interest later.
@@ -151,7 +151,7 @@ bool                MyXactMadeTempRelUpdate = false;
 /*
  * ProcLastRecPtr points to the start of the last XLOG record inserted by the
  * current backend.  It is updated for all inserts, transaction-controlled
- * or not.  ProcLastRecEnd is similar but points to end+1 of last record.
+ * or not.     ProcLastRecEnd is similar but points to end+1 of last record.
  */
 static XLogRecPtr ProcLastRecPtr = {0, 0};
 
@@ -162,7 +162,7 @@ XLogRecPtr  ProcLastRecEnd = {0, 0};
  * (which is almost but not quite the same as a pointer to the most recent
  * CHECKPOINT record). We update this from the shared-memory copy,
  * XLogCtl->Insert.RedoRecPtr, whenever we can safely do so (ie, when we
- * hold the Insert lock).  See XLogInsert for details.  We are also allowed
+ * hold the Insert lock).  See XLogInsert for details. We are also allowed
  * to update from XLogCtl->Insert.RedoRecPtr if we hold the info_lck;
  * see GetRedoRecPtr.
  */
@@ -766,7 +766,7 @@ begin:;
                /*
                 * We do not acquire SInvalLock here because of possible deadlock.
                 * Anyone who wants to inspect other procs' logRec must acquire
-                * WALInsertLock, instead.  A better solution would be a per-PROC
+                * WALInsertLock, instead.      A better solution would be a per-PROC
                 * spinlock, but no time for that before 7.2 --- tgl 12/19/01.
                 */
                MyProc->logRec = RecPtr;
@@ -1283,26 +1283,27 @@ XLogFlush(XLogRecPtr record)
 
        /*
         * If we still haven't flushed to the request point then we have a
-        * problem; most likely, the requested flush point is past end of XLOG.
-        * This has been seen to occur when a disk page has a corrupted LSN.
+        * problem; most likely, the requested flush point is past end of
+        * XLOG. This has been seen to occur when a disk page has a corrupted
+        * LSN.
         *
         * Formerly we treated this as a PANIC condition, but that hurts the
         * system's robustness rather than helping it: we do not want to take
         * down the whole system due to corruption on one data page.  In
-        * particular, if the bad page is encountered again during recovery then
-        * we would be unable to restart the database at all!  (This scenario
-        * has actually happened in the field several times with 7.1 releases.
-        * Note that we cannot get here while InRedo is true, but if the bad
-        * page is brought in and marked dirty during recovery then
+        * particular, if the bad page is encountered again during recovery
+        * then we would be unable to restart the database at all!      (This
+        * scenario has actually happened in the field several times with 7.1
+        * releases. Note that we cannot get here while InRedo is true, but if
+        * the bad page is brought in and marked dirty during recovery then
         * CreateCheckpoint will try to flush it at the end of recovery.)
         *
         * The current approach is to ERROR under normal conditions, but only
-        * WARNING during recovery, so that the system can be brought up even if
-        * there's a corrupt LSN.  Note that for calls from xact.c, the ERROR
-        * will be promoted to PANIC since xact.c calls this routine inside a
-        * critical section.  However, calls from bufmgr.c are not within
-        * critical sections and so we will not force a restart for a bad LSN
-        * on a data page.
+        * WARNING during recovery, so that the system can be brought up even
+        * if there's a corrupt LSN.  Note that for calls from xact.c, the
+        * ERROR will be promoted to PANIC since xact.c calls this routine
+        * inside a critical section.  However, calls from bufmgr.c are not
+        * within critical sections and so we will not force a restart for a
+        * bad LSN on a data page.
         */
        if (XLByteLT(LogwrtResult.Flush, record))
                elog(InRecovery ? WARNING : ERROR,
@@ -1565,7 +1566,7 @@ PreallocXlogFiles(XLogRecPtr endptr)
 
        XLByteToPrevSeg(endptr, _logId, _logSeg);
        if ((endptr.xrecoff - 1) % XLogSegSize >=
-                        (uint32) (0.75 * XLogSegSize))
+               (uint32) (0.75 * XLogSegSize))
        {
                NextLogSeg(_logId, _logSeg);
                use_existent = true;
@@ -1618,8 +1619,8 @@ MoveOfflineLogs(uint32 log, uint32 seg, XLogRecPtr endptr)
                                /*
                                 * Before deleting the file, see if it can be recycled as
                                 * a future log segment.  We allow recycling segments up
-                                * to XLOGfileslop segments beyond the current
-                                * XLOG location.
+                                * to XLOGfileslop segments beyond the current XLOG
+                                * location.
                                 */
                                if (InstallXLogFileSegment(endlogId, endlogSeg, path,
                                                                                   true, XLOGfileslop,
@@ -2196,7 +2197,7 @@ ReadControlFile(void)
        if (ControlFile->catalog_version_no != CATALOG_VERSION_NO)
                elog(PANIC,
                         "The database cluster was initialized with CATALOG_VERSION_NO %d,\n"
-                        "\tbut the backend was compiled with CATALOG_VERSION_NO %d.\n"
+                  "\tbut the backend was compiled with CATALOG_VERSION_NO %d.\n"
                         "\tIt looks like you need to initdb.",
                         ControlFile->catalog_version_no, CATALOG_VERSION_NO);
        if (ControlFile->blcksz != BLCKSZ)
@@ -2221,7 +2222,7 @@ ReadControlFile(void)
 
        if (ControlFile->funcMaxArgs != FUNC_MAX_ARGS)
                elog(PANIC,
-                        "The database cluster was initialized with FUNC_MAX_ARGS %d,\n"
+                 "The database cluster was initialized with FUNC_MAX_ARGS %d,\n"
                         "\tbut the backend was compiled with FUNC_MAX_ARGS %d.\n"
                         "\tIt looks like you need to recompile or initdb.",
                         ControlFile->funcMaxArgs, FUNC_MAX_ARGS);
@@ -2235,21 +2236,21 @@ ReadControlFile(void)
 #else
        if (ControlFile->enableIntTimes != FALSE)
                elog(PANIC,
-                        "The database cluster was initialized with HAVE_INT64_TIMESTAMP\n"
-                        "\tbut the backend was compiled without HAVE_INT64_TIMESTAMP.\n"
+               "The database cluster was initialized with HAVE_INT64_TIMESTAMP\n"
+                "\tbut the backend was compiled without HAVE_INT64_TIMESTAMP.\n"
                         "\tIt looks like you need to recompile or initdb.");
 #endif
 
        if (ControlFile->localeBuflen != LOCALE_NAME_BUFLEN)
                elog(PANIC,
                         "The database cluster was initialized with LOCALE_NAME_BUFLEN %d,\n"
-                        "\tbut the backend was compiled with LOCALE_NAME_BUFLEN %d.\n"
+                  "\tbut the backend was compiled with LOCALE_NAME_BUFLEN %d.\n"
                         "\tIt looks like you need to initdb.",
                         ControlFile->localeBuflen, LOCALE_NAME_BUFLEN);
 
        if (setlocale(LC_COLLATE, ControlFile->lc_collate) == NULL)
                elog(PANIC,
-                        "The database cluster was initialized with LC_COLLATE '%s',\n"
+                  "The database cluster was initialized with LC_COLLATE '%s',\n"
                         "\twhich is not recognized by setlocale().\n"
                         "\tIt looks like you need to initdb.",
                         ControlFile->lc_collate);
@@ -3019,19 +3020,19 @@ CreateCheckPoint(bool shutdown)
        }
 
        /*
-        * Get UNDO record ptr - this is oldest of PGPROC->logRec values. We do
-        * this while holding insert lock to ensure that we won't miss any
+        * Get UNDO record ptr - this is oldest of PGPROC->logRec values. We
+        * do this while holding insert lock to ensure that we won't miss any
         * about-to-commit transactions (UNDO must include all xacts that have
         * commits after REDO point).
         *
         * XXX temporarily ifdef'd out to avoid three-way deadlock condition:
         * GetUndoRecPtr needs to grab SInvalLock to ensure that it is looking
-        * at a stable set of proc records, but grabbing SInvalLock while holding
-        * WALInsertLock is no good.  GetNewTransactionId may cause a WAL record
-        * to be written while holding XidGenLock, and GetSnapshotData needs to
-        * get XidGenLock while holding SInvalLock, so there's a risk of deadlock.
-        * Need to find a better solution.  See pgsql-hackers discussion of
-        * 17-Dec-01.
+        * at a stable set of proc records, but grabbing SInvalLock while
+        * holding WALInsertLock is no good.  GetNewTransactionId may cause a
+        * WAL record to be written while holding XidGenLock, and
+        * GetSnapshotData needs to get XidGenLock while holding SInvalLock,
+        * so there's a risk of deadlock. Need to find a better solution.  See
+        * pgsql-hackers discussion of 17-Dec-01.
         */
 #ifdef NOT_USED
        checkPoint.undo = GetUndoRecPtr();
@@ -3298,9 +3299,7 @@ assign_xlog_sync_method(const char *method, bool doit, bool interactive)
        }
 #endif
        else
-       {
                return NULL;
-       }
 
        if (!doit)
                return method;
index 28faa61..26e522f 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.140 2002/09/02 01:05:03 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.141 2002/09/04 20:31:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -191,7 +191,7 @@ usage(void)
 {
        fprintf(stderr,
                        gettext("Usage:\n"
-       "  postgres -boot [-d level] [-D datadir] [-F] [-o file] [-x num] dbname\n"
+                                       "  postgres -boot [-d level] [-D datadir] [-F] [-o file] [-x num] dbname\n"
                                        "  -d 1-5           debug mode\n"
                                        "  -D datadir       data directory\n"
                                        "  -F               turn off fsync\n"
@@ -235,9 +235,7 @@ BootstrapMain(int argc, char *argv[])
         * If we are running under the postmaster, this is done already.
         */
        if (!IsUnderPostmaster)
-       {
                MemoryContextInit();
-       }
 
        /*
         * process command arguments
@@ -260,18 +258,19 @@ BootstrapMain(int argc, char *argv[])
                                potential_DataDir = optarg;
                                break;
                        case 'd':
-                       {
-                               /* Turn on debugging for the bootstrap process. */
-                               char *debugstr = palloc(strlen("debug") + strlen(optarg) + 1);
-                               sprintf(debugstr, "debug%s", optarg);
-                               SetConfigOption("server_min_messages", debugstr,
-                                                               PGC_POSTMASTER, PGC_S_ARGV);
-                               SetConfigOption("client_min_messages", debugstr,
-                                                               PGC_POSTMASTER, PGC_S_ARGV);
-                               pfree(debugstr);
+                               {
+                                       /* Turn on debugging for the bootstrap process. */
+                                       char       *debugstr = palloc(strlen("debug") + strlen(optarg) + 1);
+
+                                       sprintf(debugstr, "debug%s", optarg);
+                                       SetConfigOption("server_min_messages", debugstr,
+                                                                       PGC_POSTMASTER, PGC_S_ARGV);
+                                       SetConfigOption("client_min_messages", debugstr,
+                                                                       PGC_POSTMASTER, PGC_S_ARGV);
+                                       pfree(debugstr);
+                                       break;
+                               }
                                break;
-                       }
-                       break;
                        case 'F':
                                SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV);
                                break;
@@ -391,7 +390,8 @@ BootstrapMain(int argc, char *argv[])
                                InitDummyProcess();             /* needed to get LWLocks */
                        CreateDummyCaches();
                        CreateCheckPoint(false);
-                       SetSavedRedoRecPtr(); /* pass redo ptr back to postmaster */
+                       SetSavedRedoRecPtr();           /* pass redo ptr back to
+                                                                                * postmaster */
                        proc_exit(0);           /* done */
 
                case BS_XLOG_STARTUP:
@@ -587,7 +587,7 @@ DefineAttr(char *name, char *type, int attnum)
 
        namestrcpy(&attrtypes[attnum]->attname, name);
        elog(DEBUG3, "column %s %s", NameStr(attrtypes[attnum]->attname), type);
-       attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
+       attrtypes[attnum]->attnum = 1 + attnum;         /* fillatt */
 
        typeoid = gettype(type);
 
@@ -640,14 +640,15 @@ DefineAttr(char *name, char *type, int attnum)
        }
        attrtypes[attnum]->attcacheoff = -1;
        attrtypes[attnum]->atttypmod = -1;
+
        /*
-        * Mark as "not null" if type is fixed-width and prior columns are too.
-        * This corresponds to case where column can be accessed directly via
-        * C struct declaration.
+        * Mark as "not null" if type is fixed-width and prior columns are
+        * too. This corresponds to case where column can be accessed directly
+        * via C struct declaration.
         */
        if (attlen > 0)
        {
-               int             i;
+               int                     i;
 
                for (i = 0; i < attnum; i++)
                {
@@ -829,7 +830,7 @@ cleanup()
  * and not an OID at all, until the first reference to a type not known in
  * Procid[].  At that point it will read and cache pg_type in the Typ array,
  * and subsequently return a real OID (and set the global pointer Ap to
- * point at the found row in Typ).  So caller must check whether Typ is
+ * point at the found row in Typ).     So caller must check whether Typ is
  * still NULL to determine what the return value is!
  * ----------------
  */
index ea3131b..56c9a4f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.76 2002/09/02 01:05:03 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.77 2002/09/04 20:31:13 momjian Exp $
  *
  * NOTES
  *       See acl.h.
@@ -91,22 +91,25 @@ merge_acl_with_grant(Acl *old_acl, bool is_grant,
        foreach(j, grantees)
        {
                PrivGrantee *grantee = (PrivGrantee *) lfirst(j);
-               AclItem         aclitem;
+               AclItem aclitem;
                uint32          idtype;
 
                if (grantee->username)
                {
-                       aclitem.ai_id = get_usesysid(grantee->username);
+                       aclitem.        ai_id = get_usesysid(grantee->username);
+
                        idtype = ACL_IDTYPE_UID;
                }
                else if (grantee->groupname)
                {
-                       aclitem.ai_id = get_grosysid(grantee->groupname);
+                       aclitem.        ai_id = get_grosysid(grantee->groupname);
+
                        idtype = ACL_IDTYPE_GID;
                }
                else
                {
-                       aclitem.ai_id = ACL_ID_WORLD;
+                       aclitem.        ai_id = ACL_ID_WORLD;
+
                        idtype = ACL_IDTYPE_WORLD;
                }
 
@@ -376,7 +379,7 @@ ExecuteGrantStmt_Function(GrantStmt *stmt)
                char            replaces[Natts_pg_proc];
 
                oid = LookupFuncNameTypeNames(func->funcname, func->funcargs,
-                                                                         stmt->is_grant ? "GRANT" : "REVOKE");
+                                                                       stmt->is_grant ? "GRANT" : "REVOKE");
 
                relation = heap_openr(ProcedureRelationName, RowExclusiveLock);
                tuple = SearchSysCache(PROCOID,
@@ -569,8 +572,8 @@ ExecuteGrantStmt_Namespace(GrantStmt *stmt)
                        aclcheck_error(ACLCHECK_NOT_OWNER, nspname);
 
                /*
-                * If there's no ACL, create a default using the pg_namespace.nspowner
-                * field.
+                * If there's no ACL, create a default using the
+                * pg_namespace.nspowner field.
                 */
                aclDatum = SysCacheGetAttr(NAMESPACENAME, tuple,
                                                                   Anum_pg_namespace_nspacl,
@@ -1163,8 +1166,8 @@ pg_namespace_aclcheck(Oid nsp_oid, Oid userid, AclMode mode)
        Acl                *acl;
 
        /*
-        * If we have been assigned this namespace as a temp namespace,
-        * assume we have all grantable privileges on it.
+        * If we have been assigned this namespace as a temp namespace, assume
+        * we have all grantable privileges on it.
         */
        if (isTempNamespace(nsp_oid))
                return ACLCHECK_OK;
index 4c45787..2792d27 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.47 2002/06/20 20:29:26 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.48 2002/09/04 20:31:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -91,8 +91,8 @@ GetDatabasePath(Oid tblNode)
 bool
 IsSystemRelation(Relation relation)
 {
-       return  IsSystemNamespace(RelationGetNamespace(relation)) ||
-                       IsToastNamespace(RelationGetNamespace(relation));
+       return IsSystemNamespace(RelationGetNamespace(relation)) ||
+               IsToastNamespace(RelationGetNamespace(relation));
 }
 
 /*
@@ -104,10 +104,10 @@ IsSystemRelation(Relation relation)
 bool
 IsSystemClass(Form_pg_class reltuple)
 {
-       Oid             relnamespace = reltuple->relnamespace;
+       Oid                     relnamespace = reltuple->relnamespace;
 
-       return  IsSystemNamespace(relnamespace) ||
-                       IsToastNamespace(relnamespace);
+       return IsSystemNamespace(relnamespace) ||
+               IsToastNamespace(relnamespace);
 }
 
 /*
@@ -129,9 +129,9 @@ IsToastRelation(Relation relation)
 bool
 IsToastClass(Form_pg_class reltuple)
 {
-       Oid             relnamespace = reltuple->relnamespace;
+       Oid                     relnamespace = reltuple->relnamespace;
 
-       return  IsToastNamespace(relnamespace);
+       return IsToastNamespace(relnamespace);
 }
 
 /*
index d51c8d5..8fb977e 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.8 2002/08/02 18:15:05 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/dependency.c,v 1.9 2002/09/04 20:31:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -69,46 +69,46 @@ typedef enum ObjectClasses
 /* expansible list of ObjectAddresses */
 typedef struct ObjectAddresses
 {
-       ObjectAddress  *refs;           /* => palloc'd array */
-       int                             numrefs;        /* current number of references */
-       int                             maxrefs;        /* current size of palloc'd array */
-       struct ObjectAddresses *link; /* list link for use in recursion */
+       ObjectAddress *refs;            /* => palloc'd array */
+       int                     numrefs;                /* current number of references */
+       int                     maxrefs;                /* current size of palloc'd array */
+       struct ObjectAddresses *link;           /* list link for use in recursion */
 } ObjectAddresses;
 
 /* for find_expr_references_walker */
 typedef struct
 {
-       ObjectAddresses addrs;          /* addresses being accumulated */
-       List               *rtables;    /* list of rangetables to resolve Vars */
+       ObjectAddresses addrs;          /* addresses being accumulated */
+       List       *rtables;            /* list of rangetables to resolve Vars */
 } find_expr_references_context;
 
 
 /*
  * Because not all system catalogs have predetermined OIDs, we build a table
- * mapping between ObjectClasses and OIDs.  This is done at most once per
+ * mapping between ObjectClasses and OIDs.     This is done at most once per
  * backend run, to minimize lookup overhead.
  */
-static bool    object_classes_initialized = false;
+static bool object_classes_initialized = false;
 static Oid     object_classes[MAX_OCLASS];
 
 
 static bool recursiveDeletion(const ObjectAddress *object,
-                                                         DropBehavior behavior,
-                                                         const ObjectAddress *callingObject,
-                                                         ObjectAddresses *pending,
-                                                         Relation depRel);
+                                 DropBehavior behavior,
+                                 const ObjectAddress *callingObject,
+                                 ObjectAddresses *pending,
+                                 Relation depRel);
 static void doDeletion(const ObjectAddress *object);
 static bool find_expr_references_walker(Node *node,
-                                                                               find_expr_references_context *context);
+                                                       find_expr_references_context *context);
 static void eliminate_duplicate_dependencies(ObjectAddresses *addrs);
 static int     object_address_comparator(const void *a, const void *b);
 static void init_object_addresses(ObjectAddresses *addrs);
 static void add_object_address(ObjectClasses oclass, Oid objectId, int32 subId,
-                                                          ObjectAddresses *addrs);
+                                  ObjectAddresses *addrs);
 static void add_exact_object_address(const ObjectAddress *object,
-                                                                        ObjectAddresses *addrs);
+                                                ObjectAddresses *addrs);
 static void del_object_address(const ObjectAddress *object,
-                                                          ObjectAddresses *addrs);
+                                  ObjectAddresses *addrs);
 static void del_object_address_by_index(int index, ObjectAddresses *addrs);
 static void term_object_addresses(ObjectAddresses *addrs);
 static void init_object_classes(void);
@@ -131,12 +131,12 @@ void
 performDeletion(const ObjectAddress *object,
                                DropBehavior behavior)
 {
-       char               *objDescription;
-       Relation                depRel;
+       char       *objDescription;
+       Relation        depRel;
 
        /*
-        * Get object description for possible use in failure message.
-        * Must do this before deleting it ...
+        * Get object description for possible use in failure message. Must do
+        * this before deleting it ...
         */
        objDescription = getObjectDescription(object);
 
@@ -165,7 +165,7 @@ performDeletion(const ObjectAddress *object,
  * callingObject is NULL at the outer level, else identifies the object that
  * we recursed from (the reference object that someone else needs to delete).
  * pending is a linked list of objects that outer recursion levels want to
- * delete.  We remove the target object from any outer-level list it may
+ * delete.     We remove the target object from any outer-level list it may
  * appear in.
  * depRel is the already-open pg_depend relation.
  *
@@ -178,7 +178,7 @@ performDeletion(const ObjectAddress *object,
  * This is even more complex than one could wish, because it is possible for
  * the same pair of objects to be related by both NORMAL and AUTO (or IMPLICIT)
  * dependencies.  (Since one or both paths might be indirect, it's very hard
- * to prevent this; we must cope instead.)  If there is an AUTO/IMPLICIT
+ * to prevent this; we must cope instead.)     If there is an AUTO/IMPLICIT
  * deletion path then we should perform the deletion, and not fail because
  * of the NORMAL dependency.  So, when we hit a NORMAL dependency we don't
  * immediately decide we've failed; instead we stick the NORMAL dependent
@@ -191,7 +191,7 @@ performDeletion(const ObjectAddress *object,
  *
  * Note: in the case where the AUTO path is traversed first, we will never
  * see the NORMAL dependency path because of the pg_depend removals done in
- * recursive executions of step 1.  The pending list is necessary essentially
+ * recursive executions of step 1.     The pending list is necessary essentially
  * just to make the behavior independent of the order in which pg_depend
  * entries are visited.
  */
@@ -202,16 +202,16 @@ recursiveDeletion(const ObjectAddress *object,
                                  ObjectAddresses *pending,
                                  Relation depRel)
 {
-       bool                    ok = true;
-       char               *objDescription;
-       ObjectAddresses mypending;
-       ScanKeyData             key[3];
-       int                             nkeys;
-       SysScanDesc             scan;
-       HeapTuple               tup;
-       ObjectAddress   otherObject;
-       ObjectAddress   owningObject;
-       bool                    amOwned = false;
+       bool            ok = true;
+       char       *objDescription;
+       ObjectAddresses mypending;
+       ScanKeyData key[3];
+       int                     nkeys;
+       SysScanDesc scan;
+       HeapTuple       tup;
+       ObjectAddress otherObject;
+       ObjectAddress owningObject;
+       bool            amOwned = false;
 
        /*
         * Get object description for possible use in messages.  Must do this
@@ -231,8 +231,8 @@ recursiveDeletion(const ObjectAddress *object,
         * ensures that we avoid infinite recursion in the case of cycles.
         * Also, some dependency types require extra processing here.
         *
-        * When dropping a whole object (subId = 0), remove all pg_depend
-        * records for its sub-objects too.
+        * When dropping a whole object (subId = 0), remove all pg_depend records
+        * for its sub-objects too.
         */
        ScanKeyEntryInitialize(&key[0], 0x0,
                                                   Anum_pg_depend_classid, F_OIDEQ,
@@ -255,7 +255,7 @@ recursiveDeletion(const ObjectAddress *object,
 
        while (HeapTupleIsValid(tup = systable_getnext(scan)))
        {
-               Form_pg_depend  foundDep = (Form_pg_depend) GETSTRUCT(tup);
+               Form_pg_depend foundDep = (Form_pg_depend) GETSTRUCT(tup);
 
                otherObject.classId = foundDep->refclassid;
                otherObject.objectId = foundDep->refobjid;
@@ -268,9 +268,10 @@ recursiveDeletion(const ObjectAddress *object,
                                /* no problem */
                                break;
                        case DEPENDENCY_INTERNAL:
+
                                /*
-                                * This object is part of the internal implementation
-                                * of another object.  We have three cases:
+                                * This object is part of the internal implementation of
+                                * another object.      We have three cases:
                                 *
                                 * 1. At the outermost recursion level, disallow the DROP.
                                 * (We just elog here, rather than considering this drop
@@ -279,30 +280,32 @@ recursiveDeletion(const ObjectAddress *object,
                                 */
                                if (callingObject == NULL)
                                {
-                                       char *otherObjDesc = getObjectDescription(&otherObject);
+                                       char       *otherObjDesc = getObjectDescription(&otherObject);
 
                                        elog(ERROR, "Cannot drop %s because %s requires it"
                                                 "\n\tYou may drop %s instead",
                                                 objDescription, otherObjDesc, otherObjDesc);
                                }
+
                                /*
-                                * 2. When recursing from the other end of this dependency,
-                                * it's okay to continue with the deletion.  This holds when
-                                * recursing from a whole object that includes the nominal
-                                * other end as a component, too.
+                                * 2. When recursing from the other end of this
+                                * dependency, it's okay to continue with the deletion.
+                                * This holds when recursing from a whole object that
+                                * includes the nominal other end as a component, too.
                                 */
                                if (callingObject->classId == otherObject.classId &&
                                        callingObject->objectId == otherObject.objectId &&
-                                       (callingObject->objectSubId == otherObject.objectSubId ||
-                                        callingObject->objectSubId == 0))
+                               (callingObject->objectSubId == otherObject.objectSubId ||
+                                callingObject->objectSubId == 0))
                                        break;
+
                                /*
                                 * 3. When recursing from anyplace else, transform this
                                 * deletion request into a delete of the other object.
-                                * (This will be an error condition iff RESTRICT mode.)
-                                * In this case we finish deleting my dependencies except
-                                * for the INTERNAL link, which will be needed to cause
-                                * the owning object to recurse back to me.
+                                * (This will be an error condition iff RESTRICT mode.) In
+                                * this case we finish deleting my dependencies except for
+                                * the INTERNAL link, which will be needed to cause the
+                                * owning object to recurse back to me.
                                 */
                                if (amOwned)    /* shouldn't happen */
                                        elog(ERROR, "recursiveDeletion: multiple INTERNAL dependencies for %s",
@@ -312,6 +315,7 @@ recursiveDeletion(const ObjectAddress *object,
                                /* "continue" bypasses the simple_heap_delete call below */
                                continue;
                        case DEPENDENCY_PIN:
+
                                /*
                                 * Should not happen; PIN dependencies should have zeroes
                                 * in the depender fields...
@@ -331,10 +335,10 @@ recursiveDeletion(const ObjectAddress *object,
        systable_endscan(scan);
 
        /*
-        * CommandCounterIncrement here to ensure that preceding changes
-        * are all visible; in particular, that the above deletions of pg_depend
-        * entries are visible.  That prevents infinite recursion in case of
-        * dependency loop (which is perfectly legal).
+        * CommandCounterIncrement here to ensure that preceding changes are
+        * all visible; in particular, that the above deletions of pg_depend
+        * entries are visible.  That prevents infinite recursion in case of a
+        * dependency loop (which is perfectly legal).
         */
        CommandCounterIncrement();
 
@@ -368,21 +372,21 @@ recursiveDeletion(const ObjectAddress *object,
 
        /*
         * Step 2: scan pg_depend records that link to this object, showing
-        * the things that depend on it.  Recursively delete those things.
-        * (We don't delete the pg_depend records here, as the recursive call
-        * will do that.)  Note it's important to delete the dependent objects
+        * the things that depend on it.  Recursively delete those things. (We
+        * don't delete the pg_depend records here, as the recursive call will
+        * do that.)  Note it's important to delete the dependent objects
         * before the referenced one, since the deletion routines might do
-        * things like try to update the pg_class record when deleting a
-        * check constraint.
+        * things like try to update the pg_class record when deleting a check
+        * constraint.
         *
         * Again, when dropping a whole object (subId = 0), find pg_depend
         * records for its sub-objects too.
         *
         * NOTE: because we are using SnapshotNow, if a recursive call deletes
-        * any pg_depend tuples that our scan hasn't yet visited, we will not see
-        * them as good when we do visit them.  This is essential for correct
-        * behavior if there are multiple dependency paths between two objects
-        * --- else we might try to delete an already-deleted object.
+        * any pg_depend tuples that our scan hasn't yet visited, we will not
+        * see them as good when we do visit them.      This is essential for
+        * correct behavior if there are multiple dependency paths between two
+        * objects --- else we might try to delete an already-deleted object.
         */
        ScanKeyEntryInitialize(&key[0], 0x0,
                                                   Anum_pg_depend_refclassid, F_OIDEQ,
@@ -405,7 +409,7 @@ recursiveDeletion(const ObjectAddress *object,
 
        while (HeapTupleIsValid(tup = systable_getnext(scan)))
        {
-               Form_pg_depend  foundDep = (Form_pg_depend) GETSTRUCT(tup);
+               Form_pg_depend foundDep = (Form_pg_depend) GETSTRUCT(tup);
 
                otherObject.classId = foundDep->classid;
                otherObject.objectId = foundDep->objid;
@@ -418,9 +422,9 @@ recursiveDeletion(const ObjectAddress *object,
                                {
                                        /*
                                         * We've found a restricted object (or at least one
-                                        * that's not deletable along this path).  Log for later
-                                        * processing.  (Note it's okay if the same object gets
-                                        * into mypending multiple times.)
+                                        * that's not deletable along this path).  Log for
+                                        * later processing.  (Note it's okay if the same
+                                        * object gets into mypending multiple times.)
                                         */
                                        add_exact_object_address(&otherObject, &mypending);
                                }
@@ -437,6 +441,7 @@ recursiveDeletion(const ObjectAddress *object,
                                break;
                        case DEPENDENCY_AUTO:
                        case DEPENDENCY_INTERNAL:
+
                                /*
                                 * We propagate the DROP without complaint even in the
                                 * RESTRICT case.  (However, normal dependencies on the
@@ -451,6 +456,7 @@ recursiveDeletion(const ObjectAddress *object,
                                        ok = false;
                                break;
                        case DEPENDENCY_PIN:
+
                                /*
                                 * For a PIN dependency we just elog immediately; there
                                 * won't be any others to report.
@@ -469,19 +475,19 @@ recursiveDeletion(const ObjectAddress *object,
 
        /*
         * If we found no restricted objects, or got rid of them all via other
-        * paths, we're in good shape.  Otherwise continue step 2 by processing
-        * the remaining restricted objects.
+        * paths, we're in good shape.  Otherwise continue step 2 by
+        * processing the remaining restricted objects.
         */
        if (mypending.numrefs > 0)
        {
                /*
-                * Successively extract and delete each remaining object.
-                * Note that the right things will happen if some of these objects
+                * Successively extract and delete each remaining object. Note
+                * that the right things will happen if some of these objects
                 * depend on others: we'll report/delete each one exactly once.
                 */
                while (mypending.numrefs > 0)
                {
-                       ObjectAddress   otherObject = mypending.refs[0];
+                       ObjectAddress otherObject = mypending.refs[0];
 
                        del_object_address_by_index(0, &mypending);
 
@@ -508,19 +514,21 @@ recursiveDeletion(const ObjectAddress *object,
        doDeletion(object);
 
        /*
-        * Delete any comments associated with this object.  (This is a convenient
-        * place to do it instead of having every object type know to do it.)
+        * Delete any comments associated with this object.  (This is a
+        * convenient place to do it instead of having every object type know
+        * to do it.)
         */
        DeleteComments(object->objectId, object->classId, object->objectSubId);
 
        /*
-        * If this object is mentioned in any caller's pending list, remove it.
+        * If this object is mentioned in any caller's pending list, remove
+        * it.
         */
        del_object_address(object, pending);
 
        /*
-        * CommandCounterIncrement here to ensure that preceding changes
-        * are all visible.
+        * CommandCounterIncrement here to ensure that preceding changes are
+        * all visible.
         */
        CommandCounterIncrement();
 
@@ -543,37 +551,37 @@ doDeletion(const ObjectAddress *object)
        switch (getObjectClass(object))
        {
                case OCLASS_CLASS:
-               {
-                       HeapTuple       relTup;
-                       char            relKind;
-
-                       /*
-                        * Need the relkind to figure out how to drop.
-                        */
-                       relTup = SearchSysCache(RELOID,
-                                                                       ObjectIdGetDatum(object->objectId),
-                                                                       0, 0, 0);
-                       if (!HeapTupleIsValid(relTup))
-                               elog(ERROR, "doDeletion: Relation %u does not exist",
-                                        object->objectId);
-                       relKind = ((Form_pg_class) GETSTRUCT(relTup))->relkind;
-                       ReleaseSysCache(relTup);
-
-                       if (relKind == RELKIND_INDEX)
-                       {
-                               Assert(object->objectSubId == 0);
-                               index_drop(object->objectId);
-                       }
-                       else
                        {
-                               if (object->objectSubId != 0)
-                                       RemoveAttributeById(object->objectId,
-                                                                               object->objectSubId);
+                               HeapTuple       relTup;
+                               char            relKind;
+
+                               /*
+                                * Need the relkind to figure out how to drop.
+                                */
+                               relTup = SearchSysCache(RELOID,
+                                                                         ObjectIdGetDatum(object->objectId),
+                                                                               0, 0, 0);
+                               if (!HeapTupleIsValid(relTup))
+                                       elog(ERROR, "doDeletion: Relation %u does not exist",
+                                                object->objectId);
+                               relKind = ((Form_pg_class) GETSTRUCT(relTup))->relkind;
+                               ReleaseSysCache(relTup);
+
+                               if (relKind == RELKIND_INDEX)
+                               {
+                                       Assert(object->objectSubId == 0);
+                                       index_drop(object->objectId);
+                               }
                                else
-                                       heap_drop_with_catalog(object->objectId);
+                               {
+                                       if (object->objectSubId != 0)
+                                               RemoveAttributeById(object->objectId,
+                                                                                       object->objectSubId);
+                                       else
+                                               heap_drop_with_catalog(object->objectId);
+                               }
+                               break;
                        }
-                       break;
-               }
 
                case OCLASS_PROC:
                        RemoveFunctionById(object->objectId);
@@ -644,7 +652,7 @@ doDeletion(const ObjectAddress *object)
  * It can be NIL if no such variables are expected.
  *
  * XXX is it important to create dependencies on the datatypes mentioned in
- * the expression?  In most cases this would be redundant (eg, a ref to an
+ * the expression?     In most cases this would be redundant (eg, a ref to an
  * operator indirectly references its input and output datatypes), but I'm
  * not quite convinced there are no cases where we need it.
  */
@@ -653,7 +661,7 @@ recordDependencyOnExpr(const ObjectAddress *depender,
                                           Node *expr, List *rtable,
                                           DependencyType behavior)
 {
-       find_expr_references_context    context;
+       find_expr_references_context context;
 
        init_object_addresses(&context.addrs);
 
@@ -755,8 +763,8 @@ find_expr_references_walker(Node *node,
                bool            result;
 
                /*
-                * Add whole-relation refs for each plain relation mentioned in the
-                * subquery's rtable.  (Note: query_tree_walker takes care of
+                * Add whole-relation refs for each plain relation mentioned in
+                * the subquery's rtable.  (Note: query_tree_walker takes care of
                 * recursing into RTE_FUNCTION and RTE_SUBQUERY RTEs, so no need
                 * to do that here.)
                 */
@@ -787,7 +795,7 @@ find_expr_references_walker(Node *node,
 static void
 eliminate_duplicate_dependencies(ObjectAddresses *addrs)
 {
-       ObjectAddress  *priorobj;
+       ObjectAddress *priorobj;
        int                     oldref,
                                newrefs;
 
@@ -803,13 +811,14 @@ eliminate_duplicate_dependencies(ObjectAddresses *addrs)
        newrefs = 1;
        for (oldref = 1; oldref < addrs->numrefs; oldref++)
        {
-               ObjectAddress  *thisobj = addrs->refs + oldref;
+               ObjectAddress *thisobj = addrs->refs + oldref;
 
                if (priorobj->classId == thisobj->classId &&
                        priorobj->objectId == thisobj->objectId)
                {
                        if (priorobj->objectSubId == thisobj->objectSubId)
                                continue;               /* identical, so drop thisobj */
+
                        /*
                         * If we have a whole-object reference and a reference to a
                         * part of the same object, we don't need the whole-object
@@ -852,9 +861,10 @@ object_address_comparator(const void *a, const void *b)
                return -1;
        if (obja->objectId > objb->objectId)
                return 1;
+
        /*
-        * We sort the subId as an unsigned int so that 0 will come first.
-        * See logic in eliminate_duplicate_dependencies.
+        * We sort the subId as an unsigned int so that 0 will come first. See
+        * logic in eliminate_duplicate_dependencies.
         */
        if ((unsigned int) obja->objectSubId < (unsigned int) objb->objectSubId)
                return -1;
@@ -894,7 +904,7 @@ static void
 add_object_address(ObjectClasses oclass, Oid objectId, int32 subId,
                                   ObjectAddresses *addrs)
 {
-       ObjectAddress  *item;
+       ObjectAddress *item;
 
        /* enlarge array if needed */
        if (addrs->numrefs >= addrs->maxrefs)
@@ -920,7 +930,7 @@ static void
 add_exact_object_address(const ObjectAddress *object,
                                                 ObjectAddresses *addrs)
 {
-       ObjectAddress  *item;
+       ObjectAddress *item;
 
        /* enlarge array if needed */
        if (addrs->numrefs >= addrs->maxrefs)
@@ -937,7 +947,7 @@ add_exact_object_address(const ObjectAddress *object,
 
 /*
  * If an ObjectAddresses array contains any matches for the given object,
- * remove it/them.  Also, do the same in any linked ObjectAddresses arrays.
+ * remove it/them.     Also, do the same in any linked ObjectAddresses arrays.
  */
 static void
 del_object_address(const ObjectAddress *object,
@@ -948,9 +958,9 @@ del_object_address(const ObjectAddress *object,
                int                     i;
 
                /* Scan backwards to simplify deletion logic. */
-               for (i = addrs->numrefs-1; i >= 0; i--)
+               for (i = addrs->numrefs - 1; i >= 0; i--)
                {
-                       ObjectAddress  *thisobj = addrs->refs + i;
+                       ObjectAddress *thisobj = addrs->refs + i;
 
                        if (object->classId == thisobj->classId &&
                                object->objectId == thisobj->objectId)
@@ -1134,150 +1144,150 @@ getObjectDescription(const ObjectAddress *object)
                        break;
 
                case OCLASS_CAST:
-               {
-                       Relation                castDesc;
-                       ScanKeyData             skey[1];
-                       SysScanDesc             rcscan;
-                       HeapTuple               tup;
-                       Form_pg_cast    castForm;
+                       {
+                               Relation        castDesc;
+                               ScanKeyData skey[1];
+                               SysScanDesc rcscan;
+                               HeapTuple       tup;
+                               Form_pg_cast castForm;
 
-                       castDesc = heap_openr(CastRelationName, AccessShareLock);
+                               castDesc = heap_openr(CastRelationName, AccessShareLock);
 
-                       ScanKeyEntryInitialize(&skey[0], 0x0,
-                                                                  ObjectIdAttributeNumber, F_OIDEQ,
-                                                                  ObjectIdGetDatum(object->objectId));
+                               ScanKeyEntryInitialize(&skey[0], 0x0,
+                                                                          ObjectIdAttributeNumber, F_OIDEQ,
+                                                                        ObjectIdGetDatum(object->objectId));
 
-                       rcscan = systable_beginscan(castDesc, CastOidIndex, true,
-                                                                               SnapshotNow, 1, skey);
+                               rcscan = systable_beginscan(castDesc, CastOidIndex, true,
+                                                                                       SnapshotNow, 1, skey);
 
-                       tup = systable_getnext(rcscan);
+                               tup = systable_getnext(rcscan);
 
-                       if (!HeapTupleIsValid(tup))
-                               elog(ERROR, "getObjectDescription: Cast %u does not exist",
-                                        object->objectId);
+                               if (!HeapTupleIsValid(tup))
+                                       elog(ERROR, "getObjectDescription: Cast %u does not exist",
+                                                object->objectId);
 
-                       castForm = (Form_pg_cast) GETSTRUCT(tup);
+                               castForm = (Form_pg_cast) GETSTRUCT(tup);
 
-                       appendStringInfo(&buffer, "cast from %s to %s",
-                                                        format_type_be(castForm->castsource),
-                                                        format_type_be(castForm->casttarget));
+                               appendStringInfo(&buffer, "cast from %s to %s",
+                                                                format_type_be(castForm->castsource),
+                                                                format_type_be(castForm->casttarget));
 
-                       systable_endscan(rcscan);
-                       heap_close(castDesc, AccessShareLock);
-                       break;
-               }
+                               systable_endscan(rcscan);
+                               heap_close(castDesc, AccessShareLock);
+                               break;
+                       }
 
                case OCLASS_CONSTRAINT:
-               {
-                       Relation                conDesc;
-                       ScanKeyData             skey[1];
-                       SysScanDesc             rcscan;
-                       HeapTuple               tup;
-                       Form_pg_constraint con;
+                       {
+                               Relation        conDesc;
+                               ScanKeyData skey[1];
+                               SysScanDesc rcscan;
+                               HeapTuple       tup;
+                               Form_pg_constraint con;
 
-                       conDesc = heap_openr(ConstraintRelationName, AccessShareLock);
+                               conDesc = heap_openr(ConstraintRelationName, AccessShareLock);
 
-                       ScanKeyEntryInitialize(&skey[0], 0x0,
-                                                                  ObjectIdAttributeNumber, F_OIDEQ,
-                                                                  ObjectIdGetDatum(object->objectId));
+                               ScanKeyEntryInitialize(&skey[0], 0x0,
+                                                                          ObjectIdAttributeNumber, F_OIDEQ,
+                                                                        ObjectIdGetDatum(object->objectId));
 
-                       rcscan = systable_beginscan(conDesc, ConstraintOidIndex, true,
-                                                                               SnapshotNow, 1, skey);
+                               rcscan = systable_beginscan(conDesc, ConstraintOidIndex, true,
+                                                                                       SnapshotNow, 1, skey);
 
-                       tup = systable_getnext(rcscan);
+                               tup = systable_getnext(rcscan);
 
-                       if (!HeapTupleIsValid(tup))
-                               elog(ERROR, "getObjectDescription: Constraint %u does not exist",
-                                        object->objectId);
+                               if (!HeapTupleIsValid(tup))
+                                       elog(ERROR, "getObjectDescription: Constraint %u does not exist",
+                                                object->objectId);
 
-                       con = (Form_pg_constraint) GETSTRUCT(tup);
+                               con = (Form_pg_constraint) GETSTRUCT(tup);
 
-                       if (OidIsValid(con->conrelid))
-                       {
-                               appendStringInfo(&buffer, "constraint %s on ",
-                                                                NameStr(con->conname));
-                               getRelationDescription(&buffer, con->conrelid);
-                       }
-                       else
-                       {
-                               appendStringInfo(&buffer, "constraint %s",
-                                                                NameStr(con->conname));
-                       }
+                               if (OidIsValid(con->conrelid))
+                               {
+                                       appendStringInfo(&buffer, "constraint %s on ",
+                                                                        NameStr(con->conname));
+                                       getRelationDescription(&buffer, con->conrelid);
+                               }
+                               else
+                               {
+                                       appendStringInfo(&buffer, "constraint %s",
+                                                                        NameStr(con->conname));
+                               }
 
-                       systable_endscan(rcscan);
-                       heap_close(conDesc, AccessShareLock);
-                       break;
-               }
+                               systable_endscan(rcscan);
+                               heap_close(conDesc, AccessShareLock);
+                               break;
+                       }
 
                case OCLASS_CONVERSION:
-               {
-                       HeapTuple               conTup;
-
-                       conTup = SearchSysCache(CONOID,
-                                                                        ObjectIdGetDatum(object->objectId),
-                                                                        0, 0, 0);
-                       if (!HeapTupleIsValid(conTup))
-                               elog(ERROR, "getObjectDescription: Conversion %u does not exist",
-                                        object->objectId);
-                       appendStringInfo(&buffer, "conversion %s",
-                                                        NameStr(((Form_pg_conversion) GETSTRUCT(conTup))->conname));
-                       ReleaseSysCache(conTup);
-                       break;
-               }
+                       {
+                               HeapTuple       conTup;
+
+                               conTup = SearchSysCache(CONOID,
+                                                                         ObjectIdGetDatum(object->objectId),
+                                                                               0, 0, 0);
+                               if (!HeapTupleIsValid(conTup))
+                                       elog(ERROR, "getObjectDescription: Conversion %u does not exist",
+                                                object->objectId);
+                               appendStringInfo(&buffer, "conversion %s",
+                                                                NameStr(((Form_pg_conversion) GETSTRUCT(conTup))->conname));
+                               ReleaseSysCache(conTup);
+                               break;
+                       }
 
                case OCLASS_DEFAULT:
-               {
-                       Relation                attrdefDesc;
-                       ScanKeyData             skey[1];
-                       SysScanDesc             adscan;
-                       HeapTuple               tup;
-                       Form_pg_attrdef attrdef;
-                       ObjectAddress   colobject;
+                       {
+                               Relation        attrdefDesc;
+                               ScanKeyData skey[1];
+                               SysScanDesc adscan;
+                               HeapTuple       tup;
+                               Form_pg_attrdef attrdef;
+                               ObjectAddress colobject;
 
-                       attrdefDesc = heap_openr(AttrDefaultRelationName, AccessShareLock);
+                               attrdefDesc = heap_openr(AttrDefaultRelationName, AccessShareLock);
 
-                       ScanKeyEntryInitialize(&skey[0], 0x0,
-                                                                  ObjectIdAttributeNumber, F_OIDEQ,
-                                                                  ObjectIdGetDatum(object->objectId));
+                               ScanKeyEntryInitialize(&skey[0], 0x0,
+                                                                          ObjectIdAttributeNumber, F_OIDEQ,
+                                                                        ObjectIdGetDatum(object->objectId));
 
-                       adscan = systable_beginscan(attrdefDesc, AttrDefaultOidIndex, true,
-                                                                               SnapshotNow, 1, skey);
+                               adscan = systable_beginscan(attrdefDesc, AttrDefaultOidIndex, true,
+                                                                                       SnapshotNow, 1, skey);
 
-                       tup = systable_getnext(adscan);
+                               tup = systable_getnext(adscan);
 
-                       if (!HeapTupleIsValid(tup))
-                               elog(ERROR, "getObjectDescription: Default %u does not exist",
-                                        object->objectId);
+                               if (!HeapTupleIsValid(tup))
+                                       elog(ERROR, "getObjectDescription: Default %u does not exist",
+                                                object->objectId);
 
-                       attrdef = (Form_pg_attrdef) GETSTRUCT(tup);
+                               attrdef = (Form_pg_attrdef) GETSTRUCT(tup);
 
-                       colobject.classId = RelOid_pg_class;
-                       colobject.objectId = attrdef->adrelid;
-                       colobject.objectSubId = attrdef->adnum;
+                               colobject.classId = RelOid_pg_class;
+                               colobject.objectId = attrdef->adrelid;
+                               colobject.objectSubId = attrdef->adnum;
 
-                       appendStringInfo(&buffer, "default for %s",
-                                                        getObjectDescription(&colobject));
+                               appendStringInfo(&buffer, "default for %s",
+                                                                getObjectDescription(&colobject));
 
-                       systable_endscan(adscan);
-                       heap_close(attrdefDesc, AccessShareLock);
-                       break;
-               }
+                               systable_endscan(adscan);
+                               heap_close(attrdefDesc, AccessShareLock);
+                               break;
+                       }
 
                case OCLASS_LANGUAGE:
-               {
-                       HeapTuple               langTup;
-
-                       langTup = SearchSysCache(LANGOID,
-                                                                        ObjectIdGetDatum(object->objectId),
-                                                                        0, 0, 0);
-                       if (!HeapTupleIsValid(langTup))
-                               elog(ERROR, "getObjectDescription: Language %u does not exist",
-                                        object->objectId);
-                       appendStringInfo(&buffer, "language %s",
-                                                        NameStr(((Form_pg_language) GETSTRUCT(langTup))->lanname));
-                       ReleaseSysCache(langTup);
-                       break;
-               }
+                       {
+                               HeapTuple       langTup;
+
+                               langTup = SearchSysCache(LANGOID,
+                                                                         ObjectIdGetDatum(object->objectId),
+                                                                                0, 0, 0);
+                               if (!HeapTupleIsValid(langTup))
+                                       elog(ERROR, "getObjectDescription: Language %u does not exist",
+                                                object->objectId);
+                               appendStringInfo(&buffer, "language %s",
+                                                                NameStr(((Form_pg_language) GETSTRUCT(langTup))->lanname));
+                               ReleaseSysCache(langTup);
+                               break;
+                       }
 
                case OCLASS_OPERATOR:
                        appendStringInfo(&buffer, "operator %s",
@@ -1285,126 +1295,126 @@ getObjectDescription(const ObjectAddress *object)
                        break;
 
                case OCLASS_OPCLASS:
-               {
-                       HeapTuple       opcTup;
-                       Form_pg_opclass opcForm;
-                       HeapTuple       amTup;
-                       Form_pg_am      amForm;
-                       char       *nspname;
-
-                       opcTup = SearchSysCache(CLAOID,
-                                                                       ObjectIdGetDatum(object->objectId),
-                                                                       0, 0, 0);
-                       if (!HeapTupleIsValid(opcTup))
-                               elog(ERROR, "cache lookup of opclass %u failed",
-                                        object->objectId);
-                       opcForm = (Form_pg_opclass) GETSTRUCT(opcTup);
-
-                       /* Qualify the name if not visible in search path */
-                       if (OpclassIsVisible(object->objectId))
-                               nspname = NULL;
-                       else
-                               nspname = get_namespace_name(opcForm->opcnamespace);
-
-                       appendStringInfo(&buffer, "operator class %s",
-                                                        quote_qualified_identifier(nspname,
-                                                                                                               NameStr(opcForm->opcname)));
-
-                       amTup = SearchSysCache(AMOID,
-                                                                  ObjectIdGetDatum(opcForm->opcamid),
-                                                                  0, 0, 0);
-                       if (!HeapTupleIsValid(amTup))
-                               elog(ERROR, "syscache lookup for AM %u failed",
-                                        opcForm->opcamid);
-                       amForm = (Form_pg_am) GETSTRUCT(amTup);
-
-                       appendStringInfo(&buffer, " for %s",
-                                                        NameStr(amForm->amname));
-
-                       ReleaseSysCache(amTup);
-                       ReleaseSysCache(opcTup);
-                       break;
-               }
+                       {
+                               HeapTuple       opcTup;
+                               Form_pg_opclass opcForm;
+                               HeapTuple       amTup;
+                               Form_pg_am      amForm;
+                               char       *nspname;
+
+                               opcTup = SearchSysCache(CLAOID,
+                                                                         ObjectIdGetDatum(object->objectId),
+                                                                               0, 0, 0);
+                               if (!HeapTupleIsValid(opcTup))
+                                       elog(ERROR, "cache lookup of opclass %u failed",
+                                                object->objectId);
+                               opcForm = (Form_pg_opclass) GETSTRUCT(opcTup);
+
+                               /* Qualify the name if not visible in search path */
+                               if (OpclassIsVisible(object->objectId))
+                                       nspname = NULL;
+                               else
+                                       nspname = get_namespace_name(opcForm->opcnamespace);
+
+                               appendStringInfo(&buffer, "operator class %s",
+                                                                quote_qualified_identifier(nspname,
+                                                                                        NameStr(opcForm->opcname)));
+
+                               amTup = SearchSysCache(AMOID,
+                                                                          ObjectIdGetDatum(opcForm->opcamid),
+                                                                          0, 0, 0);
+                               if (!HeapTupleIsValid(amTup))
+                                       elog(ERROR, "syscache lookup for AM %u failed",
+                                                opcForm->opcamid);
+                               amForm = (Form_pg_am) GETSTRUCT(amTup);
+
+                               appendStringInfo(&buffer, " for %s",
+                                                                NameStr(amForm->amname));
+
+                               ReleaseSysCache(amTup);
+                               ReleaseSysCache(opcTup);
+                               break;
+                       }
 
                case OCLASS_REWRITE:
-               {
-                       Relation                ruleDesc;
-                       ScanKeyData             skey[1];
-                       SysScanDesc             rcscan;
-                       HeapTuple               tup;
-                       Form_pg_rewrite rule;
+                       {
+                               Relation        ruleDesc;
+                               ScanKeyData skey[1];
+                               SysScanDesc rcscan;
+                               HeapTuple       tup;
+                               Form_pg_rewrite rule;
 
-                       ruleDesc = heap_openr(RewriteRelationName, AccessShareLock);
+                               ruleDesc = heap_openr(RewriteRelationName, AccessShareLock);
 
-                       ScanKeyEntryInitialize(&skey[0], 0x0,
-                                                                  ObjectIdAttributeNumber, F_OIDEQ,
-                                                                  ObjectIdGetDatum(object->objectId));
+                               ScanKeyEntryInitialize(&skey[0], 0x0,
+                                                                          ObjectIdAttributeNumber, F_OIDEQ,
+                                                                        ObjectIdGetDatum(object->objectId));
 
-                       rcscan = systable_beginscan(ruleDesc, RewriteOidIndex, true,
-                                                                               SnapshotNow, 1, skey);
+                               rcscan = systable_beginscan(ruleDesc, RewriteOidIndex, true,
+                                                                                       SnapshotNow, 1, skey);
 
-                       tup = systable_getnext(rcscan);
+                               tup = systable_getnext(rcscan);
 
-                       if (!HeapTupleIsValid(tup))
-                               elog(ERROR, "getObjectDescription: Rule %u does not exist",
-                                        object->objectId);
+                               if (!HeapTupleIsValid(tup))
+                                       elog(ERROR, "getObjectDescription: Rule %u does not exist",
+                                                object->objectId);
 
-                       rule = (Form_pg_rewrite) GETSTRUCT(tup);
+                               rule = (Form_pg_rewrite) GETSTRUCT(tup);
 
-                       appendStringInfo(&buffer, "rule %s on ",
-                                                        NameStr(rule->rulename));
-                       getRelationDescription(&buffer, rule->ev_class);
+                               appendStringInfo(&buffer, "rule %s on ",
+                                                                NameStr(rule->rulename));
+                               getRelationDescription(&buffer, rule->ev_class);
 
-                       systable_endscan(rcscan);
-                       heap_close(ruleDesc, AccessShareLock);
-                       break;
-               }
+                               systable_endscan(rcscan);
+                               heap_close(ruleDesc, AccessShareLock);
+                               break;
+                       }
 
                case OCLASS_TRIGGER:
-               {
-                       Relation                trigDesc;
-                       ScanKeyData             skey[1];
-                       SysScanDesc             tgscan;
-                       HeapTuple               tup;
-                       Form_pg_trigger trig;
+                       {
+                               Relation        trigDesc;
+                               ScanKeyData skey[1];
+                               SysScanDesc tgscan;
+                               HeapTuple       tup;
+                               Form_pg_trigger trig;
 
-                       trigDesc = heap_openr(TriggerRelationName, AccessShareLock);
+                               trigDesc = heap_openr(TriggerRelationName, AccessShareLock);
 
-                       ScanKeyEntryInitialize(&skey[0], 0x0,
-                                                                  ObjectIdAttributeNumber, F_OIDEQ,
-                                                                  ObjectIdGetDatum(object->objectId));
+                               ScanKeyEntryInitialize(&skey[0], 0x0,
+                                                                          ObjectIdAttributeNumber, F_OIDEQ,
+                                                                        ObjectIdGetDatum(object->objectId));
 
-                       tgscan = systable_beginscan(trigDesc, TriggerOidIndex, true,
-                                                                               SnapshotNow, 1, skey);
+                               tgscan = systable_beginscan(trigDesc, TriggerOidIndex, true,
+                                                                                       SnapshotNow, 1, skey);
 
-                       tup = systable_getnext(tgscan);
+                               tup = systable_getnext(tgscan);
 
-                       if (!HeapTupleIsValid(tup))
-                               elog(ERROR, "getObjectDescription: Trigger %u does not exist",
-                                        object->objectId);
+                               if (!HeapTupleIsValid(tup))
+                                       elog(ERROR, "getObjectDescription: Trigger %u does not exist",
+                                                object->objectId);
 
-                       trig = (Form_pg_trigger) GETSTRUCT(tup);
+                               trig = (Form_pg_trigger) GETSTRUCT(tup);
 
-                       appendStringInfo(&buffer, "trigger %s on ",
-                                                        NameStr(trig->tgname));
-                       getRelationDescription(&buffer, trig->tgrelid);
+                               appendStringInfo(&buffer, "trigger %s on ",
+                                                                NameStr(trig->tgname));
+                               getRelationDescription(&buffer, trig->tgrelid);
 
-                       systable_endscan(tgscan);
-                       heap_close(trigDesc, AccessShareLock);
-                       break;
-               }
+                               systable_endscan(tgscan);
+                               heap_close(trigDesc, AccessShareLock);
+                               break;
+                       }
 
                case OCLASS_SCHEMA:
-               {
-                       char       *nspname;
+                       {
+                               char       *nspname;
 
-                       nspname = get_namespace_name(object->objectId);
-                       if (!nspname)
-                               elog(ERROR, "getObjectDescription: Schema %u does not exist",
-                                        object->objectId);
-                       appendStringInfo(&buffer, "schema %s", nspname);
-                       break;
-               }
+                               nspname = get_namespace_name(object->objectId);
+                               if (!nspname)
+                                       elog(ERROR, "getObjectDescription: Schema %u does not exist",
+                                                object->objectId);
+                               appendStringInfo(&buffer, "schema %s", nspname);
+                               break;
+                       }
 
                default:
                        appendStringInfo(&buffer, "unknown object %u %u %d",
@@ -1424,7 +1434,7 @@ static void
 getRelationDescription(StringInfo buffer, Oid relid)
 {
        HeapTuple       relTup;
-       Form_pg_class   relForm;
+       Form_pg_class relForm;
        char       *nspname;
        char       *relname;
 
index 09afaf2..15f3e1e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.224 2002/09/02 01:05:03 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.225 2002/09/04 20:31:13 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -67,10 +67,10 @@ static void AddNewRelationTuple(Relation pg_class_desc,
                                        Oid new_rel_oid, Oid new_type_oid,
                                        char relkind);
 static void AddNewRelationType(const char *typeName,
-                                                          Oid typeNamespace,
-                                                          Oid new_rel_oid,
-                                                          char new_rel_kind,
-                                                          Oid new_type_oid);
+                                  Oid typeNamespace,
+                                  Oid new_rel_oid,
+                                  char new_rel_kind,
+                                  Oid new_type_oid);
 static void RelationRemoveInheritance(Relation relation);
 static void StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin);
 static void StoreRelCheck(Relation rel, char *ccname, char *ccbin);
@@ -214,14 +214,14 @@ heap_create(const char *relname,
        Oid                     relid;
        Oid                     dbid = shared_relation ? InvalidOid : MyDatabaseId;
        bool            nailme = false;
-       RelFileNode     rnode;
+       RelFileNode rnode;
        Relation        rel;
 
        /*
         * sanity checks
         */
        if (!allow_system_table_mods &&
-               (IsSystemNamespace(relnamespace) || IsToastNamespace(relnamespace)) &&
+       (IsSystemNamespace(relnamespace) || IsToastNamespace(relnamespace)) &&
                IsNormalProcessingMode())
                elog(ERROR, "cannot create %s.%s: "
                         "system catalog modifications are currently disallowed",
@@ -256,21 +256,13 @@ heap_create(const char *relname,
                        relid = RelOid_pg_class;
                }
                else if (strcmp(ShadowRelationName, relname) == 0)
-               {
                        relid = RelOid_pg_shadow;
-               }
                else if (strcmp(GroupRelationName, relname) == 0)
-               {
                        relid = RelOid_pg_group;
-               }
                else if (strcmp(DatabaseRelationName, relname) == 0)
-               {
                        relid = RelOid_pg_database;
-               }
                else
-               {
                        relid = newoid();
-               }
        }
        else
                relid = newoid();
@@ -293,7 +285,8 @@ heap_create(const char *relname,
                                                                         nailme);
 
        /*
-        * have the storage manager create the relation's disk file, if wanted.
+        * have the storage manager create the relation's disk file, if
+        * wanted.
         */
        if (storage_create)
                heap_storage_create(rel);
@@ -396,7 +389,7 @@ CheckAttributeNames(TupleDesc tupdesc, char relkind)
         */
        for (i = 0; i < natts; i++)
        {
-               Oid             att_type = tupdesc->attrs[i]->atttypid;
+               Oid                     att_type = tupdesc->attrs[i]->atttypid;
 
                if (att_type == UNKNOWNOID)
                        elog(WARNING, "Attribute \"%s\" has an unknown type"
@@ -427,8 +420,8 @@ AddNewAttributeTuples(Oid new_rel_oid,
        Relation        rel;
        CatalogIndexState indstate;
        int                     natts = tupdesc->natts;
-       ObjectAddress   myself,
-                                       referenced;
+       ObjectAddress myself,
+                               referenced;
 
        /*
         * open pg_attribute and its indexes.
@@ -451,7 +444,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
                (*dpp)->attcacheoff = -1;
 
                tup = heap_addheader(Natts_pg_attribute,
-                                    false,
+                                                        false,
                                                         ATTRIBUTE_TUPLE_SIZE,
                                                         (void *) *dpp);
 
@@ -463,7 +456,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
 
                myself.classId = RelOid_pg_class;
                myself.objectId = new_rel_oid;
-               myself.objectSubId = i+1;
+               myself.objectSubId = i + 1;
                referenced.classId = RelOid_pg_type;
                referenced.objectId = (*dpp)->atttypid;
                referenced.objectSubId = 0;
@@ -475,7 +468,8 @@ AddNewAttributeTuples(Oid new_rel_oid,
        /*
         * Next we add the system attributes.  Skip OID if rel has no OIDs.
         * Skip all for a view or type relation.  We don't bother with making
-        * datatype dependencies here, since presumably all these types are pinned.
+        * datatype dependencies here, since presumably all these types are
+        * pinned.
         */
        if (relkind != RELKIND_VIEW && relkind != RELKIND_COMPOSITE_TYPE)
        {
@@ -488,7 +482,7 @@ AddNewAttributeTuples(Oid new_rel_oid,
                                Form_pg_attribute attStruct;
 
                                tup = heap_addheader(Natts_pg_attribute,
-                                                    false,
+                                                                        false,
                                                                         ATTRIBUTE_TUPLE_SIZE,
                                                                         (void *) *dpp);
 
@@ -497,9 +491,9 @@ AddNewAttributeTuples(Oid new_rel_oid,
                                attStruct->attrelid = new_rel_oid;
 
                                /*
-                                * Unneeded since they should be OK in the constant data
-                                * anyway
-                                */
+                                * Unneeded since they should be OK in the constant data
+                                * anyway
+                                */
                                /* attStruct->attstattarget = 0; */
                                /* attStruct->attcacheoff = -1; */
 
@@ -590,7 +584,7 @@ AddNewRelationTuple(Relation pg_class_desc,
         * ----------------
         */
        tup = heap_addheader(Natts_pg_class_fixed,
-                            true,
+                                                true,
                                                 CLASS_TUPLE_SIZE,
                                                 (void *) new_rel_reltup);
 
@@ -628,13 +622,13 @@ AddNewRelationType(const char *typeName,
         *
         * OLD and probably obsolete comments:
         *
-        * The sizes are set to oid size because it makes implementing sets
-        * MUCH easier, and no one (we hope) uses these fields to figure out
-        * how much space to allocate for the type. An oid is the type used
-        * for a set definition.  When a user requests a set, what they
-        * actually get is the oid of a tuple in the pg_proc catalog, so the
-        * size of the "set" is the size of an oid. Similarly, byval being
-        * true makes sets much easier, and it isn't used by anything else.
+        * The sizes are set to oid size because it makes implementing sets MUCH
+        * easier, and no one (we hope) uses these fields to figure out how
+        * much space to allocate for the type. An oid is the type used for a
+        * set definition.      When a user requests a set, what they actually get
+        * is the oid of a tuple in the pg_proc catalog, so the size of the
+        * "set" is the size of an oid. Similarly, byval being true makes sets
+        * much easier, and it isn't used by anything else.
         */
        TypeCreate(typeName,            /* type name */
                           typeNamespace,       /* type namespace */
@@ -689,10 +683,10 @@ heap_create_with_catalog(const char *relname,
 
        if (get_relname_relid(relname, relnamespace))
                elog(ERROR, "Relation '%s' already exists", relname);
-       
+
        /*
         * Create the relcache entry (mostly dummy at this point) and the
-        * physical disk file.  (If we fail further down, it's the smgr's
+        * physical disk file.  (If we fail further down, it's the smgr's
         * responsibility to remove the disk file again.)
         *
         * NB: create a physical file only if it's not a view or type relation.
@@ -702,7 +696,7 @@ heap_create_with_catalog(const char *relname,
                                                           tupdesc,
                                                           shared_relation,
                                                           (relkind != RELKIND_VIEW &&
-                                                           relkind != RELKIND_COMPOSITE_TYPE),
+                                                               relkind != RELKIND_COMPOSITE_TYPE),
                                                           allow_system_table_mods);
 
        /* Fetch the relation OID assigned by heap_create */
@@ -746,14 +740,14 @@ heap_create_with_catalog(const char *relname,
        AddNewAttributeTuples(new_rel_oid, new_rel_desc->rd_att, relkind);
 
        /*
-        * make a dependency link to force the relation to be deleted if
-        * its namespace is.  Skip this in bootstrap mode, since we don't
-        * make dependencies while bootstrapping.
+        * make a dependency link to force the relation to be deleted if its
+        * namespace is.  Skip this in bootstrap mode, since we don't make
+        * dependencies while bootstrapping.
         */
        if (!IsBootstrapProcessingMode())
        {
-               ObjectAddress   myself,
-                                               referenced;
+               ObjectAddress myself,
+                                       referenced;
 
                myself.classId = RelOid_pg_class;
                myself.objectId = new_rel_oid;
@@ -768,8 +762,9 @@ heap_create_with_catalog(const char *relname,
         * store constraints and defaults passed in the tupdesc, if any.
         *
         * NB: this may do a CommandCounterIncrement and rebuild the relcache
-        * entry, so the relation must be valid and self-consistent at this point.
-        * In particular, there are not yet constraints and defaults anywhere.
+        * entry, so the relation must be valid and self-consistent at this
+        * point. In particular, there are not yet constraints and defaults
+        * anywhere.
         */
        StoreConstraints(new_rel_desc, tupdesc);
 
@@ -788,8 +783,8 @@ heap_create_with_catalog(const char *relname,
  *             RelationRemoveInheritance
  *
  * Formerly, this routine checked for child relations and aborted the
- * deletion if any were found.  Now we rely on the dependency mechanism
- * to check for or delete child relations.  By the time we get here,
+ * deletion if any were found. Now we rely on the dependency mechanism
+ * to check for or delete child relations.     By the time we get here,
  * there are no children and we need only remove any pg_inherits rows
  * linking this relation to its parent(s).
  */
@@ -811,9 +806,7 @@ RelationRemoveInheritance(Relation relation)
                                                          SnapshotNow, 1, &key);
 
        while (HeapTupleIsValid(tuple = systable_getnext(scan)))
-       {
                simple_heap_delete(catalogRelation, &tuple->t_self);
-       }
 
        systable_endscan(scan);
        heap_close(catalogRelation, RowExclusiveLock);
@@ -863,7 +856,7 @@ void
 DeleteAttributeTuples(Oid relid)
 {
        Relation        attrel;
-       SysScanDesc     scan;
+       SysScanDesc scan;
        ScanKeyData key[1];
        HeapTuple       atttup;
 
@@ -880,9 +873,7 @@ DeleteAttributeTuples(Oid relid)
 
        /* Delete all the matching tuples */
        while ((atttup = systable_getnext(scan)) != NULL)
-       {
                simple_heap_delete(attrel, &atttup->t_self);
-       }
 
        /* Clean up after the scan */
        systable_endscan(scan);
@@ -907,10 +898,10 @@ RemoveAttributeById(Oid relid, AttrNumber attnum)
 
        /*
         * Grab an exclusive lock on the target table, which we will NOT
-        * release until end of transaction.  (In the simple case where
-        * we are directly dropping this column, AlterTableDropColumn already
-        * did this ... but when cascading from a drop of some other object,
-        * we may not have any lock.)
+        * release until end of transaction.  (In the simple case where we are
+        * directly dropping this column, AlterTableDropColumn already did
+        * this ... but when cascading from a drop of some other object, we
+        * may not have any lock.)
         */
        rel = relation_open(relid, AccessExclusiveLock);
 
@@ -920,7 +911,7 @@ RemoveAttributeById(Oid relid, AttrNumber attnum)
                                                           ObjectIdGetDatum(relid),
                                                           Int16GetDatum(attnum),
                                                           0, 0);
-       if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
+       if (!HeapTupleIsValid(tuple))           /* shouldn't happen */
                elog(ERROR, "RemoveAttributeById: Failed to find attribute %d in relation %u",
                         attnum, relid);
        attStruct = (Form_pg_attribute) GETSTRUCT(tuple);
@@ -985,7 +976,7 @@ RemoveAttrDefault(Oid relid, AttrNumber attnum,
        /* There should be at most one matching tuple, but we loop anyway */
        while (HeapTupleIsValid(tuple = systable_getnext(scan)))
        {
-               ObjectAddress   object;
+               ObjectAddress object;
 
                object.classId = RelationGetRelid(attrdef_rel);
                object.objectId = HeapTupleGetOid(tuple);
@@ -1007,7 +998,7 @@ RemoveAttrDefault(Oid relid, AttrNumber attnum,
 /*
  *             RemoveAttrDefaultById
  *
- * Remove a pg_attrdef entry specified by OID.  This is the guts of
+ * Remove a pg_attrdef entry specified by OID. This is the guts of
  * attribute-default removal.  Note it should be called via performDeletion,
  * not directly.
  */
@@ -1058,7 +1049,7 @@ RemoveAttrDefaultById(Oid attrdefId)
                                                           ObjectIdGetDatum(myrelid),
                                                           Int16GetDatum(myattnum),
                                                           0, 0);
-       if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
+       if (!HeapTupleIsValid(tuple))           /* shouldn't happen */
                elog(ERROR, "RemoveAttrDefaultById: cache lookup failed for rel %u attr %d",
                         myrelid, myattnum);
 
@@ -1175,7 +1166,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin)
        HeapTuple       atttup;
        Form_pg_attribute attStruct;
        Oid                     attrdefOid;
-       ObjectAddress   colobject,
+       ObjectAddress colobject,
                                defobject;
 
        /*
@@ -1307,8 +1298,8 @@ StoreRelCheck(Relation rel, char *ccname, char *ccbin)
                attNos = (int16 *) palloc(keycount * sizeof(int16));
                foreach(vl, varList)
                {
-                       Var        *var = (Var *) lfirst(vl);
-                       int             j;
+                       Var                *var = (Var *) lfirst(vl);
+                       int                     j;
 
                        for (j = 0; j < i; j++)
                                if (attNos[j] == var->varattno)
@@ -1324,24 +1315,24 @@ StoreRelCheck(Relation rel, char *ccname, char *ccbin)
        /*
         * Create the Check Constraint
         */
-       CreateConstraintEntry(ccname,   /* Constraint Name */
-                                                 RelationGetNamespace(rel), /* namespace */
-                                                 CONSTRAINT_CHECK, /* Constraint Type */
-                                                 false,        /* Is Deferrable */
+       CreateConstraintEntry(ccname,           /* Constraint Name */
+                                                 RelationGetNamespace(rel),    /* namespace */
+                                                 CONSTRAINT_CHECK,             /* Constraint Type */
+                                                 false,        /* Is Deferrable */
                                                  false,        /* Is Deferred */
-                                                 RelationGetRelid(rel), /* relation */
-                                                 attNos,       /* attrs in the constraint */
-                                                 keycount,     /* # attrs in the constraint */
-                                                 InvalidOid, /* not a domain constraint */
-                                                 InvalidOid, /* Foreign key fields */
+                                                 RelationGetRelid(rel),                /* relation */
+                                                 attNos,               /* attrs in the constraint */
+                                                 keycount,             /* # attrs in the constraint */
+                                                 InvalidOid,   /* not a domain constraint */
+                                                 InvalidOid,   /* Foreign key fields */
                                                  NULL,
                                                  0,
                                                  ' ',
                                                  ' ',
                                                  ' ',
-                                                 expr,         /* Tree form check constraint */
+                                                 expr, /* Tree form check constraint */
                                                  ccbin,        /* Binary form check constraint */
-                                                 ccsrc);       /* Source form check constraint */
+                                                 ccsrc);               /* Source form check constraint */
 
        pfree(ccsrc);
 }
@@ -1366,8 +1357,8 @@ StoreConstraints(Relation rel, TupleDesc tupdesc)
        /*
         * Deparsing of constraint expressions will fail unless the
         * just-created pg_attribute tuples for this relation are made
-        * visible.  So, bump the command counter.  CAUTION: this will
-        * cause a relcache entry rebuild.
+        * visible.  So, bump the command counter.      CAUTION: this will cause a
+        * relcache entry rebuild.
         */
        CommandCounterIncrement();
 
@@ -1513,12 +1504,14 @@ AddRelationRawConstraints(Relation rel,
                                List       *listptr2;
 
                                /*
-                                * Generate a name that does not conflict with pre-existing
-                                * constraints, nor with any auto-generated names so far.
+                                * Generate a name that does not conflict with
+                                * pre-existing constraints, nor with any auto-generated
+                                * names so far.
                                 */
                                ccname = GenerateConstraintName(RelationGetRelid(rel),
                                                                                                RelationGetNamespace(rel),
                                                                                                &constr_name_ctr);
+
                                /*
                                 * Check against other new constraints, in case the user
                                 * has specified a name that looks like an auto-generated
@@ -1668,7 +1661,7 @@ cookDefault(ParseState *pstate,
                        int32 atttypmod,
                        char *attname)
 {
-       Node            *expr;
+       Node       *expr;
 
        Assert(raw_default != NULL);
 
@@ -1699,18 +1692,18 @@ cookDefault(ParseState *pstate,
 
        /*
         * Check that it will be possible to coerce the expression to the
-        * column's type.  We store the expression without coercion,
-        * however, to avoid premature coercion in cases like
+        * column's type.  We store the expression without coercion, however,
+        * to avoid premature coercion in cases like
         *
         * CREATE TABLE tbl (fld timestamp DEFAULT 'now'::text);
         *
-        * NB: this should match the code in optimizer/prep/preptlist.c that
-        * will actually do the coercion, to ensure we don't accept an
-        * unusable default expression.
+        * NB: this should match the code in optimizer/prep/preptlist.c that will
+        * actually do the coercion, to ensure we don't accept an unusable
+        * default expression.
         */
        if (OidIsValid(atttypid))
        {
-               Oid             type_id = exprType(expr);
+               Oid                     type_id = exprType(expr);
 
                if (type_id != atttypid)
                {
@@ -1718,7 +1711,7 @@ cookDefault(ParseState *pstate,
                                                                 atttypid, atttypmod, false) == NULL)
                                elog(ERROR, "Column \"%s\" is of type %s"
                                         " but default expression is of type %s"
-                                        "\n\tYou will need to rewrite or cast the expression",
+                                  "\n\tYou will need to rewrite or cast the expression",
                                         attname,
                                         format_type_be(atttypid),
                                         format_type_be(type_id));
@@ -1735,7 +1728,7 @@ cookDefault(ParseState *pstate,
         */
        fix_opids(expr);
 
-       return(expr);
+       return (expr);
 }
 
 
@@ -1753,7 +1746,7 @@ RemoveRelConstraints(Relation rel, const char *constrName,
 {
        int                     ndeleted = 0;
        Relation        conrel;
-       SysScanDesc     conscan;
+       SysScanDesc conscan;
        ScanKeyData key[1];
        HeapTuple       contup;
 
@@ -1773,11 +1766,11 @@ RemoveRelConstraints(Relation rel, const char *constrName,
         */
        while ((contup = systable_getnext(conscan)) != NULL)
        {
-               Form_pg_constraint      con = (Form_pg_constraint) GETSTRUCT(contup);
+               Form_pg_constraint con = (Form_pg_constraint) GETSTRUCT(contup);
 
                if (strcmp(NameStr(con->conname), constrName) == 0)
                {
-                       ObjectAddress   conobj;
+                       ObjectAddress conobj;
 
                        conobj.classId = RelationGetRelid(conrel);
                        conobj.objectId = HeapTupleGetOid(contup);
@@ -1815,9 +1808,7 @@ RemoveStatistics(Relation rel)
                                                          SnapshotNow, 1, &key);
 
        while (HeapTupleIsValid(tuple = systable_getnext(scan)))
-       {
                simple_heap_delete(pgstatistic, &tuple->t_self);
-       }
 
        systable_endscan(scan);
        heap_close(pgstatistic, RowExclusiveLock);
@@ -1836,7 +1827,7 @@ RelationTruncateIndexes(Oid heapId)
 {
        Relation        indexRelation;
        ScanKeyData entry;
-       SysScanDesc     scan;
+       SysScanDesc scan;
        HeapTuple       indexTuple;
 
        /* Scan pg_index to find indexes on specified heap */
index f91600f..4909c2e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.195 2002/09/03 16:00:02 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.196 2002/09/04 20:31:14 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -320,13 +320,13 @@ UpdateRelationRelation(Relation indexRelation)
 
        /* XXX Natts_pg_class_fixed is a hack - see pg_class.h */
        tuple = heap_addheader(Natts_pg_class_fixed,
-                              true,
+                                                  true,
                                                   CLASS_TUPLE_SIZE,
                                                   (void *) indexRelation->rd_rel);
 
        /*
-        * the new tuple must have the oid already chosen for the index.
-        * sure would be embarrassing to do this sort of thing in polite company.
+        * the new tuple must have the oid already chosen for the index. sure
+        * would be embarrassing to do this sort of thing in polite company.
         */
        HeapTupleSetOid(tuple, RelationGetRelid(indexRelation));
        simple_heap_insert(pg_class, tuple);
@@ -391,7 +391,7 @@ AppendAttributeTuples(Relation indexRelation, int numatts)
                Assert(indexTupDesc->attrs[i]->attcacheoff == -1);
 
                new_tuple = heap_addheader(Natts_pg_attribute,
-                                          false,
+                                                                  false,
                                                                   ATTRIBUTE_TUPLE_SIZE,
                                                                   (void *) indexTupDesc->attrs[i]);
 
@@ -478,7 +478,7 @@ UpdateIndexRelation(Oid indexoid,
         * form a tuple to insert into pg_index
         */
        tuple = heap_addheader(Natts_pg_index,
-                              false,
+                                                  false,
                                                   itupLen,
                                                   (void *) indexForm);
 
@@ -532,8 +532,8 @@ index_create(Oid heapRelationId,
        heapRelation = heap_open(heapRelationId, ShareLock);
 
        /*
-        * The index will be in the same namespace as its parent table,
-        * and is shared across databases if and only if the parent is.
+        * The index will be in the same namespace as its parent table, and is
+        * shared across databases if and only if the parent is.
         */
        namespaceId = RelationGetNamespace(heapRelation);
        shared_relation = heapRelation->rd_rel->relisshared;
@@ -554,7 +554,7 @@ index_create(Oid heapRelationId,
         * We cannot allow indexing a shared relation after initdb (because
         * there's no way to make the entry in other databases' pg_class).
         * Unfortunately we can't distinguish initdb from a manually started
-        * standalone backend.  However, we can at least prevent this mistake
+        * standalone backend.  However, we can at least prevent this mistake
         * under normal multi-user operation.
         */
        if (shared_relation && IsUnderPostmaster)
@@ -577,6 +577,7 @@ index_create(Oid heapRelationId,
                                                                                                classObjectId);
 
        indexTupDesc->tdhasoid = false;
+
        /*
         * create the index relation's relcache entry and physical disk file.
         * (If we fail further down, it's the smgr's responsibility to remove
@@ -643,20 +644,20 @@ index_create(Oid heapRelationId,
         * Register constraint and dependencies for the index.
         *
         * If the index is from a CONSTRAINT clause, construct a pg_constraint
-        * entry.  The index is then linked to the constraint, which in turn is
-        * linked to the table.  If it's not a CONSTRAINT, make the dependency
-        * directly on the table.
+        * entry.  The index is then linked to the constraint, which in turn
+        * is linked to the table.      If it's not a CONSTRAINT, make the
+        * dependency directly on the table.
         *
-        * We don't need a dependency on the namespace, because there'll be
-        * an indirect dependency via our parent table.
+        * We don't need a dependency on the namespace, because there'll be an
+        * indirect dependency via our parent table.
         *
-        * During bootstrap we can't register any dependencies, and we don't
-        * try to make a constraint either.
+        * During bootstrap we can't register any dependencies, and we don't try
+        * to make a constraint either.
         */
        if (!IsBootstrapProcessingMode())
        {
-               ObjectAddress   myself,
-                                               referenced;
+               ObjectAddress myself,
+                                       referenced;
 
                myself.classId = RelOid_pg_class;
                myself.objectId = indexoid;
@@ -674,25 +675,25 @@ index_create(Oid heapRelationId,
                        else
                        {
                                elog(ERROR, "index_create: constraint must be PRIMARY or UNIQUE");
-                               constraintType = 0;     /* keep compiler quiet */
+                               constraintType = 0;             /* keep compiler quiet */
                        }
 
                        conOid = CreateConstraintEntry(indexRelationName,
                                                                                   namespaceId,
                                                                                   constraintType,
-                                                                                  false, /* isDeferrable */
-                                                                                  false, /* isDeferred */
+                                                                                  false,               /* isDeferrable */
+                                                                                  false,               /* isDeferred */
                                                                                   heapRelationId,
                                                                                   indexInfo->ii_KeyAttrNumbers,
                                                                                   indexInfo->ii_NumKeyAttrs,
-                                                                                  InvalidOid, /* no domain */
-                                                                                  InvalidOid, /* no foreign key */
+                                                                                  InvalidOid,  /* no domain */
+                                                                                  InvalidOid,  /* no foreign key */
                                                                                   NULL,
                                                                                   0,
                                                                                   ' ',
                                                                                   ' ',
                                                                                   ' ',
-                                                                                  NULL, /* no check constraint */
+                                                                                  NULL,                /* no check constraint */
                                                                                   NULL,
                                                                                   NULL);
 
@@ -807,6 +808,7 @@ index_drop(Oid indexId)
         * fix RELATION relation
         */
        DeleteRelationTuple(indexId);
+
        /*
         * fix ATTRIBUTE relation
         */
@@ -839,11 +841,12 @@ index_drop(Oid indexId)
        smgrunlink(DEFAULT_SMGR, userIndexRelation);
 
        /*
-        * We are presently too lazy to attempt to compute the new correct value
-        * of relhasindex (the next VACUUM will fix it if necessary).  So there is
-        * no need to update the pg_class tuple for the owning relation.
-        * But we must send out a shared-cache-inval notice on the owning relation
-        * to ensure other backends update their relcache lists of indexes.
+        * We are presently too lazy to attempt to compute the new correct
+        * value of relhasindex (the next VACUUM will fix it if necessary).
+        * So there is no need to update the pg_class tuple for the owning
+        * relation. But we must send out a shared-cache-inval notice on the
+        * owning relation to ensure other backends update their relcache
+        * lists of indexes.
         */
        CacheInvalidateRelcache(heapId);
 
@@ -1640,7 +1643,7 @@ IndexBuildHeapScan(Relation heapRelation,
                                         * transaction.)
                                         */
                                        if (!TransactionIdIsCurrentTransactionId(
-                                                       HeapTupleHeaderGetXmin(heapTuple->t_data)))
+                                                         HeapTupleHeaderGetXmin(heapTuple->t_data)))
                                                elog(ERROR, "IndexBuildHeapScan: concurrent insert in progress");
                                        indexIt = true;
                                        tupleIsAlive = true;
@@ -1655,7 +1658,7 @@ IndexBuildHeapScan(Relation heapRelation,
                                         * transaction.)
                                         */
                                        if (!TransactionIdIsCurrentTransactionId(
-                                                       HeapTupleHeaderGetXmax(heapTuple->t_data)))
+                                                         HeapTupleHeaderGetXmax(heapTuple->t_data)))
                                                elog(ERROR, "IndexBuildHeapScan: concurrent delete in progress");
                                        indexIt = true;
                                        tupleIsAlive = false;
@@ -1798,12 +1801,12 @@ reindex_index(Oid indexId, bool force, bool inplace)
        /*
         * Open our index relation and get an exclusive lock on it.
         *
-        * Note: doing this before opening the parent heap relation means
-        * there's a possibility for deadlock failure against another xact
-        * that is doing normal accesses to the heap and index.  However,
-        * it's not real clear why you'd be needing to do REINDEX on a table
-        * that's in active use, so I'd rather have the protection of making
-        * sure the index is locked down.
+        * Note: doing this before opening the parent heap relation means there's
+        * a possibility for deadlock failure against another xact that is
+        * doing normal accesses to the heap and index.  However, it's not
+        * real clear why you'd be needing to do REINDEX on a table that's in
+        * active use, so I'd rather have the protection of making sure the
+        * index is locked down.
         */
        iRel = index_open(indexId);
        if (iRel == NULL)
index 4206c33..27d66b4 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.101 2002/08/06 02:36:34 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.102 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -44,7 +44,7 @@ CatalogOpenIndexes(Relation heapRel)
        resultRelInfo = makeNode(ResultRelInfo);
        resultRelInfo->ri_RangeTableIndex = 1;          /* dummy */
        resultRelInfo->ri_RelationDesc = heapRel;
-       resultRelInfo->ri_TrigDesc = NULL; /* we don't fire triggers */
+       resultRelInfo->ri_TrigDesc = NULL;      /* we don't fire triggers */
 
        ExecOpenIndices(resultRelInfo);
 
@@ -132,14 +132,14 @@ CatalogIndexInsert(CatalogIndexState indstate, HeapTuple heapTuple)
  * CatalogUpdateIndexes - do all the indexing work for a new catalog tuple
  *
  * This is a convenience routine for the common case where we only need
- * to insert or update a single tuple in a system catalog.  Avoid using it for
+ * to insert or update a single tuple in a system catalog.     Avoid using it for
  * multiple tuples, since opening the indexes and building the index info
  * structures is moderately expensive.
  */
 void
 CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple)
 {
-       CatalogIndexState       indstate;
+       CatalogIndexState indstate;
 
        indstate = CatalogOpenIndexes(heapRel);
        CatalogIndexInsert(indstate, heapTuple);
index 1b4f2ae..182d901 100644 (file)
@@ -13,7 +13,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.34 2002/09/02 01:05:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.35 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
  * 2. If a TEMP table namespace has been initialized in this session, it
  * is always searched just after any special namespace.
  *
- * 3. The system catalog namespace is always searched.  If the system
+ * 3. The system catalog namespace is always searched. If the system
  * namespace is present in the explicit path then it will be searched in
  * the specified order; otherwise it will be searched after TEMP tables and
- * *before* the explicit list.  (It might seem that the system namespace
+ * *before* the explicit list. (It might seem that the system namespace
  * should be implicitly last, but this behavior appears to be required by
  * SQL99.  Also, this provides a way to search the system namespace first
  * without thereby making it the default creation target namespace.)
@@ -76,7 +76,7 @@
  * In bootstrap mode, the search path is set equal to 'pg_catalog', so that
  * the system namespace is the only one searched or inserted into.
  * The initdb script is also careful to set search_path to 'pg_catalog' for
- * its post-bootstrap standalone backend runs.  Otherwise the default search
+ * its post-bootstrap standalone backend runs. Otherwise the default search
  * path is determined by GUC.  The factory default path contains the PUBLIC
  * namespace (if it exists), preceded by the user's personal namespace
  * (if one exists).
@@ -109,7 +109,7 @@ static bool namespaceSearchPathValid = true;
 /*
  * myTempNamespace is InvalidOid until and unless a TEMP namespace is set up
  * in a particular backend session (this happens when a CREATE TEMP TABLE
- * command is first executed).  Thereafter it's the OID of the temp namespace.
+ * command is first executed). Thereafter it's the OID of the temp namespace.
  * firstTempTransaction flags whether we've committed creation of the TEMP
  * namespace or not.
  */
@@ -127,7 +127,7 @@ static Oid  mySpecialNamespace = InvalidOid;
  * This is the text equivalent of the search path --- it's the value
  * of the GUC variable 'search_path'.
  */
-char *namespace_search_path = NULL;
+char      *namespace_search_path = NULL;
 
 
 /* Local functions */
@@ -138,11 +138,11 @@ static void RemoveTempRelationsCallback(void);
 static void NamespaceCallback(Datum arg, Oid relid);
 
 /* These don't really need to appear in any header file */
-Datum pg_table_is_visible(PG_FUNCTION_ARGS);
-Datum pg_type_is_visible(PG_FUNCTION_ARGS);
-Datum pg_function_is_visible(PG_FUNCTION_ARGS);
-Datum pg_operator_is_visible(PG_FUNCTION_ARGS);
-Datum pg_opclass_is_visible(PG_FUNCTION_ARGS);
+Datum          pg_table_is_visible(PG_FUNCTION_ARGS);
+Datum          pg_type_is_visible(PG_FUNCTION_ARGS);
+Datum          pg_function_is_visible(PG_FUNCTION_ARGS);
+Datum          pg_operator_is_visible(PG_FUNCTION_ARGS);
+Datum          pg_opclass_is_visible(PG_FUNCTION_ARGS);
 
 
 /*
@@ -230,7 +230,7 @@ RangeVarGetCreationNamespace(const RangeVar *newRelation)
        {
                /* use exact schema given */
                namespaceId = GetSysCacheOid(NAMESPACENAME,
-                                                                        CStringGetDatum(newRelation->schemaname),
+                                                               CStringGetDatum(newRelation->schemaname),
                                                                         0, 0, 0);
                if (!OidIsValid(namespaceId))
                        elog(ERROR, "Namespace \"%s\" does not exist",
@@ -312,10 +312,10 @@ RelationIsVisible(Oid relid)
        else
        {
                /*
-                * If it is in the path, it might still not be visible; it could be
-                * hidden by another relation of the same name earlier in the path.
-                * So we must do a slow check to see if this rel would be found by
-                * RelnameGetRelid.
+                * If it is in the path, it might still not be visible; it could
+                * be hidden by another relation of the same name earlier in the
+                * path. So we must do a slow check to see if this rel would be
+                * found by RelnameGetRelid.
                 */
                char       *relname = NameStr(relform->relname);
 
@@ -394,10 +394,10 @@ TypeIsVisible(Oid typid)
        else
        {
                /*
-                * If it is in the path, it might still not be visible; it could be
-                * hidden by another type of the same name earlier in the path.
-                * So we must do a slow check to see if this type would be found by
-                * TypenameGetTypid.
+                * If it is in the path, it might still not be visible; it could
+                * be hidden by another type of the same name earlier in the path.
+                * So we must do a slow check to see if this type would be found
+                * by TypenameGetTypid.
                 */
                char       *typname = NameStr(typform->typname);
 
@@ -492,18 +492,18 @@ FuncnameGetCandidates(List *names, int nargs)
 
                        /*
                         * Okay, it's in the search path, but does it have the same
-                        * arguments as something we already accepted?  If so, keep
+                        * arguments as something we already accepted?  If so, keep
                         * only the one that appears earlier in the search path.
                         *
-                        * If we have an ordered list from SearchSysCacheList (the
-                        * normal case), then any conflicting proc must immediately
-                        * adjoin this one in the list, so we only need to look at
-                        * the newest result item.  If we have an unordered list,
-                        * we have to scan the whole result list.
+                        * If we have an ordered list from SearchSysCacheList (the normal
+                        * case), then any conflicting proc must immediately adjoin
+                        * this one in the list, so we only need to look at the newest
+                        * result item.  If we have an unordered list, we have to scan
+                        * the whole result list.
                         */
                        if (resultList)
                        {
-                               FuncCandidateList       prevResult;
+                               FuncCandidateList prevResult;
 
                                if (catlist->ordered)
                                {
@@ -521,8 +521,8 @@ FuncnameGetCandidates(List *names, int nargs)
                                                 prevResult = prevResult->next)
                                        {
                                                if (nargs == prevResult->nargs &&
-                                                       memcmp(procform->proargtypes, prevResult->args,
-                                                                  nargs * sizeof(Oid)) == 0)
+                                                 memcmp(procform->proargtypes, prevResult->args,
+                                                                nargs * sizeof(Oid)) == 0)
                                                        break;
                                        }
                                }
@@ -531,7 +531,7 @@ FuncnameGetCandidates(List *names, int nargs)
                                        /* We have a match with a previous result */
                                        Assert(pathpos != prevResult->pathpos);
                                        if (pathpos > prevResult->pathpos)
-                                               continue; /* keep previous result */
+                                               continue;               /* keep previous result */
                                        /* replace previous result */
                                        prevResult->pathpos = pathpos;
                                        prevResult->oid = HeapTupleGetOid(proctup);
@@ -595,10 +595,10 @@ FunctionIsVisible(Oid funcid)
        else
        {
                /*
-                * If it is in the path, it might still not be visible; it could be
-                * hidden by another proc of the same name and arguments earlier
-                * in the path.  So we must do a slow check to see if this is the
-                * same proc that would be found by FuncnameGetCandidates.
+                * If it is in the path, it might still not be visible; it could
+                * be hidden by another proc of the same name and arguments
+                * earlier in the path.  So we must do a slow check to see if this
+                * is the same proc that would be found by FuncnameGetCandidates.
                 */
                char       *proname = NameStr(procform->proname);
                int                     nargs = procform->pronargs;
@@ -641,7 +641,7 @@ FunctionIsVisible(Oid funcid)
  * identical entries in later namespaces.
  *
  * The returned items always have two args[] entries --- one or the other
- * will be InvalidOid for a prefix or postfix oprkind.  nargs is 2, too.
+ * will be InvalidOid for a prefix or postfix oprkind. nargs is 2, too.
  */
 FuncCandidateList
 OpernameGetCandidates(List *names, char oprkind)
@@ -707,18 +707,18 @@ OpernameGetCandidates(List *names, char oprkind)
 
                        /*
                         * Okay, it's in the search path, but does it have the same
-                        * arguments as something we already accepted?  If so, keep
+                        * arguments as something we already accepted?  If so, keep
                         * only the one that appears earlier in the search path.
                         *
-                        * If we have an ordered list from SearchSysCacheList (the
-                        * normal case), then any conflicting oper must immediately
-                        * adjoin this one in the list, so we only need to look at
-                        * the newest result item.  If we have an unordered list,
-                        * we have to scan the whole result list.
+                        * If we have an ordered list from SearchSysCacheList (the normal
+                        * case), then any conflicting oper must immediately adjoin
+                        * this one in the list, so we only need to look at the newest
+                        * result item.  If we have an unordered list, we have to scan
+                        * the whole result list.
                         */
                        if (resultList)
                        {
-                               FuncCandidateList       prevResult;
+                               FuncCandidateList prevResult;
 
                                if (catlist->ordered)
                                {
@@ -744,7 +744,7 @@ OpernameGetCandidates(List *names, char oprkind)
                                        /* We have a match with a previous result */
                                        Assert(pathpos != prevResult->pathpos);
                                        if (pathpos > prevResult->pathpos)
-                                               continue; /* keep previous result */
+                                               continue;               /* keep previous result */
                                        /* replace previous result */
                                        prevResult->pathpos = pathpos;
                                        prevResult->oid = HeapTupleGetOid(opertup);
@@ -807,10 +807,11 @@ OperatorIsVisible(Oid oprid)
        else
        {
                /*
-                * If it is in the path, it might still not be visible; it could be
-                * hidden by another operator of the same name and arguments earlier
-                * in the path.  So we must do a slow check to see if this is the
-                * same operator that would be found by OpernameGetCandidates.
+                * If it is in the path, it might still not be visible; it could
+                * be hidden by another operator of the same name and arguments
+                * earlier in the path.  So we must do a slow check to see if this
+                * is the same operator that would be found by
+                * OpernameGetCandidates.
                 */
                char       *oprname = NameStr(oprform->oprname);
                FuncCandidateList clist;
@@ -882,18 +883,18 @@ OpclassGetCandidates(Oid amid)
 
                /*
                 * Okay, it's in the search path, but does it have the same name
-                * as something we already accepted?  If so, keep
-                * only the one that appears earlier in the search path.
+                * as something we already accepted?  If so, keep only the one
+                * that appears earlier in the search path.
                 *
-                * If we have an ordered list from SearchSysCacheList (the
-                * normal case), then any conflicting opclass must immediately
-                * adjoin this one in the list, so we only need to look at
-                * the newest result item.  If we have an unordered list,
-                * we have to scan the whole result list.
+                * If we have an ordered list from SearchSysCacheList (the normal
+                * case), then any conflicting opclass must immediately adjoin
+                * this one in the list, so we only need to look at the newest
+                * result item.  If we have an unordered list, we have to scan the
+                * whole result list.
                 */
                if (resultList)
                {
-                       OpclassCandidateList    prevResult;
+                       OpclassCandidateList prevResult;
 
                        if (catlist->ordered)
                        {
@@ -919,7 +920,7 @@ OpclassGetCandidates(Oid amid)
                                /* We have a match with a previous result */
                                Assert(pathpos != prevResult->pathpos);
                                if (pathpos > prevResult->pathpos)
-                                       continue; /* keep previous result */
+                                       continue;       /* keep previous result */
                                /* replace previous result */
                                prevResult->opcname_tmp = NameStr(opcform->opcname);
                                prevResult->pathpos = pathpos;
@@ -1019,10 +1020,10 @@ OpclassIsVisible(Oid opcid)
        else
        {
                /*
-                * If it is in the path, it might still not be visible; it could be
-                * hidden by another opclass of the same name earlier in the path.
-                * So we must do a slow check to see if this opclass would be found by
-                * OpclassnameGetOpcid.
+                * If it is in the path, it might still not be visible; it could
+                * be hidden by another opclass of the same name earlier in the
+                * path. So we must do a slow check to see if this opclass would
+                * be found by OpclassnameGetOpcid.
                 */
                char       *opcname = NameStr(opcform->opcname);
 
@@ -1063,6 +1064,7 @@ DeconstructQualifiedName(List *names,
                        catalogname = strVal(lfirst(names));
                        schemaname = strVal(lsecond(names));
                        objname = strVal(lfirst(lnext(lnext(names))));
+
                        /*
                         * We check the catalog name and then ignore it.
                         */
@@ -1190,7 +1192,7 @@ char *
 NameListToString(List *names)
 {
        StringInfoData string;
-       List            *l;
+       List       *l;
 
        initStringInfo(&string);
 
@@ -1248,11 +1250,12 @@ PopSpecialNamespace(Oid namespaceId)
 /*
  * FindConversionByName - find a conversion by possibly qualified name
  */
-Oid FindConversionByName(List *name)
+Oid
+FindConversionByName(List *name)
 {
-       char            *conversion_name;
-       Oid     namespaceId;
-       Oid conoid;
+       char       *conversion_name;
+       Oid                     namespaceId;
+       Oid                     conoid;
        List       *lptr;
 
        /* Convert list of names to a name and namespace */
@@ -1285,7 +1288,8 @@ Oid FindConversionByName(List *name)
 /*
  * FindDefaultConversionProc - find default encoding cnnversion proc
  */
-Oid FindDefaultConversionProc(int4 for_encoding, int4 to_encoding)
+Oid
+FindDefaultConversionProc(int4 for_encoding, int4 to_encoding)
 {
        Oid                     proc;
        List       *lptr;
@@ -1341,13 +1345,13 @@ recomputeNamespacePath(void)
         * Convert the list of names to a list of OIDs.  If any names are not
         * recognizable or we don't have read access, just leave them out of
         * the list.  (We can't raise an error, since the search_path setting
-        * has already been accepted.)  Don't make duplicate entries, either.
+        * has already been accepted.)  Don't make duplicate entries, either.
         */
        oidlist = NIL;
        foreach(l, namelist)
        {
-               char   *curname = (char *) lfirst(l);
-               Oid             namespaceId;
+               char       *curname = (char *) lfirst(l);
+               Oid                     namespaceId;
 
                if (strcmp(curname, "$user") == 0)
                {
@@ -1359,7 +1363,7 @@ recomputeNamespacePath(void)
                                                                   0, 0, 0);
                        if (HeapTupleIsValid(tuple))
                        {
-                               char   *uname;
+                               char       *uname;
 
                                uname = NameStr(((Form_pg_shadow) GETSTRUCT(tuple))->usename);
                                namespaceId = GetSysCacheOid(NAMESPACENAME,
@@ -1396,9 +1400,9 @@ recomputeNamespacePath(void)
                firstNS = (Oid) lfirsti(oidlist);
 
        /*
-        * Add any implicitly-searched namespaces to the list.  Note these
-        * go on the front, not the back; also notice that we do not check
-        * USAGE permissions for these.
+        * Add any implicitly-searched namespaces to the list.  Note these go
+        * on the front, not the back; also notice that we do not check USAGE
+        * permissions for these.
         */
        if (!intMember(PG_CATALOG_NAMESPACE, oidlist))
                oidlist = lconsi(PG_CATALOG_NAMESPACE, oidlist);
@@ -1453,13 +1457,13 @@ InitTempTableNamespace(void)
        Oid                     namespaceId;
 
        /*
-        * First, do permission check to see if we are authorized to make
-        * temp tables.  We use a nonstandard error message here since
+        * First, do permission check to see if we are authorized to make temp
+        * tables.      We use a nonstandard error message here since
         * "databasename: permission denied" might be a tad cryptic.
         *
-        * Note we apply the check to the session user, not the currently
-        * active userid, since we are not going to change our minds about
-        * temp table availability during the session.
+        * Note we apply the check to the session user, not the currently active
+        * userid, since we are not going to change our minds about temp table
+        * availability during the session.
         */
        if (pg_database_aclcheck(MyDatabaseId, GetSessionUserId(),
                                                         ACL_CREATE_TEMP) != ACLCHECK_OK)
@@ -1476,11 +1480,11 @@ InitTempTableNamespace(void)
                /*
                 * First use of this temp namespace in this database; create it.
                 * The temp namespaces are always owned by the superuser.  We
-                * leave their permissions at default --- i.e., no access except to
-                * superuser --- to ensure that unprivileged users can't peek
+                * leave their permissions at default --- i.e., no access except
+                * to superuser --- to ensure that unprivileged users can't peek
                 * at other backends' temp tables.  This works because the places
-                * that access the temp namespace for my own backend skip permissions
-                * checks on it.
+                * that access the temp namespace for my own backend skip
+                * permissions checks on it.
                 */
                namespaceId = NamespaceCreate(namespaceName, BOOTSTRAP_USESYSID);
                /* Advance command counter to make namespace visible */
@@ -1504,7 +1508,7 @@ InitTempTableNamespace(void)
 
        firstTempTransaction = true;
 
-       namespaceSearchPathValid = false; /* need to rebuild list */
+       namespaceSearchPathValid = false;       /* need to rebuild list */
 }
 
 /*
@@ -1516,7 +1520,7 @@ AtEOXact_Namespace(bool isCommit)
        /*
         * If we abort the transaction in which a temp namespace was selected,
         * we'll have to do any creation or cleanout work over again.  So,
-        * just forget the namespace entirely until next time.  On the other
+        * just forget the namespace entirely until next time.  On the other
         * hand, if we commit then register an exit callback to clean out the
         * temp tables at backend shutdown.  (We only want to register the
         * callback once per session, so this is a good place to do it.)
@@ -1528,17 +1532,18 @@ AtEOXact_Namespace(bool isCommit)
                else
                {
                        myTempNamespace = InvalidOid;
-                       namespaceSearchPathValid = false; /* need to rebuild list */
+                       namespaceSearchPathValid = false;       /* need to rebuild list */
                }
                firstTempTransaction = false;
        }
+
        /*
         * Clean up if someone failed to do PopSpecialNamespace
         */
        if (OidIsValid(mySpecialNamespace))
        {
                mySpecialNamespace = InvalidOid;
-               namespaceSearchPathValid = false; /* need to rebuild list */
+               namespaceSearchPathValid = false;               /* need to rebuild list */
        }
 }
 
@@ -1561,14 +1566,14 @@ RemoveTempRelations(Oid tempNamespaceId)
 
        /*
         * Scan pg_class to find all the relations in the target namespace.
-        * Ignore indexes, though, on the assumption that they'll go away
-        * when their tables are deleted.
+        * Ignore indexes, though, on the assumption that they'll go away when
+        * their tables are deleted.
         *
-        * NOTE: if there are deletion constraints between temp relations,
-        * then our CASCADE delete call may cause as-yet-unvisited objects
-        * to go away.  This is okay because we are using SnapshotNow; when
-        * the scan does reach those pg_class tuples, they'll be ignored as
-        * already deleted.
+        * NOTE: if there are deletion constraints between temp relations, then
+        * our CASCADE delete call may cause as-yet-unvisited objects to go
+        * away.  This is okay because we are using SnapshotNow; when the scan
+        * does reach those pg_class tuples, they'll be ignored as already
+        * deleted.
         */
        ScanKeyEntryInitialize(&key, 0x0,
                                                   Anum_pg_class_relnamespace,
@@ -1605,7 +1610,7 @@ RemoveTempRelations(Oid tempNamespaceId)
 static void
 RemoveTempRelationsCallback(void)
 {
-       if (OidIsValid(myTempNamespace)) /* should always be true */
+       if (OidIsValid(myTempNamespace))        /* should always be true */
        {
                /* Need to ensure we have a usable transaction. */
                AbortOutOfAnyTransaction();
@@ -1644,18 +1649,19 @@ assign_search_path(const char *newval, bool doit, bool interactive)
 
        /*
         * If we aren't inside a transaction, we cannot do database access so
-        * cannot verify the individual names.  Must accept the list on faith.
+        * cannot verify the individual names.  Must accept the list on faith.
         */
        if (interactive && IsTransactionState())
        {
                /*
                 * Verify that all the names are either valid namespace names or
                 * "$user".  We do not require $user to correspond to a valid
-                * namespace.  We do not check for USAGE rights, either; should we?
+                * namespace.  We do not check for USAGE rights, either; should
+                * we?
                 */
                foreach(l, namelist)
                {
-                       char   *curname = (char *) lfirst(l);
+                       char       *curname = (char *) lfirst(l);
 
                        if (strcmp(curname, "$user") == 0)
                                continue;
@@ -1670,9 +1676,9 @@ assign_search_path(const char *newval, bool doit, bool interactive)
        freeList(namelist);
 
        /*
-        * We mark the path as needing recomputation, but don't do anything until
-        * it's needed.  This avoids trying to do database access during GUC
-        * initialization.
+        * We mark the path as needing recomputation, but don't do anything
+        * until it's needed.  This avoids trying to do database access during
+        * GUC initialization.
         */
        if (doit)
                namespaceSearchPathValid = false;
@@ -1692,7 +1698,8 @@ InitializeSearchPath(void)
        {
                /*
                 * In bootstrap mode, the search path must be 'pg_catalog' so that
-                * tables are created in the proper namespace; ignore the GUC setting.
+                * tables are created in the proper namespace; ignore the GUC
+                * setting.
                 */
                MemoryContext oldcxt;
 
@@ -1707,8 +1714,8 @@ InitializeSearchPath(void)
        else
        {
                /*
-                * In normal mode, arrange for a callback on any syscache invalidation
-                * of pg_namespace rows.
+                * In normal mode, arrange for a callback on any syscache
+                * invalidation of pg_namespace rows.
                 */
                CacheRegisterSyscacheCallback(NAMESPACEOID,
                                                                          NamespaceCallback,
index 719d229..7b83cf9 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.54 2002/08/22 00:01:41 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.55 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -54,8 +54,8 @@ AggregateCreate(const char *aggName,
        Oid                     procOid;
        TupleDesc       tupDesc;
        int                     i;
-       ObjectAddress   myself,
-                                       referenced;
+       ObjectAddress myself,
+                               referenced;
 
        /* sanity checks */
        if (!aggName)
@@ -85,12 +85,12 @@ AggregateCreate(const char *aggName,
        proc = (Form_pg_proc) GETSTRUCT(tup);
        if (proc->prorettype != aggTransType)
                elog(ERROR, "return type of transition function %s is not %s",
-                        NameListToString(aggtransfnName), format_type_be(aggTransType));
+                NameListToString(aggtransfnName), format_type_be(aggTransType));
 
        /*
         * If the transfn is strict and the initval is NULL, make sure input
-        * type and transtype are the same (or at least binary-compatible),
-        * so that it's OK to use the first input value as the initial
+        * type and transtype are the same (or at least binary-compatible), so
+        * that it's OK to use the first input value as the initial
         * transValue.
         */
        if (proc->proisstrict && agginitval == NULL)
@@ -128,26 +128,29 @@ AggregateCreate(const char *aggName,
 
        /*
         * Everything looks okay.  Try to create the pg_proc entry for the
-        * aggregate.  (This could fail if there's already a conflicting entry.)
+        * aggregate.  (This could fail if there's already a conflicting
+        * entry.)
         */
        MemSet(fnArgs, 0, FUNC_MAX_ARGS * sizeof(Oid));
        fnArgs[0] = aggBaseType;
 
        procOid = ProcedureCreate(aggName,
                                                          aggNamespace,
-                                                         false,                /* no replacement */
-                                                         false,                /* doesn't return a set */
-                                                         finaltype,    /* returnType */
-                                                         INTERNALlanguageId,   /* languageObjectId */
+                                                         false,        /* no replacement */
+                                                         false,        /* doesn't return a set */
+                                                         finaltype,            /* returnType */
+                                                         INTERNALlanguageId,           /* languageObjectId */
                                                          0,
-                                                         "aggregate_dummy",    /* placeholder proc */
-                                                         "-",                  /* probin */
-                                                         true,                 /* isAgg */
-                                                         false,                /* security invoker (currently not definable for agg) */
-                                                         false,                /* isStrict (not needed for agg) */
-                                                         PROVOLATILE_IMMUTABLE,        /* volatility (not needed for agg) */
-                                                         1,                    /* parameterCount */
-                                                         fnArgs);              /* parameterTypes */
+                                                         "aggregate_dummy",            /* placeholder proc */
+                                                         "-",          /* probin */
+                                                         true,         /* isAgg */
+                                                         false,        /* security invoker (currently not
+                                                                                * definable for agg) */
+                                                         false,        /* isStrict (not needed for agg) */
+                                                         PROVOLATILE_IMMUTABLE,        /* volatility (not
+                                                                                                                * needed for agg) */
+                                                         1,    /* parameterCount */
+                                                         fnArgs);      /* parameterTypes */
 
        /*
         * Okay to create the pg_aggregate entry.
index 85ca6ea..92d4552 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_constraint.c,v 1.5 2002/08/26 17:53:57 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_constraint.c,v 1.6 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,7 +34,7 @@
  *     Create a constraint table entry.
  *
  * Subsidiary records (such as triggers or indexes to implement the
- * constraint) are *not* created here.  But we do make dependency links
+ * constraint) are *not* created here. But we do make dependency links
  * from the constraint to the things it depends on.
  */
 Oid
@@ -136,7 +136,7 @@ CreateConstraintEntry(const char *constraintName,
         */
        if (conBin)
                values[Anum_pg_constraint_conbin - 1] = DirectFunctionCall1(textin,
-                                                                               CStringGetDatum(conBin));
+                                                                                               CStringGetDatum(conBin));
        else
                nulls[Anum_pg_constraint_conbin - 1] = 'n';
 
@@ -145,7 +145,7 @@ CreateConstraintEntry(const char *constraintName,
         */
        if (conSrc)
                values[Anum_pg_constraint_consrc - 1] = DirectFunctionCall1(textin,
-                                                                               CStringGetDatum(conSrc));       
+                                                                                               CStringGetDatum(conSrc));
        else
                nulls[Anum_pg_constraint_consrc - 1] = 'n';
 
@@ -165,10 +165,10 @@ CreateConstraintEntry(const char *constraintName,
        if (OidIsValid(relId))
        {
                /*
-                * Register auto dependency from constraint to owning relation,
-                * or to specific column(s) if any are mentioned.
+                * Register auto dependency from constraint to owning relation, or
+                * to specific column(s) if any are mentioned.
                 */
-               ObjectAddress   relobject;
+               ObjectAddress relobject;
 
                relobject.classId = RelOid_pg_class;
                relobject.objectId = relId;
@@ -195,7 +195,7 @@ CreateConstraintEntry(const char *constraintName,
                 * Register normal dependency from constraint to foreign relation,
                 * or to specific column(s) if any are mentioned.
                 */
-               ObjectAddress   relobject;
+               ObjectAddress relobject;
 
                relobject.classId = RelOid_pg_class;
                relobject.objectId = foreignRelId;
@@ -219,11 +219,11 @@ CreateConstraintEntry(const char *constraintName,
        if (conExpr != NULL)
        {
                /*
-                * Register dependencies from constraint to objects mentioned
-                * in CHECK expression.  We gin up a rather bogus rangetable
-                * list to handle any Vars in the constraint.
+                * Register dependencies from constraint to objects mentioned in
+                * CHECK expression.  We gin up a rather bogus rangetable list to
+                * handle any Vars in the constraint.
                 */
-               RangeTblEntry   rte;
+               RangeTblEntry rte;
 
                MemSet(&rte, 0, sizeof(rte));
                rte.type = T_RangeTblEntry;
@@ -271,7 +271,7 @@ ConstraintNameIsUsed(Oid relId, Oid relNamespace, const char *cname)
 
        while (HeapTupleIsValid(tup = systable_getnext(conscan)))
        {
-               Form_pg_constraint      con = (Form_pg_constraint) GETSTRUCT(tup);
+               Form_pg_constraint con = (Form_pg_constraint) GETSTRUCT(tup);
 
                if (con->conrelid == relId)
                {
@@ -338,7 +338,7 @@ GenerateConstraintName(Oid relId, Oid relNamespace, int *counter)
 
                while (HeapTupleIsValid(tup = systable_getnext(conscan)))
                {
-                       Form_pg_constraint      con = (Form_pg_constraint) GETSTRUCT(tup);
+                       Form_pg_constraint con = (Form_pg_constraint) GETSTRUCT(tup);
 
                        if (con->conrelid == relId)
                        {
@@ -366,7 +366,7 @@ ConstraintNameIsGenerated(const char *cname)
 {
        if (cname[0] != '$')
                return false;
-       if (strspn(cname+1, "0123456789") != strlen(cname+1))
+       if (strspn(cname + 1, "0123456789") != strlen(cname + 1))
                return false;
        return true;
 }
@@ -377,11 +377,11 @@ ConstraintNameIsGenerated(const char *cname)
 void
 RemoveConstraintById(Oid conId)
 {
-       Relation                conDesc;
-       ScanKeyData             skey[1];
-       SysScanDesc     conscan;
-       HeapTuple               tup;
-       Form_pg_constraint      con;
+       Relation        conDesc;
+       ScanKeyData skey[1];
+       SysScanDesc conscan;
+       HeapTuple       tup;
+       Form_pg_constraint con;
 
        conDesc = heap_openr(ConstraintRelationName, RowExclusiveLock);
 
@@ -399,8 +399,8 @@ RemoveConstraintById(Oid conId)
        con = (Form_pg_constraint) GETSTRUCT(tup);
 
        /*
-        * If the constraint is for a relation, open and exclusive-lock
-        * the relation it's for.
+        * If the constraint is for a relation, open and exclusive-lock the
+        * relation it's for.
         *
         * XXX not clear what we should lock, if anything, for other constraints.
         */
@@ -411,16 +411,16 @@ RemoveConstraintById(Oid conId)
                rel = heap_open(con->conrelid, AccessExclusiveLock);
 
                /*
-                * We need to update the relcheck count if it is a check constraint
-                * being dropped.  This update will force backends to rebuild
-                * relcache entries when we commit.
+                * We need to update the relcheck count if it is a check
+                * constraint being dropped.  This update will force backends to
+                * rebuild relcache entries when we commit.
                 */
                if (con->contype == CONSTRAINT_CHECK)
                {
-                       Relation                pgrel;
-                       HeapTuple               relTup;
-                       Form_pg_class   classForm;
-               
+                       Relation        pgrel;
+                       HeapTuple       relTup;
+                       Form_pg_class classForm;
+
                        pgrel = heap_openr(RelationRelationName, RowExclusiveLock);
                        relTup = SearchSysCacheCopy(RELOID,
                                                                                ObjectIdGetDatum(con->conrelid),
index 7dfd067..bd72150 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_conversion.c,v 1.5 2002/08/06 05:40:45 ishii Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_conversion.c,v 1.6 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
  * Add a new tuple to pg_coversion.
  * ---------------
  */
-Oid    ConversionCreate(const char *conname, Oid connamespace,
-                                                        int32 conowner,
-                                                        int4 conforencoding, int4 contoencoding,
-                                                        Oid conproc, bool def)
+Oid
+ConversionCreate(const char *conname, Oid connamespace,
+                                int32 conowner,
+                                int4 conforencoding, int4 contoencoding,
+                                Oid conproc, bool def)
 {
-       int i;
+       int                     i;
        Relation        rel;
        TupleDesc       tupDesc;
        HeapTuple       tup;
@@ -49,8 +50,8 @@ Oid   ConversionCreate(const char *conname, Oid connamespace,
        Datum           values[Natts_pg_conversion];
        NameData        cname;
        Oid                     oid;
-       ObjectAddress   myself,
-                                       referenced;
+       ObjectAddress myself,
+                               referenced;
 
        /* sanity checks */
        if (!conname)
@@ -58,20 +59,22 @@ Oid ConversionCreate(const char *conname, Oid connamespace,
 
        /* make sure there is no existing conversion of same name */
        if (SearchSysCacheExists(CONNAMESP,
-                                                       PointerGetDatum(conname),
-                                                       ObjectIdGetDatum(connamespace),
-                                                        0,0))
+                                                        PointerGetDatum(conname),
+                                                        ObjectIdGetDatum(connamespace),
+                                                        0, 0))
                elog(ERROR, "conversion name \"%s\" already exists", conname);
 
        if (def)
        {
-               /* make sure there is no existing default
-                  <for encoding><to encoding> pair in this name space */
+               /*
+                * make sure there is no existing default <for encoding><to
+                * encoding> pair in this name space
+                */
                if (FindDefaultConversion(connamespace,
                                                                  conforencoding,
                                                                  contoencoding))
                        elog(ERROR, "default conversion for %s to %s already exists",
-                                pg_encoding_to_char(conforencoding),pg_encoding_to_char(contoencoding));
+                                pg_encoding_to_char(conforencoding), pg_encoding_to_char(contoencoding));
        }
 
        /* open pg_conversion */
@@ -129,8 +132,9 @@ Oid ConversionCreate(const char *conname, Oid connamespace,
  * Drop a conversion and do dependency check.
  * ---------------
  */
-void   ConversionDrop(const char *conname, Oid connamespace,
-                                          int32 conowner, DropBehavior behavior)
+void
+ConversionDrop(const char *conname, Oid connamespace,
+                          int32 conowner, DropBehavior behavior)
 {
        Relation        rel;
        TupleDesc       tupDesc;
@@ -138,8 +142,8 @@ void        ConversionDrop(const char *conname, Oid connamespace,
        HeapScanDesc scan;
        ScanKeyData scanKeyData;
        Form_pg_conversion body;
-       ObjectAddress   object;
-       Oid     myoid;
+       ObjectAddress object;
+       Oid                     myoid;
 
        /* sanity checks */
        if (!conname)
@@ -156,12 +160,12 @@ void      ConversionDrop(const char *conname, Oid connamespace,
        tupDesc = rel->rd_att;
 
        scan = heap_beginscan(rel, SnapshotNow,
-                                                         1, &scanKeyData);
+                                                 1, &scanKeyData);
 
        /* search for the target tuple */
        while (HeapTupleIsValid(tuple = heap_getnext(scan, ForwardScanDirection)))
        {
-               body = (Form_pg_conversion)GETSTRUCT(tuple);
+               body = (Form_pg_conversion) GETSTRUCT(tuple);
                if (!strncmp(NameStr(body->conname), conname, NAMEDATALEN))
                        break;
        }
@@ -172,12 +176,12 @@ void      ConversionDrop(const char *conname, Oid connamespace,
                return;
        }
 
-       if (!superuser() && ((Form_pg_conversion)GETSTRUCT(tuple))->conowner != GetUserId())
+       if (!superuser() && ((Form_pg_conversion) GETSTRUCT(tuple))->conowner != GetUserId())
                elog(ERROR, "permission denied");
 
        myoid = HeapTupleGetOid(tuple);
        heap_endscan(scan);
-       heap_close(rel, AccessShareLock);
+       heap_close(rel, AccessShareLock);
 
        /*
         * Do the deletion
@@ -215,7 +219,7 @@ RemoveConversionById(Oid conversionOid)
        tupDesc = rel->rd_att;
 
        scan = heap_beginscan(rel, SnapshotNow,
-                                                         1, &scanKeyData);
+                                                 1, &scanKeyData);
 
        /* search for the target tuple */
        if (HeapTupleIsValid(tuple = heap_getnext(scan, ForwardScanDirection)))
@@ -233,28 +237,29 @@ RemoveConversionById(Oid conversionOid)
  * If found, returns the procedure's oid, otherwise InvalidOid.
  * ---------------
  */
-Oid FindDefaultConversion(Oid name_space, int4 for_encoding, int4 to_encoding)
+Oid
+FindDefaultConversion(Oid name_space, int4 for_encoding, int4 to_encoding)
 {
-       CatCList        *catlist;
+       CatCList   *catlist;
        HeapTuple       tuple;
        Form_pg_conversion body;
-       Oid proc = InvalidOid;
-       int     i;
+       Oid                     proc = InvalidOid;
+       int                     i;
 
        /* Check we have usage rights in target namespace */
        if (pg_namespace_aclcheck(name_space, GetUserId(), ACL_USAGE) != ACLCHECK_OK)
                return proc;
 
        catlist = SearchSysCacheList(CONDEFAULT, 3,
-                                                          ObjectIdGetDatum(name_space),
-                                                          Int32GetDatum(for_encoding),
-                                                          Int32GetDatum(to_encoding),
-                                                          0);
+                                                                ObjectIdGetDatum(name_space),
+                                                                Int32GetDatum(for_encoding),
+                                                                Int32GetDatum(to_encoding),
+                                                                0);
 
        for (i = 0; i < catlist->n_members; i++)
        {
                tuple = &catlist->members[i]->tuple;
-               body = (Form_pg_conversion)GETSTRUCT(tuple);
+               body = (Form_pg_conversion) GETSTRUCT(tuple);
                if (body->condefault == TRUE)
                {
                        proc = body->conproc;
@@ -272,22 +277,23 @@ Oid FindDefaultConversion(Oid name_space, int4 for_encoding, int4 to_encoding)
  * Returns conversion oid.
  * ---------------
  */
-Oid FindConversion(const char *conname, Oid connamespace)
+Oid
+FindConversion(const char *conname, Oid connamespace)
 {
        HeapTuple       tuple;
-       Oid procoid;
-       Oid conoid;
+       Oid                     procoid;
+       Oid                     conoid;
        AclResult       aclresult;
 
        /* search pg_conversion by connamespace and conversion name */
        tuple = SearchSysCache(CONNAMESP,
                                                   PointerGetDatum(conname),
                                                   ObjectIdGetDatum(connamespace),
-                                                  0,0);
+                                                  0, 0);
 
        if (!HeapTupleIsValid(tuple))
                return InvalidOid;
-       procoid = ((Form_pg_conversion)GETSTRUCT(tuple))->conproc;
+       procoid = ((Form_pg_conversion) GETSTRUCT(tuple))->conproc;
        conoid = HeapTupleGetOid(tuple);
 
        ReleaseSysCache(tuple);
@@ -318,7 +324,7 @@ pg_convert3(PG_FUNCTION_ARGS)
        text       *retval;
        unsigned char *str;
        unsigned char *result;
-       int len;
+       int                     len;
 
        if (!OidIsValid(convoid))
                elog(ERROR, "Conversion does not exist");
@@ -331,13 +337,13 @@ pg_convert3(PG_FUNCTION_ARGS)
 
        tuple = SearchSysCache(CONOID,
                                                   ObjectIdGetDatum(convoid),
-                                                  0,0,0);
+                                                  0, 0, 0);
        if (!HeapTupleIsValid(tuple))
                elog(ERROR, "Conversion %u search from syscache failed", convoid);
 
        result = palloc(len * 4 + 1);
 
-       body = (Form_pg_conversion)GETSTRUCT(tuple);
+       body = (Form_pg_conversion) GETSTRUCT(tuple);
        OidFunctionCall5(body->conproc,
                                         Int32GetDatum(body->conforencoding),
                                         Int32GetDatum(body->contoencoding),
@@ -347,9 +353,11 @@ pg_convert3(PG_FUNCTION_ARGS)
 
        ReleaseSysCache(tuple);
 
-       /* build text data type structre. we cannot use textin() here,
-          since textin assumes that input string encoding is same as
-          database encoding.  */
+       /*
+        * build text data type structre. we cannot use textin() here, since
+        * textin assumes that input string encoding is same as database
+        * encoding.
+        */
        len = strlen(result) + VARHDRSZ;
        retval = palloc(len);
        VARATT_SIZEP(retval) = len;
index 0427b37..cd058a1 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_depend.c,v 1.5 2002/08/11 21:17:34 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_depend.c,v 1.6 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -44,7 +44,7 @@ recordDependencyOn(const ObjectAddress *depender,
 
 /*
  * Record multiple dependencies (of the same kind) for a single dependent
- * object.  This has a little less overhead than recording each separately.
+ * object.     This has a little less overhead than recording each separately.
  */
 void
 recordMultipleDependencies(const ObjectAddress *depender,
@@ -79,9 +79,9 @@ recordMultipleDependencies(const ObjectAddress *depender,
        for (i = 0; i < nreferenced; i++, referenced++)
        {
                /*
-                * If the referenced object is pinned by the system, there's no real
-                * need to record dependencies on it.  This saves lots of space in
-                * pg_depend, so it's worth the time taken to check.
+                * If the referenced object is pinned by the system, there's no
+                * real need to record dependencies on it.      This saves lots of
+                * space in pg_depend, so it's worth the time taken to check.
                 */
                if (!isObjectPinned(referenced, dependDesc))
                {
@@ -89,15 +89,15 @@ recordMultipleDependencies(const ObjectAddress *depender,
                         * Record the Dependency.  Note we don't bother to check for
                         * duplicate dependencies; there's no harm in them.
                         */
-                       values[Anum_pg_depend_classid - 1]      = ObjectIdGetDatum(depender->classId);
-                       values[Anum_pg_depend_objid - 1]        = ObjectIdGetDatum(depender->objectId);
-                       values[Anum_pg_depend_objsubid - 1]     = Int32GetDatum(depender->objectSubId);
+                       values[Anum_pg_depend_classid - 1] = ObjectIdGetDatum(depender->classId);
+                       values[Anum_pg_depend_objid - 1] = ObjectIdGetDatum(depender->objectId);
+                       values[Anum_pg_depend_objsubid - 1] = Int32GetDatum(depender->objectSubId);
 
-                       values[Anum_pg_depend_refclassid - 1]   = ObjectIdGetDatum(referenced->classId);
-                       values[Anum_pg_depend_refobjid - 1]             = ObjectIdGetDatum(referenced->objectId);
-                       values[Anum_pg_depend_refobjsubid - 1]  = Int32GetDatum(referenced->objectSubId);
+                       values[Anum_pg_depend_refclassid - 1] = ObjectIdGetDatum(referenced->classId);
+                       values[Anum_pg_depend_refobjid - 1] = ObjectIdGetDatum(referenced->objectId);
+                       values[Anum_pg_depend_refobjsubid - 1] = Int32GetDatum(referenced->objectSubId);
 
-                       values[Anum_pg_depend_deptype -1] = CharGetDatum((char) behavior);
+                       values[Anum_pg_depend_deptype - 1] = CharGetDatum((char) behavior);
 
                        tup = heap_formtuple(dependDesc->rd_att, values, nulls);
 
@@ -130,11 +130,11 @@ recordMultipleDependencies(const ObjectAddress *depender,
 long
 deleteDependencyRecordsFor(Oid classId, Oid objectId)
 {
-       long                    count = 0;
-       Relation                depRel;
-       ScanKeyData             key[2];
-       SysScanDesc             scan;
-       HeapTuple               tup;
+       long            count = 0;
+       Relation        depRel;
+       ScanKeyData key[2];
+       SysScanDesc scan;
+       HeapTuple       tup;
 
        depRel = heap_openr(DependRelationName, RowExclusiveLock);
 
@@ -174,7 +174,7 @@ static bool
 isObjectPinned(const ObjectAddress *object, Relation rel)
 {
        bool            ret = false;
-       SysScanDesc     scan;
+       SysScanDesc scan;
        HeapTuple       tup;
        ScanKeyData key[2];
 
@@ -192,13 +192,13 @@ isObjectPinned(const ObjectAddress *object, Relation rel)
        /*
         * Since we won't generate additional pg_depend entries for pinned
         * objects, there can be at most one entry referencing a pinned
-        * object.  Hence, it's sufficient to look at the first returned
+        * object.      Hence, it's sufficient to look at the first returned
         * tuple; we don't need to loop.
         */
        tup = systable_getnext(scan);
        if (HeapTupleIsValid(tup))
        {
-               Form_pg_depend  foundDep = (Form_pg_depend) GETSTRUCT(tup);
+               Form_pg_depend foundDep = (Form_pg_depend) GETSTRUCT(tup);
 
                if (foundDep->deptype == DEPENDENCY_PIN)
                        ret = true;
index 8c61746..941212a 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.76 2002/08/22 00:01:41 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.77 2002/09/04 20:31:14 momjian Exp $
  *
  * NOTES
  *       these routines moved here from commands/define.c and somewhat cleaned up.
 
 
 static Oid OperatorGet(const char *operatorName,
-                                          Oid operatorNamespace,
-                                          Oid leftObjectId,
-                                          Oid rightObjectId,
-                                          bool *defined);
+                       Oid operatorNamespace,
+                       Oid leftObjectId,
+                       Oid rightObjectId,
+                       bool *defined);
 
 static Oid OperatorLookup(List *operatorName,
-                                                 Oid leftObjectId,
-                                                 Oid rightObjectId,
-                                                 bool *defined);
+                          Oid leftObjectId,
+                          Oid rightObjectId,
+                          bool *defined);
 
 static Oid OperatorShellMake(const char *operatorName,
-                                                        Oid operatorNamespace,
-                                                        Oid leftTypeId,
-                                                        Oid rightTypeId);
+                                 Oid operatorNamespace,
+                                 Oid leftTypeId,
+                                 Oid rightTypeId);
 
 static void OperatorUpd(Oid baseId, Oid commId, Oid negId);
 
 static Oid get_other_operator(List *otherOp,
-                                                         Oid otherLeftTypeId, Oid otherRightTypeId,
-                                                         const char *operatorName, Oid operatorNamespace,
-                                                         Oid leftTypeId, Oid rightTypeId,
-                                                         bool isCommutator);
+                                  Oid otherLeftTypeId, Oid otherRightTypeId,
+                                  const char *operatorName, Oid operatorNamespace,
+                                  Oid leftTypeId, Oid rightTypeId,
+                                  bool isCommutator);
 
 static void makeOperatorDependencies(HeapTuple tuple, Oid pg_operator_relid);
 
@@ -229,23 +229,23 @@ OperatorShellMake(const char *operatorName,
         */
        i = 0;
        namestrcpy(&oname, operatorName);
-       values[i++] = NameGetDatum(&oname);                             /* oprname */
+       values[i++] = NameGetDatum(&oname); /* oprname */
        values[i++] = ObjectIdGetDatum(operatorNamespace);      /* oprnamespace */
-       values[i++] = Int32GetDatum(GetUserId());               /* oprowner */
+       values[i++] = Int32GetDatum(GetUserId());       /* oprowner */
        values[i++] = CharGetDatum(leftTypeId ? (rightTypeId ? 'b' : 'r') : 'l');       /* oprkind */
-       values[i++] = BoolGetDatum(false);                              /* oprcanhash */
-       values[i++] = ObjectIdGetDatum(leftTypeId);             /* oprleft */
-       values[i++] = ObjectIdGetDatum(rightTypeId);    /* oprright */
-       values[i++] = ObjectIdGetDatum(InvalidOid);             /* oprresult */
-       values[i++] = ObjectIdGetDatum(InvalidOid);             /* oprcom */
-       values[i++] = ObjectIdGetDatum(InvalidOid);             /* oprnegate */
-       values[i++] = ObjectIdGetDatum(InvalidOid);             /* oprlsortop */
-       values[i++] = ObjectIdGetDatum(InvalidOid);             /* oprrsortop */
-       values[i++] = ObjectIdGetDatum(InvalidOid);             /* oprltcmpop */
-       values[i++] = ObjectIdGetDatum(InvalidOid);             /* oprgtcmpop */
-       values[i++] = ObjectIdGetDatum(InvalidOid);             /* oprcode */
-       values[i++] = ObjectIdGetDatum(InvalidOid);             /* oprrest */
-       values[i++] = ObjectIdGetDatum(InvalidOid);             /* oprjoin */
+       values[i++] = BoolGetDatum(false);      /* oprcanhash */
+       values[i++] = ObjectIdGetDatum(leftTypeId); /* oprleft */
+       values[i++] = ObjectIdGetDatum(rightTypeId);            /* oprright */
+       values[i++] = ObjectIdGetDatum(InvalidOid); /* oprresult */
+       values[i++] = ObjectIdGetDatum(InvalidOid); /* oprcom */
+       values[i++] = ObjectIdGetDatum(InvalidOid); /* oprnegate */
+       values[i++] = ObjectIdGetDatum(InvalidOid); /* oprlsortop */
+       values[i++] = ObjectIdGetDatum(InvalidOid); /* oprrsortop */
+       values[i++] = ObjectIdGetDatum(InvalidOid); /* oprltcmpop */
+       values[i++] = ObjectIdGetDatum(InvalidOid); /* oprgtcmpop */
+       values[i++] = ObjectIdGetDatum(InvalidOid); /* oprcode */
+       values[i++] = ObjectIdGetDatum(InvalidOid); /* oprrest */
+       values[i++] = ObjectIdGetDatum(InvalidOid); /* oprjoin */
 
        /*
         * open pg_operator
@@ -506,14 +506,14 @@ OperatorCreate(const char *operatorName,
 
        i = 0;
        namestrcpy(&oname, operatorName);
-       values[i++] = NameGetDatum(&oname);                     /* oprname */
+       values[i++] = NameGetDatum(&oname); /* oprname */
        values[i++] = ObjectIdGetDatum(operatorNamespace);      /* oprnamespace */
-       values[i++] = Int32GetDatum(GetUserId());               /* oprowner */
+       values[i++] = Int32GetDatum(GetUserId());       /* oprowner */
        values[i++] = CharGetDatum(leftTypeId ? (rightTypeId ? 'b' : 'r') : 'l');       /* oprkind */
-       values[i++] = BoolGetDatum(canHash);                    /* oprcanhash */
-       values[i++] = ObjectIdGetDatum(leftTypeId);             /* oprleft */
-       values[i++] = ObjectIdGetDatum(rightTypeId);    /* oprright */
-       values[i++] = ObjectIdGetDatum(operResultType); /* oprresult */
+       values[i++] = BoolGetDatum(canHash);            /* oprcanhash */
+       values[i++] = ObjectIdGetDatum(leftTypeId); /* oprleft */
+       values[i++] = ObjectIdGetDatum(rightTypeId);            /* oprright */
+       values[i++] = ObjectIdGetDatum(operResultType);         /* oprresult */
 
        /*
         * Set up the other operators.  If they do not currently exist, create
@@ -528,16 +528,17 @@ OperatorCreate(const char *operatorName,
                                                                                  operatorName, operatorNamespace,
                                                                                  leftTypeId, rightTypeId,
                                                                                  true);
+
                /*
-                * self-linkage to this operator; will fix below. Note
-                * that only self-linkage for commutation makes sense.
+                * self-linkage to this operator; will fix below. Note that only
+                * self-linkage for commutation makes sense.
                 */
                if (!OidIsValid(commutatorId))
                        selfCommutator = true;
        }
        else
                commutatorId = InvalidOid;
-       values[i++] = ObjectIdGetDatum(commutatorId);   /* oprcom */
+       values[i++] = ObjectIdGetDatum(commutatorId);           /* oprcom */
 
        if (negatorName)
        {
@@ -550,20 +551,20 @@ OperatorCreate(const char *operatorName,
        }
        else
                negatorId = InvalidOid;
-       values[i++] = ObjectIdGetDatum(negatorId);              /* oprnegate */
+       values[i++] = ObjectIdGetDatum(negatorId);      /* oprnegate */
 
        if (leftSortName)
        {
                /* left sort op takes left-side data type */
                leftSortId = get_other_operator(leftSortName,
-                                                                          leftTypeId, leftTypeId,
-                                                                          operatorName, operatorNamespace,
-                                                                          leftTypeId, rightTypeId,
-                                                                          false);
+                                                                               leftTypeId, leftTypeId,
+                                                                               operatorName, operatorNamespace,
+                                                                               leftTypeId, rightTypeId,
+                                                                               false);
        }
        else
                leftSortId = InvalidOid;
-       values[i++] = ObjectIdGetDatum(leftSortId);             /* oprlsortop */
+       values[i++] = ObjectIdGetDatum(leftSortId); /* oprlsortop */
 
        if (rightSortName)
        {
@@ -576,7 +577,7 @@ OperatorCreate(const char *operatorName,
        }
        else
                rightSortId = InvalidOid;
-       values[i++] = ObjectIdGetDatum(rightSortId);    /* oprrsortop */
+       values[i++] = ObjectIdGetDatum(rightSortId);            /* oprrsortop */
 
        if (ltCompareName)
        {
@@ -589,7 +590,7 @@ OperatorCreate(const char *operatorName,
        }
        else
                ltCompareId = InvalidOid;
-       values[i++] = ObjectIdGetDatum(ltCompareId);    /* oprltcmpop */
+       values[i++] = ObjectIdGetDatum(ltCompareId);            /* oprltcmpop */
 
        if (gtCompareName)
        {
@@ -602,11 +603,11 @@ OperatorCreate(const char *operatorName,
        }
        else
                gtCompareId = InvalidOid;
-       values[i++] = ObjectIdGetDatum(gtCompareId);    /* oprgtcmpop */
+       values[i++] = ObjectIdGetDatum(gtCompareId);            /* oprgtcmpop */
 
-       values[i++] = ObjectIdGetDatum(procOid);                /* oprcode */
-       values[i++] = ObjectIdGetDatum(restOid);                /* oprrest */
-       values[i++] = ObjectIdGetDatum(joinOid);                /* oprjoin */
+       values[i++] = ObjectIdGetDatum(procOid);        /* oprcode */
+       values[i++] = ObjectIdGetDatum(restOid);        /* oprrest */
+       values[i++] = ObjectIdGetDatum(joinOid);        /* oprjoin */
 
        pg_operator_desc = heap_openr(OperatorRelationName, RowExclusiveLock);
 
@@ -703,8 +704,8 @@ get_other_operator(List *otherOp, Oid otherLeftTypeId, Oid otherRightTypeId,
                otherRightTypeId == rightTypeId)
        {
                /*
-                * self-linkage to this operator; caller will fix later. Note
-                * that only self-linkage for commutation makes sense.
+                * self-linkage to this operator; caller will fix later. Note that
+                * only self-linkage for commutation makes sense.
                 */
                if (!isCommutator)
                        elog(ERROR, "operator cannot be its own negator or sort operator");
@@ -868,9 +869,9 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
 static void
 makeOperatorDependencies(HeapTuple tuple, Oid pg_operator_relid)
 {
-       Form_pg_operator        oper = (Form_pg_operator) GETSTRUCT(tuple);
-       ObjectAddress   myself,
-                                       referenced;
+       Form_pg_operator oper = (Form_pg_operator) GETSTRUCT(tuple);
+       ObjectAddress myself,
+                               referenced;
 
        myself.classId = pg_operator_relid;
        myself.objectId = HeapTupleGetOid(tuple);
@@ -918,11 +919,11 @@ makeOperatorDependencies(HeapTuple tuple, Oid pg_operator_relid)
        /*
         * NOTE: we do not consider the operator to depend on the associated
         * operators oprcom, oprnegate, oprlsortop, oprrsortop, oprltcmpop,
-        * oprgtcmpop.  We would not want to delete this operator if those
-        * go away, but only reset the link fields; which is not a function
-        * that the dependency code can presently handle.  (Something could
-        * perhaps be done with objectSubId though.)  For now, it's okay to
-        * let those links dangle if a referenced operator is removed.
+        * oprgtcmpop.  We would not want to delete this operator if those go
+        * away, but only reset the link fields; which is not a function that
+        * the dependency code can presently handle.  (Something could perhaps
+        * be done with objectSubId though.)  For now, it's okay to let those
+        * links dangle if a referenced operator is removed.
         */
 
        /* Dependency on implementation function */
index 805ce61..ba667a2 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.92 2002/09/02 01:05:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.93 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,9 +34,9 @@
 
 
 static void checkretval(Oid rettype, char fn_typtype, List *queryTreeList);
-Datum fmgr_internal_validator(PG_FUNCTION_ARGS);
-Datum fmgr_c_validator(PG_FUNCTION_ARGS);
-Datum fmgr_sql_validator(PG_FUNCTION_ARGS);
+Datum          fmgr_internal_validator(PG_FUNCTION_ARGS);
+Datum          fmgr_c_validator(PG_FUNCTION_ARGS);
+Datum          fmgr_sql_validator(PG_FUNCTION_ARGS);
 
 
 /* ----------------------------------------------------------------
@@ -73,8 +73,8 @@ ProcedureCreate(const char *procedureName,
        TupleDesc       tupDesc;
        Oid                     retval;
        bool            is_update;
-       ObjectAddress   myself,
-                                       referenced;
+       ObjectAddress myself,
+                               referenced;
 
        /*
         * sanity checks
@@ -153,16 +153,16 @@ ProcedureCreate(const char *procedureName,
        i = 0;
        namestrcpy(&procname, procedureName);
        values[i++] = NameGetDatum(&procname);          /* proname */
-       values[i++] = ObjectIdGetDatum(procNamespace); /* pronamespace */
+       values[i++] = ObjectIdGetDatum(procNamespace);          /* pronamespace */
        values[i++] = Int32GetDatum(GetUserId());       /* proowner */
-       values[i++] = ObjectIdGetDatum(languageObjectId); /* prolang */
-       values[i++] = BoolGetDatum(isAgg);                      /* proisagg */
-       values[i++] = BoolGetDatum(security_definer); /* prosecdef */
+       values[i++] = ObjectIdGetDatum(languageObjectId);       /* prolang */
+       values[i++] = BoolGetDatum(isAgg);      /* proisagg */
+       values[i++] = BoolGetDatum(security_definer);           /* prosecdef */
        values[i++] = BoolGetDatum(isStrict);           /* proisstrict */
        values[i++] = BoolGetDatum(returnsSet);         /* proretset */
        values[i++] = CharGetDatum(volatility);         /* provolatile */
-       values[i++] = UInt16GetDatum(parameterCount); /* pronargs */
-       values[i++] = ObjectIdGetDatum(returnType);     /* prorettype */
+       values[i++] = UInt16GetDatum(parameterCount);           /* pronargs */
+       values[i++] = ObjectIdGetDatum(returnType); /* prorettype */
        values[i++] = PointerGetDatum(typev);           /* proargtypes */
        values[i++] = DirectFunctionCall1(textin,       /* prosrc */
                                                                          CStringGetDatum(prosrc));
@@ -213,8 +213,8 @@ ProcedureCreate(const char *procedureName,
                }
 
                /* do not change existing ownership or permissions, either */
-               replaces[Anum_pg_proc_proowner-1] = ' ';
-               replaces[Anum_pg_proc_proacl-1] = ' ';
+               replaces[Anum_pg_proc_proowner - 1] = ' ';
+               replaces[Anum_pg_proc_proacl - 1] = ' ';
 
                /* Okay, do it... */
                tup = heap_modifytuple(oldtup, rel, values, nulls, replaces);
@@ -228,7 +228,7 @@ ProcedureCreate(const char *procedureName,
                /* Creating a new procedure */
 
                /* start out with empty permissions */
-               nulls[Anum_pg_proc_proacl-1] = 'n';
+               nulls[Anum_pg_proc_proacl - 1] = 'n';
 
                tup = heap_formtuple(tupDesc, values, nulls);
                simple_heap_insert(rel, tup);
@@ -332,7 +332,8 @@ checkretval(Oid rettype, char fn_typtype, List *queryTreeList)
        tlist = parse->targetList;
 
        /*
-        * The last query must be a SELECT if and only if return type isn't VOID.
+        * The last query must be a SELECT if and only if return type isn't
+        * VOID.
         */
        if (rettype == VOIDOID)
        {
@@ -360,8 +361,8 @@ checkretval(Oid rettype, char fn_typtype, List *queryTreeList)
 
                /*
                 * For base-type returns, the target list should have exactly one
-                * entry, and its type should agree with what the user declared. (As
-                * of Postgres 7.2, we accept binary-compatible types too.)
+                * entry, and its type should agree with what the user declared.
+                * (As of Postgres 7.2, we accept binary-compatible types too.)
                 */
                if (tlistlen != 1)
                        elog(ERROR, "function declared to return %s returns multiple columns in final SELECT",
@@ -378,11 +379,11 @@ checkretval(Oid rettype, char fn_typtype, List *queryTreeList)
                Assert(typerelid != InvalidOid);
 
                /*
-                * If the target list is of length 1, and the type of the varnode in
-                * the target list matches the declared return type, this is okay.
-                * This can happen, for example, where the body of the function is
-                * 'SELECT func2()', where func2 has the same return type as the
-                * function that's calling it.
+                * If the target list is of length 1, and the type of the varnode
+                * in the target list matches the declared return type, this is
+                * okay. This can happen, for example, where the body of the
+                * function is 'SELECT func2()', where func2 has the same return
+                * type as the function that's calling it.
                 */
                if (tlistlen == 1)
                {
@@ -392,15 +393,15 @@ checkretval(Oid rettype, char fn_typtype, List *queryTreeList)
                }
 
                /*
-                * Otherwise verify that the targetlist matches the return tuple type.
-                * This part of the typechecking is a hack. We look up the relation
-                * that is the declared return type, and scan the non-deleted
-                * attributes to ensure that they match the datatypes of the
-                * non-resjunk columns.
+                * Otherwise verify that the targetlist matches the return tuple
+                * type. This part of the typechecking is a hack. We look up the
+                * relation that is the declared return type, and scan the
+                * non-deleted attributes to ensure that they match the datatypes
+                * of the non-resjunk columns.
                 */
                reln = relation_open(typerelid, AccessShareLock);
                relnatts = reln->rd_rel->relnatts;
-               rellogcols = 0;                         /* we'll count nondeleted cols as we go */
+               rellogcols = 0;                 /* we'll count nondeleted cols as we go */
                colindex = 0;
 
                foreach(tlistitem, tlist)
@@ -413,7 +414,8 @@ checkretval(Oid rettype, char fn_typtype, List *queryTreeList)
                        if (tle->resdom->resjunk)
                                continue;
 
-                       do {
+                       do
+                       {
                                colindex++;
                                if (colindex > relnatts)
                                        elog(ERROR, "function declared to return %s does not SELECT the right number of columns (%d)",
@@ -453,8 +455,8 @@ checkretval(Oid rettype, char fn_typtype, List *queryTreeList)
                Assert(typerelid == InvalidOid);
 
                /*
-                * For RECORD return type, defer this check until we get the
-                * first tuple.
+                * For RECORD return type, defer this check until we get the first
+                * tuple.
                 */
        }
        else
@@ -532,7 +534,7 @@ fmgr_c_validator(PG_FUNCTION_ARGS)
        if (isnull)
                elog(ERROR, "null probin");
        probin = DatumGetCString(DirectFunctionCall1(textout, tmp));
-       
+
        (void) load_external_function(probin, prosrc, true, &libraryhandle);
        (void) fetch_finfo_record(libraryhandle, prosrc);
 
index e3eb6ab..d43c1ed 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.81 2002/09/02 01:05:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.82 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -73,7 +73,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace)
        i = 0;
        namestrcpy(&name, typeName);
        values[i++] = NameGetDatum(&name);      /* typname */
-       values[i++] = ObjectIdGetDatum(typeNamespace); /* typnamespace */
+       values[i++] = ObjectIdGetDatum(typeNamespace);          /* typnamespace */
        values[i++] = ObjectIdGetDatum(InvalidOid); /* typowner */
        values[i++] = Int16GetDatum(0);         /* typlen */
        values[i++] = BoolGetDatum(false);      /* typbyval */
@@ -84,12 +84,12 @@ TypeShellMake(const char *typeName, Oid typeNamespace)
        values[i++] = ObjectIdGetDatum(InvalidOid); /* typelem */
        values[i++] = ObjectIdGetDatum(InvalidOid); /* typinput */
        values[i++] = ObjectIdGetDatum(InvalidOid); /* typoutput */
-       values[i++] = CharGetDatum('i');                        /* typalign */
-       values[i++] = CharGetDatum('p');                        /* typstorage */
-       values[i++] = BoolGetDatum(false);                      /* typnotnull */
-       values[i++] = ObjectIdGetDatum(InvalidOid);     /* typbasetype */
-       values[i++] = Int32GetDatum(-1);                        /* typtypmod */
-       values[i++] = Int32GetDatum(0);                         /* typndims */
+       values[i++] = CharGetDatum('i');        /* typalign */
+       values[i++] = CharGetDatum('p');        /* typstorage */
+       values[i++] = BoolGetDatum(false);      /* typnotnull */
+       values[i++] = ObjectIdGetDatum(InvalidOid); /* typbasetype */
+       values[i++] = Int32GetDatum(-1);        /* typtypmod */
+       values[i++] = Int32GetDatum(0);         /* typndims */
        nulls[i++] = 'n';                       /* typdefaultbin */
        nulls[i++] = 'n';                       /* typdefault */
 
@@ -129,8 +129,8 @@ Oid
 TypeCreate(const char *typeName,
                   Oid typeNamespace,
                   Oid assignedTypeOid,
-                  Oid relationOid,                     /* only for 'c'atalog typeType */
-                  char relationKind,           /* ditto */
+                  Oid relationOid,             /* only for 'c'atalog typeType */
+                  char relationKind,   /* ditto */
                   int16 internalSize,
                   char typeType,
                   char typDelim,
@@ -138,13 +138,13 @@ TypeCreate(const char *typeName,
                   Oid outputProcedure,
                   Oid elementType,
                   Oid baseType,
-                  const char *defaultTypeValue,        /* human readable rep */
+                  const char *defaultTypeValue,                /* human readable rep */
                   const char *defaultTypeBin,  /* cooked rep */
                   bool passedByValue,
                   char alignment,
                   char storage,
                   int32 typeMod,
-                  int32 typNDims,                      /* Array dimensions for baseType */
+                  int32 typNDims,              /* Array dimensions for baseType */
                   bool typeNotNull)
 {
        Relation        pg_type_desc;
@@ -158,8 +158,8 @@ TypeCreate(const char *typeName,
        int                     i;
 
        /*
-        * We assume that the caller validated the arguments individually,
-        * but did not check for bad combinations.
+        * We assume that the caller validated the arguments individually, but
+        * did not check for bad combinations.
         *
         * Validate size specifications: either positive (fixed-length) or -1
         * (varlena) or -2 (cstring).  Pass-by-value types must have a fixed
@@ -195,27 +195,27 @@ TypeCreate(const char *typeName,
        i = 0;
        namestrcpy(&name, typeName);
        values[i++] = NameGetDatum(&name);      /* typname */
-       values[i++] = ObjectIdGetDatum(typeNamespace);  /* typnamespace */
+       values[i++] = ObjectIdGetDatum(typeNamespace);          /* typnamespace */
        values[i++] = Int32GetDatum(GetUserId());       /* typowner */
        values[i++] = Int16GetDatum(internalSize);      /* typlen */
        values[i++] = BoolGetDatum(passedByValue);      /* typbyval */
        values[i++] = CharGetDatum(typeType);           /* typtype */
-       values[i++] = BoolGetDatum(true);                       /* typisdefined */
+       values[i++] = BoolGetDatum(true);       /* typisdefined */
        values[i++] = CharGetDatum(typDelim);           /* typdelim */
        values[i++] = ObjectIdGetDatum(typeType == 'c' ? relationOid : InvalidOid); /* typrelid */
-       values[i++] = ObjectIdGetDatum(elementType);    /* typelem */
-       values[i++] = ObjectIdGetDatum(inputProcedure); /* typinput */
-       values[i++] = ObjectIdGetDatum(outputProcedure); /* typoutput */
+       values[i++] = ObjectIdGetDatum(elementType);            /* typelem */
+       values[i++] = ObjectIdGetDatum(inputProcedure);         /* typinput */
+       values[i++] = ObjectIdGetDatum(outputProcedure);        /* typoutput */
        values[i++] = CharGetDatum(alignment);          /* typalign */
        values[i++] = CharGetDatum(storage);            /* typstorage */
-       values[i++] = BoolGetDatum(typeNotNull);                /* typnotnull */
-       values[i++] = ObjectIdGetDatum(baseType);               /* typbasetype */
-       values[i++] = Int32GetDatum(typeMod);                   /* typtypmod */
-       values[i++] = Int32GetDatum(typNDims);                  /* typndims */
+       values[i++] = BoolGetDatum(typeNotNull);        /* typnotnull */
+       values[i++] = ObjectIdGetDatum(baseType);       /* typbasetype */
+       values[i++] = Int32GetDatum(typeMod);           /* typtypmod */
+       values[i++] = Int32GetDatum(typNDims);          /* typndims */
 
        /*
-        * initialize the default binary value for this type.  Check for
-        * nulls of course.
+        * initialize the default binary value for this type.  Check for nulls
+        * of course.
         */
        if (defaultTypeBin)
                values[i] = DirectFunctionCall1(textin,
@@ -229,7 +229,7 @@ TypeCreate(const char *typeName,
         */
        if (defaultTypeValue)
                values[i] = DirectFunctionCall1(textin,
-                                                                               CStringGetDatum(defaultTypeValue));
+                                                                         CStringGetDatum(defaultTypeValue));
        else
                nulls[i] = 'n';
        i++;                                            /* typdefault */
@@ -291,8 +291,8 @@ TypeCreate(const char *typeName,
         */
        if (!IsBootstrapProcessingMode())
        {
-               ObjectAddress   myself,
-                                               referenced;
+               ObjectAddress myself,
+                                       referenced;
 
                myself.classId = RelOid_pg_type;
                myself.objectId = typeObjectId;
@@ -321,13 +321,13 @@ TypeCreate(const char *typeName,
 
                /*
                 * If the type is a rowtype for a relation, mark it as internally
-                * dependent on the relation, *unless* it is a stand-alone composite
-                * type relation. For the latter case, we have to reverse the
-                * dependency.
+                * dependent on the relation, *unless* it is a stand-alone
+                * composite type relation. For the latter case, we have to
+                * reverse the dependency.
                 *
-                * In the former case, this allows the type to be auto-dropped
-                * when the relation is, and not otherwise. And in the latter,
-                * of course we get the opposite effect.
+                * In the former case, this allows the type to be auto-dropped when
+                * the relation is, and not otherwise. And in the latter, of
+                * course we get the opposite effect.
                 */
                if (OidIsValid(relationOid))
                {
@@ -342,11 +342,11 @@ TypeCreate(const char *typeName,
                }
 
                /*
-                * If the type is an array type, mark it auto-dependent on the base
-                * type.  (This is a compromise between the typical case where the
-                * array type is automatically generated and the case where it is
-                * manually created: we'd prefer INTERNAL for the former case and
-                * NORMAL for the latter.)
+                * If the type is an array type, mark it auto-dependent on the
+                * base type.  (This is a compromise between the typical case
+                * where the array type is automatically generated and the case
+                * where it is manually created: we'd prefer INTERNAL for the
+                * former case and NORMAL for the latter.)
                 */
                if (OidIsValid(elementType))
                {
index 85ee9e3..552573d 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/aggregatecmds.c,v 1.4 2002/08/22 00:01:41 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/aggregatecmds.c,v 1.5 2002/09/04 20:31:14 momjian Exp $
  *
  * DESCRIPTION
  *       The "DefineFoo" routines take the parse tree and pick out the
@@ -110,8 +110,8 @@ DefineAggregate(List *names, List *parameters)
         * We have historically allowed the command to look like basetype = 'ANY'
         * so we must do a case-insensitive comparison for the name ANY.  Ugh.
         *
-        * basetype can be a pseudo-type, but transtype can't, since we need
-        * to be able to store values of the transtype.
+        * basetype can be a pseudo-type, but transtype can't, since we need to
+        * be able to store values of the transtype.
         */
        if (strcasecmp(TypeNameToString(baseType), "ANY") == 0)
                baseTypeId = ANYOID;
@@ -127,10 +127,10 @@ DefineAggregate(List *names, List *parameters)
         * Most of the argument-checking is done inside of AggregateCreate
         */
        AggregateCreate(aggName,        /* aggregate name */
-                                       aggNamespace,   /* namespace */
+                                       aggNamespace,           /* namespace */
                                        transfuncName,          /* step function name */
                                        finalfuncName,          /* final function name */
-                                       baseTypeId,     /* type of data being aggregated */
+                                       baseTypeId, /* type of data being aggregated */
                                        transTypeId,    /* transition data type */
                                        initval);       /* initial condition */
 }
@@ -154,8 +154,8 @@ RemoveAggregate(RemoveAggrStmt *stmt)
         * if a basetype is passed in, then attempt to find an aggregate for
         * that specific type.
         *
-        * else attempt to find an aggregate with a basetype of ANYOID.
-        * This means that the aggregate is to apply to all basetypes (eg, COUNT).
+        * else attempt to find an aggregate with a basetype of ANYOID. This
+        * means that the aggregate is to apply to all basetypes (eg, COUNT).
         */
        if (aggType)
                basetypeID = typenameTypeId(aggType);
@@ -170,7 +170,7 @@ RemoveAggregate(RemoveAggrStmt *stmt)
        tup = SearchSysCache(PROCOID,
                                                 ObjectIdGetDatum(procOid),
                                                 0, 0, 0);
-       if (!HeapTupleIsValid(tup))     /* should not happen */
+       if (!HeapTupleIsValid(tup)) /* should not happen */
                elog(ERROR, "RemoveAggregate: couldn't find pg_proc tuple for %s",
                         NameListToString(aggName));
 
index 2d9a2da..5c20b05 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.45 2002/08/26 18:45:57 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.46 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -110,10 +110,10 @@ typedef struct
 
 
 /* Default statistics target (GUC parameter) */
-int            default_statistics_target = 10;
+int                    default_statistics_target = 10;
 
 
-static int elevel = -1;
+static int     elevel = -1;
 
 static MemoryContext anl_context = NULL;
 
@@ -163,9 +163,9 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt)
                elevel = DEBUG1;
 
        /*
-        * Use the current context for storing analysis info.  vacuum.c ensures
-        * that this context will be cleared when I return, thus releasing the
-        * memory allocated here.
+        * Use the current context for storing analysis info.  vacuum.c
+        * ensures that this context will be cleared when I return, thus
+        * releasing the memory allocated here.
         */
        anl_context = CurrentMemoryContext;
 
@@ -219,7 +219,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt)
         * We can ANALYZE any table except pg_statistic. See update_attstats
         */
        if (IsSystemNamespace(RelationGetNamespace(onerel)) &&
-               strcmp(RelationGetRelationName(onerel), StatisticRelationName) == 0)
+        strcmp(RelationGetRelationName(onerel), StatisticRelationName) == 0)
        {
                relation_close(onerel, AccessShareLock);
                return;
@@ -1042,11 +1042,15 @@ compute_minimal_stats(VacAttrStats *stats,
                         */
                        int                     f1 = nonnull_cnt - summultiple;
                        int                     d = f1 + nmultiple;
-                       double          numer, denom, stadistinct;
+                       double          numer,
+                                               denom,
+                                               stadistinct;
+
+                       numer = (double) numrows *(double) d;
 
-                       numer = (double) numrows * (double) d;
                        denom = (double) (numrows - f1) +
-                               (double) f1 * (double) numrows / totalrows;
+                               (double) f1 *(double) numrows / totalrows;
+
                        stadistinct = numer / denom;
                        /* Clamp to sane range in case of roundoff error */
                        if (stadistinct < (double) d)
@@ -1361,11 +1365,15 @@ compute_scalar_stats(VacAttrStats *stats,
                         */
                        int                     f1 = ndistinct - nmultiple + toowide_cnt;
                        int                     d = f1 + nmultiple;
-                       double          numer, denom, stadistinct;
+                       double          numer,
+                                               denom,
+                                               stadistinct;
+
+                       numer = (double) numrows *(double) d;
 
-                       numer = (double) numrows * (double) d;
                        denom = (double) (numrows - f1) +
-                               (double) f1 * (double) numrows / totalrows;
+                               (double) f1 *(double) numrows / totalrows;
+
                        stadistinct = numer / denom;
                        /* Clamp to sane range in case of roundoff error */
                        if (stadistinct < (double) d)
@@ -1666,7 +1674,7 @@ compare_mcvs(const void *a, const void *b)
  *             relation for ANALYZE (ie, ShareUpdateExclusiveLock instead
  *             of AccessShareLock); but that cure seems worse than the disease,
  *             especially now that ANALYZE doesn't start a new transaction
- *             for each relation.  The lock could be held for a long time...
+ *             for each relation.      The lock could be held for a long time...
  */
 static void
 update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats)
index d49aa0b..55cee5b 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.89 2002/09/03 01:04:41 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.90 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -60,7 +60,7 @@ static void swap_relfilenodes(Oid r1, Oid r2);
  *
  * This clusters the table by creating a new, clustered table and
  * swapping the relfilenodes of the new table and the old table, so
- * the OID of the original table is preserved.  Thus we do not lose
+ * the OID of the original table is preserved. Thus we do not lose
  * GRANT, inheritance nor references to this table (this was a bug
  * in releases thru 7.3).
  *
@@ -111,11 +111,11 @@ cluster(RangeVar *oldrelation, char *oldindexname)
                         RelationGetRelationName(OldHeap));
 
        /*
-        * Disallow clustering system relations.  This will definitely NOT work
-        * for shared relations (we have no way to update pg_class rows in other
-        * databases), nor for nailed-in-cache relations (the relfilenode values
-        * for those are hardwired, see relcache.c).  It might work for other
-        * system relations, but I ain't gonna risk it.
+        * Disallow clustering system relations.  This will definitely NOT
+        * work for shared relations (we have no way to update pg_class rows
+        * in other databases), nor for nailed-in-cache relations (the
+        * relfilenode values for those are hardwired, see relcache.c).  It
+        * might work for other system relations, but I ain't gonna risk it.
         */
        if (IsSystemRelation(OldHeap))
                elog(ERROR, "CLUSTER: cannot cluster system relation \"%s\"",
@@ -130,16 +130,20 @@ cluster(RangeVar *oldrelation, char *oldindexname)
 
        /*
         * Create the new heap, using a temporary name in the same namespace
-        * as the existing table.  NOTE: there is some risk of collision with user
-        * relnames.  Working around this seems more trouble than it's worth; in
-        * particular, we can't create the new heap in a different namespace from
-        * the old, or we will have problems with the TEMP status of temp tables.
+        * as the existing table.  NOTE: there is some risk of collision with
+        * user relnames.  Working around this seems more trouble than it's
+        * worth; in particular, we can't create the new heap in a different
+        * namespace from the old, or we will have problems with the TEMP
+        * status of temp tables.
         */
        snprintf(NewHeapName, NAMEDATALEN, "pg_temp_%u", OIDOldHeap);
 
        OIDNewHeap = make_new_heap(OIDOldHeap, NewHeapName);
 
-       /* We don't need CommandCounterIncrement() because make_new_heap did it. */
+       /*
+        * We don't need CommandCounterIncrement() because make_new_heap did
+        * it.
+        */
 
        /*
         * Copy the heap data into the new table in the desired order.
@@ -244,14 +248,14 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
        while ((tuple = index_getnext(scan, ForwardScanDirection)) != NULL)
        {
                /*
-                * We must copy the tuple because heap_insert() will overwrite
-                * the commit-status fields of the tuple it's handed, and the
-                * retrieved tuple will actually be in a disk buffer!  Thus,
-                * the source relation would get trashed, which is bad news if
-                * we abort later on.  (This was a bug in releases thru 7.0)
+                * We must copy the tuple because heap_insert() will overwrite the
+                * commit-status fields of the tuple it's handed, and the
+                * retrieved tuple will actually be in a disk buffer!  Thus, the
+                * source relation would get trashed, which is bad news if we
+                * abort later on.      (This was a bug in releases thru 7.0)
                 *
-                * Note that the copied tuple will have the original OID, if any,
-                * so this does preserve OIDs.
+                * Note that the copied tuple will have the original OID, if any, so
+                * this does preserve OIDs.
                 */
                HeapTuple       copiedTuple = heap_copytuple(tuple);
 
@@ -276,15 +280,15 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
 static List *
 get_indexattr_list(Relation OldHeap, Oid OldIndex)
 {
-       List *indexes = NIL;
+       List       *indexes = NIL;
        List       *indlist;
 
        /* Ask the relcache to produce a list of the indexes of the old rel */
        foreach(indlist, RelationGetIndexList(OldHeap))
        {
-               Oid             indexOID = (Oid) lfirsti(indlist);
-               HeapTuple indexTuple;
-               HeapTuple classTuple;
+               Oid                     indexOID = (Oid) lfirsti(indlist);
+               HeapTuple       indexTuple;
+               HeapTuple       classTuple;
                Form_pg_index indexForm;
                Form_pg_class classForm;
                IndexAttrs *attrs;
@@ -320,7 +324,8 @@ get_indexattr_list(Relation OldHeap, Oid OldIndex)
                ReleaseSysCache(classTuple);
                ReleaseSysCache(indexTuple);
 
-               /* Cons the gathered data into the list.  We do not care about
+               /*
+                * Cons the gathered data into the list.  We do not care about
                 * ordering, and this is more efficient than append.
                 */
                indexes = lcons(attrs, indexes);
@@ -330,13 +335,13 @@ get_indexattr_list(Relation OldHeap, Oid OldIndex)
 }
 
 /*
- * Create new indexes and swap the filenodes with old indexes.  Then drop
+ * Create new indexes and swap the filenodes with old indexes. Then drop
  * the new index (carrying the old index filenode along).
  */
 static void
 recreate_indexattr(Oid OIDOldHeap, List *indexes)
 {
-       List       *elem;
+       List       *elem;
 
        foreach(elem, indexes)
        {
@@ -352,13 +357,13 @@ recreate_indexattr(Oid OIDOldHeap, List *indexes)
                snprintf(newIndexName, NAMEDATALEN, "pg_temp_%u", attrs->indexOID);
 
                /*
-                * The new index will have primary and constraint status set to false,
-                * but since we will only use its filenode it doesn't matter:
-                * after the filenode swap the index will keep the constraint
-                * status of the old index.
+                * The new index will have primary and constraint status set to
+                * false, but since we will only use its filenode it doesn't
+                * matter: after the filenode swap the index will keep the
+                * constraint status of the old index.
                 */
                newIndexOID = index_create(OIDOldHeap, newIndexName,
-                                                                  attrs->indexInfo, attrs->accessMethodOID,
+                                                               attrs->indexInfo, attrs->accessMethodOID,
                                                                   attrs->classOID, false,
                                                                   false, allowSystemTableMods);
                CommandCounterIncrement();
@@ -369,8 +374,8 @@ recreate_indexattr(Oid OIDOldHeap, List *indexes)
                CommandCounterIncrement();
 
                /*
-                * Make sure that indisclustered is correct: it should be set
-                * only for the index we just clustered on.
+                * Make sure that indisclustered is correct: it should be set only
+                * for the index we just clustered on.
                 */
                pg_index = heap_openr(IndexRelationName, RowExclusiveLock);
                tuple = SearchSysCacheCopy(INDEXRELID,
@@ -392,13 +397,13 @@ recreate_indexattr(Oid OIDOldHeap, List *indexes)
                object.classId = RelOid_pg_class;
                object.objectId = newIndexOID;
                object.objectSubId = 0;
-               
+
                /*
-                * The relation is local to our transaction and we know
-                * nothing depends on it, so DROP_RESTRICT should be OK.
+                * The relation is local to our transaction and we know nothing
+                * depends on it, so DROP_RESTRICT should be OK.
                 */
                performDeletion(&object, DROP_RESTRICT);
-               
+
                /* performDeletion does CommandCounterIncrement() at its end */
        }
 }
@@ -473,7 +478,7 @@ swap_relfilenodes(Oid r1, Oid r2)
        /* Update the tuples in pg_class */
        simple_heap_update(relRelation, &reltup1->t_self, reltup1);
        simple_heap_update(relRelation, &reltup2->t_self, reltup2);
-       
+
        /* Keep system catalogs current */
        indstate = CatalogOpenIndexes(relRelation);
        CatalogIndexInsert(indstate, reltup1);
@@ -481,16 +486,17 @@ swap_relfilenodes(Oid r1, Oid r2)
        CatalogCloseIndexes(indstate);
 
        /*
-        * If we have toast tables associated with the relations being swapped,
-        * change their dependency links to re-associate them with their new
-        * owning relations.  Otherwise the wrong one will get dropped ...
+        * If we have toast tables associated with the relations being
+        * swapped, change their dependency links to re-associate them with
+        * their new owning relations.  Otherwise the wrong one will get
+        * dropped ...
         *
-        * NOTE: for now, we can assume the new table will have a TOAST table
-        * if and only if the old one does.  This logic might need work if we
-        * get smarter about dropped columns.
+        * NOTE: for now, we can assume the new table will have a TOAST table if
+        * and only if the old one does.  This logic might need work if we get
+        * smarter about dropped columns.
         *
-        * NOTE: at present, a TOAST table's only dependency is the one on
-        * its owning table.  If more are ever created, we'd need to use something
+        * NOTE: at present, a TOAST table's only dependency is the one on its
+        * owning table.  If more are ever created, we'd need to use something
         * more selective than deleteDependencyRecordsFor() to get rid of only
         * the link we want.
         */
@@ -532,12 +538,12 @@ swap_relfilenodes(Oid r1, Oid r2)
        }
 
        /*
-        * Blow away the old relcache entries now.  We need this kluge because
-        * relcache.c indexes relcache entries by rd_node as well as OID.
-        * It will get confused if it is asked to (re)build an entry with a new
+        * Blow away the old relcache entries now.      We need this kluge because
+        * relcache.c indexes relcache entries by rd_node as well as OID. It
+        * will get confused if it is asked to (re)build an entry with a new
         * rd_node value when there is still another entry laying about with
-        * that same rd_node value.  (Fortunately, since one of the entries
-        * is local in our transaction, it's sufficient to clear out our own
+        * that same rd_node value.  (Fortunately, since one of the entries is
+        * local in our transaction, it's sufficient to clear out our own
         * relcache this way; the problem cannot arise for other backends when
         * they see our update on the non-local relation.)
         */
index a692531..fb8e641 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright (c) 1996-2001, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.59 2002/09/02 01:05:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.60 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -231,7 +231,7 @@ DeleteComments(Oid oid, Oid classoid, int32 subid)
        Relation        description;
        ScanKeyData skey[3];
        int                     nkeys;
-       SysScanDesc     sd;
+       SysScanDesc sd;
        HeapTuple       oldtuple;
 
        /* Use the index to search for all matching old tuples */
@@ -260,9 +260,7 @@ DeleteComments(Oid oid, Oid classoid, int32 subid)
                                                        SnapshotNow, nkeys, skey);
 
        while ((oldtuple = systable_getnext(sd)) != NULL)
-       {
                simple_heap_delete(description, &oldtuple->t_self);
-       }
 
        /* Done */
 
@@ -357,8 +355,8 @@ CommentAttribute(List *qualname, char *comment)
        nnames = length(qualname);
        if (nnames < 2)
                elog(ERROR, "CommentAttribute: must specify relation.attribute");
-       relname = ltruncate(nnames-1, listCopy(qualname));
-       attrname = strVal(nth(nnames-1, qualname));
+       relname = ltruncate(nnames - 1, listCopy(qualname));
+       attrname = strVal(nth(nnames - 1, qualname));
 
        /* Open the containing relation to ensure it won't go away meanwhile */
        rel = makeRangeVarFromNameList(relname);
@@ -521,13 +519,13 @@ CommentRule(List *qualname, char *comment)
                else
                {
                        elog(ERROR, "rule \"%s\" does not exist", rulename);
-                       reloid = ruleoid = 0; /* keep compiler quiet */
+                       reloid = ruleoid = 0;           /* keep compiler quiet */
                }
 
                if (HeapTupleIsValid(tuple = heap_getnext(scanDesc,
                                                                                                  ForwardScanDirection)))
                        elog(ERROR, "There are multiple rules \"%s\""
-                                "\n\tPlease specify a relation name as well as a rule name",
+                        "\n\tPlease specify a relation name as well as a rule name",
                                 rulename);
 
                heap_endscan(scanDesc);
@@ -540,8 +538,8 @@ CommentRule(List *qualname, char *comment)
        {
                /* New-style: rule and relname both provided */
                Assert(nnames >= 2);
-               relname = ltruncate(nnames-1, listCopy(qualname));
-               rulename = strVal(nth(nnames-1, qualname));
+               relname = ltruncate(nnames - 1, listCopy(qualname));
+               rulename = strVal(nth(nnames - 1, qualname));
 
                /* Open the owning relation to ensure it won't go away meanwhile */
                rel = makeRangeVarFromNameList(relname);
@@ -724,7 +722,7 @@ CommentTrigger(List *qualname, char *comment)
        Relation        pg_trigger,
                                relation;
        HeapTuple       triggertuple;
-       SysScanDesc     scan;
+       SysScanDesc scan;
        ScanKeyData entry[2];
        Oid                     oid;
 
@@ -732,8 +730,8 @@ CommentTrigger(List *qualname, char *comment)
        nnames = length(qualname);
        if (nnames < 2)
                elog(ERROR, "CommentTrigger: must specify relation and trigger");
-       relname = ltruncate(nnames-1, listCopy(qualname));
-       trigname = strVal(nth(nnames-1, qualname));
+       relname = ltruncate(nnames - 1, listCopy(qualname));
+       trigname = strVal(nth(nnames - 1, qualname));
 
        /* Open the owning relation to ensure it won't go away meanwhile */
        rel = makeRangeVarFromNameList(relname);
@@ -799,7 +797,7 @@ CommentConstraint(List *qualname, char *comment)
        Relation        pg_constraint,
                                relation;
        HeapTuple       tuple;
-       SysScanDesc     scan;
+       SysScanDesc scan;
        ScanKeyData skey[1];
        Oid                     conOid = InvalidOid;
 
@@ -807,8 +805,8 @@ CommentConstraint(List *qualname, char *comment)
        nnames = length(qualname);
        if (nnames < 2)
                elog(ERROR, "CommentConstraint: must specify relation and constraint");
-       relName = ltruncate(nnames-1, listCopy(qualname));
-       conName = strVal(nth(nnames-1, qualname));
+       relName = ltruncate(nnames - 1, listCopy(qualname));
+       conName = strVal(nth(nnames - 1, qualname));
 
        /* Open the owning relation to ensure it won't go away meanwhile */
        rel = makeRangeVarFromNameList(relName);
@@ -820,9 +818,9 @@ CommentConstraint(List *qualname, char *comment)
                aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(relation));
 
        /*
-        * Fetch the constraint tuple from pg_constraint.  There may be more than
-        * one match, because constraints are not required to have unique names;
-        * if so, error out.
+        * Fetch the constraint tuple from pg_constraint.  There may be more
+        * than one match, because constraints are not required to have unique
+        * names; if so, error out.
         */
        pg_constraint = heap_openr(ConstraintRelationName, AccessShareLock);
 
@@ -835,7 +833,7 @@ CommentConstraint(List *qualname, char *comment)
 
        while (HeapTupleIsValid(tuple = systable_getnext(scan)))
        {
-               Form_pg_constraint      con = (Form_pg_constraint) GETSTRUCT(tuple);
+               Form_pg_constraint con = (Form_pg_constraint) GETSTRUCT(tuple);
 
                if (strcmp(NameStr(con->conname), conName) == 0)
                {
index 7d65a1a..614d367 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/conversioncmds.c,v 1.3 2002/08/22 00:01:42 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/conversioncmds.c,v 1.4 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,19 +33,19 @@ void
 CreateConversionCommand(CreateConversionStmt *stmt)
 {
        Oid                     namespaceId;
-       char            *conversion_name;
+       char       *conversion_name;
        AclResult       aclresult;
        int                     for_encoding;
        int                     to_encoding;
        Oid                     funcoid;
        Oid                     funcnamespace;
-       char            *dummy;
+       char       *dummy;
 
        const char *for_encoding_name = stmt->for_encoding_name;
        const char *to_encoding_name = stmt->to_encoding_name;
-       List *func_name = stmt->func_name;
+       List       *func_name = stmt->func_name;
 
-       static Oid funcargs[] = {INT4OID, INT4OID, CSTRINGOID, CSTRINGOID, INT4OID};
+       static Oid      funcargs[] = {INT4OID, INT4OID, CSTRINGOID, CSTRINGOID, INT4OID};
 
        /* Convert list of names to a name and namespace */
        namespaceId = QualifiedNameGetCreationNamespace(stmt->conversion_name, &conversion_name);
@@ -64,10 +64,11 @@ CreateConversionCommand(CreateConversionStmt *stmt)
        if (to_encoding < 0)
                elog(ERROR, "Invalid to encoding name: %s", to_encoding_name);
 
-       /* Check the existence of the conversion function.
-        * Function name could be a qualified name.
+       /*
+        * Check the existence of the conversion function. Function name could
+        * be a qualified name.
         */
-       funcoid = LookupFuncName(func_name, sizeof(funcargs)/sizeof(Oid), funcargs);
+       funcoid = LookupFuncName(func_name, sizeof(funcargs) / sizeof(Oid), funcargs);
        if (!OidIsValid(funcoid))
                elog(ERROR, "Function %s does not exist", NameListToString(func_name));
 
@@ -80,8 +81,11 @@ CreateConversionCommand(CreateConversionStmt *stmt)
        aclresult = pg_proc_aclcheck(funcoid, GetUserId(), ACL_EXECUTE);
        if (aclresult != ACLCHECK_OK)
                aclcheck_error(aclresult, get_namespace_name(funcnamespace));
-               
-       /* All seem ok, go ahead (possible failure would be a duplicate conversion name) */
+
+       /*
+        * All seem ok, go ahead (possible failure would be a duplicate
+        * conversion name)
+        */
        ConversionCreate(conversion_name, namespaceId, GetUserId(),
                                         for_encoding, to_encoding, funcoid, stmt->def);
 }
@@ -93,7 +97,7 @@ void
 DropConversionCommand(List *name, DropBehavior behavior)
 {
        Oid                     namespaceId;
-       char            *conversion_name;
+       char       *conversion_name;
        AclResult       aclresult;
 
        /* Convert list of names to a name and namespace */
@@ -104,9 +108,9 @@ DropConversionCommand(List *name, DropBehavior behavior)
        if (aclresult != ACLCHECK_OK)
                aclcheck_error(aclresult, get_namespace_name(namespaceId));
 
-       /* Go ahead (possible failure would be:
-        * none existing conversion
-        * not ower of this conversion
+       /*
+        * Go ahead (possible failure would be: none existing conversion not
+        * ower of this conversion
         */
        ConversionDrop(conversion_name, namespaceId, GetUserId(), behavior);
 }
index c8463ac..d9da44c 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.170 2002/09/02 01:05:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.171 2002/09/04 20:31:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,9 +53,9 @@ typedef enum CopyReadResult
 
 /* non-export function prototypes */
 static void CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
-                                  FILE *fp, char *delim, char *null_print);
+          FILE *fp, char *delim, char *null_print);
 static void CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
-                                        FILE *fp, char *delim, char *null_print);
+                FILE *fp, char *delim, char *null_print);
 static Oid     GetInputFunction(Oid type);
 static Oid     GetTypeElement(Oid type);
 static char *CopyReadAttribute(FILE *fp, const char *delim, CopyReadResult *result);
@@ -268,17 +268,17 @@ CopyDonePeek(FILE *fp, int c, bool pickup)
 void
 DoCopy(const CopyStmt *stmt)
 {
-       RangeVar *relation = stmt->relation;
-       char *filename = stmt->filename;
-       bool is_from = stmt->is_from;
-       bool pipe = (stmt->filename == NULL);
-       List *option;
-       List *attnamelist = stmt->attlist;
-       List *attnumlist;
-       bool binary = false;
-       bool oids = false;
-       char *delim = NULL;
-       char *null_print = NULL;
+       RangeVar   *relation = stmt->relation;
+       char       *filename = stmt->filename;
+       bool            is_from = stmt->is_from;
+       bool            pipe = (stmt->filename == NULL);
+       List       *option;
+       List       *attnamelist = stmt->attlist;
+       List       *attnumlist;
+       bool            binary = false;
+       bool            oids = false;
+       char       *delim = NULL;
+       char       *null_print = NULL;
        FILE       *fp;
        Relation        rel;
        AclMode         required_access = (is_from ? ACL_INSERT : ACL_SELECT);
@@ -336,7 +336,7 @@ DoCopy(const CopyStmt *stmt)
 
        if (!null_print)
                null_print = "\\N";
-       
+
        /*
         * Open and lock the relation, using the appropriate lock type.
         */
@@ -512,8 +512,8 @@ DoCopy(const CopyStmt *stmt)
  * Copy from relation TO file.
  */
 static void
-CopyTo(Relation rel, List *attnumlist, bool binary, bool oids, 
-                FILE *fp, char *delim, char *null_print)
+CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
+          FILE *fp, char *delim, char *null_print)
 {
        HeapTuple       tuple;
        TupleDesc       tupDesc;
@@ -537,24 +537,23 @@ CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
        /*
         * Get info about the columns we need to process.
         *
-        * For binary copy we really only need isvarlena, but compute it
-        * all...
+        * For binary copy we really only need isvarlena, but compute it all...
         */
        out_functions = (FmgrInfo *) palloc(num_phys_attrs * sizeof(FmgrInfo));
        elements = (Oid *) palloc(num_phys_attrs * sizeof(Oid));
        isvarlena = (bool *) palloc(num_phys_attrs * sizeof(bool));
        foreach(cur, attnumlist)
        {
-               int             attnum = lfirsti(cur);
+               int                     attnum = lfirsti(cur);
                Oid                     out_func_oid;
 
-               if (!getTypeOutputInfo(attr[attnum-1]->atttypid,
-                                                          &out_func_oid, &elements[attnum-1],
-                                                          &isvarlena[attnum-1]))
+               if (!getTypeOutputInfo(attr[attnum - 1]->atttypid,
+                                                          &out_func_oid, &elements[attnum - 1],
+                                                          &isvarlena[attnum - 1]))
                        elog(ERROR, "COPY: couldn't lookup info for type %u",
-                                attr[attnum-1]->atttypid);
-               fmgr_info(out_func_oid, &out_functions[attnum-1]);
-               if (binary && attr[attnum-1]->attlen == -2)
+                                attr[attnum - 1]->atttypid);
+               fmgr_info(out_func_oid, &out_functions[attnum - 1]);
+               if (binary && attr[attnum - 1]->attlen == -2)
                        elog(ERROR, "COPY BINARY: cstring not supported");
        }
 
@@ -597,7 +596,7 @@ CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
                        /* Send OID if wanted --- note fld_count doesn't include it */
                        if (oids)
                        {
-                               Oid oid = HeapTupleGetOid(tuple);
+                               Oid                     oid = HeapTupleGetOid(tuple);
 
                                fld_size = sizeof(Oid);
                                CopySendData(&fld_size, sizeof(int16), fp);
@@ -610,7 +609,7 @@ CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
                        if (oids)
                        {
                                string = DatumGetCString(DirectFunctionCall1(oidout,
-                                                               ObjectIdGetDatum(HeapTupleGetOid(tuple))));
+                                                         ObjectIdGetDatum(HeapTupleGetOid(tuple))));
                                CopySendString(string, fp);
                                pfree(string);
                                need_delim = true;
@@ -619,7 +618,7 @@ CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
 
                foreach(cur, attnumlist)
                {
-                       int             attnum = lfirsti(cur);
+                       int                     attnum = lfirsti(cur);
                        Datum           origvalue,
                                                value;
                        bool            isnull;
@@ -653,25 +652,25 @@ CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
                                 * (or for binary case, becase we must output untoasted
                                 * value).
                                 */
-                               if (isvarlena[attnum-1])
+                               if (isvarlena[attnum - 1])
                                        value = PointerGetDatum(PG_DETOAST_DATUM(origvalue));
                                else
                                        value = origvalue;
 
                                if (!binary)
                                {
-                                       string = DatumGetCString(FunctionCall3(&out_functions[attnum-1],
+                                       string = DatumGetCString(FunctionCall3(&out_functions[attnum - 1],
                                                                                                                   value,
-                                                                                  ObjectIdGetDatum(elements[attnum-1]),
-                                                                        Int32GetDatum(attr[attnum-1]->atttypmod)));
+                                                                 ObjectIdGetDatum(elements[attnum - 1]),
+                                                       Int32GetDatum(attr[attnum - 1]->atttypmod)));
                                        CopyAttributeOut(fp, string, delim);
                                        pfree(string);
                                }
                                else
                                {
-                                       fld_size = attr[attnum-1]->attlen;
+                                       fld_size = attr[attnum - 1]->attlen;
                                        CopySendData(&fld_size, sizeof(int16), fp);
-                                       if (isvarlena[attnum-1])
+                                       if (isvarlena[attnum - 1])
                                        {
                                                /* varlena */
                                                Assert(fld_size == -1);
@@ -679,7 +678,7 @@ CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
                                                                         VARSIZE(value),
                                                                         fp);
                                        }
-                                       else if (!attr[attnum-1]->attbyval)
+                                       else if (!attr[attnum - 1]->attbyval)
                                        {
                                                /* fixed-length pass-by-reference */
                                                Assert(fld_size > 0);
@@ -734,13 +733,15 @@ CopyTo(Relation rel, List *attnumlist, bool binary, bool oids,
  * Copy FROM file to relation.
  */
 static void
-CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids, 
+CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
                 FILE *fp, char *delim, char *null_print)
 {
        HeapTuple       tuple;
        TupleDesc       tupDesc;
        Form_pg_attribute *attr;
-       AttrNumber      num_phys_attrs, attr_count, num_defaults;
+       AttrNumber      num_phys_attrs,
+                               attr_count,
+                               num_defaults;
        FmgrInfo   *in_functions;
        Oid                *elements;
        int                     i;
@@ -755,8 +756,8 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
        TupleTableSlot *slot;
        bool            file_has_oids;
        int                *defmap;
-       Node      **defexprs; /* array of default att expressions */
-       ExprContext *econtext; /* used for ExecEvalExpr for default atts */
+       Node      **defexprs;           /* array of default att expressions */
+       ExprContext *econtext;          /* used for ExecEvalExpr for default atts */
        MemoryContext oldcontext = CurrentMemoryContext;
 
        tupDesc = RelationGetDescr(rel);
@@ -787,9 +788,9 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
        ExecSetSlotDescriptor(slot, tupDesc, false);
 
        /*
-        * pick up the input function and default expression (if any) for 
-        * each attribute in the relation.  (We don't actually use the
-        * input function if it's a binary copy.)
+        * pick up the input function and default expression (if any) for each
+        * attribute in the relation.  (We don't actually use the input
+        * function if it's a binary copy.)
         */
        defmap = (int *) palloc(sizeof(int) * num_phys_attrs);
        defexprs = (Node **) palloc(sizeof(Node *) * num_phys_attrs);
@@ -874,13 +875,13 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
 
        while (!done)
        {
-               bool    skip_tuple;
-               Oid             loaded_oid = InvalidOid;
+               bool            skip_tuple;
+               Oid                     loaded_oid = InvalidOid;
 
                CHECK_FOR_INTERRUPTS();
 
                copy_lineno++;
-               
+
                /* Reset the per-tuple exprcontext */
                ResetPerTupleExprContext(estate);
 
@@ -894,8 +895,8 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
 
                if (!binary)
                {
-                       CopyReadResult   result = NORMAL_ATTR;
-                       char                    *string;
+                       CopyReadResult result = NORMAL_ATTR;
+                       char       *string;
 
                        if (file_has_oids)
                        {
@@ -918,14 +919,14 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
                                                elog(ERROR, "Invalid Oid");
                                }
                        }
-      
+
                        /*
                         * Loop to read the user attributes on the line.
                         */
                        foreach(cur, attnumlist)
                        {
-                               int             attnum = lfirsti(cur);
-                               int             m = attnum - 1;
+                               int                     attnum = lfirsti(cur);
+                               int                     m = attnum - 1;
 
                                /*
                                 * If prior attr on this line was ended by newline or EOF,
@@ -953,8 +954,8 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
                                {
                                        values[m] = FunctionCall3(&in_functions[m],
                                                                                          CStringGetDatum(string),
-                                                                                         ObjectIdGetDatum(elements[m]),
-                                                                                         Int32GetDatum(attr[m]->atttypmod));
+                                                                                  ObjectIdGetDatum(elements[m]),
+                                                                         Int32GetDatum(attr[m]->atttypmod));
                                        nulls[m] = ' ';
                                }
                        }
@@ -1009,7 +1010,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
                        i = 0;
                        foreach(cur, attnumlist)
                        {
-                               int             attnum = lfirsti(cur);
+                               int                     attnum = lfirsti(cur);
 
                                i++;
 
@@ -1018,9 +1019,9 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
                                        elog(ERROR, "COPY BINARY: unexpected EOF");
                                if (fld_size == 0)
                                        continue;       /* it's NULL; nulls[attnum-1] already set */
-                               if (fld_size != attr[attnum-1]->attlen)
+                               if (fld_size != attr[attnum - 1]->attlen)
                                        elog(ERROR, "COPY BINARY: sizeof(field %d) is %d, expected %d",
-                                                i, (int) fld_size, (int) attr[attnum-1]->attlen);
+                                         i, (int) fld_size, (int) attr[attnum - 1]->attlen);
                                if (fld_size == -1)
                                {
                                        /* varlena field */
@@ -1039,9 +1040,9 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
                                                                fp);
                                        if (CopyGetEof(fp))
                                                elog(ERROR, "COPY BINARY: unexpected EOF");
-                                       values[attnum-1] = PointerGetDatum(varlena_ptr);
+                                       values[attnum - 1] = PointerGetDatum(varlena_ptr);
                                }
-                               else if (!attr[attnum-1]->attbyval)
+                               else if (!attr[attnum - 1]->attbyval)
                                {
                                        /* fixed-length pass-by-reference */
                                        Pointer         refval_ptr;
@@ -1051,7 +1052,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
                                        CopyGetData(refval_ptr, fld_size, fp);
                                        if (CopyGetEof(fp))
                                                elog(ERROR, "COPY BINARY: unexpected EOF");
-                                       values[attnum-1] = PointerGetDatum(refval_ptr);
+                                       values[attnum - 1] = PointerGetDatum(refval_ptr);
                                }
                                else
                                {
@@ -1059,29 +1060,28 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
                                        Datum           datumBuf;
 
                                        /*
-                                        * We need this horsing around because we don't
-                                        * know how shorter data values are aligned within
-                                        * a Datum.
+                                        * We need this horsing around because we don't know
+                                        * how shorter data values are aligned within a Datum.
                                         */
                                        Assert(fld_size > 0 && fld_size <= sizeof(Datum));
                                        CopyGetData(&datumBuf, fld_size, fp);
                                        if (CopyGetEof(fp))
                                                elog(ERROR, "COPY BINARY: unexpected EOF");
-                                       values[attnum-1] = fetch_att(&datumBuf, true, fld_size);
+                                       values[attnum - 1] = fetch_att(&datumBuf, true, fld_size);
                                }
 
-                               nulls[attnum-1] = ' ';
+                               nulls[attnum - 1] = ' ';
                        }
                }
 
                /*
-                * Now compute and insert any defaults available for the
-                * columns not provided by the input data.  Anything not
-                * processed here or above will remain NULL.
+                * Now compute and insert any defaults available for the columns
+                * not provided by the input data.      Anything not processed here or
+                * above will remain NULL.
                 */
                for (i = 0; i < num_defaults; i++)
                {
-                       bool isnull;
+                       bool            isnull;
 
                        values[defmap[i]] = ExecEvalExpr(defexprs[i], econtext,
                                                                                         &isnull, NULL);
@@ -1093,7 +1093,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
                 * And now we can form the input tuple.
                 */
                tuple = heap_formtuple(tupDesc, values, nulls);
-       
+
                if (oids && file_has_oids)
                        HeapTupleSetOid(tuple, loaded_oid);
 
@@ -1464,14 +1464,14 @@ CopyAttributeOut(FILE *fp, char *server_string, char *delim)
 static List *
 CopyGetAttnums(Relation rel, List *attnamelist)
 {
-       List            *attnums = NIL;
+       List       *attnums = NIL;
 
        if (attnamelist == NIL)
        {
                /* Generate default column list */
-               TupleDesc        tupDesc = RelationGetDescr(rel);
+               TupleDesc       tupDesc = RelationGetDescr(rel);
                Form_pg_attribute *attr = tupDesc->attrs;
-               int                      attr_count = tupDesc->natts;
+               int                     attr_count = tupDesc->natts;
                int                     i;
 
                for (i = 0; i < attr_count; i++)
index f5bacf6..addb6dc 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.104 2002/09/03 22:17:34 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.105 2002/09/04 20:31:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -79,14 +79,14 @@ createdb(const CreatedbStmt *stmt)
        int32           datdba;
        List       *option;
        DefElem    *downer = NULL;
-       DefElem    *dpath = NULL;
-       DefElem    *dtemplate = NULL;
-       DefElem    *dencoding = NULL;
+       DefElem    *dpath = NULL;
+       DefElem    *dtemplate = NULL;
+       DefElem    *dencoding = NULL;
        char       *dbname = stmt->dbname;
        char       *dbowner = NULL;
        char       *dbpath = NULL;
        char       *dbtemplate = NULL;
-       int                 encoding = -1;
+       int                     encoding = -1;
 
        /* Extract options from the statement node tree */
        foreach(option, stmt->options)
@@ -133,7 +133,7 @@ createdb(const CreatedbStmt *stmt)
 
        /* obtain sysid of proposed owner */
        if (dbowner)
-               datdba = get_usesysid(dbowner); /* will elog if no such user */
+               datdba = get_usesysid(dbowner); /* will elog if no such user */
        else
                datdba = GetUserId();
 
@@ -185,7 +185,7 @@ createdb(const CreatedbStmt *stmt)
         */
        if (!src_istemplate)
        {
-               if (!superuser() && GetUserId() != src_owner )
+               if (!superuser() && GetUserId() != src_owner)
                        elog(ERROR, "CREATE DATABASE: permission to copy \"%s\" denied",
                                 dbtemplate);
        }
@@ -226,10 +226,10 @@ createdb(const CreatedbStmt *stmt)
         * database), and resolve alternate physical location if one is
         * specified.
         *
-        * If an alternate location is specified but is the same as the
-        * normal path, just drop the alternate-location spec (this seems
-        * friendlier than erroring out).  We must test this case to avoid
-        * creating a circular symlink below.
+        * If an alternate location is specified but is the same as the normal
+        * path, just drop the alternate-location spec (this seems friendlier
+        * than erroring out).  We must test this case to avoid creating a
+        * circular symlink below.
         */
        nominal_loc = GetDatabasePath(dboid);
        alt_loc = resolve_alt_dbpath(dbpath, dboid);
@@ -328,11 +328,12 @@ createdb(const CreatedbStmt *stmt)
        /* do not set datpath to null, GetRawDatabaseInfo won't cope */
        new_record[Anum_pg_database_datpath - 1] =
                DirectFunctionCall1(textin, CStringGetDatum(dbpath ? dbpath : ""));
+
        /*
         * We deliberately set datconfig and datacl to defaults (NULL), rather
         * than copying them from the template database.  Copying datacl would
-        * be a bad idea when the owner is not the same as the template's owner.
-        * It's more debatable whether datconfig should be copied.
+        * be a bad idea when the owner is not the same as the template's
+        * owner. It's more debatable whether datconfig should be copied.
         */
        new_record_nulls[Anum_pg_database_datconfig - 1] = 'n';
        new_record_nulls[Anum_pg_database_datacl - 1] = 'n';
@@ -495,7 +496,7 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
        HeapTuple       tuple,
                                newtuple;
        Relation        rel;
-       ScanKeyData     scankey;
+       ScanKeyData scankey;
        HeapScanDesc scan;
        Datum           repl_val[Natts_pg_database];
        char            repl_null[Natts_pg_database];
@@ -512,25 +513,25 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
                elog(ERROR, "database \"%s\" does not exist", stmt->dbname);
 
        if (!(superuser()
-                 || ((Form_pg_database) GETSTRUCT(tuple))->datdba == GetUserId()))
+               || ((Form_pg_database) GETSTRUCT(tuple))->datdba == GetUserId()))
                elog(ERROR, "permission denied");
 
        MemSet(repl_repl, ' ', sizeof(repl_repl));
-       repl_repl[Anum_pg_database_datconfig-1] = 'r';
+       repl_repl[Anum_pg_database_datconfig - 1] = 'r';
 
-       if (strcmp(stmt->variable, "all")==0 && valuestr == NULL)
+       if (strcmp(stmt->variable, "all") == 0 && valuestr == NULL)
        {
                /* RESET ALL */
-               repl_null[Anum_pg_database_datconfig-1] = 'n';
-               repl_val[Anum_pg_database_datconfig-1] = (Datum) 0;
+               repl_null[Anum_pg_database_datconfig - 1] = 'n';
+               repl_val[Anum_pg_database_datconfig - 1] = (Datum) 0;
        }
        else
        {
-               Datum datum;
-               bool isnull;
-               ArrayType *a;
+               Datum           datum;
+               bool            isnull;
+               ArrayType  *a;
 
-               repl_null[Anum_pg_database_datconfig-1] = ' ';
+               repl_null[Anum_pg_database_datconfig - 1] = ' ';
 
                datum = heap_getattr(tuple, Anum_pg_database_datconfig,
                                                         RelationGetDescr(rel), &isnull);
@@ -542,7 +543,7 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
                else
                        a = GUCArrayDelete(a, stmt->variable);
 
-               repl_val[Anum_pg_database_datconfig-1] = PointerGetDatum(a);
+               repl_val[Anum_pg_database_datconfig - 1] = PointerGetDatum(a);
        }
 
        newtuple = heap_modifytuple(tuple, rel, repl_val, repl_null, repl_repl);
index 02b7309..0968781 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.79 2002/08/10 19:01:53 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.80 2002/09/04 20:31:15 momjian Exp $
  *
  * DESCRIPTION
  *       The "DefineFoo" routines take the parse tree and pick out the
@@ -132,10 +132,11 @@ defGetInt64(DefElem *def)
                case T_Integer:
                        return (int64) intVal(def->arg);
                case T_Float:
+
                        /*
                         * Values too large for int4 will be represented as Float
-                        * constants by the lexer.  Accept these if they are valid int8
-                        * strings.
+                        * constants by the lexer.      Accept these if they are valid
+                        * int8 strings.
                         */
                        return DatumGetInt64(DirectFunctionCall1(int8in,
                                                                         CStringGetDatum(strVal(def->arg))));
@@ -188,14 +189,14 @@ defGetTypeName(DefElem *def)
                case T_TypeName:
                        return (TypeName *) def->arg;
                case T_String:
-               {
-                       /* Allow quoted typename for backwards compatibility */
-                       TypeName   *n = makeNode(TypeName);
-
-                       n->names = makeList1(def->arg);
-                       n->typmod = -1;
-                       return n;
-               }
+                       {
+                               /* Allow quoted typename for backwards compatibility */
+                               TypeName   *n = makeNode(TypeName);
+
+                               n->names = makeList1(def->arg);
+                               n->typmod = -1;
+                               return n;
+                       }
                default:
                        elog(ERROR, "Define: argument of \"%s\" must be a type name",
                                 def->defname);
index bf8b6fb..4edc718 100644 (file)
@@ -5,7 +5,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994-5, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.86 2002/09/02 01:05:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.87 2002/09/04 20:31:15 momjian Exp $
  *
  */
 
@@ -41,18 +41,18 @@ typedef struct ExplainState
 
 static StringInfo Explain_PlanToString(Plan *plan, ExplainState *es);
 static void ExplainOneQuery(Query *query, ExplainStmt *stmt,
-                                                       TupOutputState *tstate);
+                               TupOutputState *tstate);
 static void explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
-                                                       int indent, ExplainState *es);
+                               int indent, ExplainState *es);
 static void show_scan_qual(List *qual, bool is_or_qual, const char *qlabel,
-                                                  int scanrelid, Plan *outer_plan,
-                                                  StringInfo str, int indent, ExplainState *es);
+                          int scanrelid, Plan *outer_plan,
+                          StringInfo str, int indent, ExplainState *es);
 static void show_upper_qual(List *qual, const char *qlabel,
-                                                       const char *outer_name, int outer_varno, Plan *outer_plan,
-                                                       const char *inner_name, int inner_varno, Plan *inner_plan,
-                                                       StringInfo str, int indent, ExplainState *es);
+                               const char *outer_name, int outer_varno, Plan *outer_plan,
+                               const char *inner_name, int inner_varno, Plan *inner_plan,
+                               StringInfo str, int indent, ExplainState *es);
 static void show_sort_keys(List *tlist, int nkeys, const char *qlabel,
-                                                  StringInfo str, int indent, ExplainState *es);
+                          StringInfo str, int indent, ExplainState *es);
 static Node *make_ors_ands_explicit(List *orclauses);
 
 /*
@@ -189,7 +189,7 @@ ExplainOneQuery(Query *query, ExplainStmt *stmt, TupOutputState *tstate)
                        do_text_output_multiline(tstate, f);
                        pfree(f);
                        if (es->printCost)
-                               do_text_output_oneline(tstate, "");     /* separator line */
+                               do_text_output_oneline(tstate, "");             /* separator line */
                }
        }
 
@@ -325,7 +325,7 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
                                relation = index_open(lfirsti(l));
                                appendStringInfo(str, "%s%s",
                                                                 (++i > 1) ? ", " : "",
-                                                                quote_identifier(RelationGetRelationName(relation)));
+                                       quote_identifier(RelationGetRelationName(relation)));
                                index_close(relation);
                        }
                        /* FALL THRU */
@@ -335,7 +335,7 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
                        {
                                RangeTblEntry *rte = rt_fetch(((Scan *) plan)->scanrelid,
                                                                                          es->rtable);
-                               char   *relname;
+                               char       *relname;
 
                                /* Assume it's on a real relation */
                                Assert(rte->rtekind == RTE_RELATION);
@@ -347,7 +347,7 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
                                                                 quote_identifier(relname));
                                if (strcmp(rte->eref->aliasname, relname) != 0)
                                        appendStringInfo(str, " %s",
-                                                                        quote_identifier(rte->eref->aliasname));
+                                                                quote_identifier(rte->eref->aliasname));
                        }
                        break;
                case T_SubqueryScan:
@@ -365,10 +365,10 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
                        {
                                RangeTblEntry *rte = rt_fetch(((Scan *) plan)->scanrelid,
                                                                                          es->rtable);
-                               Expr   *expr;
-                               Func   *funcnode;
-                               Oid             funcid;
-                               char   *proname;
+                               Expr       *expr;
+                               Func       *funcnode;
+                               Oid                     funcid;
+                               char       *proname;
 
                                /* Assert it's on a RangeFunction */
                                Assert(rte->rtekind == RTE_FUNCTION);
@@ -384,7 +384,7 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
                                                                 quote_identifier(proname));
                                if (strcmp(rte->eref->aliasname, proname) != 0)
                                        appendStringInfo(str, " %s",
-                                                                        quote_identifier(rte->eref->aliasname));
+                                                                quote_identifier(rte->eref->aliasname));
                        }
                        break;
                default:
@@ -482,7 +482,7 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
                case T_SubqueryScan:
                        show_upper_qual(plan->qual,
                                                        "Filter",
-                                                       "subplan", 1, ((SubqueryScan *) plan)->subplan,
+                                                 "subplan", 1, ((SubqueryScan *) plan)->subplan,
                                                        "", 0, NULL,
                                                        str, indent, es);
                        break;
@@ -662,14 +662,14 @@ show_scan_qual(List *qual, bool is_or_qual, const char *qlabel,
 
        /*
         * If we have an outer plan that is referenced by the qual, add it to
-        * the deparse context.  If not, don't (so that we don't force prefixes
-        * unnecessarily).
+        * the deparse context.  If not, don't (so that we don't force
+        * prefixes unnecessarily).
         */
        if (outer_plan)
        {
                if (intMember(OUTER, pull_varnos(node)))
                        outercontext = deparse_context_for_subplan("outer",
-                                                                                                          outer_plan->targetlist,
+                                                                                                 outer_plan->targetlist,
                                                                                                           es->rtable);
                else
                        outercontext = NULL;
@@ -760,10 +760,11 @@ show_sort_keys(List *tlist, int nkeys, const char *qlabel,
 
        /*
         * In this routine we expect that the plan node's tlist has not been
-        * processed by set_plan_references().  Normally, any Vars will contain
-        * valid varnos referencing the actual rtable.  But we might instead be
-        * looking at a dummy tlist generated by prepunion.c; if there are
-        * Vars with zero varno, use the tlist itself to determine their names.
+        * processed by set_plan_references().  Normally, any Vars will
+        * contain valid varnos referencing the actual rtable.  But we might
+        * instead be looking at a dummy tlist generated by prepunion.c; if
+        * there are Vars with zero varno, use the tlist itself to determine
+        * their names.
         */
        if (intMember(0, pull_varnos((Node *) tlist)))
        {
@@ -811,7 +812,7 @@ show_sort_keys(List *tlist, int nkeys, const char *qlabel,
 }
 
 /*
- * Indexscan qual lists have an implicit OR-of-ANDs structure.  Make it
+ * Indexscan qual lists have an implicit OR-of-ANDs structure. Make it
  * explicit so deparsing works properly.
  */
 static Node *
@@ -823,13 +824,11 @@ make_ors_ands_explicit(List *orclauses)
                return (Node *) make_ands_explicit(lfirst(orclauses));
        else
        {
-               List   *args = NIL;
-               List   *orptr;
+               List       *args = NIL;
+               List       *orptr;
 
                foreach(orptr, orclauses)
-               {
                        args = lappend(args, make_ands_explicit(lfirst(orptr)));
-               }
 
                return (Node *) make_orclause(args);
        }
index 6d6ad94..47ebe0d 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.18 2002/08/22 00:01:42 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.19 2002/09/04 20:31:15 momjian Exp $
  *
  * DESCRIPTION
  *       These routines take the parse tree and pick out the
@@ -61,7 +61,7 @@
  * allow a shell type to be used, or even created if the specified return type
  * doesn't exist yet.  (Without this, there's no way to define the I/O procs
  * for a new type.)  But SQL function creation won't cope, so error out if
- * the target language is SQL.  (We do this here, not in the SQL-function
+ * the target language is SQL. (We do this here, not in the SQL-function
  * validator, so as not to produce a WARNING and then an ERROR for the same
  * condition.)
  */
@@ -69,7 +69,7 @@ static void
 compute_return_type(TypeName *returnType, Oid languageOid,
                                        Oid *prorettype_p, bool *returnsSet_p)
 {
-       Oid             rettype;
+       Oid                     rettype;
 
        rettype = LookupTypeName(returnType);
 
@@ -87,7 +87,7 @@ compute_return_type(TypeName *returnType, Oid languageOid,
        }
        else
        {
-               char      *typnam = TypeNameToString(returnType);
+               char       *typnam = TypeNameToString(returnType);
                Oid                     namespaceId;
                AclResult       aclresult;
                char       *typname;
@@ -184,41 +184,41 @@ compute_attributes_sql_style(const List *options,
                                                         bool *security_definer)
 {
        const List *option;
-       DefElem *as_item = NULL;
-       DefElem *language_item = NULL;
-       DefElem *volatility_item = NULL;
-       DefElem *strict_item = NULL;
-       DefElem *security_item = NULL;
+       DefElem    *as_item = NULL;
+       DefElem    *language_item = NULL;
+       DefElem    *volatility_item = NULL;
+       DefElem    *strict_item = NULL;
+       DefElem    *security_item = NULL;
 
        foreach(option, options)
        {
                DefElem    *defel = (DefElem *) lfirst(option);
 
-               if (strcmp(defel->defname, "as")==0)
+               if (strcmp(defel->defname, "as") == 0)
                {
                        if (as_item)
                                elog(ERROR, "conflicting or redundant options");
                        as_item = defel;
                }
-               else if (strcmp(defel->defname, "language")==0)
+               else if (strcmp(defel->defname, "language") == 0)
                {
                        if (language_item)
                                elog(ERROR, "conflicting or redundant options");
                        language_item = defel;
                }
-               else if (strcmp(defel->defname, "volatility")==0)
+               else if (strcmp(defel->defname, "volatility") == 0)
                {
                        if (volatility_item)
                                elog(ERROR, "conflicting or redundant options");
                        volatility_item = defel;
                }
-               else if (strcmp(defel->defname, "strict")==0)
+               else if (strcmp(defel->defname, "strict") == 0)
                {
                        if (strict_item)
                                elog(ERROR, "conflicting or redundant options");
                        strict_item = defel;
                }
-               else if (strcmp(defel->defname, "security")==0)
+               else if (strcmp(defel->defname, "security") == 0)
                {
                        if (security_item)
                                elog(ERROR, "conflicting or redundant options");
@@ -229,7 +229,7 @@ compute_attributes_sql_style(const List *options,
        }
 
        if (as_item)
-               *as = (List *)as_item->arg;
+               *as = (List *) as_item->arg;
        else
                elog(ERROR, "no function body specified");
 
@@ -240,11 +240,11 @@ compute_attributes_sql_style(const List *options,
 
        if (volatility_item)
        {
-               if (strcmp(strVal(volatility_item->arg), "immutable")==0)
+               if (strcmp(strVal(volatility_item->arg), "immutable") == 0)
                        *volatility_p = PROVOLATILE_IMMUTABLE;
-               else if (strcmp(strVal(volatility_item->arg), "stable")==0)
+               else if (strcmp(strVal(volatility_item->arg), "stable") == 0)
                        *volatility_p = PROVOLATILE_STABLE;
-               else if (strcmp(strVal(volatility_item->arg), "volatile")==0)
+               else if (strcmp(strVal(volatility_item->arg), "volatile") == 0)
                        *volatility_p = PROVOLATILE_VOLATILE;
                else
                        elog(ERROR, "invalid volatility");
@@ -386,7 +386,7 @@ CreateFunction(CreateFunctionStmt *stmt)
 
        /* override attributes from explicit list */
        compute_attributes_sql_style(stmt->options,
-                                                                &as_clause, &language, &volatility, &isStrict, &security);
+                          &as_clause, &language, &volatility, &isStrict, &security);
 
        /* Convert language name to canonical case */
        case_translate_language_name(language, languageName);
@@ -439,13 +439,12 @@ CreateFunction(CreateFunctionStmt *stmt)
        if (languageOid == INTERNALlanguageId)
        {
                /*
-                * In PostgreSQL versions before 6.5, the SQL name of the
-                * created function could not be different from the internal
-                * name, and "prosrc" wasn't used.  So there is code out there
-                * that does CREATE FUNCTION xyz AS '' LANGUAGE 'internal'.
-                * To preserve some modicum of backwards compatibility, accept
-                * an empty "prosrc" value as meaning the supplied SQL
-                * function name.
+                * In PostgreSQL versions before 6.5, the SQL name of the created
+                * function could not be different from the internal name, and
+                * "prosrc" wasn't used.  So there is code out there that does
+                * CREATE FUNCTION xyz AS '' LANGUAGE 'internal'. To preserve some
+                * modicum of backwards compatibility, accept an empty "prosrc"
+                * value as meaning the supplied SQL function name.
                 */
                if (strlen(prosrc_str) == 0)
                        prosrc_str = funcname;
@@ -488,7 +487,7 @@ void
 RemoveFunction(RemoveFuncStmt *stmt)
 {
        List       *functionName = stmt->funcname;
-       List       *argTypes = stmt->args; /* list of TypeName nodes */
+       List       *argTypes = stmt->args;      /* list of TypeName nodes */
        Oid                     funcOid;
        HeapTuple       tup;
        ObjectAddress object;
@@ -496,13 +495,13 @@ RemoveFunction(RemoveFuncStmt *stmt)
        /*
         * Find the function, do permissions and validity checks
         */
-       funcOid = LookupFuncNameTypeNames(functionName, argTypes, 
+       funcOid = LookupFuncNameTypeNames(functionName, argTypes,
                                                                          "RemoveFunction");
 
        tup = SearchSysCache(PROCOID,
                                                 ObjectIdGetDatum(funcOid),
                                                 0, 0, 0);
-       if (!HeapTupleIsValid(tup))     /* should not happen */
+       if (!HeapTupleIsValid(tup)) /* should not happen */
                elog(ERROR, "RemoveFunction: couldn't find tuple for function %s",
                         NameListToString(functionName));
 
@@ -557,7 +556,7 @@ RemoveFunctionById(Oid funcOid)
        tup = SearchSysCache(PROCOID,
                                                 ObjectIdGetDatum(funcOid),
                                                 0, 0, 0);
-       if (!HeapTupleIsValid(tup))     /* should not happen */
+       if (!HeapTupleIsValid(tup)) /* should not happen */
                elog(ERROR, "RemoveFunctionById: couldn't find tuple for function %u",
                         funcOid);
 
@@ -579,7 +578,7 @@ RemoveFunctionById(Oid funcOid)
                tup = SearchSysCache(AGGFNOID,
                                                         ObjectIdGetDatum(funcOid),
                                                         0, 0, 0);
-               if (!HeapTupleIsValid(tup))     /* should not happen */
+               if (!HeapTupleIsValid(tup))             /* should not happen */
                        elog(ERROR, "RemoveFunctionById: couldn't find pg_aggregate tuple for %u",
                                 funcOid);
 
@@ -611,7 +610,7 @@ CreateCast(CreateCastStmt *stmt)
        int                     i;
 
        ObjectAddress myself,
-               referenced;
+                               referenced;
 
        sourcetypeid = LookupTypeName(stmt->sourcetype);
        if (!OidIsValid(sourcetypeid))
@@ -693,10 +692,10 @@ CreateCast(CreateCastStmt *stmt)
        }
 
        /* ready to go */
-       values[Anum_pg_cast_castsource-1] = ObjectIdGetDatum(sourcetypeid);
-       values[Anum_pg_cast_casttarget-1] = ObjectIdGetDatum(targettypeid);
-       values[Anum_pg_cast_castfunc-1] = ObjectIdGetDatum(funcid);
-       values[Anum_pg_cast_castimplicit-1] = BoolGetDatum(stmt->implicit);
+       values[Anum_pg_cast_castsource - 1] = ObjectIdGetDatum(sourcetypeid);
+       values[Anum_pg_cast_casttarget - 1] = ObjectIdGetDatum(targettypeid);
+       values[Anum_pg_cast_castfunc - 1] = ObjectIdGetDatum(funcid);
+       values[Anum_pg_cast_castimplicit - 1] = BoolGetDatum(stmt->implicit);
 
        for (i = 0; i < Natts_pg_cast; ++i)
                nulls[i] = ' ';
@@ -760,9 +759,9 @@ DropCast(DropCastStmt *stmt)
                         TypeNameToString(stmt->targettype));
 
        tuple = SearchSysCache(CASTSOURCETARGET,
-                                                ObjectIdGetDatum(sourcetypeid),
-                                                ObjectIdGetDatum(targettypeid),
-                                                0, 0);
+                                                  ObjectIdGetDatum(sourcetypeid),
+                                                  ObjectIdGetDatum(targettypeid),
+                                                  0, 0);
        if (!HeapTupleIsValid(tuple))
                elog(ERROR, "cast from type %s to type %s does not exist",
                         TypeNameToString(stmt->sourcetype),
index b951fcc..6f0c843 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.86 2002/08/30 22:18:05 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.87 2002/09/04 20:31:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -117,9 +117,9 @@ DefineIndex(RangeVar *heapRelation,
 
        /*
         * Verify we (still) have CREATE rights in the rel's namespace.
-        * (Presumably we did when the rel was created, but maybe not anymore.)
-        * Skip check if bootstrapping, since permissions machinery may not
-        * be working yet.
+        * (Presumably we did when the rel was created, but maybe not
+        * anymore.) Skip check if bootstrapping, since permissions machinery
+        * may not be working yet.
         */
        if (!IsBootstrapProcessingMode())
        {
@@ -254,8 +254,8 @@ CheckPredicate(List *predList, List *rangeTable, Oid baseRelOid)
                elog(ERROR, "Cannot use aggregate in index predicate");
 
        /*
-        * A predicate using mutable functions is probably wrong, for the
-        * same reasons that we don't allow a functional index to use one.
+        * A predicate using mutable functions is probably wrong, for the same
+        * reasons that we don't allow a functional index to use one.
         */
        if (contain_mutable_functions((Node *) predList))
                elog(ERROR, "Functions in index predicate must be marked isImmutable");
@@ -432,7 +432,7 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
        if (schemaname)
        {
                /* Look in specific schema only */
-               Oid             namespaceId;
+               Oid                     namespaceId;
 
                namespaceId = LookupExplicitNamespace(schemaname);
                tuple = SearchSysCache(CLAAMNAMENSP,
@@ -458,15 +458,15 @@ GetAttrOpClass(IndexElem *attribute, Oid attrType,
                         NameListToString(attribute->opclass), accessMethodName);
 
        /*
-        * Verify that the index operator class accepts this
-        * datatype.  Note we will accept binary compatibility.
+        * Verify that the index operator class accepts this datatype.  Note
+        * we will accept binary compatibility.
         */
        opClassId = HeapTupleGetOid(tuple);
        opInputType = ((Form_pg_opclass) GETSTRUCT(tuple))->opcintype;
 
        if (!IsBinaryCompatible(attrType, opInputType))
                elog(ERROR, "operator class \"%s\" does not accept data type %s",
-                        NameListToString(attribute->opclass), format_type_be(attrType));
+                NameListToString(attribute->opclass), format_type_be(attrType));
 
        ReleaseSysCache(tuple);
 
@@ -547,7 +547,7 @@ RemoveIndex(RangeVar *relation, DropBehavior behavior)
 
        if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_INDEX)
                elog(ERROR, "relation \"%s\" is of type \"%c\"",
-                        relation->relname, ((Form_pg_class) GETSTRUCT(tuple))->relkind);
+                relation->relname, ((Form_pg_class) GETSTRUCT(tuple))->relkind);
 
        ReleaseSysCache(tuple);
 
@@ -704,7 +704,7 @@ ReindexDatabase(const char *dbname, bool force, bool all)
        relcnt = relalc = 0;
        while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
        {
-               char relkind;
+               char            relkind;
 
                if (!all)
                {
index fe2295c..c2bb202 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/lockcmds.c,v 1.3 2002/06/20 20:29:27 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/lockcmds.c,v 1.4 2002/09/04 20:31:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -43,8 +43,8 @@ LockTableCommand(LockStmt *lockstmt)
                Relation        rel;
 
                /*
-                * We don't want to open the relation until we've checked privilege.
-                * So, manually get the relation OID.
+                * We don't want to open the relation until we've checked
+                * privilege. So, manually get the relation OID.
                 */
                reloid = RangeVarGetRelid(relation, false);
 
index a0430a8..2773946 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.4 2002/08/22 00:01:42 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.5 2002/09/04 20:31:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,7 +38,7 @@
 
 
 static void storeOperators(Oid opclassoid, int numOperators,
-                                                  Oid *operators, bool *recheck);
+                          Oid *operators, bool *recheck);
 static void storeProcedures(Oid opclassoid, int numProcs, Oid *procedures);
 
 
@@ -68,8 +68,8 @@ DefineOpClass(CreateOpClassStmt *stmt)
        AclResult       aclresult;
        NameData        opcName;
        int                     i;
-       ObjectAddress   myself,
-                                       referenced;
+       ObjectAddress myself,
+                               referenced;
 
        /* Convert list of names to a name and namespace */
        namespaceoid = QualifiedNameGetCreationNamespace(stmt->opclassname,
@@ -107,9 +107,9 @@ DefineOpClass(CreateOpClassStmt *stmt)
        storageoid = InvalidOid;
 
        /*
-        * Create work arrays to hold info about operators and procedures.
-        * We do this mainly so that we can detect duplicate strategy
-        * numbers and support-proc numbers.
+        * Create work arrays to hold info about operators and procedures. We
+        * do this mainly so that we can detect duplicate strategy numbers and
+        * support-proc numbers.
         */
        operators = (Oid *) palloc(sizeof(Oid) * numOperators);
        MemSet(operators, 0, sizeof(Oid) * numOperators);
@@ -141,11 +141,11 @@ DefineOpClass(CreateOpClassStmt *stmt)
                                                 item->number);
                                if (item->args != NIL)
                                {
-                                       TypeName *typeName1 = (TypeName *) lfirst(item->args);
-                                       TypeName *typeName2 = (TypeName *) lsecond(item->args);
+                                       TypeName   *typeName1 = (TypeName *) lfirst(item->args);
+                                       TypeName   *typeName2 = (TypeName *) lsecond(item->args);
 
                                        operOid = LookupOperNameTypeNames(item->name,
-                                                                                                         typeName1, typeName2,
+                                                                                                       typeName1, typeName2,
                                                                                                          "DefineOpClass");
                                        /* No need to check for error */
                                }
@@ -221,8 +221,8 @@ DefineOpClass(CreateOpClassStmt *stmt)
        rel = heap_openr(OperatorClassRelationName, RowExclusiveLock);
 
        /*
-        * Make sure there is no existing opclass of this name (this is
-        * just to give a more friendly error message than "duplicate key").
+        * Make sure there is no existing opclass of this name (this is just
+        * to give a more friendly error message than "duplicate key").
         */
        if (SearchSysCacheExists(CLAAMNAMENSP,
                                                         ObjectIdGetDatum(amoid),
@@ -233,12 +233,12 @@ DefineOpClass(CreateOpClassStmt *stmt)
                         opcname, stmt->amname);
 
        /*
-        * If we are creating a default opclass, check there isn't one already.
-        * (XXX should we restrict this test to visible opclasses?)
+        * If we are creating a default opclass, check there isn't one
+        * already. (XXX should we restrict this test to visible opclasses?)
         */
        if (stmt->isDefault)
        {
-               ScanKeyData     skey[1];
+               ScanKeyData skey[1];
                SysScanDesc scan;
 
                ScanKeyEntryInitialize(&skey[0], 0x0,
@@ -276,11 +276,11 @@ DefineOpClass(CreateOpClassStmt *stmt)
        values[i++] = ObjectIdGetDatum(amoid);          /* opcamid */
        namestrcpy(&opcName, opcname);
        values[i++] = NameGetDatum(&opcName);           /* opcname */
-       values[i++] = ObjectIdGetDatum(namespaceoid);   /* opcnamespace */
+       values[i++] = ObjectIdGetDatum(namespaceoid);           /* opcnamespace */
        values[i++] = Int32GetDatum(GetUserId());       /* opcowner */
        values[i++] = ObjectIdGetDatum(typeoid);        /* opcintype */
-       values[i++] = BoolGetDatum(stmt->isDefault);    /* opcdefault */
-       values[i++] = ObjectIdGetDatum(storageoid);     /* opckeytype */
+       values[i++] = BoolGetDatum(stmt->isDefault);            /* opcdefault */
+       values[i++] = ObjectIdGetDatum(storageoid); /* opckeytype */
 
        tup = heap_formtuple(rel->rd_att, values, nulls);
 
@@ -291,8 +291,8 @@ DefineOpClass(CreateOpClassStmt *stmt)
        heap_freetuple(tup);
 
        /*
-        * Now add tuples to pg_amop and pg_amproc tying in the
-        * operators and functions.
+        * Now add tuples to pg_amop and pg_amproc tying in the operators and
+        * functions.
         */
        storeOperators(opclassoid, numOperators, operators, recheck);
        storeProcedures(opclassoid, numProcs, procedures);
@@ -358,11 +358,12 @@ static void
 storeOperators(Oid opclassoid, int numOperators,
                           Oid *operators, bool *recheck)
 {
-       Relation                rel;
-       Datum                   values[Natts_pg_amop];
-       char                    nulls[Natts_pg_amop];
-       HeapTuple               tup;
-       int                             i, j;
+       Relation        rel;
+       Datum           values[Natts_pg_amop];
+       char            nulls[Natts_pg_amop];
+       HeapTuple       tup;
+       int                     i,
+                               j;
 
        rel = heap_openr(AccessMethodOperatorRelationName, RowExclusiveLock);
 
@@ -378,9 +379,9 @@ storeOperators(Oid opclassoid, int numOperators,
                }
 
                i = 0;
-               values[i++] = ObjectIdGetDatum(opclassoid);                     /* amopclaid */
-               values[i++] = Int16GetDatum(j + 1);                                     /* amopstrategy */
-               values[i++] = BoolGetDatum(recheck[j]);         /* amopreqcheck */
+               values[i++] = ObjectIdGetDatum(opclassoid);             /* amopclaid */
+               values[i++] = Int16GetDatum(j + 1);             /* amopstrategy */
+               values[i++] = BoolGetDatum(recheck[j]); /* amopreqcheck */
                values[i++] = ObjectIdGetDatum(operators[j]);   /* amopopr */
 
                tup = heap_formtuple(rel->rd_att, values, nulls);
@@ -401,11 +402,12 @@ storeOperators(Oid opclassoid, int numOperators,
 static void
 storeProcedures(Oid opclassoid, int numProcs, Oid *procedures)
 {
-       Relation                rel;
-       Datum                   values[Natts_pg_amproc];
-       char                    nulls[Natts_pg_amproc];
-       HeapTuple               tup;
-       int                             i, j;
+       Relation        rel;
+       Datum           values[Natts_pg_amproc];
+       char            nulls[Natts_pg_amproc];
+       HeapTuple       tup;
+       int                     i,
+                               j;
 
        rel = heap_openr(AccessMethodProcedureRelationName, RowExclusiveLock);
 
@@ -421,9 +423,9 @@ storeProcedures(Oid opclassoid, int numProcs, Oid *procedures)
                }
 
                i = 0;
-               values[i++] = ObjectIdGetDatum(opclassoid);                     /* amopclaid */
-               values[i++] = Int16GetDatum(j + 1);                                     /* amprocnum */
-               values[i++] = ObjectIdGetDatum(procedures[j]);          /* amproc */
+               values[i++] = ObjectIdGetDatum(opclassoid);             /* amopclaid */
+               values[i++] = Int16GetDatum(j + 1);             /* amprocnum */
+               values[i++] = ObjectIdGetDatum(procedures[j]);  /* amproc */
 
                tup = heap_formtuple(rel->rd_att, values, nulls);
 
@@ -445,14 +447,15 @@ storeProcedures(Oid opclassoid, int numProcs, Oid *procedures)
 void
 RemoveOpClass(RemoveOpClassStmt *stmt)
 {
-       Oid                     amID, opcID;
+       Oid                     amID,
+                               opcID;
        char       *schemaname;
        char       *opcname;
        HeapTuple       tuple;
        ObjectAddress object;
 
        /*
-        *      Get the access method's OID.
+        * Get the access method's OID.
         */
        amID = GetSysCacheOid(AMNAME,
                                                  CStringGetDatum(stmt->amname),
@@ -471,7 +474,7 @@ RemoveOpClass(RemoveOpClassStmt *stmt)
        if (schemaname)
        {
                /* Look in specific schema only */
-               Oid             namespaceId;
+               Oid                     namespaceId;
 
                namespaceId = LookupExplicitNamespace(schemaname);
                tuple = SearchSysCache(CLAAMNAMENSP,
@@ -523,10 +526,10 @@ RemoveOpClass(RemoveOpClassStmt *stmt)
 void
 RemoveOpClassById(Oid opclassOid)
 {
-       Relation                rel;
-       HeapTuple               tup;
-       ScanKeyData             skey[1];
-       SysScanDesc             scan;
+       Relation        rel;
+       HeapTuple       tup;
+       ScanKeyData skey[1];
+       SysScanDesc scan;
 
        /*
         * First remove the pg_opclass entry itself.
@@ -536,7 +539,7 @@ RemoveOpClassById(Oid opclassOid)
        tup = SearchSysCache(CLAOID,
                                                 ObjectIdGetDatum(opclassOid),
                                                 0, 0, 0);
-       if (!HeapTupleIsValid(tup))     /* should not happen */
+       if (!HeapTupleIsValid(tup)) /* should not happen */
                elog(ERROR, "RemoveOpClassById: couldn't find pg_class entry %u",
                         opclassOid);
 
@@ -559,9 +562,7 @@ RemoveOpClassById(Oid opclassOid)
                                                          SnapshotNow, 1, skey);
 
        while (HeapTupleIsValid(tup = systable_getnext(scan)))
-       {
                simple_heap_delete(rel, &tup->t_self);
-       }
 
        systable_endscan(scan);
        heap_close(rel, RowExclusiveLock);
@@ -579,9 +580,7 @@ RemoveOpClassById(Oid opclassOid)
                                                          SnapshotNow, 1, skey);
 
        while (HeapTupleIsValid(tup = systable_getnext(scan)))
-       {
                simple_heap_delete(rel, &tup->t_self);
-       }
 
        systable_endscan(scan);
        heap_close(rel, RowExclusiveLock);
index 4d91ce4..bb82e0d 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/operatorcmds.c,v 1.6 2002/07/24 19:11:09 petere Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/operatorcmds.c,v 1.7 2002/09/04 20:31:15 momjian Exp $
  *
  * DESCRIPTION
  *       The "DefineFoo" routines take the parse tree and pick out the
@@ -62,7 +62,7 @@ DefineOperator(List *names, List *parameters)
        char       *oprName;
        Oid                     oprNamespace;
        AclResult       aclresult;
-       bool            canHash = false;                /* operator hashes */
+       bool            canHash = false;        /* operator hashes */
        bool            canMerge = false;               /* operator merges */
        List       *functionName = NIL;         /* function for operator */
        TypeName   *typeName1 = NULL;           /* first type name */
@@ -74,7 +74,7 @@ DefineOperator(List *names, List *parameters)
        List       *negatorName = NIL;          /* optional negator operator name */
        List       *restrictionName = NIL;      /* optional restrict. sel.
                                                                                 * procedure */
-       List       *joinName = NIL;                     /* optional join sel. procedure */
+       List       *joinName = NIL; /* optional join sel. procedure */
        List       *leftSortName = NIL;         /* optional left sort operator */
        List       *rightSortName = NIL;        /* optional right sort operator */
        List       *ltCompareName = NIL;        /* optional < compare operator */
@@ -173,7 +173,7 @@ DefineOperator(List *names, List *parameters)
         * now have OperatorCreate do all the work..
         */
        OperatorCreate(oprName,         /* operator name */
-                                  oprNamespace, /* namespace */
+                                  oprNamespace,        /* namespace */
                                   typeId1,             /* left type id */
                                   typeId2,             /* right type id */
                                   functionName,        /* function for operator */
@@ -185,9 +185,9 @@ DefineOperator(List *names, List *parameters)
                                   joinName,    /* optional join sel. procedure name */
                                   canHash,             /* operator hashes */
                                   leftSortName,        /* optional left sort operator */
-                                  rightSortName,       /* optional right sort operator */
-                                  ltCompareName,       /* optional < comparison op */
-                                  gtCompareName);      /* optional < comparison op */
+                                  rightSortName,               /* optional right sort operator */
+                                  ltCompareName,               /* optional < comparison op */
+                                  gtCompareName);              /* optional < comparison op */
 }
 
 
@@ -198,9 +198,9 @@ DefineOperator(List *names, List *parameters)
 void
 RemoveOperator(RemoveOperStmt *stmt)
 {
-       List *operatorName = stmt->opname;
-       TypeName *typeName1 = (TypeName *) lfirst(stmt->args);
-       TypeName *typeName2 = (TypeName *) lsecond(stmt->args);
+       List       *operatorName = stmt->opname;
+       TypeName   *typeName1 = (TypeName *) lfirst(stmt->args);
+       TypeName   *typeName2 = (TypeName *) lsecond(stmt->args);
        Oid                     operOid;
        HeapTuple       tup;
        ObjectAddress object;
@@ -211,7 +211,7 @@ RemoveOperator(RemoveOperStmt *stmt)
        tup = SearchSysCache(OPEROID,
                                                 ObjectIdGetDatum(operOid),
                                                 0, 0, 0);
-       if (!HeapTupleIsValid(tup))     /* should not happen */
+       if (!HeapTupleIsValid(tup)) /* should not happen */
                elog(ERROR, "RemoveOperator: failed to find tuple for operator '%s'",
                         NameListToString(operatorName));
 
@@ -247,7 +247,7 @@ RemoveOperatorById(Oid operOid)
        tup = SearchSysCache(OPEROID,
                                                 ObjectIdGetDatum(operOid),
                                                 0, 0, 0);
-       if (!HeapTupleIsValid(tup))     /* should not happen */
+       if (!HeapTupleIsValid(tup)) /* should not happen */
                elog(ERROR, "RemoveOperatorById: failed to find tuple for operator %u",
                         operOid);
 
index 754ea46..0454b21 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/portalcmds.c,v 1.2 2002/05/21 22:05:54 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/portalcmds.c,v 1.3 2002/09/04 20:31:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -134,12 +134,12 @@ PerformPortalFetch(char *name,
         * Determine which direction to go in, and check to see if we're
         * already at the end of the available tuples in that direction.  If
         * so, set the direction to NoMovement to avoid trying to fetch any
-        * tuples.  (This check exists because not all plan node types
-        * are robust about being called again if they've already returned
-        * NULL once.)  Then call the executor (we must not skip this, because
-        * the destination needs to see a setup and shutdown even if no tuples
-        * are available).  Finally, update the atStart/atEnd state depending
-        * on the number of tuples that were retrieved.
+        * tuples.      (This check exists because not all plan node types are
+        * robust about being called again if they've already returned NULL
+        * once.)  Then call the executor (we must not skip this, because the
+        * destination needs to see a setup and shutdown even if no tuples are
+        * available).  Finally, update the atStart/atEnd state depending on
+        * the number of tuples that were retrieved.
         */
        if (forward)
        {
@@ -151,9 +151,9 @@ PerformPortalFetch(char *name,
                ExecutorRun(queryDesc, estate, direction, (long) count);
 
                if (estate->es_processed > 0)
-                       portal->atStart = false; /* OK to back up now */
+                       portal->atStart = false;        /* OK to back up now */
                if (count <= 0 || (int) estate->es_processed < count)
-                       portal->atEnd = true;   /* we retrieved 'em all */
+                       portal->atEnd = true;           /* we retrieved 'em all */
        }
        else
        {
@@ -165,9 +165,9 @@ PerformPortalFetch(char *name,
                ExecutorRun(queryDesc, estate, direction, (long) count);
 
                if (estate->es_processed > 0)
-                       portal->atEnd = false;  /* OK to go forward now */
+                       portal->atEnd = false;          /* OK to go forward now */
                if (count <= 0 || (int) estate->es_processed < count)
-                       portal->atStart = true; /* we retrieved 'em all */
+                       portal->atStart = true;         /* we retrieved 'em all */
        }
 
        /* Return command status if wanted */
index 9dbe214..cf869ed 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (c) 2002, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/prepare.c,v 1.1 2002/08/27 04:55:07 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/prepare.c,v 1.2 2002/09/04 20:31:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,7 +34,7 @@ typedef struct
        List       *query_list;         /* list of queries */
        List       *plan_list;          /* list of plans */
        List       *argtype_list;       /* list of parameter type OIDs */
-       MemoryContext    context;       /* context containing this query */
+       MemoryContext context;          /* context containing this query */
 } QueryHashEntry;
 
 /*
@@ -47,7 +47,7 @@ static HTAB *prepared_queries = NULL;
 
 static void InitQueryHashTable(void);
 static void StoreQuery(const char *stmt_name, List *query_list,
-                                          List *plan_list, List *argtype_list);
+                  List *plan_list, List *argtype_list);
 static QueryHashEntry *FetchQuery(const char *plan_name);
 static void RunQuery(QueryDesc *qdesc, EState *state);
 
@@ -58,9 +58,9 @@ static void RunQuery(QueryDesc *qdesc, EState *state);
 void
 PrepareQuery(PrepareStmt *stmt)
 {
-       List *plan_list = NIL;
-       List *query_list,
-                *query_list_item;
+       List       *plan_list = NIL;
+       List       *query_list,
+                          *query_list_item;
 
        if (!stmt->name)
                elog(ERROR, "No statement name given");
@@ -73,8 +73,8 @@ PrepareQuery(PrepareStmt *stmt)
 
        foreach(query_list_item, query_list)
        {
-               Query *query = (Query *) lfirst(query_list_item);
-               Plan  *plan;
+               Query      *query = (Query *) lfirst(query_list_item);
+               Plan       *plan;
 
                /* We can't generate plans for utility statements. */
                if (query->commandType == CMD_UTILITY)
@@ -97,10 +97,10 @@ PrepareQuery(PrepareStmt *stmt)
 void
 ExecuteQuery(ExecuteStmt *stmt, CommandDest outputDest)
 {
-       QueryHashEntry  *entry;
-       List            *l,
-                               *query_list,
-                               *plan_list;
+       QueryHashEntry *entry;
+       List       *l,
+                          *query_list,
+                          *plan_list;
        ParamListInfo paramLI = NULL;
 
        /* Look it up in the hash table */
@@ -115,8 +115,8 @@ ExecuteQuery(ExecuteStmt *stmt, CommandDest outputDest)
        /* Evaluate parameters, if any */
        if (entry->argtype_list != NIL)
        {
-               int nargs = length(entry->argtype_list);
-               int i = 0;
+               int                     nargs = length(entry->argtype_list);
+               int                     i = 0;
                ExprContext *econtext = MakeExprContext(NULL, CurrentMemoryContext);
 
                /* Parser should have caught this error, but check */
@@ -126,10 +126,10 @@ ExecuteQuery(ExecuteStmt *stmt, CommandDest outputDest)
                paramLI = (ParamListInfo) palloc((nargs + 1) * sizeof(ParamListInfoData));
                MemSet(paramLI, 0, (nargs + 1) * sizeof(ParamListInfoData));
 
-               foreach (l, stmt->params)
+               foreach(l, stmt->params)
                {
-                       Node *n = lfirst(l);
-                       bool isNull;
+                       Node       *n = lfirst(l);
+                       bool            isNull;
 
                        paramLI[i].value = ExecEvalExprSwitchContext(n,
                                                                                                                 econtext,
@@ -147,9 +147,9 @@ ExecuteQuery(ExecuteStmt *stmt, CommandDest outputDest)
        /* Execute each query */
        foreach(l, query_list)
        {
-               Query *query = lfirst(l);
-               Plan *plan = lfirst(plan_list);
-               bool is_last_query;
+               Query      *query = lfirst(l);
+               Plan       *plan = lfirst(plan_list);
+               bool            is_last_query;
 
                plan_list = lnext(plan_list);
                is_last_query = (plan_list == NIL);
@@ -158,8 +158,8 @@ ExecuteQuery(ExecuteStmt *stmt, CommandDest outputDest)
                        ProcessUtility(query->utilityStmt, outputDest, NULL);
                else
                {
-                       QueryDesc *qdesc;
-                       EState    *state;
+                       QueryDesc  *qdesc;
+                       EState     *state;
 
                        if (Show_executor_stats)
                                ResetUsage();
@@ -185,11 +185,11 @@ ExecuteQuery(ExecuteStmt *stmt, CommandDest outputDest)
                }
 
                /*
-                * If we're processing multiple queries, we need to increment
-                * the command counter between them. For the last query,
-                * there's no need to do this, it's done automatically.
+                * If we're processing multiple queries, we need to increment the
+                * command counter between them. For the last query, there's no
+                * need to do this, it's done automatically.
                 */
-               if (! is_last_query)
+               if (!is_last_query)
                        CommandCounterIncrement();
        }
 
@@ -202,7 +202,7 @@ ExecuteQuery(ExecuteStmt *stmt, CommandDest outputDest)
 static void
 InitQueryHashTable(void)
 {
-       HASHCTL hash_ctl;
+       HASHCTL         hash_ctl;
 
        MemSet(&hash_ctl, 0, sizeof(hash_ctl));
 
@@ -229,9 +229,9 @@ StoreQuery(const char *stmt_name, List *query_list, List *plan_list,
 {
        QueryHashEntry *entry;
        MemoryContext oldcxt,
-                                 entrycxt;
-       char key[HASH_KEY_LEN];
-       bool found;
+                               entrycxt;
+       char            key[HASH_KEY_LEN];
+       bool            found;
 
        /* Initialize the hash table, if necessary */
        if (!prepared_queries)
@@ -258,10 +258,10 @@ StoreQuery(const char *stmt_name, List *query_list, List *plan_list,
        oldcxt = MemoryContextSwitchTo(entrycxt);
 
        /*
-        * We need to copy the data so that it is stored in the correct
-        * memory context.  Do this before making hashtable entry, so that
-        * an out-of-memory failure only wastes memory and doesn't leave us
-        * with an incomplete (ie corrupt) hashtable entry.
+        * We need to copy the data so that it is stored in the correct memory
+        * context.  Do this before making hashtable entry, so that an
+        * out-of-memory failure only wastes memory and doesn't leave us with
+        * an incomplete (ie corrupt) hashtable entry.
         */
        query_list = (List *) copyObject(query_list);
        plan_list = (List *) copyObject(plan_list);
@@ -293,7 +293,7 @@ StoreQuery(const char *stmt_name, List *query_list, List *plan_list,
 static QueryHashEntry *
 FetchQuery(const char *plan_name)
 {
-       char key[HASH_KEY_LEN];
+       char            key[HASH_KEY_LEN];
        QueryHashEntry *entry;
 
        /*
@@ -306,8 +306,8 @@ FetchQuery(const char *plan_name)
 
        /*
         * We can't just use the statement name as supplied by the user: the
-        * hash package is picky enough that it needs to be NULL-padded out
-        * to the appropriate length to work correctly.
+        * hash package is picky enough that it needs to be NULL-padded out to
+        * the appropriate length to work correctly.
         */
        MemSet(key, 0, sizeof(key));
        strncpy(key, plan_name, sizeof(key));
@@ -344,7 +344,7 @@ FetchQueryParams(const char *plan_name)
 static void
 RunQuery(QueryDesc *qdesc, EState *state)
 {
-       TupleDesc tupdesc;
+       TupleDesc       tupdesc;
 
        tupdesc = ExecutorStart(qdesc, state);
 
@@ -363,7 +363,7 @@ RunQuery(QueryDesc *qdesc, EState *state)
 void
 DeallocateQuery(DeallocateStmt *stmt)
 {
-       char key[HASH_KEY_LEN];
+       char            key[HASH_KEY_LEN];
        QueryHashEntry *entry;
 
        /*
@@ -376,18 +376,18 @@ DeallocateQuery(DeallocateStmt *stmt)
 
        /*
         * We can't just use the statement name as supplied by the user: the
-        * hash package is picky enough that it needs to be NULL-padded out
-        * to the appropriate length to work correctly.
+        * hash package is picky enough that it needs to be NULL-padded out to
+        * the appropriate length to work correctly.
         */
        MemSet(key, 0, sizeof(key));
        strncpy(key, stmt->name, sizeof(key));
 
        /*
         * First lookup the entry, so we can release all the subsidiary memory
-        * it has allocated (when it's removed, hash_search() will return
-        * dangling pointer, so it needs to be done prior to HASH_REMOVE).
-        * This requires an extra hash-table lookup, but DEALLOCATE
-        * isn't exactly a performance bottleneck.
+        * it has allocated (when it's removed, hash_search() will return a
+        * dangling pointer, so it needs to be done prior to HASH_REMOVE).
+        * This requires an extra hash-table lookup, but DEALLOCATE isn't
+        * exactly a performance bottleneck.
         */
        entry = (QueryHashEntry *) hash_search(prepared_queries,
                                                                                   key,
index 8aa2add..0d282e8 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/proclang.c,v 1.41 2002/08/22 00:01:42 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/proclang.c,v 1.42 2002/09/04 20:31:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -41,7 +41,8 @@ void
 CreateProceduralLanguage(CreatePLangStmt *stmt)
 {
        char            languageName[NAMEDATALEN];
-       Oid                     procOid, valProcOid;
+       Oid                     procOid,
+                               valProcOid;
        Oid                     typev[FUNC_MAX_ARGS];
        char            nulls[Natts_pg_language];
        Datum           values[Natts_pg_language];
@@ -49,8 +50,8 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
        HeapTuple       tup;
        TupleDesc       tupDesc;
        int                     i;
-       ObjectAddress   myself,
-                                       referenced;
+       ObjectAddress myself,
+                               referenced;
 
        /*
         * Check permission
index 6210067..09165d4 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/schemacmds.c,v 1.5 2002/07/18 16:47:24 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/schemacmds.c,v 1.6 2002/09/04 20:31:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -61,15 +61,17 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
                owner_name = authId;
                /* The following will error out if user does not exist */
                owner_userid = get_usesysid(owner_name);
+
                /*
-                * Set the current user to the requested authorization so
-                * that objects created in the statement have the requested
-                * owner.  (This will revert to session user on error or at
-                * the end of this routine.)
+                * Set the current user to the requested authorization so that
+                * objects created in the statement have the requested owner.
+                * (This will revert to session user on error or at the end of
+                * this routine.)
                 */
                SetUserId(owner_userid);
        }
-       else /* not superuser */
+       else
+/* not superuser */
        {
                owner_userid = saved_userid;
                owner_name = GetUserNameFromId(owner_userid);
@@ -98,17 +100,17 @@ CreateSchemaCommand(CreateSchemaStmt *stmt)
 
        /*
         * Temporarily make the new namespace be the front of the search path,
-        * as well as the default creation target namespace.  This will be undone
-        * at the end of this routine, or upon error.
+        * as well as the default creation target namespace.  This will be
+        * undone at the end of this routine, or upon error.
         */
        PushSpecialNamespace(namespaceId);
 
        /*
         * Examine the list of commands embedded in the CREATE SCHEMA command,
         * and reorganize them into a sequentially executable order with no
-        * forward references.  Note that the result is still a list of raw
-        * parsetrees in need of parse analysis --- we cannot, in general,
-        * run analyze.c on one statement until we have actually executed the
+        * forward references.  Note that the result is still a list of raw
+        * parsetrees in need of parse analysis --- we cannot, in general, run
+        * analyze.c on one statement until we have actually executed the
         * prior ones.
         */
        parsetree_list = analyzeCreateSchemaStmt(stmt);
@@ -171,12 +173,12 @@ RemoveSchema(List *names, DropBehavior behavior)
                aclcheck_error(ACLCHECK_NOT_OWNER, namespaceName);
 
        /*
-        * Do the deletion.  Objects contained in the schema are removed
-        * by means of their dependency links to the schema.
+        * Do the deletion.  Objects contained in the schema are removed by
+        * means of their dependency links to the schema.
         *
-        * XXX currently, index opclasses don't have creation/deletion
-        * commands, so they will not get removed when the containing
-        * schema is removed.  This is annoying but not fatal.
+        * XXX currently, index opclasses don't have creation/deletion commands,
+        * so they will not get removed when the containing schema is removed.
+        * This is annoying but not fatal.
         */
        object.classId = get_system_catalog_relid(NamespaceRelationName);
        object.objectId = namespaceId;
index fd62e41..5906788 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.86 2002/09/03 18:50:54 petere Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.87 2002/09/04 20:31:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -60,7 +60,7 @@ typedef struct sequence_magic
  * rely on the relcache, since it's only, well, a cache, and may decide to
  * discard entries.)
  *
- * XXX We use linear search to find pre-existing SeqTable entries.  This is
+ * XXX We use linear search to find pre-existing SeqTable entries.     This is
  * good when only a small number of sequences are touched in a session, but
  * would suck with many different sequences.  Perhaps use a hashtable someday.
  */
@@ -81,9 +81,9 @@ static SeqTable seqtab = NULL;        /* Head of list of SeqTable items */
 
 
 static void init_sequence(const char *caller, RangeVar *relation,
-                                                 SeqTable *p_elm, Relation *p_rel);
+                         SeqTable *p_elm, Relation *p_rel);
 static Form_pg_sequence read_info(const char *caller, SeqTable elm,
-                                                                 Relation rel, Buffer *buf);
+                 Relation rel, Buffer *buf);
 static void init_params(CreateSeqStmt *seq, Form_pg_sequence new);
 static void do_setval(RangeVar *sequence, int64 next, bool iscalled);
 
@@ -226,15 +226,15 @@ DefineSequence(CreateSeqStmt *seq)
         * Two special hacks here:
         *
         * 1. Since VACUUM does not process sequences, we have to force the tuple
-        * to have xmin = FrozenTransactionId now.  Otherwise it would become
-        * invisible to SELECTs after 2G transactions.  It is okay to do this
+        * to have xmin = FrozenTransactionId now.      Otherwise it would become
+        * invisible to SELECTs after 2G transactions.  It is okay to do this
         * because if the current transaction aborts, no other xact will ever
         * examine the sequence tuple anyway.
         *
         * 2. Even though heap_insert emitted a WAL log record, we have to emit
         * an XLOG_SEQ_LOG record too, since (a) the heap_insert record will
         * not have the right xmin, and (b) REDO of the heap_insert record
-        * would re-init page and sequence magic number would be lost.  This
+        * would re-init page and sequence magic number would be lost.  This
         * means two log records instead of one :-(
         */
        LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
@@ -243,11 +243,12 @@ DefineSequence(CreateSeqStmt *seq)
 
        {
                /*
-                * Note that the "tuple" structure is still just a local tuple record
-                * created by heap_formtuple; its t_data pointer doesn't point at the
-                * disk buffer.  To scribble on the disk buffer we need to fetch the
-                * item pointer.  But do the same to the local tuple, since that will
-                * be the source for the WAL log record, below.
+                * Note that the "tuple" structure is still just a local tuple
+                * record created by heap_formtuple; its t_data pointer doesn't
+                * point at the disk buffer.  To scribble on the disk buffer we
+                * need to fetch the item pointer.      But do the same to the local
+                * tuple, since that will be the source for the WAL log record,
+                * below.
                 */
                ItemId          itemId;
                Item            item;
@@ -323,7 +324,7 @@ nextval(PG_FUNCTION_ARGS)
        bool            logit = false;
 
        sequence = makeRangeVarFromNameList(textToQualifiedNameList(seqin,
-                                                                                                                               "nextval"));
+                                                                                                                        "nextval"));
 
        /* open and AccessShareLock sequence */
        init_sequence("nextval", sequence, &elm, &seqrel);
@@ -358,14 +359,14 @@ nextval(PG_FUNCTION_ARGS)
        }
 
        /*
-        * Decide whether we should emit a WAL log record.  If so, force up
+        * Decide whether we should emit a WAL log record.      If so, force up
         * the fetch count to grab SEQ_LOG_VALS more values than we actually
         * need to cache.  (These will then be usable without logging.)
         *
-        * If this is the first nextval after a checkpoint, we must force
-        * a new WAL record to be written anyway, else replay starting from the
+        * If this is the first nextval after a checkpoint, we must force a new
+        * WAL record to be written anyway, else replay starting from the
         * checkpoint would fail to advance the sequence past the logged
-        * values.  In this case we may as well fetch extra values.
+        * values.      In this case we may as well fetch extra values.
         */
        if (log < fetch)
        {
@@ -401,7 +402,8 @@ nextval(PG_FUNCTION_ARGS)
                                        break;          /* stop fetching */
                                if (!seq->is_cycled)
                                {
-                                       char buf[100];
+                                       char            buf[100];
+
                                        snprintf(buf, 100, INT64_FORMAT, maxv);
                                        elog(ERROR, "%s.nextval: reached MAXVALUE (%s)",
                                                 sequence->relname, buf);
@@ -421,7 +423,8 @@ nextval(PG_FUNCTION_ARGS)
                                        break;          /* stop fetching */
                                if (!seq->is_cycled)
                                {
-                                       char buf[100];
+                                       char            buf[100];
+
                                        snprintf(buf, 100, INT64_FORMAT, minv);
                                        elog(ERROR, "%s.nextval: reached MINVALUE (%s)",
                                                 sequence->relname, buf);
@@ -507,7 +510,7 @@ currval(PG_FUNCTION_ARGS)
        int64           result;
 
        sequence = makeRangeVarFromNameList(textToQualifiedNameList(seqin,
-                                                                                                                               "currval"));
+                                                                                                                        "currval"));
 
        /* open and AccessShareLock sequence */
        init_sequence("currval", sequence, &elm, &seqrel);
@@ -560,7 +563,10 @@ do_setval(RangeVar *sequence, int64 next, bool iscalled)
 
        if ((next < seq->min_value) || (next > seq->max_value))
        {
-               char bufv[100], bufm[100], bufx[100];
+               char            bufv[100],
+                                       bufm[100],
+                                       bufx[100];
+
                snprintf(bufv, 100, INT64_FORMAT, next);
                snprintf(bufm, 100, INT64_FORMAT, seq->min_value);
                snprintf(bufx, 100, INT64_FORMAT, seq->max_value);
@@ -632,7 +638,7 @@ setval(PG_FUNCTION_ARGS)
        RangeVar   *sequence;
 
        sequence = makeRangeVarFromNameList(textToQualifiedNameList(seqin,
-                                                                                                                               "setval"));
+                                                                                                                         "setval"));
 
        do_setval(sequence, next, true);
 
@@ -652,7 +658,7 @@ setval_and_iscalled(PG_FUNCTION_ARGS)
        RangeVar   *sequence;
 
        sequence = makeRangeVarFromNameList(textToQualifiedNameList(seqin,
-                                                                                                                               "setval"));
+                                                                                                                         "setval"));
 
        do_setval(sequence, next, iscalled);
 
@@ -672,7 +678,7 @@ init_sequence(const char *caller, RangeVar *relation,
        TransactionId thisxid = GetCurrentTransactionId();
        SeqTable        elm;
        Relation        seqrel;
-       
+
        /* Look to see if we already have a seqtable entry for relation */
        for (elm = seqtab; elm != NULL; elm = elm->next)
        {
@@ -697,9 +703,9 @@ init_sequence(const char *caller, RangeVar *relation,
         * Allocate new seqtable entry if we didn't find one.
         *
         * NOTE: seqtable entries remain in the list for the life of a backend.
-        * If the sequence itself is deleted then the entry becomes wasted memory,
-        * but it's small enough that this should not matter.
-        */ 
+        * If the sequence itself is deleted then the entry becomes wasted
+        * memory, but it's small enough that this should not matter.
+        */
        if (elm == NULL)
        {
                /*
@@ -828,7 +834,9 @@ init_params(CreateSeqStmt *seq, Form_pg_sequence new)
 
        if (new->min_value >= new->max_value)
        {
-               char bufm[100], bufx[100];
+               char            bufm[100],
+                                       bufx[100];
+
                snprintf(bufm, 100, INT64_FORMAT, new->min_value);
                snprintf(bufx, 100, INT64_FORMAT, new->max_value);
                elog(ERROR, "DefineSequence: MINVALUE (%s) must be less than MAXVALUE (%s)",
@@ -847,7 +855,9 @@ init_params(CreateSeqStmt *seq, Form_pg_sequence new)
 
        if (new->last_value < new->min_value)
        {
-               char bufs[100], bufm[100];
+               char            bufs[100],
+                                       bufm[100];
+
                snprintf(bufs, 100, INT64_FORMAT, new->last_value);
                snprintf(bufm, 100, INT64_FORMAT, new->min_value);
                elog(ERROR, "DefineSequence: START value (%s) can't be less than MINVALUE (%s)",
@@ -855,7 +865,9 @@ init_params(CreateSeqStmt *seq, Form_pg_sequence new)
        }
        if (new->last_value > new->max_value)
        {
-               char bufs[100], bufm[100];
+               char            bufs[100],
+                                       bufm[100];
+
                snprintf(bufs, 100, INT64_FORMAT, new->last_value);
                snprintf(bufm, 100, INT64_FORMAT, new->max_value);
                elog(ERROR, "DefineSequence: START value (%s) can't be greater than MAXVALUE (%s)",
@@ -866,7 +878,8 @@ init_params(CreateSeqStmt *seq, Form_pg_sequence new)
                new->cache_value = 1;
        else if ((new->cache_value = defGetInt64(cache_value)) <= 0)
        {
-               char buf[100];
+               char            buf[100];
+
                snprintf(buf, 100, INT64_FORMAT, new->cache_value);
                elog(ERROR, "DefineSequence: CACHE (%s) can't be <= 0",
                         buf);
index 8709111..3b06c69 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.38 2002/09/02 01:05:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.39 2002/09/04 20:31:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -60,11 +60,11 @@ static void setRelhassubclassInRelation(Oid relationId, bool relhassubclass);
 static void CheckTupleType(Form_pg_class tuple_class);
 static bool needs_toast_table(Relation rel);
 static void validateForeignKeyConstraint(FkConstraint *fkconstraint,
-                                                                                Relation rel, Relation pkrel);
-static Oid     createForeignKeyConstraint(Relation rel, Relation pkrel,
-                                                                          FkConstraint *fkconstraint);
+                                                        Relation rel, Relation pkrel);
+static Oid createForeignKeyConstraint(Relation rel, Relation pkrel,
+                                                  FkConstraint *fkconstraint);
 static void createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint,
-                                                                        Oid constrOid);
+                                                Oid constrOid);
 static char *fkMatchTypeToString(char match_type);
 
 /* Used by attribute and relation renaming routines: */
@@ -114,9 +114,8 @@ DefineRelation(CreateStmt *stmt, char relkind)
 
        /*
         * Look up the namespace in which we are supposed to create the
-        * relation.  Check we have permission to create there.
-        * Skip check if bootstrapping, since permissions machinery may not
-        * be working yet.
+        * relation.  Check we have permission to create there. Skip check if
+        * bootstrapping, since permissions machinery may not be working yet.
         */
        namespaceId = RangeVarGetCreationNamespace(stmt->relation);
 
@@ -136,7 +135,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
         */
        schema = MergeAttributes(schema, stmt->inhRelations,
                                                         stmt->relation->istemp,
-                                                        &inheritOids, &old_constraints, &parentHasOids);
+                                                &inheritOids, &old_constraints, &parentHasOids);
 
        numberOfAttributes = length(schema);
        if (numberOfAttributes <= 0)
@@ -180,10 +179,10 @@ DefineRelation(CreateStmt *stmt, char relkind)
                        else
                        {
                                /*
-                                * Generate a constraint name.  NB: this should match the
+                                * Generate a constraint name.  NB: this should match the
                                 * form of names that GenerateConstraintName() may produce
-                                * for names added later.  We are assured that there is
-                                * no name conflict, because MergeAttributes() did not pass
+                                * for names added later.  We are assured that there is no
+                                * name conflict, because MergeAttributes() did not pass
                                 * back any names of this form.
                                 */
                                check[ncheck].ccname = (char *) palloc(NAMEDATALEN);
@@ -242,8 +241,8 @@ DefineRelation(CreateStmt *stmt, char relkind)
         * CREATE TABLE.
         *
         * Another task that's conveniently done at this step is to add
-        * dependency links between columns and supporting relations (such
-        * as SERIAL sequences).
+        * dependency links between columns and supporting relations (such as
+        * SERIAL sequences).
         *
         * First, scan schema to find new column defaults.
         */
@@ -271,7 +270,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
                if (colDef->support != NULL)
                {
                        /* Create dependency for supporting relation for this column */
-                       ObjectAddress   colobject,
+                       ObjectAddress colobject,
                                                suppobject;
 
                        colobject.classId = RelOid_pg_class;
@@ -334,9 +333,9 @@ TruncateRelation(const RangeVar *relation)
        Relation        rel;
        Oid                     relid;
        Oid                     toastrelid;
-       ScanKeyData key;
-       Relation        fkeyRel;
-       SysScanDesc     fkeyScan;
+       ScanKeyData key;
+       Relation        fkeyRel;
+       SysScanDesc fkeyScan;
        HeapTuple       tuple;
 
        /* Grab exclusive lock in preparation for truncate */
@@ -366,8 +365,7 @@ TruncateRelation(const RangeVar *relation)
                aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel));
 
        /*
-        * Don't allow truncate on tables which are referenced
-        * by foreign keys
+        * Don't allow truncate on tables which are referenced by foreign keys
         */
        fkeyRel = heap_openr(ConstraintRelationName, AccessShareLock);
 
@@ -380,8 +378,8 @@ TruncateRelation(const RangeVar *relation)
                                                                  SnapshotNow, 1, &key);
 
        /*
-        * First foreign key found with us as the reference
-        * should throw an error.
+        * First foreign key found with us as the reference should throw an
+        * error.
         */
        while (HeapTupleIsValid(tuple = systable_getnext(fkeyScan)))
        {
@@ -554,7 +552,8 @@ MergeAttributes(List *schema, List *supers, bool istemp,
                /*
                 * newattno[] will contain the child-table attribute numbers for
                 * the attributes of this parent table.  (They are not the same
-                * for parents after the first one, nor if we have dropped columns.)
+                * for parents after the first one, nor if we have dropped
+                * columns.)
                 */
                newattno = (AttrNumber *) palloc(tupleDesc->natts * sizeof(AttrNumber));
 
@@ -572,9 +571,10 @@ MergeAttributes(List *schema, List *supers, bool istemp,
                         */
                        if (attribute->attisdropped)
                        {
-                               /* 
-                                * change_varattnos_of_a_node asserts that this is greater than
-                                * zero, so if anything tries to use it, we should find out.
+                               /*
+                                * change_varattnos_of_a_node asserts that this is greater
+                                * than zero, so if anything tries to use it, we should
+                                * find out.
                                 */
                                newattno[parent_attno - 1] = 0;
                                continue;
@@ -684,6 +684,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
                                Node       *expr;
 
                                cdef->contype = CONSTR_CHECK;
+
                                /*
                                 * Do not inherit generated constraint names, since they
                                 * might conflict across multiple inheritance parents.
@@ -857,8 +858,8 @@ StoreCatalogInheritance(Oid relationId, List *supers)
                return;
 
        /*
-        * Store INHERITS information in pg_inherits using direct ancestors only.
-        * Also enter dependencies on the direct ancestors.
+        * Store INHERITS information in pg_inherits using direct ancestors
+        * only. Also enter dependencies on the direct ancestors.
         */
        relation = heap_openr(InheritsRelationName, RowExclusiveLock);
        desc = RelationGetDescr(relation);
@@ -1076,7 +1077,7 @@ renameatt(Oid myrelid,
         *
         * normally, only the owner of a class can change its schema.
         */
-       if (!allowSystemTableMods 
+       if (!allowSystemTableMods
                && IsSystemRelation(targetrelation))
                elog(ERROR, "renameatt: class \"%s\" is a system catalog",
                         RelationGetRelationName(targetrelation));
@@ -1141,8 +1142,8 @@ renameatt(Oid myrelid,
                         oldattname);
 
        /*
-        * if the attribute is inherited, forbid the renaming, unless we
-        * are already inside a recursive rename.
+        * if the attribute is inherited, forbid the renaming, unless we are
+        * already inside a recursive rename.
         */
        if (attform->attisinherited && !recursing)
                elog(ERROR, "renameatt: inherited attribute \"%s\" may not be renamed",
@@ -1233,7 +1234,8 @@ renameatt(Oid myrelid,
                                                           true, false);
        }
 
-       relation_close(targetrelation, NoLock); /* close rel but keep lock! */
+       relation_close(targetrelation, NoLock);         /* close rel but keep
+                                                                                                * lock! */
 }
 
 /*
@@ -1382,7 +1384,7 @@ update_ri_trigger_args(Oid relid,
 {
        Relation        tgrel;
        ScanKeyData skey[1];
-       SysScanDesc     trigscan;
+       SysScanDesc trigscan;
        HeapTuple       tuple;
        Datum           values[Natts_pg_trigger];
        char            nulls[Natts_pg_trigger];
@@ -1577,8 +1579,8 @@ AlterTableAddColumn(Oid myrelid,
        HeapTuple       typeTuple;
        Form_pg_type tform;
        int                     attndims;
-       ObjectAddress   myself,
-                                       referenced;
+       ObjectAddress myself,
+                               referenced;
 
        /*
         * Grab an exclusive lock on the target table, which we will NOT
@@ -1666,7 +1668,7 @@ AlterTableAddColumn(Oid myrelid,
 
        if (colDef->is_not_null)
                elog(ERROR, "Adding NOT NULL columns is not implemented."
-                        "\n\tAdd the column, then use ALTER TABLE ... SET NOT NULL.");
+                  "\n\tAdd the column, then use ALTER TABLE ... SET NOT NULL.");
 
        pgclass = heap_openr(RelationRelationName, RowExclusiveLock);
 
@@ -1678,8 +1680,9 @@ AlterTableAddColumn(Oid myrelid,
                         RelationGetRelationName(rel));
 
        /*
-        * this test is deliberately not attisdropped-aware, since if one tries
-        * to add a column matching a dropped column name, it's gonna fail anyway.
+        * this test is deliberately not attisdropped-aware, since if one
+        * tries to add a column matching a dropped column name, it's gonna
+        * fail anyway.
         */
        if (SearchSysCacheExists(ATTNAME,
                                                         ObjectIdGetDatum(myrelid),
@@ -1706,7 +1709,7 @@ AlterTableAddColumn(Oid myrelid,
        tform = (Form_pg_type) GETSTRUCT(typeTuple);
 
        attributeTuple = heap_addheader(Natts_pg_attribute,
-                                       false,
+                                                                       false,
                                                                        ATTRIBUTE_TUPLE_SIZE,
                                                                        (void *) &attributeD);
 
@@ -1806,8 +1809,8 @@ AlterTableAlterColumnDropNotNull(Oid myrelid, bool recurse,
        HeapTuple       tuple;
        AttrNumber      attnum;
        Relation        attr_rel;
-       List            *indexoidlist;
-       List            *indexoidscan;
+       List       *indexoidlist;
+       List       *indexoidscan;
 
        rel = heap_open(myrelid, AccessExclusiveLock);
 
@@ -1874,10 +1877,10 @@ AlterTableAlterColumnDropNotNull(Oid myrelid, bool recurse,
 
        foreach(indexoidscan, indexoidlist)
        {
-               Oid             indexoid = lfirsti(indexoidscan);
+               Oid                     indexoid = lfirsti(indexoidscan);
                HeapTuple       indexTuple;
-               Form_pg_index   indexStruct;
-               int             i;
+               Form_pg_index indexStruct;
+               int                     i;
 
                indexTuple = SearchSysCache(INDEXRELID,
                                                                        ObjectIdGetDatum(indexoid),
@@ -1891,11 +1894,11 @@ AlterTableAlterColumnDropNotNull(Oid myrelid, bool recurse,
                if (indexStruct->indisprimary)
                {
                        /*
-                        * Loop over each attribute in the primary key and
-                        * see if it matches the to-be-altered attribute
+                        * Loop over each attribute in the primary key and see if it
+                        * matches the to-be-altered attribute
                         */
                        for (i = 0; i < INDEX_MAX_KEYS &&
-                                        indexStruct->indkey[i] != InvalidAttrNumber; i++)
+                                indexStruct->indkey[i] != InvalidAttrNumber; i++)
                        {
                                if (indexStruct->indkey[i] == attnum)
                                        elog(ERROR, "ALTER TABLE: Attribute \"%s\" is in a primary key", colName);
@@ -1913,7 +1916,7 @@ AlterTableAlterColumnDropNotNull(Oid myrelid, bool recurse,
        attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock);
 
        tuple = SearchSysCacheCopyAttName(myrelid, colName);
-       if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
+       if (!HeapTupleIsValid(tuple))           /* shouldn't happen */
                elog(ERROR, "ALTER TABLE: relation \"%s\" has no column \"%s\"",
                         RelationGetRelationName(rel), colName);
 
@@ -1940,7 +1943,7 @@ AlterTableAlterColumnSetNotNull(Oid myrelid, bool recurse,
        HeapTuple       tuple;
        AttrNumber      attnum;
        Relation        attr_rel;
-       HeapScanDesc    scan;
+       HeapScanDesc scan;
        TupleDesc       tupdesc;
 
        rel = heap_open(myrelid, AccessExclusiveLock);
@@ -2000,8 +2003,8 @@ AlterTableAlterColumnSetNotNull(Oid myrelid, bool recurse,
                         colName);
 
        /*
-        * Perform a scan to ensure that there are no NULL
-        * values already in the relation
+        * Perform a scan to ensure that there are no NULL values already in
+        * the relation
         */
        tupdesc = RelationGetDescr(rel);
 
@@ -2009,7 +2012,7 @@ AlterTableAlterColumnSetNotNull(Oid myrelid, bool recurse,
 
        while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
        {
-               Datum           d;
+               Datum           d;
                bool            isnull;
 
                d = heap_getattr(tuple, attnum, tupdesc, &isnull);
@@ -2027,7 +2030,7 @@ AlterTableAlterColumnSetNotNull(Oid myrelid, bool recurse,
        attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock);
 
        tuple = SearchSysCacheCopyAttName(myrelid, colName);
-       if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
+       if (!HeapTupleIsValid(tuple))           /* shouldn't happen */
                elog(ERROR, "ALTER TABLE: relation \"%s\" has no column \"%s\"",
                         RelationGetRelationName(rel), colName);
 
@@ -2153,7 +2156,7 @@ AlterTableAlterColumnFlags(Oid myrelid, bool recurse,
 {
        Relation        rel;
        int                     newtarget = 1;
-       char        newstorage = 'p';
+       char            newstorage = 'p';
        Relation        attrelation;
        HeapTuple       tuple;
        Form_pg_attribute attrtuple;
@@ -2200,7 +2203,7 @@ AlterTableAlterColumnFlags(Oid myrelid, bool recurse,
        else if (*flagType == 'M')
        {
                /* STORAGE */
-               char        *storagemode;
+               char       *storagemode;
 
                Assert(IsA(flagValue, String));
                storagemode = strVal(flagValue);
@@ -2246,7 +2249,7 @@ AlterTableAlterColumnFlags(Oid myrelid, bool recurse,
                        if (childrelid == myrelid)
                                continue;
                        AlterTableAlterColumnFlags(childrelid,
-                                                                          false, colName, flagValue, flagType);
+                                                                       false, colName, flagValue, flagType);
                }
        }
 
@@ -2263,6 +2266,7 @@ AlterTableAlterColumnFlags(Oid myrelid, bool recurse,
        if (attrtuple->attnum < 0)
                elog(ERROR, "ALTER TABLE: cannot change system attribute \"%s\"",
                         colName);
+
        /*
         * Now change the appropriate field
         */
@@ -2306,7 +2310,7 @@ AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
        AttrNumber      n;
        TupleDesc       tupleDesc;
        bool            success;
-       ObjectAddress   object;
+       ObjectAddress object;
 
        rel = heap_open(myrelid, AccessExclusiveLock);
 
@@ -2336,8 +2340,9 @@ AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
                         colName);
 
        /*
-        * Make sure there will be at least one user column left in the relation
-        * after we drop this one.  Zero-length tuples tend to confuse us.
+        * Make sure there will be at least one user column left in the
+        * relation after we drop this one.  Zero-length tuples tend to
+        * confuse us.
         */
        tupleDesc = RelationGetDescr(rel);
 
@@ -2355,7 +2360,7 @@ AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
 
        if (!success)
                elog(ERROR, "ALTER TABLE: Cannot drop last column from table \"%s\"",
-                       RelationGetRelationName(rel));
+                        RelationGetRelationName(rel));
 
        /* Don't drop inherited columns */
        if (tupleDesc->attrs[attnum - 1]->attisinherited && !recursing)
@@ -2363,8 +2368,8 @@ AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
                         colName);
 
        /*
-        * If we are asked to drop ONLY in this table (no recursion),
-        * we need to mark the inheritors' attribute as non-inherited.
+        * If we are asked to drop ONLY in this table (no recursion), we need
+        * to mark the inheritors' attribute as non-inherited.
         */
        if (!recurse && !recursing)
        {
@@ -2378,14 +2383,14 @@ AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
                attr_rel = heap_openr(AttributeRelationName, RowExclusiveLock);
                foreach(child, children)
                {
-                       Oid             childrelid = lfirsti(child);
-                       Relation childrel;
+                       Oid                     childrelid = lfirsti(child);
+                       Relation        childrel;
                        HeapTuple       tuple;
 
                        childrel = heap_open(childrelid, AccessExclusiveLock);
 
                        tuple = SearchSysCacheCopyAttName(childrelid, colName);
-                       if (!HeapTupleIsValid(tuple)) /* shouldn't happen */
+                       if (!HeapTupleIsValid(tuple))           /* shouldn't happen */
                                elog(ERROR, "ALTER TABLE: relation %u has no column \"%s\"",
                                         childrelid, colName);
 
@@ -2407,7 +2412,7 @@ AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
        if (recurse)
        {
                List       *child,
-                          *children;
+                                  *children;
 
                /* this routine is actually in the planner */
                children = find_all_inheritors(myrelid);
@@ -2495,8 +2500,8 @@ AlterTableAddConstraint(Oid myrelid, bool recurse,
        foreach(listptr, newConstraints)
        {
                /*
-                * copy is because we may destructively alter the node below
-                * by inserting a generated name; this name is not necessarily
+                * copy is because we may destructively alter the node below by
+                * inserting a generated name; this name is not necessarily
                 * correct for children or parents.
                 */
                Node       *newConstraint = copyObject(lfirst(listptr));
@@ -2533,16 +2538,16 @@ AlterTableAddConstraint(Oid myrelid, bool recurse,
                                                                if (constr->name)
                                                                {
                                                                        if (ConstraintNameIsUsed(RelationGetRelid(rel),
-                                                                                                                        RelationGetNamespace(rel),
-                                                                                                                        constr->name))
+                                                                                          RelationGetNamespace(rel),
+                                                                                                                  constr->name))
                                                                                elog(ERROR, "constraint \"%s\" already exists for relation \"%s\"",
                                                                                         constr->name,
-                                                                                        RelationGetRelationName(rel));
+                                                                                  RelationGetRelationName(rel));
                                                                }
                                                                else
                                                                        constr->name = GenerateConstraintName(RelationGetRelid(rel),
-                                                                                                                                                 RelationGetNamespace(rel),
-                                                                                                                                                 &counter);
+                                                                                          RelationGetNamespace(rel),
+                                                                                                                          &counter);
 
                                                                /*
                                                                 * We need to make a parse state and range
@@ -2552,8 +2557,8 @@ AlterTableAddConstraint(Oid myrelid, bool recurse,
                                                                 */
                                                                pstate = make_parsestate(NULL);
                                                                rte = addRangeTableEntryForRelation(pstate,
-                                                                                                                                       myrelid,
-                                                                                       makeAlias(RelationGetRelationName(rel), NIL),
+                                                                                                                                myrelid,
+                                                                                                                                       makeAlias(RelationGetRelationName(rel), NIL),
                                                                                                                                        false,
                                                                                                                                        true);
                                                                addRTEtoQuery(pstate, rte, true, true);
@@ -2657,23 +2662,23 @@ AlterTableAddConstraint(Oid myrelid, bool recurse,
                                        if (fkconstraint->constr_name)
                                        {
                                                if (ConstraintNameIsUsed(RelationGetRelid(rel),
-                                                                                                RelationGetNamespace(rel),
-                                                                                                fkconstraint->constr_name))
+                                                                                          RelationGetNamespace(rel),
+                                                                                         fkconstraint->constr_name))
                                                        elog(ERROR, "constraint \"%s\" already exists for relation \"%s\"",
                                                                 fkconstraint->constr_name,
                                                                 RelationGetRelationName(rel));
                                        }
                                        else
                                                fkconstraint->constr_name = GenerateConstraintName(RelationGetRelid(rel),
-                                                                                                                                                  RelationGetNamespace(rel),
-                                                                                                                                                  &counter);
+                                                                                          RelationGetNamespace(rel),
+                                                                                                                          &counter);
 
                                        /*
                                         * Grab an exclusive lock on the pk table, so that
                                         * someone doesn't delete rows out from under us.
                                         * (Although a lesser lock would do for that purpose,
-                                        * we'll need exclusive lock anyway to add triggers
-                                        * to the pk table; trying to start with a lesser lock
+                                        * we'll need exclusive lock anyway to add triggers to
+                                        * the pk table; trying to start with a lesser lock
                                         * will just create a risk of deadlock.)
                                         */
                                        pkrel = heap_openrv(fkconstraint->pktable,
@@ -2716,12 +2721,14 @@ AlterTableAddConstraint(Oid myrelid, bool recurse,
                                                                                                                   fkconstraint);
 
                                        /*
-                                        * Create the triggers that will enforce the constraint.
+                                        * Create the triggers that will enforce the
+                                        * constraint.
                                         */
                                        createForeignKeyTriggers(rel, fkconstraint, constrOid);
 
                                        /*
-                                        * Close pk table, but keep lock until we've committed.
+                                        * Close pk table, but keep lock until we've
+                                        * committed.
                                         */
                                        heap_close(pkrel, NoLock);
 
@@ -2754,10 +2761,9 @@ validateForeignKeyConstraint(FkConstraint *fkconstraint,
        int                     count;
 
        /*
-        * Scan through each tuple, calling RI_FKey_check_ins
-        * (insert trigger) as if that tuple had just been
-        * inserted.  If any of those fail, it should
-        * elog(ERROR) and that's that.
+        * Scan through each tuple, calling RI_FKey_check_ins (insert trigger)
+        * as if that tuple had just been inserted.  If any of those fail, it
+        * should elog(ERROR) and that's that.
         */
        MemSet(&trig, 0, sizeof(trig));
        trig.tgoid = InvalidOid;
@@ -2848,7 +2854,7 @@ createForeignKeyConstraint(Relation rel, Relation pkrel,
        i = 0;
        foreach(l, fkconstraint->fk_attrs)
        {
-               char *id = strVal(lfirst(l));
+               char       *id = strVal(lfirst(l));
                AttrNumber      attno;
 
                attno = get_attnum(RelationGetRelid(rel), id);
@@ -2864,7 +2870,7 @@ createForeignKeyConstraint(Relation rel, Relation pkrel,
        i = 0;
        foreach(l, fkconstraint->pk_attrs)
        {
-               char *id = strVal(lfirst(l));
+               char       *id = strVal(lfirst(l));
                AttrNumber      attno;
 
                attno = get_attnum(RelationGetRelid(pkrel), id);
@@ -2883,14 +2889,14 @@ createForeignKeyConstraint(Relation rel, Relation pkrel,
                                                                 RelationGetRelid(rel),
                                                                 fkattr,
                                                                 fkcount,
-                                                                InvalidOid, /* not a domain constraint */
+                                                                InvalidOid,    /* not a domain constraint */
                                                                 RelationGetRelid(pkrel),
                                                                 pkattr,
                                                                 pkcount,
                                                                 fkconstraint->fk_upd_action,
                                                                 fkconstraint->fk_del_action,
                                                                 fkconstraint->fk_matchtype,
-                                                                NULL, /* no check constraint */
+                                                                NULL,  /* no check constraint */
                                                                 NULL,
                                                                 NULL);
 }
@@ -2910,7 +2916,8 @@ createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint,
                                constrobj;
 
        /*
-        * Reconstruct a RangeVar for my relation (not passed in, unfortunately).
+        * Reconstruct a RangeVar for my relation (not passed in,
+        * unfortunately).
         */
        myRel = makeRangeVar(get_namespace_name(RelationGetNamespace(rel)),
                                                 RelationGetRelationName(rel));
@@ -2956,9 +2963,9 @@ createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint,
        fk_trigger->args = lappend(fk_trigger->args,
                                                           makeString(myRel->relname));
        fk_trigger->args = lappend(fk_trigger->args,
-                                                          makeString(fkconstraint->pktable->relname));
+                                                        makeString(fkconstraint->pktable->relname));
        fk_trigger->args = lappend(fk_trigger->args,
-                                                          makeString(fkMatchTypeToString(fkconstraint->fk_matchtype)));
+                       makeString(fkMatchTypeToString(fkconstraint->fk_matchtype)));
        fk_attr = fkconstraint->fk_attrs;
        pk_attr = fkconstraint->pk_attrs;
        if (length(fk_attr) != length(pk_attr))
@@ -2983,8 +2990,8 @@ createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint,
        CommandCounterIncrement();
 
        /*
-        * Build and execute a CREATE CONSTRAINT TRIGGER statement for the
-        * ON DELETE action on the referenced table.
+        * Build and execute a CREATE CONSTRAINT TRIGGER statement for the ON
+        * DELETE action on the referenced table.
         */
        fk_trigger = makeNode(CreateTrigStmt);
        fk_trigger->trigname = fkconstraint->constr_name;
@@ -3032,9 +3039,9 @@ createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint,
        fk_trigger->args = lappend(fk_trigger->args,
                                                           makeString(myRel->relname));
        fk_trigger->args = lappend(fk_trigger->args,
-                                                          makeString(fkconstraint->pktable->relname));
+                                                        makeString(fkconstraint->pktable->relname));
        fk_trigger->args = lappend(fk_trigger->args,
-                                                          makeString(fkMatchTypeToString(fkconstraint->fk_matchtype)));
+                       makeString(fkMatchTypeToString(fkconstraint->fk_matchtype)));
        fk_attr = fkconstraint->fk_attrs;
        pk_attr = fkconstraint->pk_attrs;
        while (fk_attr != NIL)
@@ -3054,8 +3061,8 @@ createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint,
        CommandCounterIncrement();
 
        /*
-        * Build and execute a CREATE CONSTRAINT TRIGGER statement for the
-        * ON UPDATE action on the referenced table.
+        * Build and execute a CREATE CONSTRAINT TRIGGER statement for the ON
+        * UPDATE action on the referenced table.
         */
        fk_trigger = makeNode(CreateTrigStmt);
        fk_trigger->trigname = fkconstraint->constr_name;
@@ -3103,9 +3110,9 @@ createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint,
        fk_trigger->args = lappend(fk_trigger->args,
                                                           makeString(myRel->relname));
        fk_trigger->args = lappend(fk_trigger->args,
-                                                          makeString(fkconstraint->pktable->relname));
+                                                        makeString(fkconstraint->pktable->relname));
        fk_trigger->args = lappend(fk_trigger->args,
-                                                          makeString(fkMatchTypeToString(fkconstraint->fk_matchtype)));
+                       makeString(fkMatchTypeToString(fkconstraint->fk_matchtype)));
        fk_attr = fkconstraint->fk_attrs;
        pk_attr = fkconstraint->pk_attrs;
        while (fk_attr != NIL)
@@ -3129,7 +3136,7 @@ createForeignKeyTriggers(Relation rel, FkConstraint *fkconstraint,
 static char *
 fkMatchTypeToString(char match_type)
 {
-       switch (match_type) 
+       switch (match_type)
        {
                case FKCONSTR_MATCH_FULL:
                        return pstrdup("FULL");
@@ -3227,10 +3234,10 @@ AlterTableDropConstraint(Oid myrelid, bool recurse,
 void
 AlterTableOwner(Oid relationOid, int32 newOwnerSysId)
 {
-       Relation                target_rel;
-       Relation                class_rel;
-       HeapTuple               tuple;
-       Form_pg_class   tuple_class;
+       Relation        target_rel;
+       Relation        class_rel;
+       HeapTuple       tuple;
+       Form_pg_class tuple_class;
 
        /* Get exclusive lock till end of transaction on the target table */
        /* Use relation_open here so that we work on indexes... */
@@ -3250,8 +3257,8 @@ AlterTableOwner(Oid relationOid, int32 newOwnerSysId)
        CheckTupleType(tuple_class);
 
        /*
-        * Okay, this is a valid tuple: change its ownership and
-        * write to the heap.
+        * Okay, this is a valid tuple: change its ownership and write to the
+        * heap.
         */
        tuple_class->relowner = newOwnerSysId;
        simple_heap_update(class_rel, &tuple->t_self, tuple);
@@ -3267,16 +3274,15 @@ AlterTableOwner(Oid relationOid, int32 newOwnerSysId)
        if (tuple_class->relkind == RELKIND_RELATION ||
                tuple_class->relkind == RELKIND_TOASTVALUE)
        {
-               List *index_oid_list, *i;
+               List       *index_oid_list,
+                                  *i;
 
                /* Find all the indexes belonging to this relation */
                index_oid_list = RelationGetIndexList(target_rel);
 
                /* For each index, recursively change its ownership */
                foreach(i, index_oid_list)
-               {
                        AlterTableOwner(lfirsti(i), newOwnerSysId);
-               }
 
                freeList(index_oid_list);
        }
@@ -3285,9 +3291,7 @@ AlterTableOwner(Oid relationOid, int32 newOwnerSysId)
        {
                /* If it has a toast table, recurse to change its ownership */
                if (tuple_class->reltoastrelid != InvalidOid)
-               {
                        AlterTableOwner(tuple_class->reltoastrelid, newOwnerSysId);
-               }
        }
 
        heap_freetuple(tuple);
@@ -3355,7 +3359,7 @@ AlterTableCreateToastTable(Oid relOid, bool silent)
         * We cannot allow toasting a shared relation after initdb (because
         * there's no way to mark it toasted in other databases' pg_class).
         * Unfortunately we can't distinguish initdb from a manually started
-        * standalone backend.  However, we can at least prevent this mistake
+        * standalone backend.  However, we can at least prevent this mistake
         * under normal multi-user operation.
         */
        shared_relation = rel->rd_rel->relisshared;
@@ -3453,10 +3457,11 @@ AlterTableCreateToastTable(Oid relOid, bool silent)
        tupdesc->attrs[2]->attstorage = 'p';
 
        /*
-        * Note: the toast relation is placed in the regular pg_toast namespace
-        * even if its master relation is a temp table.  There cannot be any
-        * naming collision, and the toast rel will be destroyed when its master
-        * is, so there's no need to handle the toast rel as temp.
+        * Note: the toast relation is placed in the regular pg_toast
+        * namespace even if its master relation is a temp table.  There
+        * cannot be any naming collision, and the toast rel will be destroyed
+        * when its master is, so there's no need to handle the toast rel as
+        * temp.
         */
        toast_relid = heap_create_with_catalog(toast_relname,
                                                                                   PG_TOAST_NAMESPACE,
@@ -3471,12 +3476,12 @@ AlterTableCreateToastTable(Oid relOid, bool silent)
        /*
         * Create unique index on chunk_id, chunk_seq.
         *
-        * NOTE: the normal TOAST access routines could actually function with 
-        * single-column index on chunk_id only. However, the slice access
+        * NOTE: the normal TOAST access routines could actually function with a
+        * single-column index on chunk_id only. However, the slice access
         * routines use both columns for faster access to an individual chunk.
-        * In addition, we want it to be unique as a check against the 
+        * In addition, we want it to be unique as a check against the
         * possibility of duplicate TOAST chunk OIDs. The index might also be
-        * a little more efficient this way, since btree isn't all that happy 
+        * a little more efficient this way, since btree isn't all that happy
         * with large numbers of equal keys.
         */
 
@@ -3516,8 +3521,8 @@ AlterTableCreateToastTable(Oid relOid, bool silent)
        heap_freetuple(reltup);
 
        /*
-        * Register dependency from the toast table to the master, so that
-        * the toast table will be deleted if the master is.
+        * Register dependency from the toast table to the master, so that the
+        * toast table will be deleted if the master is.
         */
        baseobject.classId = RelOid_pg_class;
        baseobject.objectId = relOid;
index 4b76510..1d0e969 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.130 2002/09/02 01:05:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.131 2002/09/04 20:31:15 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,7 +55,7 @@ static void DeferredTriggerExecute(DeferredTriggerEvent event, int itemno,
  * Create a trigger.  Returns the OID of the created trigger.
  *
  * forConstraint, if true, says that this trigger is being created to
- * implement a constraint.  The caller will then be expected to make
+ * implement a constraint.     The caller will then be expected to make
  * a pg_depend entry linking the trigger to that constraint (and thereby
  * to the owning relation(s)).
  */
@@ -69,7 +69,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
        Relation        rel;
        AclResult       aclresult;
        Relation        tgrel;
-       SysScanDesc     tgscan;
+       SysScanDesc tgscan;
        ScanKeyData key;
        Relation        pgrel;
        HeapTuple       tuple;
@@ -82,8 +82,8 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
        char       *trigname;
        char       *constrname;
        Oid                     constrrelid;
-       ObjectAddress   myself,
-                                       referenced;
+       ObjectAddress myself,
+                               referenced;
 
        rel = heap_openrv(stmt->relation, AccessExclusiveLock);
 
@@ -98,7 +98,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
 
        if (!allowSystemTableMods && IsSystemRelation(rel))
                elog(ERROR, "CreateTrigger: can't create trigger for system relation %s",
-                       stmt->relation->relname);
+                        stmt->relation->relname);
 
        /* permission checks */
 
@@ -132,9 +132,9 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
 
        /*
         * If trigger is an RI constraint, use specified trigger name as
-        * constraint name and build a unique trigger name instead.
-        * This is mainly for backwards compatibility with CREATE CONSTRAINT
-        * TRIGGER commands.
+        * constraint name and build a unique trigger name instead. This is
+        * mainly for backwards compatibility with CREATE CONSTRAINT TRIGGER
+        * commands.
         */
        if (stmt->isconstraint)
        {
@@ -183,10 +183,10 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
        }
 
        /*
-        * Scan pg_trigger for existing triggers on relation.  We do this mainly
-        * because we must count them; a secondary benefit is to give a nice
-        * error message if there's already a trigger of the same name.  (The
-        * unique index on tgrelid/tgname would complain anyway.)
+        * Scan pg_trigger for existing triggers on relation.  We do this
+        * mainly because we must count them; a secondary benefit is to give a
+        * nice error message if there's already a trigger of the same name.
+        * (The unique index on tgrelid/tgname would complain anyway.)
         *
         * NOTE that this is cool only because we have AccessExclusiveLock on the
         * relation, so the trigger set won't be changing underneath us.
@@ -241,13 +241,13 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
 
        values[Anum_pg_trigger_tgrelid - 1] = ObjectIdGetDatum(RelationGetRelid(rel));
        values[Anum_pg_trigger_tgname - 1] = DirectFunctionCall1(namein,
-                                                                               CStringGetDatum(trigname));
+                                                                                         CStringGetDatum(trigname));
        values[Anum_pg_trigger_tgfoid - 1] = ObjectIdGetDatum(funcoid);
        values[Anum_pg_trigger_tgtype - 1] = Int16GetDatum(tgtype);
        values[Anum_pg_trigger_tgenabled - 1] = BoolGetDatum(true);
        values[Anum_pg_trigger_tgisconstraint - 1] = BoolGetDatum(stmt->isconstraint);
        values[Anum_pg_trigger_tgconstrname - 1] = DirectFunctionCall1(namein,
-                                                                                                                                  CStringGetDatum(constrname));
+                                                                                       CStringGetDatum(constrname));
        values[Anum_pg_trigger_tgconstrrelid - 1] = ObjectIdGetDatum(constrrelid);
        values[Anum_pg_trigger_tgdeferrable - 1] = BoolGetDatum(stmt->deferrable);
        values[Anum_pg_trigger_tginitdeferred - 1] = BoolGetDatum(stmt->initdeferred);
@@ -354,8 +354,9 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
         * CREATE TRIGGER command, also make trigger be auto-dropped if its
         * relation is dropped or if the FK relation is dropped.  (Auto drop
         * is compatible with our pre-7.3 behavior.)  If the trigger is being
-        * made for a constraint, we can skip the relation links; the dependency
-        * on the constraint will indirectly depend on the relations.
+        * made for a constraint, we can skip the relation links; the
+        * dependency on the constraint will indirectly depend on the
+        * relations.
         */
        referenced.classId = RelOid_pg_proc;
        referenced.objectId = funcoid;
@@ -389,10 +390,10 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
 void
 DropTrigger(Oid relid, const char *trigname, DropBehavior behavior)
 {
-       Relation                tgrel;
-       ScanKeyData             skey[2];
-       SysScanDesc             tgscan;
-       HeapTuple               tup;
+       Relation        tgrel;
+       ScanKeyData skey[2];
+       SysScanDesc tgscan;
+       HeapTuple       tup;
        ObjectAddress object;
 
        /*
@@ -440,14 +441,14 @@ void
 RemoveTriggerById(Oid trigOid)
 {
        Relation        tgrel;
-       SysScanDesc     tgscan;
-       ScanKeyData     skey[1];
+       SysScanDesc tgscan;
+       ScanKeyData skey[1];
        HeapTuple       tup;
        Oid                     relid;
        Relation        rel;
        Relation        pgrel;
        HeapTuple       tuple;
-       Form_pg_class   classForm;
+       Form_pg_class classForm;
 
        tgrel = heap_openr(TriggerRelationName, RowExclusiveLock);
 
@@ -495,8 +496,8 @@ RemoveTriggerById(Oid trigOid)
         * rebuild relcache entries.
         *
         * Note this is OK only because we have AccessExclusiveLock on the rel,
-        * so no one else is creating/deleting triggers on this rel at the same
-        * time.
+        * so no one else is creating/deleting triggers on this rel at the
+        * same time.
         */
        pgrel = heap_openr(RelationRelationName, RowExclusiveLock);
        tuple = SearchSysCacheCopy(RELOID,
@@ -545,7 +546,7 @@ renametrig(Oid relid,
        Relation        targetrel;
        Relation        tgrel;
        HeapTuple       tuple;
-       SysScanDesc     tgscan;
+       SysScanDesc tgscan;
        ScanKeyData key[2];
 
        /*
@@ -555,10 +556,10 @@ renametrig(Oid relid,
        targetrel = heap_open(relid, AccessExclusiveLock);
 
        /*
-        * Scan pg_trigger twice for existing triggers on relation.  We do this in
-        * order to ensure a trigger does not exist with newname (The unique index
-        * on tgrelid/tgname would complain anyway) and to ensure a trigger does
-        * exist with oldname.
+        * Scan pg_trigger twice for existing triggers on relation.  We do
+        * this in order to ensure a trigger does not exist with newname (The
+        * unique index on tgrelid/tgname would complain anyway) and to ensure
+        * a trigger does exist with oldname.
         *
         * NOTE that this is cool only because we have AccessExclusiveLock on the
         * relation, so the trigger set won't be changing underneath us.
@@ -601,7 +602,7 @@ renametrig(Oid relid,
                /*
                 * Update pg_trigger tuple with new tgname.
                 */
-               tuple = heap_copytuple(tuple); /* need a modifiable copy */
+               tuple = heap_copytuple(tuple);  /* need a modifiable copy */
 
                namestrcpy(&((Form_pg_trigger) GETSTRUCT(tuple))->tgname, newname);
 
@@ -611,9 +612,10 @@ renametrig(Oid relid,
                CatalogUpdateIndexes(tgrel, tuple);
 
                /*
-                * Invalidate relation's relcache entry so that other backends (and
-                * this one too!) are sent SI message to make them rebuild relcache
-                * entries.  (Ideally this should happen automatically...)
+                * Invalidate relation's relcache entry so that other backends
+                * (and this one too!) are sent SI message to make them rebuild
+                * relcache entries.  (Ideally this should happen
+                * automatically...)
                 */
                CacheInvalidateRelcache(relid);
        }
@@ -649,17 +651,17 @@ RelationBuildTriggers(Relation relation)
        int                     found = 0;
        Relation        tgrel;
        ScanKeyData skey;
-       SysScanDesc     tgscan;
+       SysScanDesc tgscan;
        HeapTuple       htup;
 
        triggers = (Trigger *) MemoryContextAlloc(CacheMemoryContext,
                                                                                          ntrigs * sizeof(Trigger));
 
        /*
-        * Note: since we scan the triggers using TriggerRelidNameIndex,
-        * we will be reading the triggers in name order, except possibly
-        * during emergency-recovery operations (ie, IsIgnoringSystemIndexes).
-        * This in turn ensures that triggers will be fired in name order.
+        * Note: since we scan the triggers using TriggerRelidNameIndex, we
+        * will be reading the triggers in name order, except possibly during
+        * emergency-recovery operations (ie, IsIgnoringSystemIndexes). This
+        * in turn ensures that triggers will be fired in name order.
         */
        ScanKeyEntryInitialize(&skey,
                                                   (bits16) 0x0,
@@ -1528,17 +1530,17 @@ deferredTriggerInvokeEvents(bool immediate_only)
 
        /*
         * If immediate_only is true, we remove fully-processed events from
-        * the event queue to recycle space.  If immediate_only is false,
-        * we are going to discard the whole event queue on return anyway,
-        * so no need to bother with "retail" pfree's.
+        * the event queue to recycle space.  If immediate_only is false, we
+        * are going to discard the whole event queue on return anyway, so no
+        * need to bother with "retail" pfree's.
         *
         * In a scenario with many commands in a transaction and many
-        * deferred-to-end-of-transaction triggers, it could get annoying
-        * to rescan all the deferred triggers at each command end.
-        * To speed this up, we could remember the actual end of the queue at
-        * EndQuery and examine only events that are newer. On state changes
-        * we simply reset the saved position to the beginning of the queue
-        * and process all events once with the new states.
+        * deferred-to-end-of-transaction triggers, it could get annoying to
+        * rescan all the deferred triggers at each command end. To speed this
+        * up, we could remember the actual end of the queue at EndQuery and
+        * examine only events that are newer. On state changes we simply
+        * reset the saved position to the beginning of the queue and process
+        * all events once with the new states.
         */
 
        /* Make a per-tuple memory context for trigger function calls */
@@ -1559,8 +1561,8 @@ deferredTriggerInvokeEvents(bool immediate_only)
                /*
                 * Check if event is already completely done.
                 */
-               if (! (event->dte_event & (TRIGGER_DEFERRED_DONE |
-                                                                  TRIGGER_DEFERRED_CANCELED)))
+               if (!(event->dte_event & (TRIGGER_DEFERRED_DONE |
+                                                                 TRIGGER_DEFERRED_CANCELED)))
                {
                        MemoryContextReset(per_tuple_context);
 
@@ -1577,16 +1579,16 @@ deferredTriggerInvokeEvents(bool immediate_only)
                                 * should call it now.
                                 */
                                if (immediate_only &&
-                                       deferredTriggerCheckState(event->dte_item[i].dti_tgoid,
-                                                                                         event->dte_item[i].dti_state))
+                                 deferredTriggerCheckState(event->dte_item[i].dti_tgoid,
+                                                                                       event->dte_item[i].dti_state))
                                {
                                        still_deferred_ones = true;
                                        continue;
                                }
 
                                /*
-                                * So let's fire it... but first, open the correct relation
-                                * if this is not the same relation as before.
+                                * So let's fire it... but first, open the correct
+                                * relation if this is not the same relation as before.
                                 */
                                if (rel == NULL || rel->rd_id != event->dte_relid)
                                {
@@ -1596,14 +1598,14 @@ deferredTriggerInvokeEvents(bool immediate_only)
                                                pfree(finfo);
 
                                        /*
-                                        * We assume that an appropriate lock is still held by the
-                                        * executor, so grab no new lock here.
+                                        * We assume that an appropriate lock is still held by
+                                        * the executor, so grab no new lock here.
                                         */
                                        rel = heap_open(event->dte_relid, NoLock);
 
                                        /*
-                                        * Allocate space to cache fmgr lookup info for triggers
-                                        * of this relation.
+                                        * Allocate space to cache fmgr lookup info for
+                                        * triggers of this relation.
                                         */
                                        finfo = (FmgrInfo *)
                                                palloc(rel->trigdesc->numtriggers * sizeof(FmgrInfo));
@@ -1615,15 +1617,15 @@ deferredTriggerInvokeEvents(bool immediate_only)
                                                                           per_tuple_context);
 
                                event->dte_item[i].dti_state |= TRIGGER_DEFERRED_DONE;
-                       } /* end loop over items within event */
+                       }                                       /* end loop over items within event */
                }
 
                /*
                 * If it's now completely done, throw it away.
                 *
                 * NB: it's possible the trigger calls above added more events to the
-                * queue, or that calls we will do later will want to add more,
-                * so we have to be careful about maintaining list validity here.
+                * queue, or that calls we will do later will want to add more, so
+                * we have to be careful about maintaining list validity here.
                 */
                next_event = event->dte_next;
 
@@ -1724,6 +1726,7 @@ DeferredTriggerBeginXact(void)
        oldcxt = MemoryContextSwitchTo(deftrig_cxt);
 
        deftrig_all_isset = false;
+
        /*
         * If unspecified, constraints default to IMMEDIATE, per SQL
         */
@@ -1827,8 +1830,8 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
 
        /*
         * If called outside a transaction block, we can safely return: this
-        * command cannot effect any subsequent transactions, and there
-        * are no "session-level" trigger settings.
+        * command cannot effect any subsequent transactions, and there are no
+        * "session-level" trigger settings.
         */
        if (!IsTransactionBlock())
                return;
@@ -1879,7 +1882,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
                {
                        char       *cname = strVal(lfirst(l));
                        ScanKeyData skey;
-                       SysScanDesc     tgscan;
+                       SysScanDesc tgscan;
                        HeapTuple       htup;
 
                        /*
@@ -1892,7 +1895,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
                         * Setup to scan pg_trigger by tgconstrname ...
                         */
                        ScanKeyEntryInitialize(&skey, (bits16) 0x0,
-                                                                  (AttrNumber) Anum_pg_trigger_tgconstrname,
+                                                          (AttrNumber) Anum_pg_trigger_tgconstrname,
                                                                   (RegProcedure) F_NAMEEQ,
                                                                   PointerGetDatum(cname));
 
@@ -1910,9 +1913,9 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
                                Oid                     constr_oid;
 
                                /*
-                                * If we found some, check that they fit the deferrability but
-                                * skip ON <event> RESTRICT ones, since they are silently
-                                * never deferrable.
+                                * If we found some, check that they fit the deferrability
+                                * but skip ON <event> RESTRICT ones, since they are
+                                * silently never deferrable.
                                 */
                                if (stmt->deferred && !pg_trigger->tgdeferrable &&
                                        pg_trigger->tgfoid != F_RI_FKEY_RESTRICT_UPD &&
@@ -1971,11 +1974,11 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt)
 
        /*
         * SQL99 requires that when a constraint is set to IMMEDIATE, any
-        * deferred checks against that constraint must be made when the
-        * SET CONSTRAINTS command is executed -- i.e. the effects of the
-        * SET CONSTRAINTS command applies retroactively. This happens "for
-        * free" since we have already made the necessary modifications to
-        * the constraints, and deferredTriggerEndQuery() is called by
+        * deferred checks against that constraint must be made when the SET
+        * CONSTRAINTS command is executed -- i.e. the effects of the SET
+        * CONSTRAINTS command applies retroactively. This happens "for free"
+        * since we have already made the necessary modifications to the
+        * constraints, and deferredTriggerEndQuery() is called by
         * finish_xact_command().
         */
 }
@@ -2062,6 +2065,7 @@ DeferredTriggerSaveEvent(ResultRelInfo *relinfo, int event,
                        break;
 
                case TRIGGER_EVENT_UPDATE:
+
                        /*
                         * Check if one of the referenced keys is changed.
                         */
index bb1250b..165a42b 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.12 2002/08/29 00:17:03 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.13 2002/09/04 20:31:16 momjian Exp $
  *
  * DESCRIPTION
  *       The "DefineFoo" routines take the parse tree and pick out the
@@ -49,7 +49,7 @@
 #include "utils/syscache.h"
 
 
-static Oid findTypeIOFunction(List *procname, Oid typeOid, bool isOutput);
+static Oid     findTypeIOFunction(List *procname, Oid typeOid, bool isOutput);
 
 /*
  * DefineType
@@ -101,15 +101,15 @@ DefineType(List *names, List *parameters)
                if (strcasecmp(defel->defname, "internallength") == 0)
                        internalLength = defGetTypeLength(defel);
                else if (strcasecmp(defel->defname, "externallength") == 0)
-                       ; /* ignored -- remove after 7.3 */
+                       ;                                       /* ignored -- remove after 7.3 */
                else if (strcasecmp(defel->defname, "input") == 0)
                        inputName = defGetQualifiedName(defel);
                else if (strcasecmp(defel->defname, "output") == 0)
                        outputName = defGetQualifiedName(defel);
                else if (strcasecmp(defel->defname, "send") == 0)
-                       ; /* ignored -- remove after 7.3 */
+                       ;                                       /* ignored -- remove after 7.3 */
                else if (strcasecmp(defel->defname, "receive") == 0)
-                       ; /* ignored -- remove after 7.3 */
+                       ;                                       /* ignored -- remove after 7.3 */
                else if (strcasecmp(defel->defname, "delimiter") == 0)
                {
                        char       *p = defGetString(defel);
@@ -203,8 +203,9 @@ DefineType(List *names, List *parameters)
        outputOid = findTypeIOFunction(outputName, typoid, true);
 
        /*
-        * Verify that I/O procs return the expected thing.  OPAQUE is an allowed,
-        * but deprecated, alternative to the fully type-safe choices.
+        * Verify that I/O procs return the expected thing.  OPAQUE is an
+        * allowed, but deprecated, alternative to the fully type-safe
+        * choices.
         */
        resulttype = get_func_rettype(inputOid);
        if (!(OidIsValid(typoid) && resulttype == typoid))
@@ -229,26 +230,26 @@ DefineType(List *names, List *parameters)
         * now have TypeCreate do all the real work.
         */
        typoid =
-               TypeCreate(typeName,            /* type name */
-                                  typeNamespace,       /* namespace */
-                                  InvalidOid,          /* preassigned type oid (not done here) */
-                                  InvalidOid,          /* relation oid (n/a here) */
-                                  0,                           /* relation kind (ditto) */
-                                  internalLength,      /* internal size */
-                                  'b',                         /* type-type (base type) */
-                                  delimiter,           /* array element delimiter */
-                                  inputOid,            /* input procedure */
-                                  outputOid,           /* output procedure */
-                                  elemType,            /* element type ID */
-                                  InvalidOid,          /* base type ID (only for domains) */
+               TypeCreate(typeName,    /* type name */
+                                  typeNamespace,               /* namespace */
+                                  InvalidOid,  /* preassigned type oid (not done here) */
+                                  InvalidOid,  /* relation oid (n/a here) */
+                                  0,                   /* relation kind (ditto) */
+                                  internalLength,              /* internal size */
+                                  'b',                 /* type-type (base type) */
+                                  delimiter,   /* array element delimiter */
+                                  inputOid,    /* input procedure */
+                                  outputOid,   /* output procedure */
+                                  elemType,    /* element type ID */
+                                  InvalidOid,  /* base type ID (only for domains) */
                                   defaultValue,        /* default type value */
-                                  NULL,                        /* no binary form available */
-                                  byValue,                     /* passed by value */
-                                  alignment,           /* required alignment */
-                                  storage,                     /* TOAST strategy */
-                                  -1,                          /* typMod (Domains only) */
-                                  0,                           /* Array Dimensions of typbasetype */
-                                  false);                      /* Type NOT NULL */
+                                  NULL,                /* no binary form available */
+                                  byValue,             /* passed by value */
+                                  alignment,   /* required alignment */
+                                  storage,             /* TOAST strategy */
+                                  -1,                  /* typMod (Domains only) */
+                                  0,                   /* Array Dimensions of typbasetype */
+                                  false);              /* Type NOT NULL */
 
        /*
         * When we create a base type (as opposed to a complex type) we need
@@ -392,7 +393,7 @@ DefineDomain(CreateDomainStmt *stmt)
        List       *listptr;
        Oid                     basetypeoid;
        Oid                     domainoid;
-       Form_pg_type    baseType;
+       Form_pg_type baseType;
 
        /* Convert list of names to a name and namespace */
        domainNamespace = QualifiedNameGetCreationNamespace(stmt->domainname,
@@ -406,7 +407,7 @@ DefineDomain(CreateDomainStmt *stmt)
 
        /*
         * Domainnames, unlike typenames don't need to account for the '_'
-        * prefix.  So they can be one character longer.
+        * prefix.      So they can be one character longer.
         */
        if (strlen(domainName) > (NAMEDATALEN - 1))
                elog(ERROR, "CREATE DOMAIN: domain names must be %d characters or less",
@@ -421,9 +422,10 @@ DefineDomain(CreateDomainStmt *stmt)
        basetypeoid = HeapTupleGetOid(typeTup);
 
        /*
-        * Base type must be a plain base type.  Domains over pseudo types would
-        * create a security hole.  Domains of domains might be made to work in
-        * the future, but not today.  Ditto for domains over complex types.
+        * Base type must be a plain base type.  Domains over pseudo types
+        * would create a security hole.  Domains of domains might be made to
+        * work in the future, but not today.  Ditto for domains over complex
+        * types.
         */
        typtype = baseType->typtype;
        if (typtype != 'b')
@@ -450,13 +452,13 @@ DefineDomain(CreateDomainStmt *stmt)
        outputProcedure = baseType->typoutput;
 
        /* Inherited default value */
-       datum = SysCacheGetAttr(TYPEOID, typeTup,
+       datum = SysCacheGetAttr(TYPEOID, typeTup,
                                                        Anum_pg_type_typdefault, &isnull);
        if (!isnull)
                defaultValue = DatumGetCString(DirectFunctionCall1(textout, datum));
 
        /* Inherited default binary value */
-       datum = SysCacheGetAttr(TYPEOID, typeTup,
+       datum = SysCacheGetAttr(TYPEOID, typeTup,
                                                        Anum_pg_type_typdefaultbin, &isnull);
        if (!isnull)
                defaultValueBin = DatumGetCString(DirectFunctionCall1(textout, datum));
@@ -469,11 +471,11 @@ DefineDomain(CreateDomainStmt *stmt)
        basetypelem = baseType->typelem;
 
        /*
-        * Run through constraints manually to avoid the additional
-        * processing conducted by DefineRelation() and friends.
+        * Run through constraints manually to avoid the additional processing
+        * conducted by DefineRelation() and friends.
         *
-        * Besides, we don't want any constraints to be cooked.  We'll
-        * do that when the table is created via MergeDomainAttributes().
+        * Besides, we don't want any constraints to be cooked.  We'll do that
+        * when the table is created via MergeDomainAttributes().
         */
        foreach(listptr, schema)
        {
@@ -482,77 +484,79 @@ DefineDomain(CreateDomainStmt *stmt)
 
                switch (colDef->contype)
                {
-                       /*
-                        * The inherited default value may be overridden by the user
-                        * with the DEFAULT <expr> statement.
-                        *
-                        * We have to search the entire constraint tree returned as we
-                        * don't want to cook or fiddle too much.
-                        */
+                               /*
+                                * The inherited default value may be overridden by the
+                                * user with the DEFAULT <expr> statement.
+                                *
+                                * We have to search the entire constraint tree returned as
+                                * we don't want to cook or fiddle too much.
+                                */
                        case CONSTR_DEFAULT:
                                if (defaultExpr)
                                        elog(ERROR, "CREATE DOMAIN has multiple DEFAULT expressions");
                                /* Create a dummy ParseState for transformExpr */
                                pstate = make_parsestate(NULL);
+
                                /*
-                                * Cook the colDef->raw_expr into an expression.
-                                * Note: Name is strictly for error message
+                                * Cook the colDef->raw_expr into an expression. Note:
+                                * Name is strictly for error message
                                 */
                                defaultExpr = cookDefault(pstate, colDef->raw_expr,
                                                                                  basetypeoid,
                                                                                  stmt->typename->typmod,
                                                                                  domainName);
+
                                /*
-                                * Expression must be stored as a nodeToString result,
-                                * but we also require a valid textual representation
-                                * (mainly to make life easier for pg_dump).
+                                * Expression must be stored as a nodeToString result, but
+                                * we also require a valid textual representation (mainly
+                                * to make life easier for pg_dump).
                                 */
                                defaultValue = deparse_expression(defaultExpr,
-                                                               deparse_context_for(domainName,
-                                                                                                       InvalidOid),
-                                                                                                  false);
+                                                                                 deparse_context_for(domainName,
+                                                                                                                         InvalidOid),
+                                                                                                 false);
                                defaultValueBin = nodeToString(defaultExpr);
                                break;
 
-                       /*
-                        * Find the NULL constraint.
-                        */
+                               /*
+                                * Find the NULL constraint.
+                                */
                        case CONSTR_NOTNULL:
                                if (nullDefined)
                                        elog(ERROR, "CREATE DOMAIN has conflicting NULL / NOT NULL constraint");
                                typNotNull = true;
                                nullDefined = true;
-                               break;
+                               break;
 
                        case CONSTR_NULL:
                                if (nullDefined)
                                        elog(ERROR, "CREATE DOMAIN has conflicting NULL / NOT NULL constraint");
                                typNotNull = false;
                                nullDefined = true;
-                               break;
+                               break;
 
-                       case CONSTR_UNIQUE:
-                               elog(ERROR, "CREATE DOMAIN / UNIQUE indexes not supported");
-                               break;
+                       case CONSTR_UNIQUE:
+                               elog(ERROR, "CREATE DOMAIN / UNIQUE indexes not supported");
+                               break;
 
-                       case CONSTR_PRIMARY:
-                               elog(ERROR, "CREATE DOMAIN / PRIMARY KEY indexes not supported");
-                               break;
+                       case CONSTR_PRIMARY:
+                               elog(ERROR, "CREATE DOMAIN / PRIMARY KEY indexes not supported");
+                               break;
 
-                       case CONSTR_CHECK:
-                               elog(ERROR, "DefineDomain: CHECK Constraints not supported");
-                               break;
+                       case CONSTR_CHECK:
+                               elog(ERROR, "DefineDomain: CHECK Constraints not supported");
+                               break;
 
-                       case CONSTR_ATTR_DEFERRABLE:
-                       case CONSTR_ATTR_NOT_DEFERRABLE:
-                       case CONSTR_ATTR_DEFERRED:
-                       case CONSTR_ATTR_IMMEDIATE:
-                               elog(ERROR, "DefineDomain: DEFERRABLE, NON DEFERRABLE, DEFERRED and IMMEDIATE not supported");
-                               break;
+                       case CONSTR_ATTR_DEFERRABLE:
+                       case CONSTR_ATTR_NOT_DEFERRABLE:
+                       case CONSTR_ATTR_DEFERRED:
+                       case CONSTR_ATTR_IMMEDIATE:
+                               elog(ERROR, "DefineDomain: DEFERRABLE, NON DEFERRABLE, DEFERRED and IMMEDIATE not supported");
+                               break;
 
                        default:
-                               elog(ERROR, "DefineDomain: unrecognized constraint node type");
-                               break;
+                               elog(ERROR, "DefineDomain: unrecognized constraint node type");
+                               break;
                }
        }
 
@@ -560,33 +564,33 @@ DefineDomain(CreateDomainStmt *stmt)
         * Have TypeCreate do all the real work.
         */
        domainoid =
-               TypeCreate(domainName,                  /* type name */
+               TypeCreate(domainName,  /* type name */
                                   domainNamespace,             /* namespace */
-                                  InvalidOid,                  /* preassigned type oid (none here) */
-                                  InvalidOid,                  /* relation oid (n/a here) */
-                                  0,                                   /* relation kind (ditto) */
+                                  InvalidOid,  /* preassigned type oid (none here) */
+                                  InvalidOid,  /* relation oid (n/a here) */
+                                  0,                   /* relation kind (ditto) */
                                   internalLength,              /* internal size */
-                                  'd',                                 /* type-type (domain type) */
-                                  delimiter,                   /* array element delimiter */
+                                  'd',                 /* type-type (domain type) */
+                                  delimiter,   /* array element delimiter */
                                   inputProcedure,              /* input procedure */
                                   outputProcedure,             /* output procedure */
-                                  basetypelem,                 /* element type ID */
-                                  basetypeoid,                 /* base type ID */
-                                  defaultValue,                /* default type value (text) */
+                                  basetypelem, /* element type ID */
+                                  basetypeoid, /* base type ID */
+                                  defaultValue,        /* default type value (text) */
                                   defaultValueBin,             /* default type value (binary) */
-                                  byValue,                             /* passed by value */
-                                  alignment,                   /* required alignment */
-                                  storage,                             /* TOAST strategy */
-                                  stmt->typename->typmod, /* typeMod value */
-                                  typNDims,                    /* Array dimensions for base type */
-                                  typNotNull);                 /* Type NOT NULL */
+                                  byValue,             /* passed by value */
+                                  alignment,   /* required alignment */
+                                  storage,             /* TOAST strategy */
+                                  stmt->typename->typmod,              /* typeMod value */
+                                  typNDims,    /* Array dimensions for base type */
+                                  typNotNull); /* Type NOT NULL */
 
        /*
         * Add any dependencies needed for the default expression.
         */
        if (defaultExpr)
        {
-               ObjectAddress   domobject;
+               ObjectAddress domobject;
 
                domobject.classId = RelOid_pg_type;
                domobject.objectId = domainoid;
@@ -678,10 +682,10 @@ findTypeIOFunction(List *procname, Oid typeOid, bool isOutput)
        if (isOutput)
        {
                /*
-                * Output functions can take a single argument of the type,
-                * or two arguments (data value, element OID).  The signature
-                * may use OPAQUE in place of the actual type name; this is the
-                * only possibility if the type doesn't yet exist as a shell.
+                * Output functions can take a single argument of the type, or two
+                * arguments (data value, element OID).  The signature may use
+                * OPAQUE in place of the actual type name; this is the only
+                * possibility if the type doesn't yet exist as a shell.
                 *
                 * Note: although we could throw a NOTICE in this routine if OPAQUE
                 * is used, we do not because of the probability that it'd be
@@ -728,8 +732,8 @@ findTypeIOFunction(List *procname, Oid typeOid, bool isOutput)
        else
        {
                /*
-                * Input functions can take a single argument of type CSTRING,
-                * or three arguments (string, element OID, typmod).  The signature
+                * Input functions can take a single argument of type CSTRING, or
+                * three arguments (string, element OID, typmod).  The signature
                 * may use OPAQUE in place of CSTRING.
                 */
                MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid));
@@ -793,7 +797,7 @@ DefineCompositeType(const RangeVar *typevar, List *coldeflist)
 
        if (coldeflist == NIL)
                elog(ERROR, "attempted to define composite type relation with"
-                                       " no attrs");
+                        " no attrs");
 
        /*
         * now create the parameters for keys/inheritance etc. All of them are
index 8a4b31f..620e1be 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.110 2002/09/02 02:47:01 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.111 2002/09/04 20:31:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -41,7 +41,7 @@ extern bool Password_encryption;
 
 static void CheckPgUserAclNotNull(void);
 static void UpdateGroupMembership(Relation group_rel, HeapTuple group_tuple,
-                                                                 List *members);
+                                         List *members);
 static IdList *IdListToArray(List *members);
 static List *IdArrayToList(IdList *oldarray);
 
@@ -52,7 +52,8 @@ static List *IdArrayToList(IdList *oldarray);
  *     Outputs string in quotes, with double-quotes duplicated.
  *     We could use quote_ident(), but that expects a TEXT argument.
  */
-static void fputs_quote(char *str, FILE *fp)
+static void
+fputs_quote(char *str, FILE *fp)
 {
        fputc('"', fp);
        while (*str)
@@ -79,7 +80,7 @@ group_getfilename(void)
        char       *pfnam;
 
        bufsize = strlen(DataDir) + strlen("/global/") +
-                         strlen(USER_GROUP_FILE) + 1;
+               strlen(USER_GROUP_FILE) + 1;
        pfnam = (char *) palloc(bufsize);
        snprintf(pfnam, bufsize, "%s/global/%s", DataDir, USER_GROUP_FILE);
 
@@ -99,7 +100,7 @@ user_getfilename(void)
        char       *pfnam;
 
        bufsize = strlen(DataDir) + strlen("/global/") +
-                         strlen(PWD_FILE) + 1;
+               strlen(PWD_FILE) + 1;
        pfnam = (char *) palloc(bufsize);
        snprintf(pfnam, bufsize, "%s/global/%s", DataDir, PWD_FILE);
 
@@ -125,8 +126,8 @@ write_group_file(Relation urel, Relation grel)
 
        /*
         * Create a temporary filename to be renamed later.  This prevents the
-        * backend from clobbering the pg_group file while the postmaster might
-        * be reading from it.
+        * backend from clobbering the pg_group file while the postmaster
+        * might be reading from it.
         */
        filename = group_getfilename();
        bufsize = strlen(filename) + 12;
@@ -143,14 +144,16 @@ write_group_file(Relation urel, Relation grel)
        scan = heap_beginscan(grel, SnapshotSelf, 0, NULL);
        while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
        {
-               Datum           datum, grolist_datum;
+               Datum           datum,
+                                       grolist_datum;
                bool            isnull;
                char       *groname;
                IdList     *grolist_p;
                AclId      *aidp;
-               int                     i, j,
+               int                     i,
+                                       j,
                                        num;
-               char       *usename;
+               char       *usename;
                bool            first_user = true;
 
                datum = heap_getattr(tuple, Anum_pg_group_groname, dsc, &isnull);
@@ -199,8 +202,8 @@ write_group_file(Relation urel, Relation grel)
                                        continue;
                                }
 
-                               /* File format is:
-                                *              "dbname"        "user1" "user2" "user3"
+                               /*
+                                * File format is: "dbname"    "user1" "user2" "user3"
                                 */
                                if (first_user)
                                {
@@ -833,8 +836,8 @@ AlterUserSet(AlterUserSetStmt *stmt)
        valuestr = flatten_set_variable_args(stmt->variable, stmt->value);
 
        /*
-        * RowExclusiveLock is sufficient, because we don't need to update
-        * the flat password file.
+        * RowExclusiveLock is sufficient, because we don't need to update the
+        * flat password file.
         */
        rel = heap_openr(ShadowRelationName, RowExclusiveLock);
        oldtuple = SearchSysCache(SHADOWNAME,
@@ -844,23 +847,23 @@ AlterUserSet(AlterUserSetStmt *stmt)
                elog(ERROR, "user \"%s\" does not exist", stmt->user);
 
        if (!(superuser()
-                 || ((Form_pg_shadow) GETSTRUCT(oldtuple))->usesysid == GetUserId()))
+        || ((Form_pg_shadow) GETSTRUCT(oldtuple))->usesysid == GetUserId()))
                elog(ERROR, "permission denied");
 
        for (i = 0; i < Natts_pg_shadow; i++)
                repl_repl[i] = ' ';
 
-       repl_repl[Anum_pg_shadow_useconfig-1] = 'r';
-       if (strcmp(stmt->variable, "all")==0 && valuestr == NULL)
+       repl_repl[Anum_pg_shadow_useconfig - 1] = 'r';
+       if (strcmp(stmt->variable, "all") == 0 && valuestr == NULL)
                /* RESET ALL */
-               repl_null[Anum_pg_shadow_useconfig-1] = 'n';
+               repl_null[Anum_pg_shadow_useconfig - 1] = 'n';
        else
        {
-               Datum datum;
-               bool isnull;
-               ArrayType *array;
+               Datum           datum;
+               bool            isnull;
+               ArrayType  *array;
 
-               repl_null[Anum_pg_shadow_useconfig-1] = ' ';
+               repl_null[Anum_pg_shadow_useconfig - 1] = ' ';
 
                datum = SysCacheGetAttr(SHADOWNAME, oldtuple,
                                                                Anum_pg_shadow_useconfig, &isnull);
@@ -872,7 +875,7 @@ AlterUserSet(AlterUserSetStmt *stmt)
                else
                        array = GUCArrayDelete(array, stmt->variable);
 
-               repl_val[Anum_pg_shadow_useconfig-1] = PointerGetDatum(array);
+               repl_val[Anum_pg_shadow_useconfig - 1] = PointerGetDatum(array);
        }
 
        newtuple = heap_modifytuple(oldtuple, rel, repl_val, repl_null, repl_repl);
@@ -1253,12 +1256,12 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
                                                                 * create user */
        {
                /*
-                * convert the to be added usernames to sysids and add them to
-                * the list
+                * convert the to be added usernames to sysids and add them to the
+                * list
                 */
                foreach(item, stmt->listUsers)
                {
-                       int32   sysid;
+                       int32           sysid;
 
                        if (strcmp(tag, "ALTER GROUP") == 0)
                        {
@@ -1282,6 +1285,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
                        if (!intMember(sysid, newlist))
                                newlist = lappendi(newlist, sysid);
                        else
+
                                /*
                                 * we silently assume here that this error will only come
                                 * up in a ALTER GROUP statement
@@ -1306,8 +1310,8 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag)
                else
                {
                        /*
-                        * convert the to be dropped usernames to sysids and
-                        * remove them from the list
+                        * convert the to be dropped usernames to sysids and remove
+                        * them from the list
                         */
                        foreach(item, stmt->listUsers)
                        {
@@ -1375,7 +1379,7 @@ UpdateGroupMembership(Relation group_rel, HeapTuple group_tuple,
        new_record_repl[Anum_pg_group_grolist - 1] = 'r';
 
        tuple = heap_modifytuple(group_tuple, group_rel,
-                                                        new_record, new_record_nulls, new_record_repl);
+                                                 new_record, new_record_nulls, new_record_repl);
 
        simple_heap_update(group_rel, &group_tuple->t_self, tuple);
 
@@ -1401,12 +1405,10 @@ IdListToArray(List *members)
        newarray->elemtype = INT4OID;
        ARR_NDIM(newarray) = 1;         /* one dimensional array */
        ARR_LBOUND(newarray)[0] = 1;    /* axis starts at one */
-       ARR_DIMS(newarray)[0] = nmembers; /* axis is this long */
+       ARR_DIMS(newarray)[0] = nmembers;       /* axis is this long */
        i = 0;
        foreach(item, members)
-       {
                ((int *) ARR_DATA_PTR(newarray))[i++] = lfirsti(item);
-       }
 
        return newarray;
 }
index 3e8cc79..a9b2e42 100644 (file)
@@ -13,7 +13,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.236 2002/09/02 01:05:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.237 2002/09/04 20:31:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -100,7 +100,7 @@ typedef struct VRelStats
 
 static MemoryContext vac_context = NULL;
 
-static int elevel = -1;
+static int     elevel = -1;
 
 static TransactionId OldestXmin;
 static TransactionId FreezeLimit;
@@ -204,8 +204,9 @@ vacuum(VacuumStmt *vacstmt)
                                                                                ALLOCSET_DEFAULT_MAXSIZE);
 
        /*
-        * If we are running only ANALYZE, we don't need per-table transactions,
-        * but we still need a memory context with table lifetime.
+        * If we are running only ANALYZE, we don't need per-table
+        * transactions, but we still need a memory context with table
+        * lifetime.
         */
        if (vacstmt->analyze && !vacstmt->vacuum)
                anl_context = AllocSetContextCreate(QueryContext,
@@ -221,29 +222,29 @@ vacuum(VacuumStmt *vacstmt)
         * Formerly, there was code here to prevent more than one VACUUM from
         * executing concurrently in the same database.  However, there's no
         * good reason to prevent that, and manually removing lockfiles after
-        * a vacuum crash was a pain for dbadmins.  So, forget about lockfiles,
-        * and just rely on the locks we grab on each target table
+        * a vacuum crash was a pain for dbadmins.      So, forget about
+        * lockfiles, and just rely on the locks we grab on each target table
         * to ensure that there aren't two VACUUMs running on the same table
         * at the same time.
         */
 
        /*
-        * The strangeness with committing and starting transactions here is due
-        * to wanting to run each table's VACUUM as a separate transaction, so
-        * that we don't hold locks unnecessarily long.  Also, if we are doing
-        * VACUUM ANALYZE, the ANALYZE part runs as a separate transaction from
-        * the VACUUM to further reduce locking.
+        * The strangeness with committing and starting transactions here is
+        * due to wanting to run each table's VACUUM as a separate
+        * transaction, so that we don't hold locks unnecessarily long.  Also,
+        * if we are doing VACUUM ANALYZE, the ANALYZE part runs as a separate
+        * transaction from the VACUUM to further reduce locking.
         *
         * vacuum_rel expects to be entered with no transaction active; it will
         * start and commit its own transaction.  But we are called by an SQL
         * command, and so we are executing inside a transaction already.  We
         * commit the transaction started in PostgresMain() here, and start
-        * another one before exiting to match the commit waiting for us back in
-        * PostgresMain().
+        * another one before exiting to match the commit waiting for us back
+        * in PostgresMain().
         *
         * In the case of an ANALYZE statement (no vacuum, just analyze) it's
-        * okay to run the whole thing in the outer transaction, and so we skip
-        * transaction start/stop operations.
+        * okay to run the whole thing in the outer transaction, and so we
+        * skip transaction start/stop operations.
         */
        if (vacstmt->vacuum)
        {
@@ -254,22 +255,23 @@ vacuum(VacuumStmt *vacstmt)
                         *
                         * Compute the initially applicable OldestXmin and FreezeLimit
                         * XIDs, so that we can record these values at the end of the
-                        * VACUUM. Note that individual tables may well be processed with
-                        * newer values, but we can guarantee that no (non-shared)
-                        * relations are processed with older ones.
+                        * VACUUM. Note that individual tables may well be processed
+                        * with newer values, but we can guarantee that no
+                        * (non-shared) relations are processed with older ones.
                         *
-                        * It is okay to record non-shared values in pg_database, even though
-                        * we may vacuum shared relations with older cutoffs, because only
-                        * the minimum of the values present in pg_database matters.  We
-                        * can be sure that shared relations have at some time been
-                        * vacuumed with cutoffs no worse than the global minimum; for, if
-                        * there is a backend in some other DB with xmin = OLDXMIN that's
-                        * determining the cutoff with which we vacuum shared relations,
-                        * it is not possible for that database to have a cutoff newer
-                        * than OLDXMIN recorded in pg_database.
+                        * It is okay to record non-shared values in pg_database, even
+                        * though we may vacuum shared relations with older cutoffs,
+                        * because only the minimum of the values present in
+                        * pg_database matters.  We can be sure that shared relations
+                        * have at some time been vacuumed with cutoffs no worse than
+                        * the global minimum; for, if there is a backend in some
+                        * other DB with xmin = OLDXMIN that's determining the cutoff
+                        * with which we vacuum shared relations, it is not possible
+                        * for that database to have a cutoff newer than OLDXMIN
+                        * recorded in pg_database.
                         */
                        vacuum_set_xid_limits(vacstmt, false,
-                                                                 &initialOldestXmin, &initialFreezeLimit);
+                                                               &initialOldestXmin, &initialFreezeLimit);
                }
 
                /* matches the StartTransaction in PostgresMain() */
@@ -281,7 +283,7 @@ vacuum(VacuumStmt *vacstmt)
         */
        foreach(cur, vrl)
        {
-               Oid             relid = (Oid) lfirsti(cur);
+               Oid                     relid = (Oid) lfirsti(cur);
 
                if (vacstmt->vacuum)
                        vacuum_rel(relid, vacstmt, RELKIND_RELATION);
@@ -290,10 +292,11 @@ vacuum(VacuumStmt *vacstmt)
                        MemoryContext old_context = NULL;
 
                        /*
-                        * If we vacuumed, use new transaction for analyze.  Otherwise,
-                        * we can use the outer transaction, but we still need to call
-                        * analyze_rel in a memory context that will be cleaned up on
-                        * return (else we leak memory while processing multiple tables).
+                        * If we vacuumed, use new transaction for analyze.
+                        * Otherwise, we can use the outer transaction, but we still
+                        * need to call analyze_rel in a memory context that will be
+                        * cleaned up on return (else we leak memory while processing
+                        * multiple tables).
                         */
                        if (vacstmt->vacuum)
                                StartTransactionCommand(true);
@@ -320,16 +323,17 @@ vacuum(VacuumStmt *vacstmt)
                /* here, we are not in a transaction */
 
                /*
-                * This matches the CommitTransaction waiting for us in PostgresMain().
-                * We tell xact.c not to chain the upcoming commit, so that a VACUUM
-                * doesn't start a transaction block, even when autocommit is off.
+                * This matches the CommitTransaction waiting for us in
+                * PostgresMain(). We tell xact.c not to chain the upcoming
+                * commit, so that a VACUUM doesn't start a transaction block,
+                * even when autocommit is off.
                 */
                StartTransactionCommand(true);
 
                /*
-                * If we did a database-wide VACUUM, update the database's pg_database
-                * row with info about the transaction IDs used, and try to truncate
-                * pg_clog.
+                * If we did a database-wide VACUUM, update the database's
+                * pg_database row with info about the transaction IDs used, and
+                * try to truncate pg_clog.
                 */
                if (vacstmt->relation == NULL)
                {
@@ -366,7 +370,7 @@ getrels(const RangeVar *vacrel, const char *stmttype)
        if (vacrel)
        {
                /* Process specific relation */
-               Oid             relid;
+               Oid                     relid;
 
                relid = RangeVarGetRelid(vacrel, false);
 
@@ -517,9 +521,9 @@ vac_update_relstats(Oid relid, BlockNumber num_pages, double num_tuples,
 
        /*
         * Invalidate the tuple in the catcaches; this also arranges to flush
-        * the relation's relcache entry.  (If we fail to commit for some reason,
-        * no flush will occur, but no great harm is done since there are no
-        * noncritical state updates here.)
+        * the relation's relcache entry.  (If we fail to commit for some
+        * reason, no flush will occur, but no great harm is done since there
+        * are no noncritical state updates here.)
         */
        CacheInvalidateHeapTuple(rd, &rtup);
 
@@ -647,8 +651,8 @@ vac_truncate_clog(TransactionId vacuumXID, TransactionId frozenXID)
        heap_close(relation, AccessShareLock);
 
        /*
-        * Do not truncate CLOG if we seem to have suffered wraparound already;
-        * the computed minimum XID might be bogus.
+        * Do not truncate CLOG if we seem to have suffered wraparound
+        * already; the computed minimum XID might be bogus.
         */
        if (vacuumAlreadyWrapped)
        {
@@ -740,7 +744,8 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind)
         *
         * We allow the user to vacuum a table if he is superuser, the table
         * owner, or the database owner (but in the latter case, only if it's
-        * not a shared relation).      pg_class_ownercheck includes the superuser case.
+        * not a shared relation).      pg_class_ownercheck includes the superuser
+        * case.
         *
         * Note we choose to treat permissions failure as a WARNING and keep
         * trying to vacuum the rest of the DB --- is this appropriate?
@@ -1581,21 +1586,23 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                         * by "recent" transactions then we have to move all chain of
                         * tuples to another places.
                         *
-                        * NOTE: this test is not 100% accurate: it is possible for
-                        * tuple to be an updated one with recent xmin, and yet not
-                        * have a corresponding tuple in the vtlinks list.  Presumably
+                        * NOTE: this test is not 100% accurate: it is possible for a
+                        * tuple to be an updated one with recent xmin, and yet not
+                        * have a corresponding tuple in the vtlinks list.      Presumably
                         * there was once a parent tuple with xmax matching the xmin,
                         * but it's possible that that tuple has been removed --- for
-                        * example, if it had xmin = xmax then HeapTupleSatisfiesVacuum
-                        * would deem it removable as soon as the xmin xact completes.
+                        * example, if it had xmin = xmax then
+                        * HeapTupleSatisfiesVacuum would deem it removable as soon as
+                        * the xmin xact completes.
                         *
                         * To be on the safe side, we abandon the repair_frag process if
-                        * we cannot find the parent tuple in vtlinks.  This may be overly
-                        * conservative; AFAICS it would be safe to move the chain.
+                        * we cannot find the parent tuple in vtlinks.  This may be
+                        * overly conservative; AFAICS it would be safe to move the
+                        * chain.
                         */
                        if (((tuple.t_data->t_infomask & HEAP_UPDATED) &&
                         !TransactionIdPrecedes(HeapTupleHeaderGetXmin(tuple.t_data),
-                                               OldestXmin)) ||
+                                                                       OldestXmin)) ||
                                (!(tuple.t_data->t_infomask & (HEAP_XMAX_INVALID |
                                                                                           HEAP_MARKED_FOR_UPDATE)) &&
                                 !(ItemPointerEquals(&(tuple.t_self),
@@ -1626,7 +1633,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                                if (vacrelstats->vtlinks == NULL)
                                {
                                        elog(WARNING, "Parent item in update-chain not found - can't continue repair_frag");
-                                       break;  /* out of walk-along-page loop */
+                                       break;          /* out of walk-along-page loop */
                                }
 
                                vtmove = (VTupleMove) palloc(100 * sizeof(VTupleMoveData));
@@ -1638,7 +1645,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                                 * we have to move to the end of chain.
                                 */
                                while (!(tp.t_data->t_infomask & (HEAP_XMAX_INVALID |
-                                                                                                 HEAP_MARKED_FOR_UPDATE)) &&
+                                                                                         HEAP_MARKED_FOR_UPDATE)) &&
                                           !(ItemPointerEquals(&(tp.t_self),
                                                                                   &(tp.t_data->t_ctid))))
                                {
@@ -1704,7 +1711,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                                                {
                                                        /* can't move item anywhere */
                                                        chain_move_failed = true;
-                                                       break; /* out of check-all-items loop */
+                                                       break;          /* out of check-all-items loop */
                                                }
                                                to_item = i;
                                                to_vacpage = fraged_pages->pagedesc[to_item];
@@ -1732,8 +1739,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 
                                        /* At beginning of chain? */
                                        if (!(tp.t_data->t_infomask & HEAP_UPDATED) ||
-                                           TransactionIdPrecedes(HeapTupleHeaderGetXmin(tp.t_data),
-                                                                 OldestXmin))
+                                               TransactionIdPrecedes(HeapTupleHeaderGetXmin(tp.t_data),
+                                                                                         OldestXmin))
                                                break;
 
                                        /* No, move to tuple with prior row version */
@@ -1749,14 +1756,14 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                                                /* see discussion above */
                                                elog(WARNING, "Parent item in update-chain not found - can't continue repair_frag");
                                                chain_move_failed = true;
-                                               break; /* out of check-all-items loop */
+                                               break;  /* out of check-all-items loop */
                                        }
                                        tp.t_self = vtlp->this_tid;
                                        Pbuf = ReadBuffer(onerel,
-                                                                         ItemPointerGetBlockNumber(&(tp.t_self)));
+                                                               ItemPointerGetBlockNumber(&(tp.t_self)));
                                        Ppage = BufferGetPage(Pbuf);
                                        Pitemid = PageGetItemId(Ppage,
-                                                                                       ItemPointerGetOffsetNumber(&(tp.t_self)));
+                                                          ItemPointerGetOffsetNumber(&(tp.t_self)));
                                        /* this can't happen since we saw tuple earlier: */
                                        if (!ItemIdIsUsed(Pitemid))
                                                elog(ERROR, "Parent itemid marked as unused");
@@ -1768,25 +1775,24 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                                                                                         &(Ptp.t_data->t_ctid)));
 
                                        /*
-                                        * Read above about cases when
-                                        * !ItemIdIsUsed(Citemid) (child item is
-                                        * removed)... Due to the fact that at the moment
-                                        * we don't remove unuseful part of update-chain,
-                                        * it's possible to get too old parent row here.
-                                        * Like as in the case which caused this problem,
-                                        * we stop shrinking here. I could try to find
-                                        * real parent row but want not to do it because
-                                        * of real solution will be implemented anyway,
-                                        * later, and we are too close to 6.5 release. -
-                                        * vadim 06/11/99
+                                        * Read above about cases when !ItemIdIsUsed(Citemid)
+                                        * (child item is removed)... Due to the fact that at
+                                        * the moment we don't remove unuseful part of
+                                        * update-chain, it's possible to get too old parent
+                                        * row here. Like as in the case which caused this
+                                        * problem, we stop shrinking here. I could try to
+                                        * find real parent row but want not to do it because
+                                        * of real solution will be implemented anyway, later,
+                                        * and we are too close to 6.5 release. - vadim
+                                        * 06/11/99
                                         */
                                        if (!(TransactionIdEquals(HeapTupleHeaderGetXmax(Ptp.t_data),
-                                                                                         HeapTupleHeaderGetXmin(tp.t_data))))
+                                                                        HeapTupleHeaderGetXmin(tp.t_data))))
                                        {
                                                ReleaseBuffer(Pbuf);
                                                elog(WARNING, "Too old parent tuple found - can't continue repair_frag");
                                                chain_move_failed = true;
-                                               break; /* out of check-all-items loop */
+                                               break;  /* out of check-all-items loop */
                                        }
                                        tp.t_datamcxt = Ptp.t_datamcxt;
                                        tp.t_data = Ptp.t_data;
@@ -1795,7 +1801,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                                                ReleaseBuffer(Cbuf);
                                        Cbuf = Pbuf;
                                        freeCbuf = true;
-                               } /* end of check-all-items loop */
+                               }                               /* end of check-all-items loop */
 
                                if (freeCbuf)
                                        ReleaseBuffer(Cbuf);
@@ -1804,9 +1810,9 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                                if (chain_move_failed)
                                {
                                        /*
-                                        * Undo changes to offsets_used state.  We don't bother
-                                        * cleaning up the amount-free state, since we're not
-                                        * going to do any further tuple motion.
+                                        * Undo changes to offsets_used state.  We don't
+                                        * bother cleaning up the amount-free state, since
+                                        * we're not going to do any further tuple motion.
                                         */
                                        for (i = 0; i < num_vtmove; i++)
                                        {
@@ -1939,7 +1945,10 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                                        }
                                        else
                                        {
-                                               /* No XLOG record, but still need to flag that XID exists on disk */
+                                               /*
+                                                * No XLOG record, but still need to flag that XID
+                                                * exists on disk
+                                                */
                                                MyXactMadeTempRelUpdate = true;
                                        }
 
@@ -1985,7 +1994,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 
                                        WriteBuffer(cur_buffer);
                                        WriteBuffer(Cbuf);
-                               } /* end of move-the-tuple-chain loop */
+                               }                               /* end of move-the-tuple-chain loop */
 
                                cur_buffer = InvalidBuffer;
                                pfree(vtmove);
@@ -1993,7 +2002,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
 
                                /* advance to next tuple in walk-along-page loop */
                                continue;
-                       } /* end of is-tuple-in-chain test */
+                       }                                       /* end of is-tuple-in-chain test */
 
                        /* try to find new page for this tuple */
                        if (cur_buffer == InvalidBuffer ||
@@ -2031,10 +2040,9 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                        /*
                         * register invalidation of source tuple in catcaches.
                         *
-                        * (Note: we do not need to register the copied tuple,
-                        * because we are not changing the tuple contents and
-                        * so there cannot be any need to flush negative
-                        * catcache entries.)
+                        * (Note: we do not need to register the copied tuple, because we
+                        * are not changing the tuple contents and so there cannot be
+                        * any need to flush negative catcache entries.)
                         */
                        CacheInvalidateHeapTuple(onerel, &tuple);
 
@@ -2090,7 +2098,10 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                        }
                        else
                        {
-                               /* No XLOG record, but still need to flag that XID exists on disk */
+                               /*
+                                * No XLOG record, but still need to flag that XID exists
+                                * on disk
+                                */
                                MyXactMadeTempRelUpdate = true;
                        }
 
@@ -2116,8 +2127,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                }                                               /* walk along page */
 
                /*
-                * If we broke out of the walk-along-page loop early (ie, still have
-                * offnum <= maxoff), then we failed to move some tuple off
+                * If we broke out of the walk-along-page loop early (ie, still
+                * have offnum <= maxoff), then we failed to move some tuple off
                 * this page.  No point in shrinking any more, so clean up and
                 * exit the per-page loop.
                 */
@@ -2126,7 +2137,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                        OffsetNumber off;
 
                        /*
-                        * Fix vacpage state for any unvisited tuples remaining on page
+                        * Fix vacpage state for any unvisited tuples remaining on
+                        * page
                         */
                        for (off = OffsetNumberNext(offnum);
                                 off <= maxoff;
@@ -2389,7 +2401,10 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
                        }
                        else
                        {
-                               /* No XLOG record, but still need to flag that XID exists on disk */
+                               /*
+                                * No XLOG record, but still need to flag that XID exists
+                                * on disk
+                                */
                                MyXactMadeTempRelUpdate = true;
                        }
 
index 4fb613c..023472e 100644 (file)
@@ -31,7 +31,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/vacuumlazy.c,v 1.18 2002/08/06 02:36:34 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/vacuumlazy.c,v 1.19 2002/09/04 20:31:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -93,7 +93,7 @@ typedef struct LVRelStats
 } LVRelStats;
 
 
-static int elevel = -1;
+static int     elevel = -1;
 
 static TransactionId OldestXmin;
 static TransactionId FreezeLimit;
@@ -756,7 +756,7 @@ lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats)
         */
 
        elog(elevel, "Truncated %u --> %u pages.\n\t%s", old_rel_pages,
-               new_rel_pages, vac_show_rusage(&ru0));
+                new_rel_pages, vac_show_rusage(&ru0));
 }
 
 /*
index 55a11a7..6f6f50a 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.70 2002/07/18 02:02:29 ishii Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.71 2002/09/04 20:31:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -111,8 +111,8 @@ assign_datestyle(const char *value, bool doit, bool interactive)
                         * Easiest way to get the current DEFAULT state is to fetch
                         * the DEFAULT string from guc.c and recursively parse it.
                         *
-                        * We can't simply "return assign_datestyle(...)" because we
-                        * need to handle constructs like "DEFAULT, ISO".
+                        * We can't simply "return assign_datestyle(...)" because we need
+                        * to handle constructs like "DEFAULT, ISO".
                         */
                        int                     saveDateStyle = DateStyle;
                        bool            saveEuroDates = EuroDates;
@@ -164,7 +164,7 @@ assign_datestyle(const char *value, bool doit, bool interactive)
                return value;
 
        /*
-        * Prepare the canonical string to return.  GUC wants it malloc'd.
+        * Prepare the canonical string to return.      GUC wants it malloc'd.
         */
        result = (char *) malloc(32);
        if (!result)
@@ -188,8 +188,8 @@ assign_datestyle(const char *value, bool doit, bool interactive)
        strcat(result, newEuroDates ? ", EURO" : ", US");
 
        /*
-        * Finally, it's safe to assign to the global variables;
-        * the assignment cannot fail now.
+        * Finally, it's safe to assign to the global variables; the
+        * assignment cannot fail now.
         */
        DateStyle = newDateStyle;
        EuroDates = newEuroDates;
@@ -203,7 +203,7 @@ assign_datestyle(const char *value, bool doit, bool interactive)
 const char *
 show_datestyle(void)
 {
-       static char             buf[64];
+       static char buf[64];
 
        switch (DateStyle)
        {
@@ -270,6 +270,7 @@ assign_timezone(const char *value, bool doit, bool interactive)
                        return NULL;
                }
                *endptr = '\0';
+
                /*
                 * Try to parse it.  XXX an invalid interval format will result in
                 * elog, which is not desirable for GUC.  We did what we could to
@@ -277,9 +278,9 @@ assign_timezone(const char *value, bool doit, bool interactive)
                 * coming in from postgresql.conf might contain anything.
                 */
                interval = DatumGetIntervalP(DirectFunctionCall3(interval_in,
-                                                                                                                CStringGetDatum(val),
-                                                                                                                ObjectIdGetDatum(InvalidOid),
-                                                                                                                Int32GetDatum(-1)));
+                                                                                                       CStringGetDatum(val),
+                                                                                       ObjectIdGetDatum(InvalidOid),
+                                                                                                        Int32GetDatum(-1)));
                pfree(val);
                if (interval->month != 0)
                {
@@ -318,8 +319,8 @@ assign_timezone(const char *value, bool doit, bool interactive)
                         * available under Solaris, among others. Apparently putenv()
                         * called as below clears the process-specific environment
                         * variables.  Other reasonable arguments to putenv() (e.g.
-                        * "TZ=", "TZ", "") result in a core dump (under Linux anyway).
-                        * - thomas 1998-01-26
+                        * "TZ=", "TZ", "") result in a core dump (under Linux
+                        * anyway). - thomas 1998-01-26
                         */
                        if (doit)
                        {
@@ -339,13 +340,14 @@ assign_timezone(const char *value, bool doit, bool interactive)
                         * Otherwise assume it is a timezone name.
                         *
                         * XXX unfortunately we have no reasonable way to check whether a
-                        * timezone name is good, so we have to just assume that it is.
+                        * timezone name is good, so we have to just assume that it
+                        * is.
                         */
                        if (doit)
                        {
                                strcpy(tzbuf, "TZ=");
-                               strncat(tzbuf, value, sizeof(tzbuf)-4);
-                               if (putenv(tzbuf) != 0) /* shouldn't happen? */
+                               strncat(tzbuf, value, sizeof(tzbuf) - 4);
+                               if (putenv(tzbuf) != 0) /* shouldn't happen? */
                                        elog(LOG, "assign_timezone: putenv failed");
                                tzset();
                                HasCTZSet = false;
@@ -360,7 +362,7 @@ assign_timezone(const char *value, bool doit, bool interactive)
                return value;
 
        /*
-        * Prepare the canonical string to return.  GUC wants it malloc'd.
+        * Prepare the canonical string to return.      GUC wants it malloc'd.
         */
        result = (char *) malloc(sizeof(tzbuf));
        if (!result)
@@ -372,13 +374,9 @@ assign_timezone(const char *value, bool doit, bool interactive)
                                 (double) CTimeZone / 3600.0);
        }
        else if (tzbuf[0] == 'T')
-       {
                strcpy(result, tzbuf + 3);
-       }
        else
-       {
                strcpy(result, "UNKNOWN");
-       }
 
        return result;
 }
@@ -399,7 +397,7 @@ show_timezone(void)
                interval.time = CTimeZone;
 
                tzn = DatumGetCString(DirectFunctionCall1(interval_out,
-                                                                                                 IntervalPGetDatum(&interval)));
+                                                                                 IntervalPGetDatum(&interval)));
        }
        else
                tzn = getenv("TZ");
@@ -422,11 +420,20 @@ assign_XactIsoLevel(const char *value, bool doit, bool interactive)
                elog(ERROR, "SET TRANSACTION ISOLATION LEVEL must be called before any query");
 
        if (strcmp(value, "serializable") == 0)
-               { if (doit) XactIsoLevel = XACT_SERIALIZABLE; }
+       {
+               if (doit)
+                       XactIsoLevel = XACT_SERIALIZABLE;
+       }
        else if (strcmp(value, "read committed") == 0)
-               { if (doit) XactIsoLevel = XACT_READ_COMMITTED; }
+       {
+               if (doit)
+                       XactIsoLevel = XACT_READ_COMMITTED;
+       }
        else if (strcmp(value, "default") == 0)
-               { if (doit) XactIsoLevel = DefaultXactIsoLevel; }
+       {
+               if (doit)
+                       XactIsoLevel = DefaultXactIsoLevel;
+       }
        else
                return NULL;
 
@@ -475,11 +482,12 @@ assign_client_encoding(const char *value, bool doit, bool interactive)
        encoding = pg_valid_client_encoding(value);
        if (encoding < 0)
                return NULL;
-               
-       /* XXX SetClientEncoding depends on namespace functions which are
-        * not available at startup time. So we accept requested client
-        * encoding anyway which might not be valid (e.g. no conversion
-        * procs available).
+
+       /*
+        * XXX SetClientEncoding depends on namespace functions which are not
+        * available at startup time. So we accept requested client encoding
+        * anyway which might not be valid (e.g. no conversion procs
+        * available).
         */
        if (SetClientEncoding(encoding, doit) < 0)
        {
index 9142031..0ce3097 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.70 2002/09/02 20:04:40 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.71 2002/09/04 20:31:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,7 +55,7 @@ DefineVirtualRelation(const RangeVar *relation, List *tlist, bool replace)
         * the (non-junk) targetlist items from the view's SELECT list.
         */
        attrList = NIL;
-       foreach (t, tlist)
+       foreach(t, tlist)
        {
                TargetEntry *entry = lfirst(t);
                Resdom     *res = entry->resdom;
@@ -115,32 +115,32 @@ DefineVirtualRelation(const RangeVar *relation, List *tlist, bool replace)
                 * Create a tuple descriptor to compare against the existing view,
                 * and verify it matches.
                 */
-           descriptor = BuildDescForRelation(attrList);
+               descriptor = BuildDescForRelation(attrList);
                checkViewTupleDesc(descriptor, rel->rd_att);
 
                /*
                 * Seems okay, so return the OID of the pre-existing view.
                 */
-               relation_close(rel, NoLock); /* keep the lock! */
+               relation_close(rel, NoLock);    /* keep the lock! */
 
                return viewOid;
        }
        else
        {
                /*
-                * now create the parameters for keys/inheritance etc. All of them are
-                * nil...
+                * now create the parameters for keys/inheritance etc. All of them
+                * are nil...
                 */
                createStmt->relation = (RangeVar *) relation;
                createStmt->tableElts = attrList;
                createStmt->inhRelations = NIL;
                createStmt->constraints = NIL;
                createStmt->hasoids = false;
-       
+
                /*
-                * finally create the relation (this will error out if there's
-                * an existing view, so we don't need more code to complain
-                * if "replace" is false).
+                * finally create the relation (this will error out if there's an
+                * existing view, so we don't need more code to complain if
+                * "replace" is false).
                 */
                return DefineRelation(createStmt, RELKIND_VIEW);
        }
@@ -179,6 +179,7 @@ checkViewTupleDesc(TupleDesc newdesc, TupleDesc olddesc)
                                 NameStr(oldattr->attname));
                /* We can ignore the remaining attributes of an attribute... */
        }
+
        /*
         * We ignore the constraint fields.  The new view desc can't have any
         * constraints, and the only ones that could be on the old view are
@@ -316,8 +317,8 @@ DefineView(const RangeVar *view, Query *viewParse, bool replace)
        /*
         * Create the view relation
         *
-        * NOTE: if it already exists and replace is false, the xact will 
-        * be aborted.
+        * NOTE: if it already exists and replace is false, the xact will be
+        * aborted.
         */
 
        viewOid = DefineVirtualRelation(view, viewParse->targetList, replace);
index d808b85..761ff40 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.31 2002/07/20 05:16:57 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.32 2002/09/04 20:31:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -383,8 +383,8 @@ ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot)
         * information for the new "clean" tuple.
         *
         * Note: we use memory on the stack to optimize things when we are
-        * dealing with a small number of attributes. for large tuples we
-        * just use palloc.
+        * dealing with a small number of attributes. for large tuples we just
+        * use palloc.
         */
        if (cleanLength > 64)
        {
index fd4431c..300c415 100644 (file)
@@ -27,7 +27,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.177 2002/09/02 01:05:05 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.178 2002/09/04 20:31:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -63,14 +63,14 @@ static TupleTableSlot *ExecutePlan(EState *estate, Plan *plan,
                        ScanDirection direction,
                        DestReceiver *destfunc);
 static void ExecSelect(TupleTableSlot *slot,
-                        DestReceiver *destfunc,
-                        EState *estate);
+                  DestReceiver *destfunc,
+                  EState *estate);
 static void ExecInsert(TupleTableSlot *slot, ItemPointer tupleid,
                   EState *estate);
 static void ExecDelete(TupleTableSlot *slot, ItemPointer tupleid,
                   EState *estate);
 static void ExecUpdate(TupleTableSlot *slot, ItemPointer tupleid,
-                       EState *estate);
+                  EState *estate);
 static TupleTableSlot *EvalPlanQualNext(EState *estate);
 static void EndEvalPlanQual(EState *estate);
 static void ExecCheckQueryPerms(CmdType operation, Query *parseTree,
@@ -116,9 +116,9 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
        /*
         * Make our own private copy of the current query snapshot data.
         *
-        * This "freezes" our idea of which tuples are good and which are not
-        * for the life of this query, even if it outlives the current command
-        * and current snapshot.
+        * This "freezes" our idea of which tuples are good and which are not for
+        * the life of this query, even if it outlives the current command and
+        * current snapshot.
         */
        estate->es_snapshot = CopyQuerySnapshot();
 
@@ -353,12 +353,13 @@ ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation)
        Oid                     userid;
        AclResult       aclcheck_result;
 
-       /*
+       /*
         * Only plain-relation RTEs need to be checked here.  Subquery RTEs
-        * will be checked when ExecCheckPlanPerms finds the SubqueryScan node,
-        * and function RTEs are checked by init_fcache when the function is
-        * prepared for execution.  Join and special RTEs need no checks.
-        */
+        * will be checked when ExecCheckPlanPerms finds the SubqueryScan
+        * node, and function RTEs are checked by init_fcache when the
+        * function is prepared for execution.  Join and special RTEs need no
+        * checks.
+        */
        if (rte->rtekind != RTE_RELATION)
                return;
 
@@ -1071,7 +1072,8 @@ lnext:    ;
 
                        slot = ExecStoreTuple(newTuple,         /* tuple to store */
                                                                  junkfilter->jf_resultSlot,    /* dest slot */
-                                                                 InvalidBuffer,        /* this tuple has no buffer */
+                                                                 InvalidBuffer,                /* this tuple has no
+                                                                                                                * buffer */
                                                                  true);                /* tuple should be pfreed */
                }
 
@@ -1083,8 +1085,9 @@ lnext:    ;
                switch (operation)
                {
                        case CMD_SELECT:
-                               ExecSelect(slot,                /* slot containing tuple */
-                                                  destfunc,    /* destination's tuple-receiver obj */
+                               ExecSelect(slot,        /* slot containing tuple */
+                                                  destfunc,    /* destination's tuple-receiver
+                                                                                * obj */
                                                   estate);
                                result = slot;
                                break;
@@ -1357,8 +1360,8 @@ ldelete:;
  */
 static void
 ExecUpdate(TupleTableSlot *slot,
-                       ItemPointer tupleid,
-                       EState *estate)
+                  ItemPointer tupleid,
+                  EState *estate)
 {
        HeapTuple       tuple;
        ResultRelInfo *resultRelInfo;
index 12b2089..5718983 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.107 2002/09/02 01:05:05 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.108 2002/09/04 20:31:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,7 +55,7 @@ static Datum ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull);
 static Datum ExecEvalOper(Expr *opClause, ExprContext *econtext,
                         bool *isNull, ExprDoneCond *isDone);
 static Datum ExecEvalDistinct(Expr *opClause, ExprContext *econtext,
-                        bool *isNull, ExprDoneCond *isDone);
+                                bool *isNull, ExprDoneCond *isDone);
 static Datum ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
                         bool *isNull, ExprDoneCond *isDone);
 static ExprDoneCond ExecEvalFuncArgs(FunctionCallInfo fcinfo,
@@ -70,8 +70,8 @@ static Datum ExecEvalNullTest(NullTest *ntest, ExprContext *econtext,
 static Datum ExecEvalBooleanTest(BooleanTest *btest, ExprContext *econtext,
                                        bool *isNull, ExprDoneCond *isDone);
 static Datum ExecEvalConstraintTest(ConstraintTest *constraint,
-                                                                       ExprContext *econtext,
-                                                                       bool *isNull, ExprDoneCond *isDone);
+                                          ExprContext *econtext,
+                                          bool *isNull, ExprDoneCond *isDone);
 
 
 /*----------
@@ -848,7 +848,7 @@ ExecMakeFunctionResult(FunctionCachePtr fcache,
  *             ExecMakeTableFunctionResult
  *
  * Evaluate a table function, producing a materialized result in a Tuplestore
- * object.  (If function returns an empty set, we just return NULL instead.)
+ * object.     (If function returns an empty set, we just return NULL instead.)
  */
 Tuplestorestate *
 ExecMakeTableFunctionResult(Expr *funcexpr,
@@ -871,13 +871,14 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
        bool            returnsTuple = false;
 
        /* Extract data from function-call expression node */
-       if (!funcexpr || !IsA(funcexpr, Expr) || funcexpr->opType != FUNC_EXPR)
+       if (!funcexpr || !IsA(funcexpr, Expr) ||funcexpr->opType != FUNC_EXPR)
                elog(ERROR, "ExecMakeTableFunctionResult: expression is not a function call");
        func = (Func *) funcexpr->oper;
        argList = funcexpr->args;
 
        /*
-        * get the fcache from the Func node. If it is NULL, then initialize it
+        * get the fcache from the Func node. If it is NULL, then initialize
+        * it
         */
        fcache = func->func_fcache;
        if (fcache == NULL)
@@ -892,7 +893,7 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
         *
         * Note: ideally, we'd do this in the per-tuple context, but then the
         * argument values would disappear when we reset the context in the
-        * inner loop.  So do it in caller context.  Perhaps we should make a
+        * inner loop.  So do it in caller context.  Perhaps we should make a
         * separate context just to hold the evaluated arguments?
         */
        MemSet(&fcinfo, 0, sizeof(fcinfo));
@@ -921,8 +922,9 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
        }
 
        /*
-        * Prepare a resultinfo node for communication.  We always do this even
-        * if not expecting a set result, so that we can pass expectedDesc.
+        * Prepare a resultinfo node for communication.  We always do this
+        * even if not expecting a set result, so that we can pass
+        * expectedDesc.
         */
        fcinfo.resultinfo = (Node *) &rsinfo;
        rsinfo.type = T_ReturnSetInfo;
@@ -948,8 +950,9 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
                HeapTuple       tuple;
 
                /*
-                * reset per-tuple memory context before each call of the function.
-                * This cleans up any local memory the function may leak when called.
+                * reset per-tuple memory context before each call of the
+                * function. This cleans up any local memory the function may leak
+                * when called.
                 */
                ResetExprContext(econtext);
 
@@ -964,18 +967,20 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
                        /*
                         * Check for end of result set.
                         *
-                        * Note: if function returns an empty set, we don't build a 
+                        * Note: if function returns an empty set, we don't build a
                         * tupdesc or tuplestore (since we can't get a tupdesc in the
                         * function-returning-tuple case)
                         */
                        if (rsinfo.isDone == ExprEndResult)
                                break;
+
                        /*
-                        * If first time through, build tupdesc and tuplestore for result
+                        * If first time through, build tupdesc and tuplestore for
+                        * result
                         */
                        if (first_time)
                        {
-                               Oid             funcrettype = funcexpr->typeOid;
+                               Oid                     funcrettype = funcexpr->typeOid;
 
                                oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_query_memory);
                                if (funcrettype == RECORDOID ||
@@ -1006,7 +1011,7 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
                                                                           0,
                                                                           false);
                                }
-                               tupstore = tuplestore_begin_heap(true, /* randomAccess */
+                               tupstore = tuplestore_begin_heap(true,  /* randomAccess */
                                                                                                 SortMem);
                                MemoryContextSwitchTo(oldcontext);
                                rsinfo.setResult = tupstore;
@@ -1026,7 +1031,7 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
                        }
                        else
                        {
-                               char nullflag;
+                               char            nullflag;
 
                                nullflag = fcinfo.isnull ? 'n' : ' ';
                                tuple = heap_formtuple(tupdesc, &result, &nullflag);
@@ -1180,7 +1185,7 @@ ExecEvalDistinct(Expr *opClause,
                                 bool *isNull,
                                 ExprDoneCond *isDone)
 {
-       bool result;
+       bool            result;
        FunctionCachePtr fcache;
        FunctionCallInfoData fcinfo;
        ExprDoneCond argDone;
index e07fd87..1a5f835 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.58 2002/09/02 01:05:05 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.59 2002/09/04 20:31:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -681,7 +681,7 @@ ExecTypeFromTL(List *targetList, bool hasoid)
 TupleTableSlot *
 TupleDescGetSlot(TupleDesc tupdesc)
 {
-       TupleTableSlot     *slot;
+       TupleTableSlot *slot;
 
        /* Make a standalone slot */
        slot = MakeTupleTableSlot();
@@ -701,19 +701,20 @@ TupleDescGetSlot(TupleDesc tupdesc)
 AttInMetadata *
 TupleDescGetAttInMetadata(TupleDesc tupdesc)
 {
-       int                             natts = tupdesc->natts;
-       int                             i;
-       Oid                             atttypeid;
-       Oid                             attinfuncid;
-       FmgrInfo           *attinfuncinfo;
-       Oid                        *attelems;
-       int32              *atttypmods;
-       AttInMetadata  *attinmeta;
+       int                     natts = tupdesc->natts;
+       int                     i;
+       Oid                     atttypeid;
+       Oid                     attinfuncid;
+       FmgrInfo   *attinfuncinfo;
+       Oid                *attelems;
+       int32      *atttypmods;
+       AttInMetadata *attinmeta;
 
        attinmeta = (AttInMetadata *) palloc(sizeof(AttInMetadata));
 
        /*
-        * Gather info needed later to call the "in" function for each attribute
+        * Gather info needed later to call the "in" function for each
+        * attribute
         */
        attinfuncinfo = (FmgrInfo *) palloc(natts * sizeof(FmgrInfo));
        attelems = (Oid *) palloc(natts * sizeof(Oid));
@@ -741,14 +742,14 @@ TupleDescGetAttInMetadata(TupleDesc tupdesc)
 HeapTuple
 BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
 {
-       TupleDesc                       tupdesc = attinmeta->tupdesc;
-       int                                     natts = tupdesc->natts;
-       Datum                      *dvalues;
-       char                       *nulls;
-       int                                     i;
-       Oid                                     attelem;
-       int32                           atttypmod;
-       HeapTuple                       tuple;
+       TupleDesc       tupdesc = attinmeta->tupdesc;
+       int                     natts = tupdesc->natts;
+       Datum      *dvalues;
+       char       *nulls;
+       int                     i;
+       Oid                     attelem;
+       int32           atttypmod;
+       HeapTuple       tuple;
 
        dvalues = (Datum *) palloc(natts * sizeof(Datum));
        nulls = (char *) palloc(natts * sizeof(char));
@@ -843,13 +844,14 @@ do_text_output_multiline(TupOutputState *tstate, char *text)
 {
        while (*text)
        {
-               char   *eol;
+               char       *eol;
 
                eol = strchr(text, '\n');
                if (eol)
                        *eol++ = '\0';
                else
-                       eol = text + strlen(text);
+                       eol = text +strlen(text);
+
                do_tup_output(tstate, &text);
                text = eol;
        }
index 3e8cf20..86440d1 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.89 2002/09/02 01:05:05 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.90 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -297,19 +297,19 @@ ExecAssignResultTypeFromTL(Plan *node, CommonState *commonstate)
        /*
         * This is pretty grotty: we need to ensure that result tuples have
         * space for an OID iff they are going to be stored into a relation
-        * that has OIDs.  We assume that estate->es_result_relation_info
-        * is already set up to describe the target relation.  One reason
-        * this is ugly is that all plan nodes in the plan tree will emit
-        * tuples with space for an OID, though we really only need the topmost
-        * plan to do so.
+        * that has OIDs.  We assume that estate->es_result_relation_info is
+        * already set up to describe the target relation.      One reason this is
+        * ugly is that all plan nodes in the plan tree will emit tuples with
+        * space for an OID, though we really only need the topmost plan to do
+        * so.
         *
         * It would be better to have InitPlan adjust the topmost plan node's
         * output descriptor after plan tree initialization.  However, that
         * doesn't quite work because in an UPDATE that spans an inheritance
-        * tree, some of the target relations may have OIDs and some not.
-        * We have to make the decision on a per-relation basis as we initialize
-        * each of the child plans of the topmost Append plan.  So, this is ugly
-        * but it works, for now ...
+        * tree, some of the target relations may have OIDs and some not. We
+        * have to make the decision on a per-relation basis as we initialize
+        * each of the child plans of the topmost Append plan.  So, this is
+        * ugly but it works, for now ...
         */
        ri = node->state->es_result_relation_info;
        if (ri != NULL)
@@ -319,7 +319,7 @@ ExecAssignResultTypeFromTL(Plan *node, CommonState *commonstate)
                if (rel != NULL)
                        hasoid = rel->rd_rel->relhasoids;
        }
-               
+
        tupDesc = ExecTypeFromTL(node->targetlist, hasoid);
        ExecAssignResultType(commonstate, tupDesc, true);
 }
@@ -696,7 +696,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
                                           nullv);
 
                /*
-                * The index AM does the rest.  Note we suppress unique-index
+                * The index AM does the rest.  Note we suppress unique-index
                 * checks if we are being called from VACUUM, since VACUUM may
                 * need to move dead tuples that have the same keys as live ones.
                 */
@@ -705,7 +705,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
                                                          nullv,        /* info on nulls */
                                                          &(heapTuple->t_self),         /* tid of heap tuple */
                                                          heapRelation,
-                                                         relationDescs[i]->rd_index->indisunique && !is_vacuum);
+                                 relationDescs[i]->rd_index->indisunique && !is_vacuum);
 
                /*
                 * keep track of index inserts for debugging
@@ -753,7 +753,7 @@ RegisterExprContextCallback(ExprContext *econtext,
                                                        ExprContextCallbackFunction function,
                                                        Datum arg)
 {
-       ExprContext_CB   *ecxt_callback;
+       ExprContext_CB *ecxt_callback;
 
        /* Save the info in appropriate memory context */
        ecxt_callback = (ExprContext_CB *)
@@ -779,8 +779,8 @@ UnregisterExprContextCallback(ExprContext *econtext,
                                                          ExprContextCallbackFunction function,
                                                          Datum arg)
 {
-       ExprContext_CB   **prev_callback;
-       ExprContext_CB   *ecxt_callback;
+       ExprContext_CB **prev_callback;
+       ExprContext_CB *ecxt_callback;
 
        prev_callback = &econtext->ecxt_callbacks;
 
@@ -792,9 +792,7 @@ UnregisterExprContextCallback(ExprContext *econtext,
                        pfree(ecxt_callback);
                }
                else
-               {
                        prev_callback = &ecxt_callback->next;
-               }
        }
 }
 
@@ -807,7 +805,7 @@ UnregisterExprContextCallback(ExprContext *econtext,
 static void
 ShutdownExprContext(ExprContext *econtext)
 {
-       ExprContext_CB   *ecxt_callback;
+       ExprContext_CB *ecxt_callback;
 
        /*
         * Call each callback function in reverse registration order.
index fe47340..b8bf811 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.56 2002/08/29 00:17:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.57 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -269,7 +269,7 @@ postquel_start(execution_state *es)
 static TupleTableSlot *
 postquel_getnext(execution_state *es)
 {
-       long    count;
+       long            count;
 
        if (es->qd->operation == CMD_UTILITY)
        {
@@ -566,8 +566,8 @@ fmgr_sql(PG_FUNCTION_ARGS)
                        elog(ERROR, "Set-valued function called in context that cannot accept a set");
 
                /*
-                * Ensure we will get shut down cleanly if the exprcontext is
-                * not run to completion.
+                * Ensure we will get shut down cleanly if the exprcontext is not
+                * run to completion.
                 */
                if (!fcache->shutdown_reg)
                {
index de83926..1a9239c 100644 (file)
@@ -46,7 +46,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.85 2002/06/20 20:29:28 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.86 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -877,8 +877,8 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
                                                &peraggstate->transtypeByVal);
 
                /*
-                * initval is potentially null, so don't try to access it as a struct
-                * field. Must do it the hard way with SysCacheGetAttr.
+                * initval is potentially null, so don't try to access it as a
+                * struct field. Must do it the hard way with SysCacheGetAttr.
                 */
                textInitVal = SysCacheGetAttr(AGGFNOID, aggTuple,
                                                                          Anum_pg_aggregate_agginitval,
@@ -907,8 +907,8 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
                if (peraggstate->transfn.fn_strict && peraggstate->initValueIsNull)
                {
                        /*
-                        * Note: use the type from the input expression here, not
-                        * from pg_proc.proargtypes, because the latter might be 0.
+                        * Note: use the type from the input expression here, not from
+                        * pg_proc.proargtypes, because the latter might be 0.
                         * (Consider COUNT(*).)
                         */
                        Oid                     inputType = exprType(aggref->target);
@@ -921,8 +921,8 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
                if (aggref->aggdistinct)
                {
                        /*
-                        * Note: use the type from the input expression here, not
-                        * from pg_proc.proargtypes, because the latter might be 0.
+                        * Note: use the type from the input expression here, not from
+                        * pg_proc.proargtypes, because the latter might be 0.
                         * (Consider COUNT(*).)
                         */
                        Oid                     inputType = exprType(aggref->target);
index 8a9ac84..cf8d74a 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.11 2002/09/02 01:05:05 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.12 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -50,13 +50,13 @@ static bool tupledesc_mismatch(TupleDesc tupdesc1, TupleDesc tupdesc2);
 static TupleTableSlot *
 FunctionNext(FunctionScan *node)
 {
-       TupleTableSlot     *slot;
-       EState                     *estate;
-       ScanDirection           direction;
-       Tuplestorestate    *tuplestorestate;
-       FunctionScanState  *scanstate;
-       bool                            should_free;
-       HeapTuple                       heapTuple;
+       TupleTableSlot *slot;
+       EState     *estate;
+       ScanDirection direction;
+       Tuplestorestate *tuplestorestate;
+       FunctionScanState *scanstate;
+       bool            should_free;
+       HeapTuple       heapTuple;
 
        /*
         * get information from the estate and scan state
@@ -69,12 +69,13 @@ FunctionNext(FunctionScan *node)
 
        /*
         * If first time through, read all tuples from function and put them
-        * in a tuplestore. Subsequent calls just fetch tuples from tuplestore.
+        * in a tuplestore. Subsequent calls just fetch tuples from
+        * tuplestore.
         */
        if (tuplestorestate == NULL)
        {
-               ExprContext        *econtext = scanstate->csstate.cstate.cs_ExprContext;
-               TupleDesc               funcTupdesc;
+               ExprContext *econtext = scanstate->csstate.cstate.cs_ExprContext;
+               TupleDesc       funcTupdesc;
 
                scanstate->tuplestorestate = tuplestorestate =
                        ExecMakeTableFunctionResult((Expr *) scanstate->funcexpr,
@@ -83,9 +84,9 @@ FunctionNext(FunctionScan *node)
                                                                                &funcTupdesc);
 
                /*
-                * If function provided a tupdesc, cross-check it.  We only really
-                * need to do this for functions returning RECORD, but might as well
-                * do it always.
+                * If function provided a tupdesc, cross-check it.      We only really
+                * need to do this for functions returning RECORD, but might as
+                * well do it always.
                 */
                if (funcTupdesc &&
                        tupledesc_mismatch(scanstate->tupdesc, funcTupdesc))
@@ -98,7 +99,7 @@ FunctionNext(FunctionScan *node)
        slot = scanstate->csstate.css_ScanTupleSlot;
        if (tuplestorestate)
                heapTuple = tuplestore_getheaptuple(tuplestorestate,
-                                                                                       ScanDirectionIsForward(direction),
+                                                                          ScanDirectionIsForward(direction),
                                                                                        &should_free);
        else
        {
@@ -135,11 +136,11 @@ ExecFunctionScan(FunctionScan *node)
 bool
 ExecInitFunctionScan(FunctionScan *node, EState *estate, Plan *parent)
 {
-       FunctionScanState  *scanstate;
-       RangeTblEntry      *rte;
-       Oid                                     funcrettype;
-       char                            functyptype;
-       TupleDesc                       tupdesc = NULL;
+       FunctionScanState *scanstate;
+       RangeTblEntry *rte;
+       Oid                     funcrettype;
+       char            functyptype;
+       TupleDesc       tupdesc = NULL;
 
        /*
         * FunctionScan should not have any children.
@@ -266,8 +267,8 @@ ExecCountSlotsFunctionScan(FunctionScan *node)
 void
 ExecEndFunctionScan(FunctionScan *node)
 {
-       FunctionScanState  *scanstate;
-       EState                     *estate;
+       FunctionScanState *scanstate;
+       EState     *estate;
 
        /*
         * get information from node
@@ -308,7 +309,7 @@ ExecEndFunctionScan(FunctionScan *node)
 void
 ExecFunctionMarkPos(FunctionScan *node)
 {
-       FunctionScanState  *scanstate;
+       FunctionScanState *scanstate;
 
        scanstate = (FunctionScanState *) node->scan.scanstate;
 
@@ -330,7 +331,7 @@ ExecFunctionMarkPos(FunctionScan *node)
 void
 ExecFunctionRestrPos(FunctionScan *node)
 {
-       FunctionScanState  *scanstate;
+       FunctionScanState *scanstate;
 
        scanstate = (FunctionScanState *) node->scan.scanstate;
 
@@ -352,7 +353,7 @@ ExecFunctionRestrPos(FunctionScan *node)
 void
 ExecFunctionReScan(FunctionScan *node, ExprContext *exprCtxt, Plan *parent)
 {
-       FunctionScanState  *scanstate;
+       FunctionScanState *scanstate;
 
        /*
         * get information from node
index 466452d..8bb5bde 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
- *     $Id: nodeHash.c,v 1.65 2002/09/02 02:47:02 momjian Exp $
+ *     $Id: nodeHash.c,v 1.66 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,7 +31,7 @@
 #include "utils/lsyscache.h"
 
 
-static uint32  hashFunc(Datum key, int typLen, bool byVal);
+static uint32 hashFunc(Datum key, int typLen, bool byVal);
 
 /* ----------------------------------------------------------------
  *             ExecHash
@@ -639,11 +639,11 @@ hashFunc(Datum key, int typLen, bool byVal)
        {
                /*
                 * If it's a by-value data type, just hash the whole Datum value.
-                * This assumes that datatypes narrower than Datum are consistently
-                * padded (either zero-extended or sign-extended, but not random
-                * bits) to fill Datum; see the XXXGetDatum macros in postgres.h.
-                * NOTE: it would not work to do hash_any(&key, len) since this
-                * would get the wrong bytes on a big-endian machine.
+                * This assumes that datatypes narrower than Datum are
+                * consistently padded (either zero-extended or sign-extended, but
+                * not random bits) to fill Datum; see the XXXGetDatum macros in
+                * postgres.h. NOTE: it would not work to do hash_any(&key, len)
+                * since this would get the wrong bytes on a big-endian machine.
                 */
                k = (unsigned char *) &key;
                typLen = sizeof(Datum);
@@ -658,14 +658,14 @@ hashFunc(Datum key, int typLen, bool byVal)
                else if (typLen == -1)
                {
                        /*
-                        * It's a varlena type, so 'key' points to a
-                        * "struct varlena".    NOTE: VARSIZE returns the
-                        * "real" data length plus the sizeof the "vl_len" attribute of
-                        * varlena (the length information). 'key' points to the beginning
-                        * of the varlena struct, so we have to use "VARDATA" to find the
-                        * beginning of the "real" data.  Also, we have to be careful to
-                        * detoast the datum if it's toasted.  (We don't worry about
-                        * freeing the detoasted copy; that happens for free when the
+                        * It's a varlena type, so 'key' points to a "struct varlena".
+                        * NOTE: VARSIZE returns the "real" data length plus the
+                        * sizeof the "vl_len" attribute of varlena (the length
+                        * information). 'key' points to the beginning of the varlena
+                        * struct, so we have to use "VARDATA" to find the beginning
+                        * of the "real" data.  Also, we have to be careful to detoast
+                        * the datum if it's toasted.  (We don't worry about freeing
+                        * the detoasted copy; that happens for free when the
                         * per-tuple memory context is reset in ExecHashGetBucket.)
                         */
                        struct varlena *vkey = PG_DETOAST_DATUM(key);
index 5eb15f7..78f5ad0 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.70 2002/06/23 21:29:32 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.71 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -165,22 +165,21 @@ IndexNext(IndexScan *node)
                while ((tuple = index_getnext(scandesc, direction)) != NULL)
                {
                        /*
-                        * store the scanned tuple in the scan tuple slot of the
-                        * scan state.  Note: we pass 'false' because tuples
-                        * returned by amgetnext are pointers onto disk pages and
-                        * must not be pfree()'d.
+                        * store the scanned tuple in the scan tuple slot of the scan
+                        * state.  Note: we pass 'false' because tuples returned by
+                        * amgetnext are pointers onto disk pages and must not be
+                        * pfree()'d.
                         */
-                       ExecStoreTuple(tuple,   /* tuple to store */
+                       ExecStoreTuple(tuple,           /* tuple to store */
                                                   slot,        /* slot to store in */
-                                                  scandesc->xs_cbuf, /* buffer containing tuple */
-                                                  false);      /* don't pfree */
+                                                  scandesc->xs_cbuf,   /* buffer containing tuple */
+                                                  false);              /* don't pfree */
 
                        /*
                         * We must check to see if the current tuple was already
-                        * matched by an earlier index, so we don't double-report
-                        * it. We do this by passing the tuple through ExecQual
-                        * and checking for failure with all previous
-                        * qualifications.
+                        * matched by an earlier index, so we don't double-report it.
+                        * We do this by passing the tuple through ExecQual and
+                        * checking for failure with all previous qualifications.
                         */
                        if (indexstate->iss_IndexPtr > 0)
                        {
@@ -485,8 +484,9 @@ ExecEndIndexScan(IndexScan *node)
         * close the heap relation.
         *
         * Currently, we do not release the AccessShareLock acquired by
-        * ExecInitIndexScan.  This lock should be held till end of transaction.
-        * (There is a faction that considers this too much locking, however.)
+        * ExecInitIndexScan.  This lock should be held till end of
+        * transaction. (There is a faction that considers this too much
+        * locking, however.)
         */
        heap_close(relation, NoLock);
 
@@ -1009,7 +1009,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
                elog(ERROR, "indexes of the relation %u was inactivated", reloid);
 
        scanstate->css_currentRelation = currentRelation;
-       scanstate->css_currentScanDesc = NULL; /* no heap scan here */
+       scanstate->css_currentScanDesc = NULL;          /* no heap scan here */
 
        /*
         * get the scan type from the relation descriptor.
index 4467fef..4237618 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.50 2002/06/20 20:29:28 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.51 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -93,7 +93,7 @@ static bool MergeCompare(List *eqQual, List *compareQual, ExprContext *econtext)
  *             This takes the mergeclause which is a qualification of the
  *             form ((= expr expr) (= expr expr) ...) and forms new lists
  *             of the forms ((< expr expr) (< expr expr) ...) and
- *             ((> expr expr) (> expr expr) ...).  These lists will be used
+ *             ((> expr expr) (> expr expr) ...).      These lists will be used
  *             by ExecMergeJoin() to determine if we should skip tuples.
  *             (We expect there to be suitable operators because the "=" operators
  *             were marked mergejoinable; however, there might be a different
index ddfcd3b..074a527 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.36 2002/06/20 20:29:28 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.37 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -284,8 +284,9 @@ ExecEndSeqScan(SeqScan *node)
         * close the heap relation.
         *
         * Currently, we do not release the AccessShareLock acquired by
-        * InitScanRelation.  This lock should be held till end of transaction.
-        * (There is a faction that considers this too much locking, however.)
+        * InitScanRelation.  This lock should be held till end of
+        * transaction. (There is a faction that considers this too much
+        * locking, however.)
         */
        heap_close(relation, NoLock);
 
index 300735f..f5e4776 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.25 2002/06/20 20:29:28 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.26 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -109,8 +109,8 @@ TidNext(TidScan *node)
                        return slot;            /* return empty slot */
 
                /*
-                * XXX shouldn't we check here to make sure tuple matches TID list?
-                * In runtime-key case this is not certain, is it?
+                * XXX shouldn't we check here to make sure tuple matches TID
+                * list? In runtime-key case this is not certain, is it?
                 */
 
                ExecStoreTuple(estate->es_evTuple[node->scan.scanrelid - 1],
@@ -468,7 +468,7 @@ ExecInitTidScan(TidScan *node, EState *estate, Plan *parent)
        currentRelation = heap_open(reloid, AccessShareLock);
 
        scanstate->css_currentRelation = currentRelation;
-       scanstate->css_currentScanDesc = NULL; /* no heap scan here */
+       scanstate->css_currentScanDesc = NULL;          /* no heap scan here */
 
        /*
         * get the scan type from the relation descriptor.
index f0cc3fe..273fe6f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.73 2002/09/02 01:05:05 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.74 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -433,6 +433,7 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
        if (i == natts)                         /* no errors in *attnum */
        {
                mtuple = heap_formtuple(rel->rd_att, v, n);
+
                /*
                 * copy the identification info of the old tuple: t_ctid, t_self,
                 * and OID (if any)
@@ -1098,7 +1099,7 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, char *Nulls, int tcount)
                                ParamListInfo paramLI;
 
                                paramLI = (ParamListInfo) palloc((nargs + 1) *
-                                                                                                sizeof(ParamListInfoData));
+                                                                                         sizeof(ParamListInfoData));
                                MemSet(paramLI, 0, (nargs + 1) * sizeof(ParamListInfoData));
 
                                state->es_param_list_info = paramLI;
@@ -1266,9 +1267,9 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
                ExecutorRun(querydesc, estate, direction, (long) count);
 
                if (estate->es_processed > 0)
-                       portal->atStart = false; /* OK to back up now */
+                       portal->atStart = false;        /* OK to back up now */
                if (count <= 0 || (int) estate->es_processed < count)
-                       portal->atEnd = true;   /* we retrieved 'em all */
+                       portal->atEnd = true;           /* we retrieved 'em all */
        }
        else
        {
@@ -1280,9 +1281,9 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
                ExecutorRun(querydesc, estate, direction, (long) count);
 
                if (estate->es_processed > 0)
-                       portal->atEnd = false;  /* OK to go forward now */
+                       portal->atEnd = false;          /* OK to go forward now */
                if (count <= 0 || (int) estate->es_processed < count)
-                       portal->atStart = true; /* we retrieved 'em all */
+                       portal->atStart = true;         /* we retrieved 'em all */
        }
 
        _SPI_current->processed = estate->es_processed;
index 62f63a5..9b9fc3d 100644 (file)
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *       $Id: stringinfo.c,v 1.31 2002/06/20 20:29:28 momjian Exp $
+ *       $Id: stringinfo.c,v 1.32 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -120,7 +120,7 @@ appendStringInfo(StringInfo str, const char *fmt,...)
                         * an example of a platform with such a bug.
                         */
 #ifdef USE_ASSERT_CHECKING
-                       str->data[str->maxlen-1] = '\0';
+                       str->data[str->maxlen - 1] = '\0';
 #endif
 
                        va_start(args, fmt);
@@ -128,7 +128,7 @@ appendStringInfo(StringInfo str, const char *fmt,...)
                                                                 fmt, args);
                        va_end(args);
 
-                       Assert(str->data[str->maxlen-1] == '\0');
+                       Assert(str->data[str->maxlen - 1] == '\0');
 
                        /*
                         * Note: some versions of vsnprintf return the number of chars
index 09129dd..7be74c5 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.89 2002/09/02 02:47:02 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.90 2002/09/04 20:31:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -130,7 +130,6 @@ pg_krb4_recvauth(Port *port)
        elog(LOG, "pg_krb4_recvauth: Kerberos not implemented on this server");
        return STATUS_ERROR;
 }
-
 #endif   /* KRB4 */
 
 
@@ -310,7 +309,6 @@ pg_krb5_recvauth(Port *port)
        elog(LOG, "pg_krb5_recvauth: Kerberos not implemented on this server");
        return STATUS_ERROR;
 }
-
 #endif   /* KRB5 */
 
 
@@ -416,7 +414,7 @@ ClientAuthentication(Port *port)
                                if (port->raddr.sa.sa_family == AF_INET)
                                        hostinfo = inet_ntoa(port->raddr.in.sin_addr);
                                elog(FATAL,
-                                        "No pg_hba.conf entry for host %s, user %s, database %s",
+                               "No pg_hba.conf entry for host %s, user %s, database %s",
                                         hostinfo, port->user, port->database);
                                break;
                        }
@@ -513,8 +511,8 @@ sendAuthRequest(Port *port, AuthRequest areq)
        pq_endmessage(&buf);
 
        /*
-        * Flush message so client will see it, except for AUTH_REQ_OK,
-        * which need not be sent until we are ready for queries.
+        * Flush message so client will see it, except for AUTH_REQ_OK, which
+        * need not be sent until we are ready for queries.
         */
        if (areq != AUTH_REQ_OK)
                pq_flush();
@@ -688,7 +686,7 @@ CheckPAMAuth(Port *port, char *user, char *password)
                         pam_strerror(pamh, retval));
        }
 
-       pam_passwd = NULL;              /* Unset pam_passwd */
+       pam_passwd = NULL;                      /* Unset pam_passwd */
 
        return (retval == PAM_SUCCESS ? STATUS_OK : STATUS_ERROR);
 }
@@ -714,13 +712,14 @@ recv_and_check_password_packet(Port *port)
                pfree(buf.data);
                return STATUS_EOF;
        }
+
        /*
-        * We don't actually use the password packet length the frontend
-        * sent us; however, it's a reasonable sanity check to ensure that
-        * we actually read as much data as we expected to.
+        * We don't actually use the password packet length the frontend sent
+        * us; however, it's a reasonable sanity check to ensure that we
+        * actually read as much data as we expected to.
         *
-        * The password packet size is the length of the buffer, plus the
-        * size field itself (4 bytes), plus a 1-byte terminator.
+        * The password packet size is the length of the buffer, plus the size
+        * field itself (4 bytes), plus a 1-byte terminator.
         */
        if (len != (buf.len + 4 + 1))
                elog(LOG, "unexpected password packet size: read %d, expected %d",
index 7b895de..d7dca96 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.12 2002/09/02 02:47:02 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.13 2002/09/04 20:31:19 momjian Exp $
  *
  *       Since the server static private key ($DataDir/server.key)
  *       will normally be stored unencrypted so that the database
  *       impersonations.
  *
  *       Another benefit of EDH is that it allows the backend and
- *       clients to use DSA keys.  DSA keys can only provide digital
+ *       clients to use DSA keys.      DSA keys can only provide digital
  *       signatures, not encryption, and are often acceptable in
  *       jurisdictions where RSA keys are unacceptable.
  *
  *       The downside to EDH is that it makes it impossible to
  *       use ssldump(1) if there's a problem establishing an SSL
- *       session.  In this case you'll need to temporarily disable
+ *       session.      In this case you'll need to temporarily disable
  *       EDH by commenting out the callback.
  *
  *       ...
@@ -49,7 +49,7 @@
  *       milestone 1: fix basic coding errors
  *       [*] existing SSL code pulled out of existing files.
  *       [*] SSL_get_error() after SSL_read() and SSL_write(),
- *           SSL_shutdown(), default to TLSv1.
+ *               SSL_shutdown(), default to TLSv1.
  *
  *       milestone 2: provide endpoint authentication (server)
  *       [*] client verifies server cert
 extern void ExitPostmaster(int);
 extern void postmaster_error(const char *fmt,...);
 
-int secure_initialize(void);
-void secure_destroy(void);
-int secure_open_server(Port *);
-void secure_close(Port *);
-ssize_t secure_read(Port *, void *ptr, size_t len);
-ssize_t secure_write(Port *, const void *ptr, size_t len);
+int                    secure_initialize(void);
+void           secure_destroy(void);
+int                    secure_open_server(Port *);
+void           secure_close(Port *);
+ssize_t                secure_read(Port *, void *ptr, size_t len);
+ssize_t                secure_write(Port *, const void *ptr, size_t len);
 
 #ifdef USE_SSL
-static DH *load_dh_file(int keylength);
-static DH *load_dh_buffer(const char *, size_t);
-static DH *tmp_dh_cb(SSL *s, int is_export, int keylength);
-static int verify_cb(int, X509_STORE_CTX *);
+static DH  *load_dh_file(int keylength);
+static DH  *load_dh_buffer(const char *, size_t);
+static DH  *tmp_dh_cb(SSL *s, int is_export, int keylength);
+static int     verify_cb(int, X509_STORE_CTX *);
 static void info_cb(SSL *ssl, int type, int args);
-static int initialize_SSL(void);
+static int     initialize_SSL(void);
 static void destroy_SSL(void);
-static int open_server_SSL(Port *);
+static int     open_server_SSL(Port *);
 static void close_SSL(Port *);
 static const char *SSLerrmessage(void);
 #endif
@@ -137,13 +137,13 @@ static const char *SSLerrmessage(void);
  *     How much data can be sent across a secure connection
  *     (total in both directions) before we require renegotiation.
  */
-#define RENEGOTIATION_LIMIT    (64 * 1024)
-#define CA_PATH        NULL
+#define RENEGOTIATION_LIMIT (64 * 1024)
+#define CA_PATH NULL
 static SSL_CTX *SSL_context = NULL;
 #endif
 
 /* ------------------------------------------------------------ */
-/*                       Hardcoded values                       */
+/*                                              Hardcoded values                                               */
 /* ------------------------------------------------------------ */
 
 /*
@@ -207,16 +207,16 @@ KWbuHn491xNO25CQWMtem80uKw+pTnisBRF/454n1Jnhub144YRBoN8CAQI=\n\
 -----END DH PARAMETERS-----\n";
 
 /* ------------------------------------------------------------ */
-/*           Procedures common to all secure sessions           */
+/*                      Procedures common to all secure sessions                       */
 /* ------------------------------------------------------------ */
 
 /*
  *     Initialize global context
  */
 int
-secure_initialize (void)
+secure_initialize(void)
 {
-       int r = 0;
+       int                     r = 0;
 
 #ifdef USE_SSL
        r = initialize_SSL();
@@ -229,7 +229,7 @@ secure_initialize (void)
  *     Destroy global context
  */
 void
-secure_destroy (void)
+secure_destroy(void)
 {
 #ifdef USE_SSL
        destroy_SSL();
@@ -240,9 +240,9 @@ secure_destroy (void)
  *     Attempt to negotiate secure session.
  */
 int
-secure_open_server (Port *port)
+secure_open_server(Port *port)
 {
-       int r = 0;
+       int                     r = 0;
 
 #ifdef USE_SSL
        r = open_server_SSL(port);
@@ -255,7 +255,7 @@ secure_open_server (Port *port)
  *     Close secure session.
  */
 void
-secure_close (Port *port)
+secure_close(Port *port)
 {
 #ifdef USE_SSL
        if (port->ssl)
@@ -267,9 +267,9 @@ secure_close (Port *port)
  *     Read data from a secure connection.
  */
 ssize_t
-secure_read (Port *port, void *ptr, size_t len)
+secure_read(Port *port, void *ptr, size_t len)
 {
-       ssize_t n;
+       ssize_t         n;
 
 #ifdef USE_SSL
        if (port->ssl)
@@ -283,28 +283,28 @@ secure_read (Port *port, void *ptr, size_t len)
                n = SSL_read(port->ssl, ptr, len);
                switch (SSL_get_error(port->ssl, n))
                {
-               case SSL_ERROR_NONE:
-                       port->count += n;
-                       break;
-               case SSL_ERROR_WANT_READ:
-                       break;
-               case SSL_ERROR_SYSCALL:
-                       errno = get_last_socket_error();
-                       elog(ERROR, "SSL SYSCALL error: %s", strerror(errno));
-                       break;
-               case SSL_ERROR_SSL:
-                       elog(ERROR, "SSL error: %s", SSLerrmessage());
-                       /* fall through */
-               case SSL_ERROR_ZERO_RETURN:
-                       secure_close(port);
-                       errno = ECONNRESET;
-                       n = -1;
-                       break;
+                       case SSL_ERROR_NONE:
+                               port->count += n;
+                               break;
+                       case SSL_ERROR_WANT_READ:
+                               break;
+                       case SSL_ERROR_SYSCALL:
+                               errno = get_last_socket_error();
+                               elog(ERROR, "SSL SYSCALL error: %s", strerror(errno));
+                               break;
+                       case SSL_ERROR_SSL:
+                               elog(ERROR, "SSL error: %s", SSLerrmessage());
+                               /* fall through */
+                       case SSL_ERROR_ZERO_RETURN:
+                               secure_close(port);
+                               errno = ECONNRESET;
+                               n = -1;
+                               break;
                }
        }
        else
 #endif
-       n = recv(port->sock, ptr, len, 0);
+               n = recv(port->sock, ptr, len, 0);
 
        return n;
 }
@@ -313,12 +313,12 @@ secure_read (Port *port, void *ptr, size_t len)
  *     Write data to a secure connection.
  */
 ssize_t
-secure_write (Port *port, const void *ptr, size_t len)
+secure_write(Port *port, const void *ptr, size_t len)
 {
-       ssize_t n;
+       ssize_t         n;
 
 #ifndef WIN32
-       pqsigfunc oldsighandler = pqsignal(SIGPIPE, SIG_IGN);
+       pqsigfunc       oldsighandler = pqsignal(SIGPIPE, SIG_IGN);
 #endif
 
 #ifdef USE_SSL
@@ -333,28 +333,28 @@ secure_write (Port *port, const void *ptr, size_t len)
                n = SSL_write(port->ssl, ptr, len);
                switch (SSL_get_error(port->ssl, n))
                {
-               case SSL_ERROR_NONE:
-                       port->count += n;
-                       break;
-               case SSL_ERROR_WANT_WRITE:
-                       break;
-               case SSL_ERROR_SYSCALL:
-                       errno = get_last_socket_error();
-                       elog(ERROR, "SSL SYSCALL error: %s", strerror(errno));
-                       break;
-               case SSL_ERROR_SSL:
-                       elog(ERROR, "SSL error: %s", SSLerrmessage());
-                       /* fall through */
-               case SSL_ERROR_ZERO_RETURN:
-                       secure_close(port);
-                       errno = ECONNRESET;
-                       n = -1;
-                       break;
+                       case SSL_ERROR_NONE:
+                               port->count += n;
+                               break;
+                       case SSL_ERROR_WANT_WRITE:
+                               break;
+                       case SSL_ERROR_SYSCALL:
+                               errno = get_last_socket_error();
+                               elog(ERROR, "SSL SYSCALL error: %s", strerror(errno));
+                               break;
+                       case SSL_ERROR_SSL:
+                               elog(ERROR, "SSL error: %s", SSLerrmessage());
+                               /* fall through */
+                       case SSL_ERROR_ZERO_RETURN:
+                               secure_close(port);
+                               errno = ECONNRESET;
+                               n = -1;
+                               break;
                }
        }
        else
 #endif
-       n = send(port->sock, ptr, len, 0);
+               n = send(port->sock, ptr, len, 0);
 
 #ifndef WIN32
        pqsignal(SIGPIPE, oldsighandler);
@@ -364,7 +364,7 @@ secure_write (Port *port, const void *ptr, size_t len)
 }
 
 /* ------------------------------------------------------------ */
-/*                        SSL specific code                     */
+/*                                               SSL specific code                                             */
 /* ------------------------------------------------------------ */
 #ifdef USE_SSL
 /*
@@ -374,13 +374,13 @@ secure_write (Port *port, const void *ptr, size_t len)
  *     to verify that the DBA-generated DH parameters file contains
  *     what we expect it to contain.
  */
-static DH *
-load_dh_file (int keylength)
+static DH  *
+load_dh_file(int keylength)
 {
-       FILE *fp;
-       char fnbuf[2048];
-       DH *dh = NULL;
-       int codes;
+       FILE       *fp;
+       char            fnbuf[2048];
+       DH                 *dh = NULL;
+       int                     codes;
 
        /* attempt to open file.  It's not an error if it doesn't exist. */
        snprintf(fnbuf, sizeof fnbuf, "%s/dh%d.pem", DataDir, keylength);
@@ -393,10 +393,10 @@ load_dh_file (int keylength)
        fclose(fp);
 
        /* is the prime the correct size? */
-       if (dh != NULL && 8*DH_size(dh) < keylength)
+       if (dh != NULL && 8 * DH_size(dh) < keylength)
        {
                elog(LOG, "DH errors (%s): %d bits expected, %d bits found",
-                       fnbuf, keylength, 8*DH_size(dh));
+                        fnbuf, keylength, 8 * DH_size(dh));
                dh = NULL;
        }
 
@@ -417,8 +417,8 @@ load_dh_file (int keylength)
                        (codes & DH_CHECK_P_NOT_SAFE_PRIME))
                {
                        elog(LOG,
-                               "DH error (%s): neither suitable generator or safe prime",
-                               fnbuf);
+                          "DH error (%s): neither suitable generator or safe prime",
+                                fnbuf);
                        return NULL;
                }
        }
@@ -432,11 +432,11 @@ load_dh_file (int keylength)
  *     To prevent problems if the DH parameters files don't even
  *     exist, we can load DH parameters hardcoded into this file.
  */
-static DH *
-load_dh_buffer (const char *buffer, size_t len)
+static DH  *
+load_dh_buffer(const char *buffer, size_t len)
 {
-       BIO *bio;
-       DH *dh = NULL;
+       BIO                *bio;
+       DH                 *dh = NULL;
 
        bio = BIO_new_mem_buf((char *) buffer, len);
        if (bio == NULL)
@@ -462,58 +462,58 @@ load_dh_buffer (const char *buffer, size_t len)
  *     the OpenSSL library can efficiently generate random keys from
  *     the information provided.
  */
-static DH *
-tmp_dh_cb (SSL *s, int is_export, int keylength)
+static DH  *
+tmp_dh_cb(SSL *s, int is_export, int keylength)
 {
-       DH *r = NULL;
-       static DH *dh = NULL;
-       static DH *dh512 = NULL;
-       static DH *dh1024 = NULL;
-       static DH *dh2048 = NULL;
-       static DH *dh4096 = NULL;
+       DH                 *r = NULL;
+       static DH  *dh = NULL;
+       static DH  *dh512 = NULL;
+       static DH  *dh1024 = NULL;
+       static DH  *dh2048 = NULL;
+       static DH  *dh4096 = NULL;
 
        switch (keylength)
        {
-       case 512:
-               if (dh512 == NULL)
-                       dh512 = load_dh_file(keylength);
-               if (dh512 == NULL)
-                       dh512 = load_dh_buffer(file_dh512, sizeof file_dh512);
-               r = dh512;
-               break;
-
-       case 1024:
-               if (dh1024 == NULL)
-                       dh1024 = load_dh_file(keylength);
-               if (dh1024 == NULL)
-                       dh1024 = load_dh_buffer(file_dh1024, sizeof file_dh1024);
-               r = dh1024;
-               break;
-
-       case 2048:
-               if (dh2048 == NULL)
-                       dh2048 = load_dh_file(keylength);
-               if (dh2048 == NULL)
-                       dh2048 = load_dh_buffer(file_dh2048, sizeof file_dh2048);
-               r = dh2048;
-               break;
-
-       case 4096:
-               if (dh4096 == NULL)
-                       dh4096 = load_dh_file(keylength);
-               if (dh4096 == NULL)
-                       dh4096 = load_dh_buffer(file_dh4096, sizeof file_dh4096);
-               r = dh4096;
-               break;
-
-       default:
-               if (dh == NULL)
-                       dh = load_dh_file(keylength);
-               r = dh;
+               case 512:
+                       if (dh512 == NULL)
+                               dh512 = load_dh_file(keylength);
+                       if (dh512 == NULL)
+                               dh512 = load_dh_buffer(file_dh512, sizeof file_dh512);
+                       r = dh512;
+                       break;
+
+               case 1024:
+                       if (dh1024 == NULL)
+                               dh1024 = load_dh_file(keylength);
+                       if (dh1024 == NULL)
+                               dh1024 = load_dh_buffer(file_dh1024, sizeof file_dh1024);
+                       r = dh1024;
+                       break;
+
+               case 2048:
+                       if (dh2048 == NULL)
+                               dh2048 = load_dh_file(keylength);
+                       if (dh2048 == NULL)
+                               dh2048 = load_dh_buffer(file_dh2048, sizeof file_dh2048);
+                       r = dh2048;
+                       break;
+
+               case 4096:
+                       if (dh4096 == NULL)
+                               dh4096 = load_dh_file(keylength);
+                       if (dh4096 == NULL)
+                               dh4096 = load_dh_buffer(file_dh4096, sizeof file_dh4096);
+                       r = dh4096;
+                       break;
+
+               default:
+                       if (dh == NULL)
+                               dh = load_dh_file(keylength);
+                       r = dh;
        }
 
        /* this may take a long time, but it may be necessary... */
-       if (r == NULL || 8*DH_size(r) < keylength)
+       if (r == NULL || 8 * DH_size(r) < keylength)
        {
                elog(DEBUG1, "DH: generating parameters (%d bits)....", keylength);
                r = DH_generate_parameters(keylength, DH_GENERATOR_2, NULL, NULL);
@@ -534,7 +534,7 @@ tmp_dh_cb (SSL *s, int is_export, int keylength)
  *     for now we accept the default checks.
  */
 static int
-verify_cb (int ok, X509_STORE_CTX *ctx)
+verify_cb(int ok, X509_STORE_CTX *ctx)
 {
        return ok;
 }
@@ -544,7 +544,7 @@ verify_cb (int ok, X509_STORE_CTX *ctx)
  *     into the PostgreSQL log.
  */
 static void
-info_cb (SSL *ssl, int type, int args)
+info_cb(SSL *ssl, int type, int args)
 {
        switch (type)
        {
@@ -579,9 +579,9 @@ info_cb (SSL *ssl, int type, int args)
  *     Initialize global SSL context.
  */
 static int
-initialize_SSL (void)
+initialize_SSL(void)
 {
-       char fnbuf[2048];
+       char            fnbuf[2048];
        struct stat buf;
 
        if (!SSL_context)
@@ -597,7 +597,7 @@ initialize_SSL (void)
                }
 
                /*
-                *      Load and verify certificate and private key
+                * Load and verify certificate and private key
                 */
                snprintf(fnbuf, sizeof(fnbuf), "%s/server.crt", DataDir);
                if (!SSL_CTX_use_certificate_file(SSL_context, fnbuf, SSL_FILETYPE_PEM))
@@ -647,7 +647,7 @@ initialize_SSL (void)
                ExitPostmaster(1);
        }
        SSL_CTX_set_verify(SSL_context,
-               SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, verify_cb);
+                                       SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, verify_cb);
 
        return 0;
 }
@@ -656,7 +656,7 @@ initialize_SSL (void)
  *     Destroy global SSL context.
  */
 static void
-destroy_SSL (void)
+destroy_SSL(void)
 {
        if (SSL_context)
        {
@@ -669,7 +669,7 @@ destroy_SSL (void)
  *     Attempt to negotiate SSL connection.
  */
 static int
-open_server_SSL (Port *port)
+open_server_SSL(Port *port)
 {
        if (!(port->ssl = SSL_new(SSL_context)) ||
                !SSL_set_fd(port->ssl, port->sock) ||
@@ -685,17 +685,17 @@ open_server_SSL (Port *port)
        port->peer = SSL_get_peer_certificate(port->ssl);
        if (port->peer == NULL)
        {
-               strncpy(port->peer_dn, "(anonymous)", sizeof (port->peer_dn));
-               strncpy(port->peer_cn, "(anonymous)", sizeof (port->peer_cn));
+               strncpy(port->peer_dn, "(anonymous)", sizeof(port->peer_dn));
+               strncpy(port->peer_cn, "(anonymous)", sizeof(port->peer_cn));
        }
        else
        {
                X509_NAME_oneline(X509_get_subject_name(port->peer),
-                       port->peer_dn, sizeof (port->peer_dn));
-               port->peer_dn[sizeof(port->peer_dn)-1] = '\0';
+                                                 port->peer_dn, sizeof(port->peer_dn));
+               port->peer_dn[sizeof(port->peer_dn) - 1] = '\0';
                X509_NAME_get_text_by_NID(X509_get_subject_name(port->peer),
-                       NID_commonName, port->peer_cn, sizeof (port->peer_cn));
-               port->peer_cn[sizeof(port->peer_cn)-1] = '\0';
+                                  NID_commonName, port->peer_cn, sizeof(port->peer_cn));
+               port->peer_cn[sizeof(port->peer_cn) - 1] = '\0';
        }
        elog(DEBUG1, "secure connection from '%s'", port->peer_cn);
 
@@ -709,7 +709,7 @@ open_server_SSL (Port *port)
  *     Close SSL connection.
  */
 static void
-close_SSL (Port *port)
+close_SSL(Port *port)
 {
        if (port->ssl)
        {
@@ -729,9 +729,9 @@ close_SSL (Port *port)
 static const char *
 SSLerrmessage(void)
 {
-       unsigned long   errcode;
-       const char         *errreason;
-       static char             errbuf[32];
+       unsigned long errcode;
+       const char *errreason;
+       static char errbuf[32];
 
        errcode = ERR_get_error();
        if (errcode == 0)
@@ -743,4 +743,4 @@ SSLerrmessage(void)
        return errbuf;
 }
 
-#endif /* USE_SSL */
+#endif   /* USE_SSL */
index 9636a06..9cc6b48 100644 (file)
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/backend/libpq/crypt.c,v 1.48 2002/06/20 20:29:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/crypt.c,v 1.49 2002/09/04 20:31:19 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,9 +35,9 @@ md5_crypt_verify(const Port *port, const char *user, const char *pgpass)
                           *valuntil = NULL,
                           *crypt_pwd;
        int                     retval = STATUS_ERROR;
-       List       **line;
-       List            *token;
-       
+       List      **line;
+       List       *token;
+
        if ((line = get_user_line(user)) == NULL)
                return STATUS_ERROR;
 
@@ -50,7 +50,7 @@ md5_crypt_verify(const Port *port, const char *user, const char *pgpass)
                if (token)
                        valuntil = lfirst(token);
        }
-       
+
        if (passwd == NULL || *passwd == '\0')
                return STATUS_ERROR;
 
index 0bf6371..cda4bc9 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.86 2002/09/02 02:47:02 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.87 2002/09/04 20:31:19 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -41,7 +41,7 @@
 /* Max size of username ident server can return */
 
 /* This is used to separate values in multi-valued column strings */
-#define MULTI_VALUE_SEP        "\001"
+#define MULTI_VALUE_SEP "\001"
 
 /*
  * These variables hold the pre-parsed contents of the hba and ident
  */
 static List *hba_lines = NIL;  /* pre-parsed contents of hba file */
 static List *ident_lines = NIL; /* pre-parsed contents of ident file */
-static List *group_lines = NIL;        /* pre-parsed contents of group file */
-static List *user_lines = NIL; /* pre-parsed contents of user password file */
+static List *group_lines = NIL; /* pre-parsed contents of group file */
+static List *user_lines = NIL; /* pre-parsed contents of user password
+                                                                * file */
 
 /* sorted entries so we can do binary search lookups */
-static List **user_sorted = NULL;      /* sorted user list, for bsearch() */
-static List **group_sorted = NULL;     /* sorted group list, for bsearch() */
-static int  user_length;
-static int  group_length;
+static List **user_sorted = NULL;              /* sorted user list, for bsearch() */
+static List **group_sorted = NULL;             /* sorted group list, for
+                                                                                * bsearch() */
+static int     user_length;
+static int     group_length;
 
 static List *tokenize_file(FILE *file);
 static char *tokenize_inc_file(const char *inc_filename);
@@ -78,14 +80,14 @@ isblank(const char c)
 
 
 /*
- *   Grab one token out of fp. Tokens are strings of non-blank
- *   characters bounded by blank characters, beginning of line, and
- *   end of line. Blank means space or tab. Return the token as
- *   *buf. Leave file positioned to character immediately after the
- *   token or EOF, whichever comes first. If no more tokens on line,
- *   return null string as *buf and position file to beginning of
- *   next line or EOF, whichever comes first. Allow spaces in quoted
- *   strings. Terminate on unquoted commas. Handle comments.
+ *      Grab one token out of fp. Tokens are strings of non-blank
+ *      characters bounded by blank characters, beginning of line, and
+ *      end of line. Blank means space or tab. Return the token as
+ *      *buf. Leave file positioned to character immediately after the
+ *      token or EOF, whichever comes first. If no more tokens on line,
+ *      return null string as *buf and position file to beginning of
+ *      next line or EOF, whichever comes first. Allow spaces in quoted
+ *      strings. Terminate on unquoted commas. Handle comments.
  */
 void
 next_token(FILE *fp, char *buf, const int bufsz)
@@ -102,8 +104,8 @@ next_token(FILE *fp, char *buf, const int bufsz)
        if (c != EOF && c != '\n')
        {
                /*
-                * Build a token in buf of next characters up to EOF, EOL, unquoted
-                * comma, or unquoted whitespace.
+                * Build a token in buf of next characters up to EOF, EOL,
+                * unquoted comma, or unquoted whitespace.
                 */
                while (c != EOF && c != '\n' &&
                           (!isblank(c) || in_quote == true))
@@ -156,9 +158,9 @@ next_token(FILE *fp, char *buf, const int bufsz)
 }
 
 /*
- *   Tokenize file and handle file inclusion and comma lists. We have
- *   to  break  apart  the  commas  to  expand  any  file names then
- *   reconstruct with commas.
+ *      Tokenize file and handle file inclusion and comma lists. We have
+ *      to  break      apart  the      commas  to      expand  any  file names then
+ *      reconstruct with commas.
  */
 static char *
 next_token_expand(FILE *file)
@@ -174,17 +176,17 @@ next_token_expand(FILE *file)
                if (!*buf)
                        break;
 
-               if (buf[strlen(buf)-1] == ',')
+               if (buf[strlen(buf) - 1] == ',')
                {
                        trailing_comma = true;
-                       buf[strlen(buf)-1] = '\0';
+                       buf[strlen(buf) - 1] = '\0';
                }
                else
                        trailing_comma = false;
 
                /* Is this referencing a file? */
                if (buf[0] == '@')
-                       incbuf = tokenize_inc_file(buf+1);
+                       incbuf = tokenize_inc_file(buf + 1);
                else
                        incbuf = pstrdup(buf);
 
@@ -238,7 +240,7 @@ tokenize_inc_file(const char *inc_filename)
 {
        char       *inc_fullname;
        FILE       *inc_file;
-       List       *inc_lines;
+       List       *inc_lines;
        List       *line;
        char       *comma_str = pstrdup("");
 
@@ -279,7 +281,7 @@ tokenize_inc_file(const char *inc_filename)
                                strcat(comma_str, MULTI_VALUE_SEP);
                        }
                        comma_str = repalloc(comma_str,
-                                               strlen(comma_str) + strlen(lfirst(token)) + 1);
+                                                 strlen(comma_str) + strlen(lfirst(token)) + 1);
                        strcat(comma_str, lfirst(token));
                }
        }
@@ -341,9 +343,9 @@ tokenize_file(FILE *file)
 static int
 user_group_qsort_cmp(const void *list1, const void *list2)
 {
-                                               /* first node is line number */
-       char       *user1 = lfirst(lnext(*(List **)list1));
-       char       *user2 = lfirst(lnext(*(List **)list2));
+       /* first node is line number */
+       char       *user1 = lfirst(lnext(*(List **) list1));
+       char       *user2 = lfirst(lnext(*(List **) list2));
 
        return strcmp(user1, user2);
 }
@@ -357,8 +359,8 @@ user_group_qsort_cmp(const void *list1, const void *list2)
 static int
 user_group_bsearch_cmp(const void *user, const void *list)
 {
-                                               /* first node is line number */
-       char       *user2 = lfirst(lnext(*(List **)list));
+       /* first node is line number */
+       char       *user2 = lfirst(lnext(*(List **) list));
 
        return strcmp(user, user2);
 }
@@ -371,24 +373,24 @@ static List **
 get_group_line(const char *group)
 {
        return (List **) bsearch((void *) group,
-                                                       (void *) group_sorted,
-                                                       group_length,
-                                                       sizeof(List *),
-                                                       user_group_bsearch_cmp);
+                                                        (void *) group_sorted,
+                                                        group_length,
+                                                        sizeof(List *),
+                                                        user_group_bsearch_cmp);
 }
 
 
 /*
  * Lookup a user name in the pg_shadow file
  */
-List **
+List     **
 get_user_line(const char *user)
 {
        return (List **) bsearch((void *) user,
-                                                       (void *) user_sorted,
-                                                       user_length,
-                                                       sizeof(List *),
-                                                       user_group_bsearch_cmp);
+                                                        (void *) user_sorted,
+                                                        user_length,
+                                                        sizeof(List *),
+                                                        user_group_bsearch_cmp);
 }
 
 
@@ -398,13 +400,14 @@ get_user_line(const char *user)
 static int
 check_group(char *group, char *user)
 {
-       List       **line, *l;
+       List      **line,
+                          *l;
 
        if ((line = get_group_line(group)) != NULL)
        {
                foreach(l, lnext(lnext(*line)))
                        if (strcmp(lfirst(l), user) == 0)
-                               return 1;
+                       return 1;
        }
 
        return 0;
@@ -416,17 +419,17 @@ check_group(char *group, char *user)
 static int
 check_user(char *user, char *param_str)
 {
-       char *tok;
+       char       *tok;
 
        for (tok = strtok(param_str, MULTI_VALUE_SEP); tok != NULL; tok = strtok(NULL, MULTI_VALUE_SEP))
        {
                if (tok[0] == '+')
                {
-                       if (check_group(tok+1, user))
+                       if (check_group(tok + 1, user))
                                return 1;
                }
                else if (strcmp(tok, user) == 0 ||
-                       strcmp(tok, "all") == 0)
+                                strcmp(tok, "all") == 0)
                        return 1;
        }
 
@@ -439,7 +442,7 @@ check_user(char *user, char *param_str)
 static int
 check_db(char *dbname, char *user, char *param_str)
 {
-       char *tok;
+       char       *tok;
 
        for (tok = strtok(param_str, MULTI_VALUE_SEP); tok != NULL; tok = strtok(NULL, MULTI_VALUE_SEP))
        {
@@ -744,7 +747,7 @@ void
 load_group()
 {
        FILE       *group_file;
-       List            *line;
+       List       *line;
 
        if (group_lines)
                free_lines(&group_lines);
@@ -761,7 +764,7 @@ load_group()
        group_length = length(group_lines);
        if (group_length)
        {
-               int i = 0;
+               int                     i = 0;
 
                group_sorted = palloc(group_length * sizeof(List *));
 
@@ -799,7 +802,7 @@ load_user()
        user_length = length(user_lines);
        if (user_length)
        {
-               int i = 0;
+               int                     i = 0;
 
                user_sorted = palloc(user_length * sizeof(List *));
 
@@ -825,7 +828,7 @@ load_hba(void)
 {
        int                     bufsize;
        FILE       *file;                       /* The config file we have to read */
-       char       *conf_file;  /* The name of the config file */
+       char       *conf_file;          /* The name of the config file */
 
        if (hba_lines)
                free_lines(&hba_lines);
@@ -935,8 +938,8 @@ check_ident_usermap(const char *usermap_name,
        if (usermap_name[0] == '\0')
        {
                elog(LOG, "check_ident_usermap: hba configuration file does not "
-                        "have the usermap field filled in in the entry that pertains "
-                        "to this connection.  That field is essential for Ident-based "
+                  "have the usermap field filled in in the entry that pertains "
+                 "to this connection.  That field is essential for Ident-based "
                         "authentication.");
                found_entry = false;
        }
@@ -999,7 +1002,7 @@ load_ident(void)
 /*
  *     Parse the string "*ident_response" as a response from a query to an Ident
  *     server.  If it's a normal response indicating a user name, return true
- *     and store the user name at *ident_user. If it's anything else,
+ *     and store the user name at *ident_user. If it's anything else,
  *     return false.
  */
 static bool
@@ -1140,7 +1143,7 @@ ident_inet(const struct in_addr remote_ip_addr,
                if (rc != 0)
                {
                        /* save_errno is in case inet_ntoa changes errno */
-                       int             save_errno = errno;
+                       int                     save_errno = errno;
 
                        elog(LOG, "Unable to connect to Ident server on the host which is "
                                 "trying to connect to Postgres "
@@ -1157,12 +1160,13 @@ ident_inet(const struct in_addr remote_ip_addr,
                        snprintf(ident_query, 80, "%d,%d\n",
                                         ntohs(remote_port), ntohs(local_port));
                        /* loop in case send is interrupted */
-                       do {
+                       do
+                       {
                                rc = send(sock_fd, ident_query, strlen(ident_query), 0);
                        } while (rc < 0 && errno == EINTR);
                        if (rc < 0)
                        {
-                               int             save_errno = errno;
+                               int                     save_errno = errno;
 
                                elog(LOG, "Unable to send query to Ident server on the host which is "
                                         "trying to connect to Postgres (Host %s, Port %d), "
@@ -1179,11 +1183,11 @@ ident_inet(const struct in_addr remote_ip_addr,
                                                  sizeof(ident_response) - 1, 0);
                                if (rc < 0)
                                {
-                                       int             save_errno = errno;
+                                       int                     save_errno = errno;
 
                                        elog(LOG, "Unable to receive response from Ident server "
                                                 "on the host which is "
-                                                "trying to connect to Postgres (Host %s, Port %d), "
+                                        "trying to connect to Postgres (Host %s, Port %d), "
                                                 "even though we successfully sent our query to it: %s",
                                                 inet_ntoa(remote_ip_addr), IDENT_PORT,
                                                 strerror(save_errno));
@@ -1369,4 +1373,3 @@ hba_getauthmethod(hbaPort *port)
        else
                return STATUS_ERROR;
 }
-
index 0ecf839..5c12e70 100644 (file)
@@ -14,7 +14,7 @@
  *     Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/libpq/md5.c,v 1.17 2002/06/20 20:29:28 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/libpq/md5.c,v 1.18 2002/09/04 20:31:19 momjian Exp $
  */
 
 
  *     NOTE:
  *
  *     There are two copies of this file, one in backend/libpq and another
- *     in interfaces/odbc.  They should be identical.  This is done so ODBC
+ *     in interfaces/odbc.  They should be identical.  This is done so ODBC
  *     can be compiled stand-alone.
  */
+
 #ifndef MD5_ODBC
 #include "postgres.h"
 #include "libpq/crypt.h"
index b8d3b8b..c0d832b 100644 (file)
@@ -29,7 +29,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *     $Id: pqcomm.c,v 1.139 2002/09/03 21:45:42 petere Exp $
+ *     $Id: pqcomm.c,v 1.140 2002/09/04 20:31:19 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -469,10 +469,9 @@ pq_recvbuf(void)
                                continue;               /* Ok if interrupted */
 
                        /*
-                        * Careful: an elog() that tries to write to the client
-                        * would cause recursion to here, leading to stack overflow
-                        * and core dump!  This message must go *only* to the postmaster
-                        * log.
+                        * Careful: an elog() that tries to write to the client would
+                        * cause recursion to here, leading to stack overflow and core
+                        * dump!  This message must go *only* to the postmaster log.
                         */
                        elog(COMMERROR, "pq_recvbuf: recv() failed: %m");
                        return EOF;
@@ -574,12 +573,12 @@ pq_getstring(StringInfo s)
        s->data[0] = '\0';
 
        /* Read until we get the terminating '\0' */
-       for(;;)
+       for (;;)
        {
                while (PqRecvPointer >= PqRecvLength)
                {
-                       if (pq_recvbuf())               /* If nothing in buffer, then recv some */
-                               return EOF;                     /* Failed to recv data */
+                       if (pq_recvbuf())       /* If nothing in buffer, then recv some */
+                               return EOF;             /* Failed to recv data */
                }
 
                for (i = PqRecvPointer; i < PqRecvLength; i++)
@@ -589,7 +588,7 @@ pq_getstring(StringInfo s)
                                /* does not copy the \0 */
                                appendBinaryStringInfo(s, PqRecvBuffer + PqRecvPointer,
                                                                           i - PqRecvPointer);
-                               PqRecvPointer = i + 1; /* advance past \0 */
+                               PqRecvPointer = i + 1;  /* advance past \0 */
                                return 0;
                        }
                }
@@ -639,7 +638,7 @@ pq_putbytes(const char *s, size_t len)
 int
 pq_flush(void)
 {
-       static int last_reported_send_errno = 0;
+       static int      last_reported_send_errno = 0;
 
        unsigned char *bufptr = PqSendBuffer;
        unsigned char *bufend = PqSendBuffer + PqSendPointer;
@@ -656,13 +655,12 @@ pq_flush(void)
                                continue;               /* Ok if we were interrupted */
 
                        /*
-                        * Careful: an elog() that tries to write to the client
-                        * would cause recursion to here, leading to stack overflow
-                        * and core dump!  This message must go *only* to the postmaster
-                        * log.
+                        * Careful: an elog() that tries to write to the client would
+                        * cause recursion to here, leading to stack overflow and core
+                        * dump!  This message must go *only* to the postmaster log.
                         *
-                        * If a client disconnects while we're in the midst of output,
-                        * we might write quite a bit of data before we get to a safe
+                        * If a client disconnects while we're in the midst of output, we
+                        * might write quite a bit of data before we get to a safe
                         * query abort point.  So, suppress duplicate log messages.
                         */
                        if (errno != last_reported_send_errno)
@@ -679,7 +677,7 @@ pq_flush(void)
                        return EOF;
                }
 
-               last_reported_send_errno = 0; /* reset after any successful send */
+               last_reported_send_errno = 0;   /* reset after any successful send */
                bufptr += r;
        }
 
index 595052a..52edda5 100644 (file)
@@ -13,7 +13,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.53 2002/08/09 22:52:04 petere Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.54 2002/09/04 20:31:19 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -121,21 +121,24 @@ main(int argc, char *argv[])
        new_argv[argc] = NULL;
 
        /*
-        * Set up locale information from environment.  Note that CTYPE
-        * and COLLATE will be overridden later from pg_control if we are
-        * in an already-initialized database.  We set them here so that
-        * they will be available to fill pg_control during initdb.  The
-        * other ones will get reset later in InitializeGUCOptions, but we set
-        * them here to get already localized behavior during startup
-        * (e.g., error messages).
+        * Set up locale information from environment.  Note that CTYPE and
+        * COLLATE will be overridden later from pg_control if we are in an
+        * already-initialized database.  We set them here so that they will
+        * be available to fill pg_control during initdb.  The other ones will
+        * get reset later in InitializeGUCOptions, but we set them here to
+        * get already localized behavior during startup (e.g., error
+        * messages).
         */
        setlocale(LC_COLLATE, "");
        setlocale(LC_CTYPE, "");
 #ifdef LC_MESSAGES
        setlocale(LC_MESSAGES, "");
 #endif
-       /* We don't use these during startup.  See also pg_locale.c about
-        * why these are set to "C". */
+
+       /*
+        * We don't use these during startup.  See also pg_locale.c about why
+        * these are set to "C".
+        */
        setlocale(LC_MONETARY, "C");
        setlocale(LC_NUMERIC, "C");
        setlocale(LC_TIME, "C");
index 8a69af3..2964085 100644 (file)
@@ -15,7 +15,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.210 2002/09/02 02:13:01 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.211 2002/09/04 20:31:19 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1518,7 +1518,7 @@ _copyAExpr(A_Expr *from)
 static ColumnRef *
 _copyColumnRef(ColumnRef *from)
 {
-       ColumnRef          *newnode = makeNode(ColumnRef);
+       ColumnRef  *newnode = makeNode(ColumnRef);
 
        Node_Copy(from, newnode, fields);
        Node_Copy(from, newnode, indirection);
@@ -1529,7 +1529,7 @@ _copyColumnRef(ColumnRef *from)
 static ParamRef *
 _copyParamRef(ParamRef *from)
 {
-       ParamRef    *newnode = makeNode(ParamRef);
+       ParamRef   *newnode = makeNode(ParamRef);
 
        newnode->number = from->number;
        Node_Copy(from, newnode, fields);
@@ -1595,7 +1595,7 @@ _copyAIndices(A_Indices *from)
 static ExprFieldSelect *
 _copyExprFieldSelect(ExprFieldSelect *from)
 {
-       ExprFieldSelect    *newnode = makeNode(ExprFieldSelect);
+       ExprFieldSelect *newnode = makeNode(ExprFieldSelect);
 
        Node_Copy(from, newnode, arg);
        Node_Copy(from, newnode, fields);
@@ -1688,7 +1688,7 @@ _copyRangeSubselect(RangeSubselect *from)
 static RangeFunction *
 _copyRangeFunction(RangeFunction *from)
 {
-       RangeFunction   *newnode = makeNode(RangeFunction);
+       RangeFunction *newnode = makeNode(RangeFunction);
 
        Node_Copy(from, newnode, funccallnode);
        Node_Copy(from, newnode, alias);
@@ -2223,7 +2223,7 @@ _copyTransactionStmt(TransactionStmt *from)
 static CompositeTypeStmt *
 _copyCompositeTypeStmt(CompositeTypeStmt *from)
 {
-       CompositeTypeStmt   *newnode = makeNode(CompositeTypeStmt);
+       CompositeTypeStmt *newnode = makeNode(CompositeTypeStmt);
 
        Node_Copy(from, newnode, typevar);
        Node_Copy(from, newnode, coldeflist);
index ee716a5..8363fcc 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.33 2002/06/20 20:29:29 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.34 2002/09/04 20:31:19 momjian Exp $
  */
 #include "postgres.h"
 
@@ -233,7 +233,7 @@ makeRelabelType(Node *arg, Oid rtype, int32 rtypmod)
 RangeVar *
 makeRangeVar(char *schemaname, char *relname)
 {
-       RangeVar *r = makeNode(RangeVar);
+       RangeVar   *r = makeNode(RangeVar);
 
        r->catalogname = NULL;
        r->schemaname = schemaname;
index 8c25505..8873c4e 100644 (file)
@@ -5,7 +5,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *     $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.172 2002/08/31 22:10:43 tgl Exp $
+ *     $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.173 2002/09/04 20:31:19 momjian Exp $
  *
  * NOTES
  *       Every (plan) node in POSTGRES has an associated "out" routine which
@@ -232,10 +232,10 @@ _outQuery(StringInfo str, Query *node)
 
        /*
         * Hack to work around missing outfuncs routines for a lot of the
-        * utility-statement node types.  (The only one we actually *need*
-        * for rules support is NotifyStmt.)  Someday we ought to support
-        * 'em all, but for the meantime do this to avoid getting lots of
-        * warnings when running with debug_print_parse on.
+        * utility-statement node types.  (The only one we actually *need* for
+        * rules support is NotifyStmt.)  Someday we ought to support 'em all,
+        * but for the meantime do this to avoid getting lots of warnings when
+        * running with debug_print_parse on.
         */
        if (node->utilityStmt)
        {
@@ -832,13 +832,13 @@ static void
 _outArrayRef(StringInfo str, ArrayRef *node)
 {
        appendStringInfo(str,
-               " ARRAYREF :refrestype %u :refattrlength %d :refelemlength %d ",
+                " ARRAYREF :refrestype %u :refattrlength %d :refelemlength %d ",
                                         node->refrestype,
                                         node->refattrlength,
                                         node->refelemlength);
 
        appendStringInfo(str,
-                                        ":refelembyval %s :refelemalign %c :refupperindexpr ",
+                                  ":refelembyval %s :refelemalign %c :refupperindexpr ",
                                         booltostr(node->refelembyval),
                                         node->refelemalign);
        _outNode(str, node->refupperindexpr);
@@ -860,7 +860,7 @@ static void
 _outFunc(StringInfo str, Func *node)
 {
        appendStringInfo(str,
-                                        " FUNC :funcid %u :funcresulttype %u :funcretset %s ",
+                                  " FUNC :funcid %u :funcresulttype %u :funcretset %s ",
                                         node->funcid,
                                         node->funcresulttype,
                                         booltostr(node->funcretset));
@@ -873,7 +873,7 @@ static void
 _outOper(StringInfo str, Oper *node)
 {
        appendStringInfo(str,
-                                        " OPER :opno %u :opid %u :opresulttype %u :opretset %s ",
+                               " OPER :opno %u :opid %u :opresulttype %u :opretset %s ",
                                         node->opno,
                                         node->opid,
                                         node->opresulttype,
@@ -1324,6 +1324,7 @@ static void
 _outRangeVar(StringInfo str, RangeVar *node)
 {
        appendStringInfo(str, " RANGEVAR :relation ");
+
        /*
         * we deliberately ignore catalogname here, since it is presently not
         * semantically meaningful
@@ -1332,8 +1333,8 @@ _outRangeVar(StringInfo str, RangeVar *node)
        appendStringInfo(str, " . ");
        _outToken(str, node->relname);
        appendStringInfo(str, " :inhopt %d :istemp %s",
-                                       (int) node->inhOpt,
-                                       booltostr(node->istemp));
+                                        (int) node->inhOpt,
+                                        booltostr(node->istemp));
        appendStringInfo(str, " :alias ");
        _outNode(str, node->alias);
 }
index 4e81ed1..e8afda6 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.56 2002/06/20 20:29:29 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.57 2002/09/04 20:31:20 momjian Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -97,7 +97,7 @@ char *
 format_node_dump(const char *dump)
 {
 #define LINELEN                78
-       char            line[LINELEN+1];
+       char            line[LINELEN + 1];
        StringInfoData str;
        int                     i;
        int                     j;
@@ -118,13 +118,13 @@ format_node_dump(const char *dump)
                }
                else
                {
-                       for (k = j-1; k > 0; k--)
+                       for (k = j - 1; k > 0; k--)
                                if (line[k] == ' ')
                                        break;
                        if (k > 0)
                        {
                                /* back up; will reprint all after space */
-                               i -= (j-k-1);
+                               i -= (j - k - 1);
                                j = k;
                        }
                }
@@ -153,7 +153,7 @@ pretty_format_node_dump(const char *dump)
 #define INDENTSTOP     3
 #define MAXINDENT      60
 #define LINELEN                78
-       char            line[LINELEN+1];
+       char            line[LINELEN + 1];
        StringInfoData str;
        int                     indentLev;
        int                     indentDist;
@@ -182,7 +182,7 @@ pretty_format_node_dump(const char *dump)
                                        }
                                        /* print the } at indentDist */
                                        line[indentDist] = '}';
-                                       line[indentDist+1] = '\0';
+                                       line[indentDist + 1] = '\0';
                                        appendStringInfo(&str, "%s\n", line);
                                        /* outdent */
                                        if (indentLev > 0)
index 4d4001d..14edd8e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.131 2002/08/31 22:10:43 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.132 2002/09/04 20:31:20 momjian Exp $
  *
  * NOTES
  *       Most of the read functions for plan nodes are tested. (In fact, they
@@ -1459,7 +1459,8 @@ _readRangeVar(void)
 
        local_node = makeNode(RangeVar);
 
-       local_node->catalogname = NULL; /* not currently saved in output format */
+       local_node->catalogname = NULL;         /* not currently saved in output
+                                                                                * format */
 
        token = pg_strtok(&length); /* eat :relation */
        token = pg_strtok(&length); /* get schemaname */
@@ -1468,11 +1469,11 @@ _readRangeVar(void)
        token = pg_strtok(&length); /* eat "." */
        token = pg_strtok(&length); /* get relname */
        local_node->relname = nullable_string(token, length);
-       
+
        token = pg_strtok(&length); /* eat :inhopt */
        token = pg_strtok(&length); /* get inhopt */
        local_node->inhOpt = (InhOption) atoi(token);
-       
+
        token = pg_strtok(&length); /* eat :istemp */
        token = pg_strtok(&length); /* get istemp */
        local_node->istemp = strtobool(token);
@@ -1493,10 +1494,10 @@ _readColumnRef(void)
        local_node = makeNode(ColumnRef);
 
        token = pg_strtok(&length); /* eat :fields */
-       local_node->fields = nodeRead(true); /* now read it */
+       local_node->fields = nodeRead(true);            /* now read it */
 
        token = pg_strtok(&length); /* eat :indirection */
-       local_node->indirection = nodeRead(true); /* now read it */
+       local_node->indirection = nodeRead(true);       /* now read it */
 
        return local_node;
 }
@@ -1515,7 +1516,7 @@ _readColumnDef(void)
        local_node->colname = nullable_string(token, length);
 
        token = pg_strtok(&length); /* eat :typename */
-       local_node->typename = nodeRead(true); /* now read it */
+       local_node->typename = nodeRead(true);          /* now read it */
 
        token = pg_strtok(&length); /* eat :is_inherited */
        token = pg_strtok(&length); /* get :is_inherited */
@@ -1526,7 +1527,7 @@ _readColumnDef(void)
        local_node->is_not_null = strtobool(token);
 
        token = pg_strtok(&length); /* eat :raw_default */
-       local_node->raw_default = nodeRead(true); /* now read it */
+       local_node->raw_default = nodeRead(true);       /* now read it */
 
        token = pg_strtok(&length); /* eat :cooked_default */
        token = pg_strtok(&length); /* now read it */
@@ -1536,7 +1537,7 @@ _readColumnDef(void)
        local_node->constraints = nodeRead(true);       /* now read it */
 
        token = pg_strtok(&length); /* eat :support */
-       local_node->support = nodeRead(true); /* now read it */
+       local_node->support = nodeRead(true);           /* now read it */
 
        return local_node;
 }
@@ -1544,7 +1545,7 @@ _readColumnDef(void)
 static TypeName *
 _readTypeName(void)
 {
-       TypeName  *local_node;
+       TypeName   *local_node;
        char       *token;
        int                     length;
 
@@ -1574,7 +1575,7 @@ _readTypeName(void)
        local_node->typmod = atoi(token);
 
        token = pg_strtok(&length); /* eat :arrayBounds */
-       local_node->arrayBounds = nodeRead(true); /* now read it */
+       local_node->arrayBounds = nodeRead(true);       /* now read it */
 
        return local_node;
 }
@@ -1582,20 +1583,20 @@ _readTypeName(void)
 static ExprFieldSelect *
 _readExprFieldSelect(void)
 {
-       ExprFieldSelect  *local_node;
+       ExprFieldSelect *local_node;
        char       *token;
        int                     length;
 
        local_node = makeNode(ExprFieldSelect);
 
        token = pg_strtok(&length); /* eat :arg */
-       local_node->arg = nodeRead(true); /* now read it */
+       local_node->arg = nodeRead(true);       /* now read it */
 
        token = pg_strtok(&length); /* eat :fields */
-       local_node->fields = nodeRead(true); /* now read it */
+       local_node->fields = nodeRead(true);            /* now read it */
 
        token = pg_strtok(&length); /* eat :indirection */
-       local_node->indirection = nodeRead(true); /* now read it */
+       local_node->indirection = nodeRead(true);       /* now read it */
 
        return local_node;
 }
@@ -1614,7 +1615,7 @@ _readAlias(void)
        local_node->aliasname = debackslash(token, length);
 
        token = pg_strtok(&length); /* eat :colnames */
-       local_node->colnames = nodeRead(true); /* now read it */
+       local_node->colnames = nodeRead(true);          /* now read it */
 
        return local_node;
 }
@@ -1671,7 +1672,7 @@ _readRangeTblEntry(void)
                        local_node->jointype = (JoinType) atoi(token);
 
                        token = pg_strtok(&length); /* eat :joinaliasvars */
-                       local_node->joinaliasvars = nodeRead(true);     /* now read it */
+                       local_node->joinaliasvars = nodeRead(true); /* now read it */
                        break;
 
                default:
index 6ffc02b..ef7b489 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_misc.c,v 1.33 2002/07/20 04:59:10 momjian Exp $
+ * $Id: geqo_misc.c,v 1.34 2002/09/04 20:31:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -250,4 +250,4 @@ geqo_print_rel(Query *root, RelOptInfo *rel)
        geqo_print_path(root, rel->cheapest_total_path, 1);
 }
 
-#endif /* GEQO_DEBUG */
+#endif   /* GEQO_DEBUG */
index c1ee656..7d8d6a6 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.87 2002/08/29 16:03:48 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.88 2002/09/04 20:31:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -43,14 +43,14 @@ static void set_inherited_rel_pathlist(Query *root, RelOptInfo *rel,
 static void set_subquery_pathlist(Query *root, RelOptInfo *rel,
                                          Index rti, RangeTblEntry *rte);
 static void set_function_pathlist(Query *root, RelOptInfo *rel,
-                                               RangeTblEntry *rte);
+                                         RangeTblEntry *rte);
 static RelOptInfo *make_one_rel_by_joins(Query *root, int levels_needed,
                                          List *initial_rels);
 static bool subquery_is_pushdown_safe(Query *subquery, Query *topquery);
 static bool recurse_pushdown_safe(Node *setOp, Query *topquery);
 static void subquery_push_qual(Query *subquery, Index rti, Node *qual);
 static void recurse_push_qual(Node *setOp, Query *topquery,
-                                                         Index rti, Node *qual);
+                                 Index rti, Node *qual);
 
 
 /*
@@ -304,9 +304,10 @@ set_subquery_pathlist(Query *root, RelOptInfo *rel,
         *
         * There are several cases where we cannot push down clauses.
         * Restrictions involving the subquery are checked by
-        * subquery_is_pushdown_safe().  Also, we do not push down clauses that
-        * contain subselects, mainly because I'm not sure it will work correctly
-        * (the subplan hasn't yet transformed sublinks to subselects).
+        * subquery_is_pushdown_safe().  Also, we do not push down clauses
+        * that contain subselects, mainly because I'm not sure it will work
+        * correctly (the subplan hasn't yet transformed sublinks to
+        * subselects).
         *
         * Non-pushed-down clauses will get evaluated as qpquals of the
         * SubqueryScan node.
@@ -542,7 +543,7 @@ make_one_rel_by_joins(Query *root, int levels_needed, List *initial_rels)
  * quals into it, because that would change the results.  For subqueries
  * using UNION/UNION ALL/INTERSECT/INTERSECT ALL, we can push the quals
  * into each component query, so long as all the component queries share
- * identical output types.  (That restriction could probably be relaxed,
+ * identical output types.     (That restriction could probably be relaxed,
  * but it would take much more code to include type coercion code into
  * the quals, and I'm also concerned about possible semantic gotchas.)
  */
@@ -633,14 +634,14 @@ subquery_push_qual(Query *subquery, Index rti, Node *qual)
        else
        {
                /*
-                * We need to replace Vars in the qual (which must refer
-                * to outputs of the subquery) with copies of the
-                * subquery's targetlist expressions.  Note that at this
-                * point, any uplevel Vars in the qual should have been
-                * replaced with Params, so they need no work.
+                * We need to replace Vars in the qual (which must refer to
+                * outputs of the subquery) with copies of the subquery's
+                * targetlist expressions.      Note that at this point, any uplevel
+                * Vars in the qual should have been replaced with Params, so they
+                * need no work.
                 *
-                * This step also ensures that when we are pushing into a setop
-                * tree, each component query gets its own copy of the qual.
+                * This step also ensures that when we are pushing into a setop tree,
+                * each component query gets its own copy of the qual.
                 */
                qual = ResolveNew(qual, rti, 0,
                                                  subquery->targetList,
@@ -649,10 +650,9 @@ subquery_push_qual(Query *subquery, Index rti, Node *qual)
                                                                                         qual);
 
                /*
-                * We need not change the subquery's hasAggs or
-                * hasSublinks flags, since we can't be pushing down any
-                * aggregates that weren't there before, and we don't push
-                * down subselects at all.
+                * We need not change the subquery's hasAggs or hasSublinks flags,
+                * since we can't be pushing down any aggregates that weren't
+                * there before, and we don't push down subselects at all.
                 */
        }
 }
index 11e18c3..9f987a4 100644 (file)
@@ -42,7 +42,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.89 2002/07/04 15:23:56 thomas Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.90 2002/09/04 20:31:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -408,8 +408,8 @@ cost_functionscan(Path *path, Query *root, RelOptInfo *baserel)
 
        /*
         * For now, estimate function's cost at one operator eval per function
-        * call.  Someday we should revive the function cost estimate columns in
-        * pg_proc...
+        * call.  Someday we should revive the function cost estimate columns
+        * in pg_proc...
         */
        cpu_per_tuple = cpu_operator_cost;
 
@@ -607,7 +607,7 @@ cost_mergejoin(Path *path, Query *root,
        double          outer_rows,
                                inner_rows;
        double          ntuples;
-       Selectivity     outerscansel,
+       Selectivity outerscansel,
                                innerscansel;
        Path            sort_path;              /* dummy for result of cost_sort */
 
@@ -617,15 +617,15 @@ cost_mergejoin(Path *path, Query *root,
        /*
         * A merge join will stop as soon as it exhausts either input stream.
         * Estimate fraction of the left and right inputs that will actually
-        * need to be scanned.  We use only the first (most significant)
-        * merge clause for this purpose.
+        * need to be scanned.  We use only the first (most significant) merge
+        * clause for this purpose.
         *
-        * Since this calculation is somewhat expensive, and will be the same
-        * for all mergejoin paths associated with the merge clause, we cache
-        * the results in the RestrictInfo node.
+        * Since this calculation is somewhat expensive, and will be the same for
+        * all mergejoin paths associated with the merge clause, we cache the
+        * results in the RestrictInfo node.
         */
        firstclause = (RestrictInfo *) lfirst(mergeclauses);
-       if (firstclause->left_mergescansel < 0) /* not computed yet? */
+       if (firstclause->left_mergescansel < 0)         /* not computed yet? */
                mergejoinscansel(root, (Node *) firstclause->clause,
                                                 &firstclause->left_mergescansel,
                                                 &firstclause->right_mergescansel);
@@ -697,10 +697,10 @@ cost_mergejoin(Path *path, Query *root,
        /*
         * The number of tuple comparisons needed depends drastically on the
         * number of equal keys in the two source relations, which we have no
-        * good way of estimating.  (XXX could the MCV statistics help?)
-        * Somewhat arbitrarily, we charge one tuple
-        * comparison (one cpu_operator_cost) for each tuple in the two source
-        * relations.  This is probably a lower bound.
+        * good way of estimating.      (XXX could the MCV statistics help?)
+        * Somewhat arbitrarily, we charge one tuple comparison (one
+        * cpu_operator_cost) for each tuple in the two source relations.
+        * This is probably a lower bound.
         */
        run_cost += cpu_operator_cost * (outer_rows + inner_rows);
 
index 3d9ec2e..5595e1a 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.121 2002/09/02 06:22:18 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.122 2002/09/04 20:31:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1332,7 +1332,7 @@ pred_test_simple_clause(Expr *predicate, Node *clause)
        test_oper = makeOper(test_op,           /* opno */
                                                 InvalidOid,    /* opid */
                                                 BOOLOID,               /* opresulttype */
-                                                false);                /* opretset */
+                                                false);        /* opretset */
        replace_opid(test_oper);
        test_expr = make_opclause(test_oper,
                                                          (Var *) clause_const,
@@ -1712,7 +1712,7 @@ match_special_index_operator(Expr *clause, Oid opclass,
 
                case OID_BYTEA_LIKE_OP:
                        isIndexable = pattern_fixed_prefix(patt, Pattern_Type_Like,
-                                                         &prefix, &rest) != Pattern_Prefix_None;
+                                                                 &prefix, &rest) != Pattern_Prefix_None;
                        break;
 
                case OID_TEXT_ICLIKE_OP:
@@ -1922,7 +1922,7 @@ expand_indexqual_conditions(List *indexquals)
                        case OID_CIDR_SUBEQ_OP:
                                resultquals = nconc(resultquals,
                                                                        network_prefix_quals(leftop, expr_op,
-                                                                                                                patt->constvalue));
+                                                                                                         patt->constvalue));
                                break;
 
                        default:
index f1e2aca..8e73bd2 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.70 2002/09/02 02:47:02 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.71 2002/09/04 20:31:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -171,7 +171,7 @@ sort_inner_and_outer(Query *root,
                default:
                        elog(ERROR, "sort_inner_and_outer: unexpected join type %d",
                                 (int) jointype);
-                       useallclauses = false;  /* keep compiler quiet */
+                       useallclauses = false;          /* keep compiler quiet */
                        break;
        }
 
index 5e4aff3..fc33d52 100644 (file)
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.39 2002/06/20 20:29:30 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.40 2002/09/04 20:31:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -519,7 +519,7 @@ build_index_pathkeys(Query *root,
 
                funcnode->funcid = index->indproc;
                funcnode->funcresulttype = get_func_rettype(index->indproc);
-               funcnode->funcretset = false; /* can never be a set */
+               funcnode->funcretset = false;   /* can never be a set */
                funcnode->func_fcache = NULL;
 
                while (*indexkeys != 0)
@@ -769,22 +769,22 @@ find_mergeclauses_for_pathkeys(Query *root,
 
                /*
                 * We can match a pathkey against either left or right side of any
-                * mergejoin clause.  (We examine both sides since we aren't told if
-                * the given pathkeys are for inner or outer input path; no confusion
-                * is possible.)  Furthermore, if there are multiple matching
-                * clauses, take them all.  In plain inner-join scenarios we expect
-                * only one match, because redundant-mergeclause elimination will
-                * have removed any redundant mergeclauses from the input list.
-                * However, in outer-join scenarios there might be multiple matches.
-                * An example is
+                * mergejoin clause.  (We examine both sides since we aren't told
+                * if the given pathkeys are for inner or outer input path; no
+                * confusion is possible.)      Furthermore, if there are multiple
+                * matching clauses, take them all.  In plain inner-join scenarios
+                * we expect only one match, because redundant-mergeclause
+                * elimination will have removed any redundant mergeclauses from
+                * the input list. However, in outer-join scenarios there might be
+                * multiple matches. An example is
                 *
-                *              select * from a full join b on
-                *              a.v1 = b.v1 and a.v2 = b.v2 and a.v1 = b.v2;
+                * select * from a full join b on a.v1 = b.v1 and a.v2 = b.v2 and
+                * a.v1 = b.v2;
                 *
-                * Given the pathkeys ((a.v1), (a.v2)) it is okay to return all
-                * three clauses (in the order a.v1=b.v1, a.v1=b.v2, a.v2=b.v2)
-                * and indeed we *must* do so or we will be unable to form a
-                * valid plan.
+                * Given the pathkeys ((a.v1), (a.v2)) it is okay to return all three
+                * clauses (in the order a.v1=b.v1, a.v1=b.v2, a.v2=b.v2) and
+                * indeed we *must* do so or we will be unable to form a valid
+                * plan.
                 */
                foreach(j, restrictinfos)
                {
@@ -812,8 +812,8 @@ find_mergeclauses_for_pathkeys(Query *root,
                        break;
 
                /*
-                * If we did find usable mergeclause(s) for this sort-key position,
-                * add them to result list.
+                * If we did find usable mergeclause(s) for this sort-key
+                * position, add them to result list.
                 */
                mergeclauses = nconc(mergeclauses, matched_restrictinfos);
        }
index 908d36b..da3568b 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.117 2002/09/02 02:47:02 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.118 2002/09/04 20:31:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -79,7 +79,7 @@ static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
 static TidScan *make_tidscan(List *qptlist, List *qpqual, Index scanrelid,
                         List *tideval);
 static FunctionScan *make_functionscan(List *qptlist, List *qpqual,
-                                                                          Index scanrelid);
+                                 Index scanrelid);
 static NestLoop *make_nestloop(List *tlist,
                          List *joinclauses, List *otherclauses,
                          Plan *lefttree, Plan *righttree,
@@ -206,8 +206,8 @@ create_scan_plan(Query *root, Path *best_path)
 
                case T_FunctionScan:
                        plan = (Scan *) create_functionscan_plan(best_path,
-                                                                                               tlist,
-                                                                                               scan_clauses);
+                                                                                                        tlist,
+                                                                                                        scan_clauses);
                        break;
 
                default:
@@ -1346,8 +1346,8 @@ make_functionscan(List *qptlist,
                                  List *qpqual,
                                  Index scanrelid)
 {
-       FunctionScan   *node = makeNode(FunctionScan);
-       Plan               *plan = &node->scan.plan;
+       FunctionScan *node = makeNode(FunctionScan);
+       Plan       *plan = &node->scan.plan;
 
        /* cost should be inserted by caller */
        plan->state = (EState *) NULL;
index 0187c21..e06282c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.74 2002/09/02 02:47:02 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.75 2002/09/04 20:31:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -108,12 +108,15 @@ add_base_rels_to_query(Query *root, Node *jtnode)
                                           add_base_rels_to_query(root, j->rarg));
                /* the join's own rtindex is NOT added to result */
                jrel = build_other_rel(root, j->rtindex);
+
                /*
-                * Mark the join's otherrel with outerjoinset = list of baserel ids
-                * included in the join.  Note we must copy here because result list
-                * is destructively modified by nconcs at higher levels.
+                * Mark the join's otherrel with outerjoinset = list of baserel
+                * ids included in the join.  Note we must copy here because
+                * result list is destructively modified by nconcs at higher
+                * levels.
                 */
                jrel->outerjoinset = listCopy(result);
+
                /*
                 * Safety check: join RTEs should not be SELECT FOR UPDATE targets
                 */
@@ -172,8 +175,8 @@ add_vars_to_targetlist(Query *root, List *vars)
                if (rel->reloptkind == RELOPT_OTHER_JOIN_REL)
                {
                        /* Var is an alias */
-                       Node   *expansion;
-                       List   *varsused;
+                       Node       *expansion;
+                       List       *varsused;
 
                        expansion = flatten_join_alias_vars((Node *) var,
                                                                                                root->rtable, true);
@@ -196,7 +199,7 @@ add_vars_to_targetlist(Query *root, List *vars)
  * distribute_quals_to_rels
  *       Recursively scan the query's join tree for WHERE and JOIN/ON qual
  *       clauses, and add these to the appropriate RestrictInfo and JoinInfo
- *       lists belonging to base RelOptInfos.  Also, base RelOptInfos are marked
+ *       lists belonging to base RelOptInfos.  Also, base RelOptInfos are marked
  *       with outerjoinset information, to aid in proper positioning of qual
  *       clauses that appear above outer joins.
  *
@@ -400,7 +403,8 @@ distribute_qual_to_rels(Query *root, Node *clause,
        restrictinfo->right_sortop = InvalidOid;
        restrictinfo->left_pathkey = NIL;       /* not computable yet */
        restrictinfo->right_pathkey = NIL;
-       restrictinfo->left_mergescansel = -1; /* not computed until needed */
+       restrictinfo->left_mergescansel = -1;           /* not computed until
+                                                                                                * needed */
        restrictinfo->right_mergescansel = -1;
        restrictinfo->hashjoinoperator = InvalidOid;
        restrictinfo->left_bucketsize = -1; /* not computed until needed */
@@ -419,7 +423,7 @@ distribute_qual_to_rels(Query *root, Node *clause,
         * earlier by add_base_rels_to_query.
         *
         * We can combine this step with a cross-check that the clause contains
-        * no relids not within its scope.  If the first crosscheck succeeds,
+        * no relids not within its scope.      If the first crosscheck succeeds,
         * the clause contains no aliases and we needn't look more closely.
         */
        if (!is_subseti(relids, qualscope))
@@ -763,10 +767,10 @@ process_implied_equality(Query *root, Node *item1, Node *item2,
        clause = makeNode(Expr);
        clause->typeOid = BOOLOID;
        clause->opType = OP_EXPR;
-       clause->oper = (Node *) makeOper(oprid(eq_operator),/* opno */
+       clause->oper = (Node *) makeOper(oprid(eq_operator),            /* opno */
                                                                         InvalidOid,            /* opid */
-                                                                        BOOLOID,                       /* opresulttype */
-                                                                        false);                        /* opretset */
+                                                                        BOOLOID,       /* opresulttype */
+                                                                        false);        /* opretset */
        clause->args = makeList2(item1, item2);
 
        ReleaseSysCache(eq_operator);
index b55f838..5510a74 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.123 2002/08/28 20:46:23 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.124 2002/09/04 20:31:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,7 +42,7 @@
 
 
 static Node *pull_up_subqueries(Query *parse, Node *jtnode,
-                                                               bool below_outer_join);
+                                  bool below_outer_join);
 static bool is_simple_subquery(Query *subquery);
 static bool has_nullable_targetlist(Query *subquery);
 static void resolvenew_in_jointree(Node *jtnode, int varno, List *subtlist);
@@ -301,16 +301,16 @@ pull_up_subqueries(Query *parse, Node *jtnode, bool below_outer_join)
                 *
                 * If we are inside an outer join, only pull up subqueries whose
                 * targetlists are nullable --- otherwise substituting their tlist
-                * entries for upper Var references would do the wrong thing
-                * (the results wouldn't become NULL when they're supposed to).
-                * XXX This could be improved by generating pseudo-variables for
-                * such expressions; we'd have to figure out how to get the pseudo-
-                * variables evaluated at the right place in the modified plan tree.
-                * Fix it someday.
+                * entries for upper Var references would do the wrong thing (the
+                * results wouldn't become NULL when they're supposed to). XXX
+                * This could be improved by generating pseudo-variables for such
+                * expressions; we'd have to figure out how to get the pseudo-
+                * variables evaluated at the right place in the modified plan
+                * tree. Fix it someday.
                 *
                 * Note: even if the subquery itself is simple enough, we can't pull
-                * it up if there is a reference to its whole tuple result.  Perhaps
-                * a pseudo-variable is the answer here too.
+                * it up if there is a reference to its whole tuple result.
+                * Perhaps a pseudo-variable is the answer here too.
                 */
                if (rte->rtekind == RTE_SUBQUERY && is_simple_subquery(subquery) &&
                        (!below_outer_join || has_nullable_targetlist(subquery)) &&
@@ -336,8 +336,8 @@ pull_up_subqueries(Query *parse, Node *jtnode, bool below_outer_join)
                                                                   below_outer_join);
 
                        /*
-                        * Now make a modifiable copy of the subquery that we can
-                        * run OffsetVarNodes on.
+                        * Now make a modifiable copy of the subquery that we can run
+                        * OffsetVarNodes on.
                         */
                        subquery = copyObject(subquery);
 
@@ -352,7 +352,8 @@ pull_up_subqueries(Query *parse, Node *jtnode, bool below_outer_join)
                         * Replace all of the top query's references to the subquery's
                         * outputs with copies of the adjusted subtlist items, being
                         * careful not to replace any of the jointree structure.
-                        * (This'd be a lot cleaner if we could use query_tree_mutator.)
+                        * (This'd be a lot cleaner if we could use
+                        * query_tree_mutator.)
                         */
                        subtlist = subquery->targetList;
                        parse->targetList = (List *)
@@ -375,15 +376,16 @@ pull_up_subqueries(Query *parse, Node *jtnode, bool below_outer_join)
                        }
 
                        /*
-                        * Now append the adjusted rtable entries to upper query.
-                        * (We hold off until after fixing the upper rtable entries;
-                        * no point in running that code on the subquery ones too.)
+                        * Now append the adjusted rtable entries to upper query. (We
+                        * hold off until after fixing the upper rtable entries; no
+                        * point in running that code on the subquery ones too.)
                         */
                        parse->rtable = nconc(parse->rtable, subquery->rtable);
 
                        /*
                         * Pull up any FOR UPDATE markers, too.  (OffsetVarNodes
-                        * already adjusted the marker values, so just nconc the list.)
+                        * already adjusted the marker values, so just nconc the
+                        * list.)
                         */
                        parse->rowMarks = nconc(parse->rowMarks, subquery->rowMarks);
 
@@ -500,9 +502,9 @@ is_simple_subquery(Query *subquery)
 
        /*
         * Don't pull up a subquery that has any set-returning functions in
-        * its targetlist.  Otherwise we might well wind up inserting
-        * set-returning functions into places where they mustn't go,
-        * such as quals of higher queries.
+        * its targetlist.      Otherwise we might well wind up inserting
+        * set-returning functions into places where they mustn't go, such as
+        * quals of higher queries.
         */
        if (expression_returns_set((Node *) subquery->targetList))
                return false;
@@ -724,8 +726,8 @@ preprocess_expression(Query *parse, Node *expr, int kind)
 
        /*
         * If the query has any join RTEs, try to replace join alias variables
-        * with base-relation variables, to allow quals to be pushed down.
-        * We must do this after sublink processing, since it does not recurse
+        * with base-relation variables, to allow quals to be pushed down. We
+        * must do this after sublink processing, since it does not recurse
         * into sublinks.
         *
         * The flattening pass is expensive enough that it seems worthwhile to
index b685cfa..66998b0 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.80 2002/09/02 02:47:02 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.81 2002/09/04 20:31:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -423,7 +423,7 @@ join_references_mutator(Node *node,
                resdom = tlist_member((Node *) var, context->outer_tlist);
                if (resdom)
                {
-                       Var        *newvar = (Var *) copyObject(var);
+                       Var                *newvar = (Var *) copyObject(var);
 
                        newvar->varno = OUTER;
                        newvar->varattno = resdom->resno;
@@ -432,7 +432,7 @@ join_references_mutator(Node *node,
                resdom = tlist_member((Node *) var, context->inner_tlist);
                if (resdom)
                {
-                       Var        *newvar = (Var *) copyObject(var);
+                       Var                *newvar = (Var *) copyObject(var);
 
                        newvar->varno = INNER;
                        newvar->varattno = resdom->resno;
index c1ab186..1dcebba 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.54 2002/06/20 20:29:31 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.55 2002/09/04 20:31:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -369,7 +369,7 @@ make_subplan(SubLink *slink)
                        }
                        if (use_material)
                        {
-                               Plan   *matplan;
+                               Plan       *matplan;
 
                                matplan = (Plan *) make_material(plan->targetlist, plan);
                                /* kluge --- see comments above */
@@ -663,8 +663,8 @@ SS_finalize_plan(Plan *plan, List *rtable)
                case T_Append:
                        foreach(lst, ((Append *) plan)->appendplans)
                                results.paramids = set_unioni(results.paramids,
-                                                                SS_finalize_plan((Plan *) lfirst(lst),
-                                                                                                 rtable));
+                                                                  SS_finalize_plan((Plan *) lfirst(lst),
+                                                                                                       rtable));
                        break;
 
                case T_NestLoop:
index 41f9b2f..5b930e2 100644 (file)
@@ -15,7 +15,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.55 2002/08/31 22:10:43 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.56 2002/09/04 20:31:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -128,7 +128,8 @@ expand_targetlist(List *tlist, int command_type,
 
        /*
         * The rewriter should have already ensured that the TLEs are in
-        * correct order; but we have to insert TLEs for any missing attributes.
+        * correct order; but we have to insert TLEs for any missing
+        * attributes.
         *
         * Scan the tuple description in the relation's relcache entry to make
         * sure we have all the user attributes in the right order.
@@ -161,14 +162,14 @@ expand_targetlist(List *tlist, int command_type,
                        /*
                         * Didn't find a matching tlist entry, so make one.
                         *
-                        * For INSERT, generate a NULL constant.  (We assume the
-                        * rewriter would have inserted any available default value.)
-                        * Also, if the column isn't dropped, apply any domain constraints
-                        * that might exist --- this is to catch domain NOT NULL.
+                        * For INSERT, generate a NULL constant.  (We assume the rewriter
+                        * would have inserted any available default value.) Also, if
+                        * the column isn't dropped, apply any domain constraints that
+                        * might exist --- this is to catch domain NOT NULL.
                         *
                         * For UPDATE, generate a Var reference to the existing value of
-                        * the attribute, so that it gets copied to the new tuple.
-                        * But generate a NULL for dropped columns (we want to drop any
+                        * the attribute, so that it gets copied to the new tuple. But
+                        * generate a NULL for dropped columns (we want to drop any
                         * old values).
                         */
                        Oid                     atttype = att_tup->atttypid;
@@ -181,13 +182,13 @@ expand_targetlist(List *tlist, int command_type,
                                        new_expr = (Node *) makeConst(atttype,
                                                                                                  att_tup->attlen,
                                                                                                  (Datum) 0,
-                                                                                                 true,         /* isnull */
+                                                                                                 true, /* isnull */
                                                                                                  att_tup->attbyval,
-                                                                                                 false,        /* not a set */
+                                                                                                 false,                /* not a set */
                                                                                                  false);
                                        if (!att_tup->attisdropped)
                                                new_expr = coerce_type_constraints(NULL, new_expr,
-                                                                                                                  atttype, false);
+                                                                                                                atttype, false);
                                        break;
                                case CMD_UPDATE:
                                        /* Insert NULLs for dropped columns */
@@ -215,7 +216,7 @@ expand_targetlist(List *tlist, int command_type,
                        new_tle = makeTargetEntry(makeResdom(attrno,
                                                                                                 atttype,
                                                                                                 atttypmod,
-                                                                                                pstrdup(NameStr(att_tup->attname)),
+                                                                         pstrdup(NameStr(att_tup->attname)),
                                                                                                 false),
                                                                          new_expr);
                }
index 492492b..fb4fd3e 100644 (file)
@@ -14,7 +14,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.77 2002/09/02 02:47:02 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.78 2002/09/04 20:31:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -63,8 +63,8 @@ static List *generate_setop_tlist(List *colTypes, int flag,
                                         List *input_tlist,
                                         List *refnames_tlist);
 static List *generate_append_tlist(List *colTypes, bool flag,
-                                        List *input_plans,
-                                        List *refnames_tlist);
+                                         List *input_plans,
+                                         List *refnames_tlist);
 static Node *adjust_inherited_attrs_mutator(Node *node,
                                                           adjust_inherited_attrs_context *context);
 
@@ -172,8 +172,9 @@ recurse_set_operations(Node *setOp, Query *parse,
                 * This would fail if the Vars generated by generate_setop_tlist()
                 * were not exactly equal() to the corresponding tlist entries of
                 * the subplan.  However, since the subplan was generated by
-                * generate_union_plan() or generate_nonunion_plan(), and hence its
-                * tlist was generated by generate_append_tlist(), this will work.
+                * generate_union_plan() or generate_nonunion_plan(), and hence
+                * its tlist was generated by generate_append_tlist(), this will
+                * work.
                 */
                if (flag >= 0 ||
                        !tlist_same_datatypes(plan->targetlist, colTypes, junkOK))
@@ -485,15 +486,15 @@ generate_append_tlist(List *colTypes, bool flag,
        /*
         * First extract typmods to use.
         *
-        * If the inputs all agree on type and typmod of a particular column,
-        * use that typmod; else use -1.
+        * If the inputs all agree on type and typmod of a particular column, use
+        * that typmod; else use -1.
         */
        colTypmods = (int32 *) palloc(length(colTypes) * sizeof(int32));
 
        foreach(planl, input_plans)
        {
-               Plan   *subplan = (Plan *) lfirst(planl);
-               List   *subtlist;
+               Plan       *subplan = (Plan *) lfirst(planl);
+               List       *subtlist;
 
                curColType = colTypes;
                colindex = 0;
@@ -796,8 +797,8 @@ adjust_inherited_attrs_mutator(Node *node,
                        var->varno = context->new_rt_index;
                        if (var->varattno > 0)
                        {
-                               char *attname = get_attname(context->old_relid,
-                                                                                       var->varattno);
+                               char       *attname = get_attname(context->old_relid,
+                                                                                                 var->varattno);
 
                                var->varattno = get_attnum(context->new_relid, attname);
                                if (var->varattno == InvalidAttrNumber)
@@ -819,10 +820,10 @@ adjust_inherited_attrs_mutator(Node *node,
        if (IsA(node, JoinExpr))
        {
                /* Copy the JoinExpr node with correct mutation of subnodes */
-               JoinExpr *j;
+               JoinExpr   *j;
 
                j = (JoinExpr *) expression_tree_mutator(node,
-                                                                                                adjust_inherited_attrs_mutator,
+                                                                                 adjust_inherited_attrs_mutator,
                                                                                                 (void *) context);
                /* now fix JoinExpr's rtindex */
                if (j->rtindex == context->old_rt_index)
index 3b5e698..edf77fa 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.107 2002/08/31 22:10:43 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.108 2002/09/04 20:31:22 momjian Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -43,7 +43,7 @@ typedef struct
 {
        Query      *query;
        List       *groupClauses;
-}      check_subplans_for_ungrouped_vars_context;
+} check_subplans_for_ungrouped_vars_context;
 
 static bool contain_agg_clause_walker(Node *node, void *context);
 static bool pull_agg_clause_walker(Node *node, List **listptr);
@@ -51,7 +51,7 @@ static bool expression_returns_set_walker(Node *node, void *context);
 static bool contain_subplans_walker(Node *node, void *context);
 static bool pull_subplans_walker(Node *node, List **listptr);
 static bool check_subplans_for_ungrouped_vars_walker(Node *node,
-                                       check_subplans_for_ungrouped_vars_context * context);
+                                        check_subplans_for_ungrouped_vars_context *context);
 static bool contain_mutable_functions_walker(Node *node, void *context);
 static bool contain_volatile_functions_walker(Node *node, void *context);
 static Node *eval_const_expressions_mutator(Node *node, void *context);
@@ -479,7 +479,7 @@ expression_returns_set_walker(Node *node, void *context)
                return false;
        if (IsA(node, Expr))
        {
-               Expr   *expr = (Expr *) node;
+               Expr       *expr = (Expr *) node;
 
                switch (expr->opType)
                {
@@ -633,7 +633,7 @@ check_subplans_for_ungrouped_vars(Query *query)
 
 static bool
 check_subplans_for_ungrouped_vars_walker(Node *node,
-                                        check_subplans_for_ungrouped_vars_context * context)
+                                         check_subplans_for_ungrouped_vars_context *context)
 {
        List       *gl;
 
@@ -786,11 +786,11 @@ contain_mutable_functions_walker(Node *node, void *context)
  *       Recursively search for volatile functions within a clause.
  *
  * Returns true if any volatile function (or operator implemented by a
- * volatile function) is found.        This test prevents invalid conversions
+ * volatile function) is found. This test prevents invalid conversions
  * of volatile expressions into indexscan quals.
  *
  * XXX we do not examine sublinks/subplans to see if they contain uses of
- * volatile functions.  It's not real clear if that is correct or not...
+ * volatile functions. It's not real clear if that is correct or not...
  */
 bool
 contain_volatile_functions(Node *clause)
@@ -837,7 +837,7 @@ contain_volatile_functions_walker(Node *node, void *context)
  *       of the current query level and no uses of volatile functions.
  *       Such a clause is not necessarily a true constant: it can still contain
  *       Params and outer-level Vars, not to mention functions whose results
- *       may vary from one statement to the next.  However, the clause's value
+ *       may vary from one statement to the next.      However, the clause's value
  *       will be constant over any one scan of the current query, so it can be
  *       used as an indexscan key or (if a top-level qual) can be pushed up to
  *       become a gating qual.
@@ -1143,7 +1143,7 @@ eval_const_expressions_mutator(Node *node, void *context)
                 * expression_tree_mutator directly rather than recursing to self.
                 */
                args = (List *) expression_tree_mutator((Node *) expr->args,
-                                                                                               eval_const_expressions_mutator,
+                                                                                 eval_const_expressions_mutator,
                                                                                                (void *) context);
 
                switch (expr->opType)
@@ -1166,13 +1166,14 @@ eval_const_expressions_mutator(Node *node, void *context)
                                break;
                        case DISTINCT_EXPR:
                                {
-                                       List *arg;
-                                       bool has_null_input = false;
-                                       bool all_null_input = true;
-                                       bool has_nonconst_input = false;
+                                       List       *arg;
+                                       bool            has_null_input = false;
+                                       bool            all_null_input = true;
+                                       bool            has_nonconst_input = false;
 
                                        /*
-                                        * Check for constant inputs and especially constant-NULL inputs.
+                                        * Check for constant inputs and especially
+                                        * constant-NULL inputs.
                                         */
                                        Assert(length(args) == 2);
                                        foreach(arg, args)
@@ -1183,9 +1184,7 @@ eval_const_expressions_mutator(Node *node, void *context)
                                                        all_null_input &= ((Const *) lfirst(arg))->constisnull;
                                                }
                                                else
-                                               {
                                                        has_nonconst_input = true;
-                                               }
                                        }
                                        /* all nulls? then not distinct */
                                        if (all_null_input)
@@ -1206,18 +1205,23 @@ eval_const_expressions_mutator(Node *node, void *context)
                                                bool            const_is_null;
 
                                                Oper       *oper = (Oper *) expr->oper;
-                                               replace_opid(oper);             /* OK to scribble on input to this extent */
+
+                                               replace_opid(oper);             /* OK to scribble on input
+                                                                                                * to this extent */
                                                result_typeid = oper->opresulttype;
 
                                                /*
-                                                * OK, looks like we can simplify this operator/function.
+                                                * OK, looks like we can simplify this
+                                                * operator/function.
                                                 *
-                                                * We use the executor's routine ExecEvalExpr() to avoid duplication of
-                                                * code and ensure we get the same result as the executor would get.
+                                                * We use the executor's routine ExecEvalExpr() to
+                                                * avoid duplication of code and ensure we get the
+                                                * same result as the executor would get.
                                                 *
-                                                * Build a new Expr node containing the already-simplified arguments. The
-                                                * only other setup needed here is the replace_opid() that we already
-                                                * did for the OP_EXPR case.
+                                                * Build a new Expr node containing the
+                                                * already-simplified arguments. The only other
+                                                * setup needed here is the replace_opid() that we
+                                                * already did for the OP_EXPR case.
                                                 */
                                                newexpr = makeNode(Expr);
                                                newexpr->typeOid = expr->typeOid;
@@ -1229,17 +1233,22 @@ eval_const_expressions_mutator(Node *node, void *context)
                                                get_typlenbyval(result_typeid, &resultTypLen, &resultTypByVal);
 
                                                /*
-                                                * It is OK to pass a dummy econtext because none of the
-                                                * ExecEvalExpr() code used in this situation will use econtext.  That
-                                                * might seem fortuitous, but it's not so unreasonable --- a constant
-                                                * expression does not depend on context, by definition, n'est ce pas?
+                                                * It is OK to pass a dummy econtext because none
+                                                * of the ExecEvalExpr() code used in this
+                                                * situation will use econtext.  That might seem
+                                                * fortuitous, but it's not so unreasonable --- a
+                                                * constant expression does not depend on context,
+                                                * by definition, n'est ce pas?
                                                 */
                                                econtext = MakeExprContext(NULL, CurrentMemoryContext);
 
                                                const_val = ExecEvalExprSwitchContext((Node *) newexpr, econtext,
-                                                                                                                         &const_is_null, NULL);
+                                                                                                  &const_is_null, NULL);
 
-                                               /* Must copy result out of sub-context used by expression eval */
+                                               /*
+                                                * Must copy result out of sub-context used by
+                                                * expression eval
+                                                */
                                                if (!const_is_null)
                                                        const_val = datumCopy(const_val, resultTypByVal, resultTypLen);
 
@@ -1250,8 +1259,8 @@ eval_const_expressions_mutator(Node *node, void *context)
                                                 * Make the constant result node.
                                                 */
                                                return (Node *) makeConst(result_typeid, resultTypLen,
-                                                                                                 const_val, const_is_null,
-                                                                                                 resultTypByVal, false, false);
+                                                                                               const_val, const_is_null,
+                                                                                  resultTypByVal, false, false);
                                        }
                                        break;
                                }
@@ -1952,6 +1961,7 @@ expression_tree_walker(Node *node,
                                        return true;
                                if (walker(join->quals, context))
                                        return true;
+
                                /*
                                 * alias clause, using list are deemed uninteresting.
                                 */
index b9a91d1..3aee668 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.73 2002/06/20 20:29:31 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.74 2002/09/04 20:31:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -163,7 +163,7 @@ find_secondary_indexes(Oid relationObjectId)
                MemSet(info->ordering, 0, sizeof(Oid) * (INDEX_MAX_KEYS + 1));
                if (amorderstrategy != 0)
                {
-                       int             oprindex = amorderstrategy - 1;
+                       int                     oprindex = amorderstrategy - 1;
 
                        for (i = 0; i < info->ncolumns; i++)
                        {
index 978d9f0..49e2f1f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.38 2002/06/20 20:29:31 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.39 2002/09/04 20:31:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -157,16 +157,16 @@ make_base_rel(Query *root, int relid)
        switch (rte->rtekind)
        {
                case RTE_RELATION:
-               {
-                       /* Table --- retrieve statistics from the system catalogs */
-                       bool            indexed;
-
-                       get_relation_info(rte->relid,
-                                                         &indexed, &rel->pages, &rel->tuples);
-                       if (indexed)
-                               rel->indexlist = find_secondary_indexes(rte->relid);
-                       break;
-               }
+                       {
+                               /* Table --- retrieve statistics from the system catalogs */
+                               bool            indexed;
+
+                               get_relation_info(rte->relid,
+                                                                 &indexed, &rel->pages, &rel->tuples);
+                               if (indexed)
+                                       rel->indexlist = find_secondary_indexes(rte->relid);
+                               break;
+                       }
                case RTE_SUBQUERY:
                case RTE_FUNCTION:
                        /* Subquery or function --- nothing to do here */
@@ -379,11 +379,11 @@ build_join_rel(Query *root,
         * of the outer and inner join relations and then merging the results
         * together.
         *
-        * XXX right now we don't remove any irrelevant elements, we just
-        * append the two tlists together.  Someday consider pruning vars from the
+        * XXX right now we don't remove any irrelevant elements, we just append
+        * the two tlists together.  Someday consider pruning vars from the
         * join's targetlist if they are needed only to evaluate restriction
-        * clauses of this join, and will never be accessed at higher levels of
-        * the plantree.
+        * clauses of this join, and will never be accessed at higher levels
+        * of the plantree.
         *
         * NOTE: the tlist order for a join rel will depend on which pair of
         * outer and inner rels we first try to build it from.  But the
@@ -396,12 +396,12 @@ build_join_rel(Query *root,
 
        /*
         * If there are any alias variables attached to the matching join RTE,
-        * attach them to the tlist too, so that they will be evaluated for use
-        * at higher plan levels.
+        * attach them to the tlist too, so that they will be evaluated for
+        * use at higher plan levels.
         */
        if (joinrterel)
        {
-               List   *jrtetl;
+               List       *jrtetl;
 
                foreach(jrtetl, joinrterel->targetlist)
                {
index 776636f..ccccdbf 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.38 2002/06/20 20:29:31 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.39 2002/09/04 20:31:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,7 +53,7 @@ static bool contain_var_clause_walker(Node *node, void *context);
 static bool pull_var_clause_walker(Node *node,
                                           pull_var_clause_context *context);
 static Node *flatten_join_alias_vars_mutator(Node *node,
-                                               flatten_join_alias_vars_context *context);
+                                                               flatten_join_alias_vars_context *context);
 
 
 /*
@@ -317,7 +317,7 @@ pull_var_clause_walker(Node *node, pull_var_clause_context *context)
  * If force is TRUE then we will reduce all JOIN alias Vars to non-alias Vars
  * or expressions thereof (there may be COALESCE and/or type conversions
  * involved).  If force is FALSE we will not expand a Var to a non-Var
- * expression.  This is a hack to avoid confusing mergejoin planning, which
+ * expression. This is a hack to avoid confusing mergejoin planning, which
  * currently cannot cope with non-Var join items --- we leave the join vars
  * as Vars till after planning is done, then expand them during setrefs.c.
  *
@@ -346,9 +346,9 @@ flatten_join_alias_vars_mutator(Node *node,
                return NULL;
        if (IsA(node, Var))
        {
-               Var        *var = (Var *) node;
+               Var                *var = (Var *) node;
                RangeTblEntry *rte;
-               Node   *newvar;
+               Node       *newvar;
 
                if (var->varlevelsup != 0)
                        return node;            /* no need to copy, really */
@@ -357,7 +357,7 @@ flatten_join_alias_vars_mutator(Node *node,
                        return node;
                Assert(var->varattno > 0);
                newvar = (Node *) nth(var->varattno - 1, rte->joinaliasvars);
-               if (IsA(newvar, Var) || context->force)
+               if (IsA(newvar, Var) ||context->force)
                {
                        /* expand it; recurse in case join input is itself a join */
                        return flatten_join_alias_vars_mutator(newvar, context);
index 9896011..97b242b 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- *     $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.247 2002/09/02 06:11:42 momjian Exp $
+ *     $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.248 2002/09/04 20:31:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -54,7 +54,8 @@ typedef struct
        List       *tables;                     /* CREATE TABLE items */
        List       *views;                      /* CREATE VIEW items */
        List       *grants;                     /* GRANT items */
-       List       *fwconstraints;      /* Forward referencing FOREIGN KEY constraints */
+       List       *fwconstraints;      /* Forward referencing FOREIGN KEY
+                                                                * constraints */
        List       *alters;                     /* Generated ALTER items (from the above) */
        List       *ixconstraints;      /* index-creating constraints */
        List       *blist;                      /* "before list" of things to do before
@@ -84,13 +85,13 @@ typedef struct
 
 
 static Query *transformStmt(ParseState *pstate, Node *stmt,
-                                               List **extras_before, List **extras_after);
+                         List **extras_before, List **extras_after);
 static Query *transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt);
 static Query *transformInsertStmt(ParseState *pstate, InsertStmt *stmt,
-                                               List **extras_before, List **extras_after);
+                                       List **extras_before, List **extras_after);
 static Query *transformIndexStmt(ParseState *pstate, IndexStmt *stmt);
 static Query *transformRuleStmt(ParseState *query, RuleStmt *stmt,
-                                               List **extras_before, List **extras_after);
+                                 List **extras_before, List **extras_after);
 static Query *transformSelectStmt(ParseState *pstate, SelectStmt *stmt);
 static Query *transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt);
 static Node *transformSetOperationTree(ParseState *pstate, SelectStmt *stmt);
@@ -98,7 +99,7 @@ static Query *transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt);
 static Query *transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt);
 static Query *transformExecuteStmt(ParseState *pstate, ExecuteStmt *stmt);
 static Query *transformCreateStmt(ParseState *pstate, CreateStmt *stmt,
-                                               List **extras_before, List **extras_after);
+                                       List **extras_before, List **extras_after);
 static Query *transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt,
                                                List **extras_before, List **extras_after);
 static void transformColumnDefinition(ParseState *pstate,
@@ -139,6 +140,7 @@ parse_analyze(Node *parseTree, ParseState *parentParseState)
 {
        List       *result = NIL;
        ParseState *pstate = make_parsestate(parentParseState);
+
        /* Lists to return extra commands from transformation */
        List       *extras_before = NIL;
        List       *extras_after = NIL;
@@ -163,13 +165,13 @@ parse_analyze(Node *parseTree, ParseState *parentParseState)
        }
 
        /*
-        * Make sure that only the original query is marked original.
-        * We have to do this explicitly since recursive calls of parse_analyze
-        * will have set originalQuery in some of the added-on queries.
+        * Make sure that only the original query is marked original. We have
+        * to do this explicitly since recursive calls of parse_analyze will
+        * have set originalQuery in some of the added-on queries.
         */
        foreach(listscan, result)
        {
-               Query  *q = lfirst(listscan);
+               Query      *q = lfirst(listscan);
 
                q->originalQuery = (q == query);
        }
@@ -194,7 +196,7 @@ release_pstate_resources(ParseState *pstate)
  */
 static Query *
 transformStmt(ParseState *pstate, Node *parseTree,
-                         List **extras_before, List **extras_after)
+                         List **extras_before, List **extras_after)
 {
        Query      *result = NULL;
 
@@ -205,7 +207,7 @@ transformStmt(ParseState *pstate, Node *parseTree,
                         */
                case T_CreateStmt:
                        result = transformCreateStmt(pstate, (CreateStmt *) parseTree,
-                                                                       extras_before, extras_after);
+                                                                                extras_before, extras_after);
                        break;
 
                case T_IndexStmt:
@@ -214,7 +216,7 @@ transformStmt(ParseState *pstate, Node *parseTree,
 
                case T_RuleStmt:
                        result = transformRuleStmt(pstate, (RuleStmt *) parseTree,
-                                                                       extras_before, extras_after);
+                                                                          extras_before, extras_after);
                        break;
 
                case T_ViewStmt:
@@ -222,7 +224,7 @@ transformStmt(ParseState *pstate, Node *parseTree,
                                ViewStmt   *n = (ViewStmt *) parseTree;
 
                                n->query = transformStmt(pstate, (Node *) n->query,
-                                                                       extras_before, extras_after);
+                                                                                extras_before, extras_after);
 
                                /*
                                 * If a list of column names was given, run through and
@@ -270,14 +272,14 @@ transformStmt(ParseState *pstate, Node *parseTree,
                                result = makeNode(Query);
                                result->commandType = CMD_UTILITY;
                                n->query = transformStmt(pstate, (Node *) n->query,
-                                                               extras_before, extras_after);
+                                                                                extras_before, extras_after);
                                result->utilityStmt = (Node *) parseTree;
                        }
                        break;
 
                case T_AlterTableStmt:
                        result = transformAlterTableStmt(pstate, (AlterTableStmt *) parseTree,
-                                                                               extras_before, extras_after);
+                                                                                        extras_before, extras_after);
                        break;
 
                case T_PrepareStmt:
@@ -293,7 +295,7 @@ transformStmt(ParseState *pstate, Node *parseTree,
                         */
                case T_InsertStmt:
                        result = transformInsertStmt(pstate, (InsertStmt *) parseTree,
-                                                                               extras_before, extras_after);
+                                                                                extras_before, extras_after);
                        break;
 
                case T_DeleteStmt:
@@ -341,7 +343,7 @@ transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt)
 
        /* set up range table with just the result rel */
        qry->resultRelation = setTargetTable(pstate, stmt->relation,
-                                                                                interpretInhOption(stmt->relation->inhOpt),
+                                                         interpretInhOption(stmt->relation->inhOpt),
                                                                                 true);
 
        qry->distinctClause = NIL;
@@ -434,10 +436,11 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt,
 
                /*
                 * Note: we are not expecting that extras_before and extras_after
-                * are going to be used by the transformation of the SELECT statement.
+                * are going to be used by the transformation of the SELECT
+                * statement.
                 */
                selectQuery = transformStmt(sub_pstate, stmt->selectStmt,
-                                                               extras_before, extras_after);
+                                                                       extras_before, extras_after);
 
                release_pstate_resources(sub_pstate);
                pfree(sub_pstate);
@@ -525,7 +528,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt,
        foreach(tl, qry->targetList)
        {
                TargetEntry *tle = (TargetEntry *) lfirst(tl);
-               ResTarget   *col;
+               ResTarget  *col;
 
                if (icolumns == NIL || attnos == NIL)
                        elog(ERROR, "INSERT has more expressions than target columns");
@@ -541,7 +544,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt,
                        Assert(IsA(col, ResTarget));
                        Assert(!tle->resdom->resjunk);
                        updateTargetListEntry(pstate, tle, col->name, lfirsti(attnos),
-                                                         col->indirection);
+                                                                 col->indirection);
                }
                else
                {
@@ -555,9 +558,9 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt,
        }
 
        /*
-        * Ensure that the targetlist has the same number of  entries
-        * that were present in the columns list.  Don't do the check
-        * for select statements.
+        * Ensure that the targetlist has the same number of  entries that
+        * were present in the columns list.  Don't do the check for select
+        * statements.
         */
        if (stmt->cols != NIL && (icolumns != NIL || attnos != NIL))
                elog(ERROR, "INSERT has more target columns than expressions");
@@ -780,8 +783,8 @@ transformCreateStmt(ParseState *pstate, CreateStmt *stmt,
        q->utilityStmt = (Node *) stmt;
        stmt->tableElts = cxt.columns;
        stmt->constraints = cxt.ckconstraints;
-       *extras_before = nconc (*extras_before, cxt.blist);
-       *extras_after = nconc (cxt.alist, *extras_after);
+       *extras_before = nconc(*extras_before, cxt.blist);
+       *extras_after = nconc(cxt.alist, *extras_after);
 
        return q;
 }
@@ -839,7 +842,7 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
                snamespace = get_namespace_name(RangeVarGetCreationNamespace(cxt->relation));
 
                elog(NOTICE, "%s will create implicit sequence '%s' for SERIAL column '%s.%s'",
-                        cxt->stmtType, sname, cxt->relation->relname, column->colname);
+                 cxt->stmtType, sname, cxt->relation->relname, column->colname);
 
                /*
                 * Build a CREATE SEQUENCE command to create the sequence object,
@@ -1213,9 +1216,10 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt)
 
        /*
         * Scan the index list and remove any redundant index specifications.
-        * This can happen if, for instance, the user writes UNIQUE PRIMARY KEY.
-        * A strict reading of SQL92 would suggest raising an error instead,
-        * but that strikes me as too anal-retentive. - tgl 2001-02-14
+        * This can happen if, for instance, the user writes UNIQUE PRIMARY
+        * KEY. A strict reading of SQL92 would suggest raising an error
+        * instead, but that strikes me as too anal-retentive. - tgl
+        * 2001-02-14
         *
         * XXX in ALTER TABLE case, it'd be nice to look for duplicate
         * pre-existing indexes, too.
@@ -1279,7 +1283,7 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt)
                        iparam = lfirst(index->indexParams);
                        index->idxname = CreateIndexName(cxt->relation->relname,
                                                                                         iparam->name ? iparam->name :
-                                                                                        strVal(llast(iparam->funcname)),
+                                                                                strVal(llast(iparam->funcname)),
                                                                                         "key", cxt->alist);
                }
                if (index->idxname == NULL)             /* should not happen */
@@ -1352,7 +1356,7 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt)
                                        IndexElem  *ielem = lfirst(attr);
                                        char       *iname = ielem->name;
 
-                                       Assert(iname); /* no func index here */
+                                       Assert(iname);          /* no func index here */
                                        fkconstraint->pk_attrs = lappend(fkconstraint->pk_attrs,
                                                                                                         makeString(iname));
                                        if (attnum >= INDEX_MAX_KEYS)
@@ -1417,7 +1421,7 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt)
                                                        elog(ERROR, "Can only have %d keys in a foreign key",
                                                                 INDEX_MAX_KEYS);
                                                pktypoid[attnum++] = transformFkeyGetColType(cxt,
-                                                                                                                                        pkattr);
+                                                                                                                                pkattr);
                                        }
                                        if (found)
                                                break;
@@ -1444,8 +1448,8 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt)
                         * fktypoid[i] is the foreign key table's i'th element's type
                         * pktypoid[i] is the primary key table's i'th element's type
                         *
-                        * We let oper() do our work for us, including elog(ERROR) if
-                        * the types don't compare with =
+                        * We let oper() do our work for us, including elog(ERROR) if the
+                        * types don't compare with =
                         */
                        Operator        o = oper(makeList1(makeString("=")),
                                                                 fktypoid[i], pktypoid[i], false);
@@ -1462,7 +1466,7 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt)
                {
                        AlterTableStmt *alterstmt = makeNode(AlterTableStmt);
 
-                       alterstmt->subtype = 'c'; /* preprocessed add constraint */
+                       alterstmt->subtype = 'c';       /* preprocessed add constraint */
                        alterstmt->relation = cxt->relation;
                        alterstmt->name = NULL;
                        alterstmt->def = (Node *) makeList1(fkconstraint);
@@ -1528,7 +1532,7 @@ transformIndexStmt(ParseState *pstate, IndexStmt *stmt)
  */
 static Query *
 transformRuleStmt(ParseState *pstate, RuleStmt *stmt,
-                               List **extras_before, List **extras_after)
+                                 List **extras_before, List **extras_after)
 {
        Query      *qry;
        RangeTblEntry *oldrte;
@@ -1658,7 +1662,7 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt,
 
                        /* Transform the rule action statement */
                        top_subqry = transformStmt(sub_pstate, action,
-                                                               extras_before, extras_after);
+                                                                          extras_before, extras_after);
 
                        /*
                         * We cannot support utility-statement actions (eg NOTIFY)
@@ -2015,8 +2019,8 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
        }
 
        /*
-        * Any column names from CREATE TABLE AS need to be attached to both the
-        * top level and the leftmost subquery.  We do not do this earlier
+        * Any column names from CREATE TABLE AS need to be attached to both
+        * the top level and the leftmost subquery.  We do not do this earlier
         * because we do *not* want the targetnames list to be affected.
         */
        if (intoColNames)
@@ -2299,7 +2303,7 @@ transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
        pstate->p_is_update = true;
 
        qry->resultRelation = setTargetTable(pstate, stmt->relation,
-                                                                                interpretInhOption(stmt->relation->inhOpt),
+                                                         interpretInhOption(stmt->relation->inhOpt),
                                                                                 true);
 
        /*
@@ -2445,6 +2449,7 @@ transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt,
                        break;
 
                case 'c':
+
                        /*
                         * Already-transformed ADD CONSTRAINT, so just make it look
                         * like the standard case.
@@ -2466,12 +2471,12 @@ transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt,
 static Query *
 transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt)
 {
-       Query   *result = makeNode(Query);
-       List    *extras_before  = NIL,
-                       *extras_after   = NIL;
-       List    *argtype_oids = NIL; /* argtype OIDs in a list */
-       Oid             *argtoids = NULL;       /* as an array for parser_param_set */
-       int             nargs;
+       Query      *result = makeNode(Query);
+       List       *extras_before = NIL,
+                          *extras_after = NIL;
+       List       *argtype_oids = NIL;         /* argtype OIDs in a list */
+       Oid                *argtoids = NULL;    /* as an array for parser_param_set */
+       int                     nargs;
 
        result->commandType = CMD_UTILITY;
        result->utilityStmt = (Node *) stmt;
@@ -2481,15 +2486,15 @@ transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt)
 
        if (nargs)
        {
-               List *l;
-               int i = 0;
+               List       *l;
+               int                     i = 0;
 
                argtoids = (Oid *) palloc(nargs * sizeof(Oid));
 
-               foreach (l, stmt->argtypes)
+               foreach(l, stmt->argtypes)
                {
-                       TypeName *tn = lfirst(l);
-                       Oid toid = typenameTypeId(tn);
+                       TypeName   *tn = lfirst(l);
+                       Oid                     toid = typenameTypeId(tn);
 
                        argtype_oids = lappendi(argtype_oids, toid);
                        argtoids[i++] = toid;
@@ -2499,12 +2504,12 @@ transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt)
        stmt->argtype_oids = argtype_oids;
 
        /*
-        * We need to adjust the parameters expected by the
-        * rest of the system, so that $1, ... $n are parsed properly.
+        * We need to adjust the parameters expected by the rest of the
+        * system, so that $1, ... $n are parsed properly.
         *
-        * This is somewhat of a hack; however, the main parser interface
-        * only allows parameters to be specified when working with a
-        * raw query string, which is not helpful here.
+        * This is somewhat of a hack; however, the main parser interface only
+        * allows parameters to be specified when working with a raw query
+        * string, which is not helpful here.
         */
        parser_param_set(argtoids, nargs);
 
@@ -2524,8 +2529,8 @@ transformPrepareStmt(ParseState *pstate, PrepareStmt *stmt)
 static Query *
 transformExecuteStmt(ParseState *pstate, ExecuteStmt *stmt)
 {
-       Query *result = makeNode(Query);
-       List   *paramtypes;
+       Query      *result = makeNode(Query);
+       List       *paramtypes;
 
        result->commandType = CMD_UTILITY;
        result->utilityStmt = (Node *) stmt;
@@ -2534,20 +2539,20 @@ transformExecuteStmt(ParseState *pstate, ExecuteStmt *stmt)
 
        if (stmt->params || paramtypes)
        {
-               int nparams = length(stmt->params);
-               int nexpected = length(paramtypes);
-               List *l;
-               int i = 1;
+               int                     nparams = length(stmt->params);
+               int                     nexpected = length(paramtypes);
+               List       *l;
+               int                     i = 1;
 
                if (nparams != nexpected)
                        elog(ERROR, "Wrong number of parameters, expected %d but got %d",
                                 nexpected, nparams);
 
-               foreach (l, stmt->params)
+               foreach(l, stmt->params)
                {
-                       Node *expr = lfirst(l);
-                       Oid expected_type_id,
-                               given_type_id;
+                       Node       *expr = lfirst(l);
+                       Oid                     expected_type_id,
+                                               given_type_id;
 
                        expr = transformExpr(pstate, expr);
 
@@ -2571,7 +2576,7 @@ transformExecuteStmt(ParseState *pstate, ExecuteStmt *stmt)
 
                                if (!expr)
                                        elog(ERROR, "Parameter $%d of type %s cannot be coerced into the expected type %s"
-                                                               "\n\tYou will need to rewrite or cast the expression",
+                                       "\n\tYou will need to rewrite or cast the expression",
                                                 i,
                                                 format_type_be(given_type_id),
                                                 format_type_be(expected_type_id));
@@ -2833,7 +2838,7 @@ transformFkeyGetPrimaryKey(FkConstraint *fkconstraint, Oid *pktypoid)
 
                pktypoid[attnum++] = attnumTypeId(pkrel, pkattno);
                fkconstraint->pk_attrs = lappend(fkconstraint->pk_attrs,
-                                                                                makeString(pstrdup(NameStr(*attnumAttName(pkrel, pkattno)))));
+                  makeString(pstrdup(NameStr(*attnumAttName(pkrel, pkattno)))));
        }
 
        ReleaseSysCache(indexTuple);
@@ -3145,8 +3150,8 @@ analyzeCreateSchemaStmt(CreateSchemaStmt *stmt)
                                                elp->relation->schemaname = cxt.schemaname;
                                        else if (strcmp(cxt.schemaname, elp->relation->schemaname) != 0)
                                                elog(ERROR, "New table specifies a schema (%s)"
-                                                       " different from the one being created (%s)",
-                                                       elp->relation->schemaname, cxt.schemaname);
+                                                        " different from the one being created (%s)",
+                                                        elp->relation->schemaname, cxt.schemaname);
 
                                        /*
                                         * XXX todo: deal with constraints
@@ -3158,14 +3163,14 @@ analyzeCreateSchemaStmt(CreateSchemaStmt *stmt)
 
                        case T_ViewStmt:
                                {
-                                       ViewStmt *elp = (ViewStmt *) element;
+                                       ViewStmt   *elp = (ViewStmt *) element;
 
                                        if (elp->view->schemaname == NULL)
                                                elp->view->schemaname = cxt.schemaname;
                                        else if (strcmp(cxt.schemaname, elp->view->schemaname) != 0)
                                                elog(ERROR, "New view specifies a schema (%s)"
-                                                       " different from the one being created (%s)",
-                                                       elp->view->schemaname, cxt.schemaname);
+                                                        " different from the one being created (%s)",
+                                                        elp->view->schemaname, cxt.schemaname);
 
                                        /*
                                         * XXX todo: deal with references between views
index 95f45a9..a46ff5e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.96 2002/08/18 18:46:15 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.97 2002/09/04 20:31:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -41,8 +41,8 @@
 static char *clauseText[] = {"ORDER BY", "GROUP BY", "DISTINCT ON"};
 
 static void extractRemainingColumns(List *common_colnames,
-                                        List *src_colnames, List *src_colvars,
-                                        List **res_colnames, List **res_colvars);
+                                               List *src_colnames, List *src_colvars,
+                                               List **res_colnames, List **res_colvars);
 static Node *transformJoinUsingClause(ParseState *pstate,
                                                 List *leftVars, List *rightVars);
 static Node *transformJoinOnClause(ParseState *pstate, JoinExpr *j,
@@ -51,11 +51,11 @@ static RangeTblRef *transformTableEntry(ParseState *pstate, RangeVar *r);
 static RangeTblRef *transformRangeSubselect(ParseState *pstate,
                                                RangeSubselect *r);
 static RangeTblRef *transformRangeFunction(ParseState *pstate,
-                                                                                  RangeFunction *r);
+                                          RangeFunction *r);
 static Node *transformFromClauseItem(ParseState *pstate, Node *n,
                                                List **containedRels);
 static Node *buildMergedJoinVar(JoinType jointype,
-                                                               Var *l_colvar, Var *r_colvar);
+                                  Var *l_colvar, Var *r_colvar);
 static TargetEntry *findTargetlistEntry(ParseState *pstate, Node *node,
                                        List *tlist, int clause);
 static List *addTargetToSortList(TargetEntry *tle, List *sortlist,
@@ -85,9 +85,9 @@ transformFromClause(ParseState *pstate, List *frmList)
 
        /*
         * The grammar will have produced a list of RangeVars,
-        * RangeSubselects, RangeFunctions, and/or JoinExprs. Transform each one
-        * (possibly adding entries to the rtable), check for duplicate refnames,
-        * and then add it to the joinlist and namespace.
+        * RangeSubselects, RangeFunctions, and/or JoinExprs. Transform each
+        * one (possibly adding entries to the rtable), check for duplicate
+        * refnames, and then add it to the joinlist and namespace.
         */
        foreach(fl, frmList)
        {
@@ -466,13 +466,14 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
        funcname = strVal(llast(((FuncCall *) r->funccallnode)->funcname));
 
        /*
-        * Transform the raw FuncCall node.  This is a bit tricky because we don't
-        * want the function expression to be able to see any FROM items already
-        * created in the current query (compare to transformRangeSubselect).
-        * But it does need to be able to see any further-up parent states.
-        * So, temporarily make the current query level have an empty namespace.
-        * NOTE: this code is OK only because the expression can't legally alter
-        * the namespace by causing implicit relation refs to be added.
+        * Transform the raw FuncCall node.  This is a bit tricky because we
+        * don't want the function expression to be able to see any FROM items
+        * already created in the current query (compare to
+        * transformRangeSubselect). But it does need to be able to see any
+        * further-up parent states. So, temporarily make the current query
+        * level have an empty namespace. NOTE: this code is OK only because
+        * the expression can't legally alter the namespace by causing
+        * implicit relation refs to be added.
         */
        save_namespace = pstate->p_namespace;
        pstate->p_namespace = NIL;
@@ -482,18 +483,18 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
        pstate->p_namespace = save_namespace;
 
        /*
-        * We still need to check that the function parameters don't refer
-        * to any other rels.  That could happen despite our hack on the namespace
-        * if fully-qualified names are used.  So, check there are no local
-        * Var references in the transformed expression.  (Outer references
-        * are OK, and are ignored here.)
+        * We still need to check that the function parameters don't refer to
+        * any other rels.      That could happen despite our hack on the
+        * namespace if fully-qualified names are used.  So, check there are
+        * no local Var references in the transformed expression.  (Outer
+        * references are OK, and are ignored here.)
         */
        if (pull_varnos(funcexpr) != NIL)
                elog(ERROR, "FROM function expression may not refer to other relations of same query level");
 
        /*
-        * Disallow aggregate functions in the expression.  (No reason to postpone
-        * this check until parseCheckAggregates.)
+        * Disallow aggregate functions in the expression.      (No reason to
+        * postpone this check until parseCheckAggregates.)
         */
        if (pstate->p_hasAggs)
        {
@@ -503,8 +504,9 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
 
        /*
         * Insist we have a bare function call (explain.c is the only place
-        * that depends on this, I think).  If this fails, it's probably because
-        * transformExpr interpreted the function notation as a type coercion.
+        * that depends on this, I think).      If this fails, it's probably
+        * because transformExpr interpreted the function notation as a type
+        * coercion.
         */
        if (!funcexpr ||
                !IsA(funcexpr, Expr) ||
@@ -596,8 +598,8 @@ transformFromClauseItem(ParseState *pstate, Node *n, List **containedRels)
                j->rarg = transformFromClauseItem(pstate, j->rarg, &r_containedRels);
 
                /*
-                * Generate combined list of relation indexes for possible use
-                * by transformJoinOnClause below.
+                * Generate combined list of relation indexes for possible use by
+                * transformJoinOnClause below.
                 */
                my_containedRels = nconc(l_containedRels, r_containedRels);
 
@@ -893,6 +895,7 @@ buildMergedJoinVar(JoinType jointype, Var *l_colvar, Var *r_colvar)
        switch (jointype)
        {
                case JOIN_INNER:
+
                        /*
                         * We can use either var; prefer non-coerced one if available.
                         */
@@ -912,25 +915,25 @@ buildMergedJoinVar(JoinType jointype, Var *l_colvar, Var *r_colvar)
                        res_node = r_node;
                        break;
                case JOIN_FULL:
-               {
-                       /*
-                        * Here we must build a COALESCE expression to ensure that
-                        * the join output is non-null if either input is.
-                        */
-                       CaseExpr   *c = makeNode(CaseExpr);
-                       CaseWhen   *w = makeNode(CaseWhen);
-                       NullTest   *n = makeNode(NullTest);
-
-                       n->arg = l_node;
-                       n->nulltesttype = IS_NOT_NULL;
-                       w->expr = (Node *) n;
-                       w->result = l_node;
-                       c->casetype = outcoltype;
-                       c->args = makeList1(w);
-                       c->defresult = r_node;
-                       res_node = (Node *) c;
-                       break;
-               }
+                       {
+                               /*
+                                * Here we must build a COALESCE expression to ensure that
+                                * the join output is non-null if either input is.
+                                */
+                               CaseExpr   *c = makeNode(CaseExpr);
+                               CaseWhen   *w = makeNode(CaseWhen);
+                               NullTest   *n = makeNode(NullTest);
+
+                               n->arg = l_node;
+                               n->nulltesttype = IS_NOT_NULL;
+                               w->expr = (Node *) n;
+                               w->result = l_node;
+                               c->casetype = outcoltype;
+                               c->args = makeList1(w);
+                               c->defresult = r_node;
+                               res_node = (Node *) c;
+                               break;
+                       }
                default:
                        elog(ERROR, "buildMergedJoinVar: unexpected jointype %d",
                                 (int) jointype);
index 18224a7..d57e18f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.82 2002/09/01 02:27:32 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.83 2002/09/04 20:31:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -29,8 +29,8 @@
 
 static Oid     PreferredType(CATEGORY category, Oid type);
 static bool find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
-                                                                 bool isExplicit,
-                                                                 Oid *funcid);
+                                         bool isExplicit,
+                                         Oid *funcid);
 static Oid     find_typmod_coercion_function(Oid typeId);
 static Node *build_func_call(Oid funcid, Oid rettype, List *args);
 
@@ -71,8 +71,8 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
                 * XXX if the typinput function is not cachable, we really ought to
                 * postpone evaluation of the function call until runtime. But
                 * there is no way to represent a typinput function call as an
-                * expression tree, because C-string values are not Datums.
-                * (XXX This *is* possible as of 7.3, do we want to do it?)
+                * expression tree, because C-string values are not Datums. (XXX
+                * This *is* possible as of 7.3, do we want to do it?)
                 */
                Const      *con = (Const *) node;
                Const      *newcon = makeNode(Const);
@@ -91,10 +91,11 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
                                                                                                           con->constvalue));
 
                        /*
-                        * If target is a domain, use the typmod it applies to the base
-                        * type.  Note that we call stringTypeDatum using the domain's
-                        * pg_type row, though.  This works because the domain row has
-                        * the same typinput and typelem as the base type --- ugly...
+                        * If target is a domain, use the typmod it applies to the
+                        * base type.  Note that we call stringTypeDatum using the
+                        * domain's pg_type row, though.  This works because the
+                        * domain row has the same typinput and typelem as the base
+                        * type --- ugly...
                         */
                        if (targetTyptype == 'd')
                                atttypmod = getBaseTypeMod(targetTypeId, atttypmod);
@@ -127,11 +128,12 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
                if (OidIsValid(funcId))
                {
                        /*
-                        * Generate an expression tree representing run-time application
-                        * of the conversion function.  If we are dealing with a domain
-                        * target type, the conversion function will yield the base type.
+                        * Generate an expression tree representing run-time
+                        * application of the conversion function.      If we are dealing
+                        * with a domain target type, the conversion function will
+                        * yield the base type.
                         */
-                       Oid             baseTypeId = getBaseType(targetTypeId);
+                       Oid                     baseTypeId = getBaseType(targetTypeId);
 
                        result = build_func_call(funcId, baseTypeId, makeList1(node));
 
@@ -147,19 +149,20 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
                        }
 
                        /*
-                        * If the input is a constant, apply the type conversion function
-                        * now instead of delaying to runtime.  (We could, of course, just
-                        * leave this to be done during planning/optimization; but it's a
-                        * very frequent special case, and we save cycles in the rewriter
-                        * if we fold the expression now.)
+                        * If the input is a constant, apply the type conversion
+                        * function now instead of delaying to runtime.  (We could, of
+                        * course, just leave this to be done during
+                        * planning/optimization; but it's a very frequent special
+                        * case, and we save cycles in the rewriter if we fold the
+                        * expression now.)
                         *
                         * Note that no folding will occur if the conversion function is
                         * not marked 'immutable'.
                         *
                         * HACK: if constant is NULL, don't fold it here.  This is needed
                         * by make_subplan(), which calls this routine on placeholder
-                        * Const nodes that mustn't be collapsed.  (It'd be a lot cleaner
-                        * to make a separate node type for that purpose...)
+                        * Const nodes that mustn't be collapsed.  (It'd be a lot
+                        * cleaner to make a separate node type for that purpose...)
                         */
                        if (IsA(node, Const) &&
                                !((Const *) node)->constisnull)
@@ -168,21 +171,23 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
                else
                {
                        /*
-                        * We don't need to do a physical conversion, but we do need to
-                        * attach a RelabelType node so that the expression will be seen
-                        * to have the intended type when inspected by higher-level code.
+                        * We don't need to do a physical conversion, but we do need
+                        * to attach a RelabelType node so that the expression will be
+                        * seen to have the intended type when inspected by
+                        * higher-level code.
                         *
                         * Also, domains may have value restrictions beyond the base type
                         * that must be accounted for.
                         */
                        result = coerce_type_constraints(pstate, node,
                                                                                         targetTypeId, true);
+
                        /*
                         * XXX could we label result with exprTypmod(node) instead of
-                        * default -1 typmod, to save a possible length-coercion later?
-                        * Would work if both types have same interpretation of typmod,
-                        * which is likely but not certain (wrong if target is a domain,
-                        * in any case).
+                        * default -1 typmod, to save a possible length-coercion
+                        * later? Would work if both types have same interpretation of
+                        * typmod, which is likely but not certain (wrong if target is
+                        * a domain, in any case).
                         */
                        result = (Node *) makeRelabelType(result, targetTypeId, -1);
                }
@@ -190,9 +195,9 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
        else if (typeInheritsFrom(inputTypeId, targetTypeId))
        {
                /*
-                * Input class type is a subclass of target, so nothing to do
-                * --- except relabel the type.  This is binary compatibility
-                * for complex types.
+                * Input class type is a subclass of target, so nothing to do ---
+                * except relabel the type.  This is binary compatibility for
+                * complex types.
                 */
                result = (Node *) makeRelabelType(node, targetTypeId, -1);
        }
@@ -254,12 +259,15 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids,
                if (targetTypeId == ANYOID)
                        continue;
 
-               /* if target is ANYARRAY and source is a varlena array type, accept */
+               /*
+                * if target is ANYARRAY and source is a varlena array type,
+                * accept
+                */
                if (targetTypeId == ANYARRAYOID)
                {
-                       Oid typOutput;
-                       Oid typElem;
-                       bool typIsVarlena;
+                       Oid                     typOutput;
+                       Oid                     typElem;
+                       bool            typIsVarlena;
 
                        if (getTypeOutputInfo(inputTypeId, &typOutput, &typElem,
                                                                  &typIsVarlena))
@@ -267,10 +275,11 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids,
                                if (OidIsValid(typElem) && typIsVarlena)
                                        continue;
                        }
+
                        /*
-                        * Otherwise reject; this assumes there are no explicit coercions
-                        * to ANYARRAY.  If we don't reject then parse_coerce would have
-                        * to repeat the above test.
+                        * Otherwise reject; this assumes there are no explicit
+                        * coercions to ANYARRAY.  If we don't reject then
+                        * parse_coerce would have to repeat the above test.
                         */
                        return false;
                }
@@ -301,15 +310,15 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids,
 
 /*
  * Create an expression tree to enforce the constraints (if any)
- * that should be applied by the type.  Currently this is only
+ * that should be applied by the type. Currently this is only
  * interesting for domain types.
  */
 Node *
 coerce_type_constraints(ParseState *pstate, Node *arg,
                                                Oid typeId, bool applyTypmod)
 {
-       char   *notNull = NULL;
-       int32   typmod = -1;
+       char       *notNull = NULL;
+       int32           typmod = -1;
 
        for (;;)
        {
@@ -351,9 +360,9 @@ coerce_type_constraints(ParseState *pstate, Node *arg,
                arg = coerce_type_typmod(pstate, arg, typeId, typmod);
 
        /*
-        * Only need to add one NOT NULL check regardless of how many 
-        * domains in the stack request it.  The topmost domain that
-        * requested it is used as the constraint name.
+        * Only need to add one NOT NULL check regardless of how many domains
+        * in the stack request it.  The topmost domain that requested it is
+        * used as the constraint name.
         */
        if (notNull)
        {
@@ -361,11 +370,11 @@ coerce_type_constraints(ParseState *pstate, Node *arg,
 
                r->arg = arg;
                r->testtype = CONSTR_TEST_NOTNULL;
-               r->name = notNull;
+               r->name = notNull;
                r->check_expr = NULL;
 
                arg = (Node *) r;
-       }       
+       }
 
        return arg;
 }
@@ -904,7 +913,7 @@ build_func_call(Oid funcid, Oid rettype, List *args)
        funcnode = makeNode(Func);
        funcnode->funcid = funcid;
        funcnode->funcresulttype = rettype;
-       funcnode->funcretset = false; /* only possible case here */
+       funcnode->funcretset = false;           /* only possible case here */
        funcnode->func_fcache = NULL;
 
        expr = makeNode(Expr);
index de07d39..7be413f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.127 2002/08/31 22:10:46 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.128 2002/09/04 20:31:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -194,7 +194,7 @@ transformExpr(ParseState *pstate, Node *expr)
                                                         */
                                                        if (Transform_null_equals &&
                                                                length(a->name) == 1 &&
-                                                               strcmp(strVal(lfirst(a->name)), "=") == 0 &&
+                                                        strcmp(strVal(lfirst(a->name)), "=") == 0 &&
                                                                (exprIsNullConstant(a->lexpr) ||
                                                                 exprIsNullConstant(a->rexpr)))
                                                        {
@@ -213,9 +213,9 @@ transformExpr(ParseState *pstate, Node *expr)
                                                        else
                                                        {
                                                                Node       *lexpr = transformExpr(pstate,
-                                                                                                                               a->lexpr);
+                                                                                                                          a->lexpr);
                                                                Node       *rexpr = transformExpr(pstate,
-                                                                                                                               a->rexpr);
+                                                                                                                          a->rexpr);
 
                                                                result = (Node *) make_op(a->name,
                                                                                                                  lexpr,
@@ -277,41 +277,48 @@ transformExpr(ParseState *pstate, Node *expr)
                                                                                                                          a->lexpr);
                                                        Node       *rexpr = transformExpr(pstate,
                                                                                                                          a->rexpr);
+
                                                        result = (Node *) make_op(a->name,
                                                                                                          lexpr,
                                                                                                          rexpr);
-                                                       ((Expr *)result)->opType = DISTINCT_EXPR;
+                                                       ((Expr *) result)->opType = DISTINCT_EXPR;
                                                }
                                                break;
                                        case OF:
                                                {
-                                                       List *telem;
-                                                       A_Const *n;
-                                                       Oid ltype, rtype;
-                                                       bool matched = FALSE;
+                                                       List       *telem;
+                                                       A_Const    *n;
+                                                       Oid                     ltype,
+                                                                               rtype;
+                                                       bool            matched = FALSE;
 
-                                                       /* Checking an expression for match to type.
+                                                       /*
+                                                        * Checking an expression for match to type.
                                                         * Will result in a boolean constant node.
                                                         */
                                                        Node       *lexpr = transformExpr(pstate,
                                                                                                                          a->lexpr);
+
                                                        ltype = exprType(lexpr);
                                                        foreach(telem, (List *) a->rexpr)
                                                        {
                                                                rtype = LookupTypeName(lfirst(telem));
                                                                matched = (rtype == ltype);
-                                                               if (matched) break;
+                                                               if (matched)
+                                                                       break;
                                                        }
 
-                                                       /* Expect two forms: equals or not equals.
-                                                        * Flip the sense of the result for not equals.
+                                                       /*
+                                                        * Expect two forms: equals or not equals.
+                                                        * Flip the sense of the result for not
+                                                        * equals.
                                                         */
                                                        if (strcmp(strVal(lfirst(a->name)), "!=") == 0)
-                                                               matched = (! matched);
+                                                               matched = (!matched);
 
                                                        n = makeNode(A_Const);
                                                        n->val.type = T_String;
-                                                       n->val.val.str = (matched? "t": "f");
+                                                       n->val.val.str = (matched ? "t" : "f");
                                                        n->typename = SystemTypeName("bool");
 
                                                        result = transformExpr(pstate, (Node *) n);
@@ -411,7 +418,7 @@ transformExpr(ParseState *pstate, Node *expr)
 
                                        /* Combining operators other than =/<> is dubious... */
                                        if (length(left_list) != 1 &&
-                                               strcmp(opname, "=") != 0 && strcmp(opname, "<>") != 0)
+                                       strcmp(opname, "=") != 0 && strcmp(opname, "<>") != 0)
                                                elog(ERROR, "Row comparison cannot use operator %s",
                                                         opname);
 
@@ -453,7 +460,7 @@ transformExpr(ParseState *pstate, Node *expr)
                                                if (opform->oprresult != BOOLOID)
                                                        elog(ERROR, "%s has result type of %s, but must return %s"
                                                                 " to be used with quantified predicate subquery",
-                                                                opname, format_type_be(opform->oprresult),
+                                                          opname, format_type_be(opform->oprresult),
                                                                 format_type_be(BOOLOID));
 
                                                if (get_func_retset(opform->oprcode))
@@ -613,7 +620,7 @@ transformExpr(ParseState *pstate, Node *expr)
                                        default:
                                                elog(ERROR, "transformExpr: unexpected booltesttype %d",
                                                         (int) b->booltesttype);
-                                               clausename = NULL;      /* keep compiler quiet */
+                                               clausename = NULL;              /* keep compiler quiet */
                                }
 
                                b->arg = transformExpr(pstate, b->arg);
@@ -624,14 +631,14 @@ transformExpr(ParseState *pstate, Node *expr)
                                break;
                        }
 
-               /*********************************************
-                * Quietly accept node types that may be presented when we are
-                * called on an already-transformed tree.
-                *
-                * Do any other node types need to be accepted?  For now we are
-                * taking a conservative approach, and only accepting node
-                * types that are demonstrably necessary to accept.
-                *********************************************/
+                       /*********************************************
+                        * Quietly accept node types that may be presented when we are
+                        * called on an already-transformed tree.
+                        *
+                        * Do any other node types need to be accepted?  For now we are
+                        * taking a conservative approach, and only accepting node
+                        * types that are demonstrably necessary to accept.
+                        *********************************************/
                case T_Expr:
                case T_Var:
                case T_Const:
@@ -705,146 +712,148 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
        switch (numnames)
        {
                case 1:
-               {
-                       char   *name = strVal(lfirst(cref->fields));
+                       {
+                               char       *name = strVal(lfirst(cref->fields));
 
-                       /* Try to identify as an unqualified column */
-                       node = colnameToVar(pstate, name);
+                               /* Try to identify as an unqualified column */
+                               node = colnameToVar(pstate, name);
+
+                               if (node == NULL)
+                               {
+                                       /*
+                                        * Not known as a column of any range-table entry, so
+                                        * try to find the name as a relation ... but not if
+                                        * subscripts appear.  Note also that only relations
+                                        * already entered into the rangetable will be
+                                        * recognized.
+                                        *
+                                        * This is a hack for backwards compatibility with
+                                        * PostQUEL- inspired syntax.  The preferred form now
+                                        * is "rel.*".
+                                        */
+                                       int                     levels_up;
 
-                       if (node == NULL)
+                                       if (cref->indirection == NIL &&
+                                               refnameRangeTblEntry(pstate, NULL, name,
+                                                                                        &levels_up) != NULL)
+                                       {
+                                               rv = makeNode(RangeVar);
+                                               rv->relname = name;
+                                               rv->inhOpt = INH_DEFAULT;
+                                               node = (Node *) rv;
+                                       }
+                                       else
+                                               elog(ERROR, "Attribute \"%s\" not found", name);
+                               }
+                               break;
+                       }
+               case 2:
                        {
-                               /*
-                                * Not known as a column of any range-table entry, so
-                                * try to find the name as a relation ... but not if
-                                * subscripts appear.  Note also that only relations
-                                * already entered into the rangetable will be recognized.
-                                *
-                                * This is a hack for backwards compatibility with PostQUEL-
-                                * inspired syntax.  The preferred form now is "rel.*".
-                                */
-                               int             levels_up;
+                               char       *name1 = strVal(lfirst(cref->fields));
+                               char       *name2 = strVal(lsecond(cref->fields));
 
-                               if (cref->indirection == NIL &&
-                                       refnameRangeTblEntry(pstate, NULL, name,
-                                                                                &levels_up) != NULL)
+                               /* Whole-row reference? */
+                               if (strcmp(name2, "*") == 0)
                                {
                                        rv = makeNode(RangeVar);
-                                       rv->relname = name;
+                                       rv->relname = name1;
                                        rv->inhOpt = INH_DEFAULT;
                                        node = (Node *) rv;
+                                       break;
                                }
-                               else
-                                       elog(ERROR, "Attribute \"%s\" not found", name);
-                       }
-                       break;
-               }
-               case 2:
-               {
-                       char   *name1 = strVal(lfirst(cref->fields));
-                       char   *name2 = strVal(lsecond(cref->fields));
 
-                       /* Whole-row reference? */
-                       if (strcmp(name2, "*") == 0)
-                       {
-                               rv = makeNode(RangeVar);
-                               rv->relname = name1;
-                               rv->inhOpt = INH_DEFAULT;
-                               node = (Node *) rv;
+                               /* Try to identify as a once-qualified column */
+                               node = qualifiedNameToVar(pstate, NULL, name1, name2, true);
+                               if (node == NULL)
+                               {
+                                       /*
+                                        * Not known as a column of any range-table entry, so
+                                        * try it as a function call.  Here, we will create an
+                                        * implicit RTE for tables not already entered.
+                                        */
+                                       rv = makeNode(RangeVar);
+                                       rv->relname = name1;
+                                       rv->inhOpt = INH_DEFAULT;
+                                       node = ParseFuncOrColumn(pstate,
+                                                                                        makeList1(makeString(name2)),
+                                                                                        makeList1(rv),
+                                                                                        false, false, true);
+                               }
                                break;
                        }
-
-                       /* Try to identify as a once-qualified column */
-                       node = qualifiedNameToVar(pstate, NULL, name1, name2, true);
-                       if (node == NULL)
-                       {
-                               /*
-                                * Not known as a column of any range-table entry, so
-                                * try it as a function call.  Here, we will create an
-                                * implicit RTE for tables not already entered.
-                                */
-                               rv = makeNode(RangeVar);
-                               rv->relname = name1;
-                               rv->inhOpt = INH_DEFAULT;
-                               node = ParseFuncOrColumn(pstate,
-                                                                                makeList1(makeString(name2)),
-                                                                                makeList1(rv),
-                                                                                false, false, true);
-                       }
-                       break;
-               }
                case 3:
-               {
-                       char   *name1 = strVal(lfirst(cref->fields));
-                       char   *name2 = strVal(lsecond(cref->fields));
-                       char   *name3 = strVal(lfirst(lnext(lnext(cref->fields))));
-
-                       /* Whole-row reference? */
-                       if (strcmp(name3, "*") == 0)
                        {
-                               rv = makeNode(RangeVar);
-                               rv->schemaname = name1;
-                               rv->relname = name2;
-                               rv->inhOpt = INH_DEFAULT;
-                               node = (Node *) rv;
-                               break;
-                       }
+                               char       *name1 = strVal(lfirst(cref->fields));
+                               char       *name2 = strVal(lsecond(cref->fields));
+                               char       *name3 = strVal(lfirst(lnext(lnext(cref->fields))));
 
-                       /* Try to identify as a twice-qualified column */
-                       node = qualifiedNameToVar(pstate, name1, name2, name3, true);
-                       if (node == NULL)
-                       {
-                               /* Try it as a function call */
-                               rv = makeNode(RangeVar);
-                               rv->schemaname = name1;
-                               rv->relname = name2;
-                               rv->inhOpt = INH_DEFAULT;
-                               node = ParseFuncOrColumn(pstate,
-                                                                                makeList1(makeString(name3)),
-                                                                                makeList1(rv),
-                                                                                false, false, true);
+                               /* Whole-row reference? */
+                               if (strcmp(name3, "*") == 0)
+                               {
+                                       rv = makeNode(RangeVar);
+                                       rv->schemaname = name1;
+                                       rv->relname = name2;
+                                       rv->inhOpt = INH_DEFAULT;
+                                       node = (Node *) rv;
+                                       break;
+                               }
+
+                               /* Try to identify as a twice-qualified column */
+                               node = qualifiedNameToVar(pstate, name1, name2, name3, true);
+                               if (node == NULL)
+                               {
+                                       /* Try it as a function call */
+                                       rv = makeNode(RangeVar);
+                                       rv->schemaname = name1;
+                                       rv->relname = name2;
+                                       rv->inhOpt = INH_DEFAULT;
+                                       node = ParseFuncOrColumn(pstate,
+                                                                                        makeList1(makeString(name3)),
+                                                                                        makeList1(rv),
+                                                                                        false, false, true);
+                               }
+                               break;
                        }
-                       break;
-               }
                case 4:
-               {
-                       char   *name1 = strVal(lfirst(cref->fields));
-                       char   *name2 = strVal(lsecond(cref->fields));
-                       char   *name3 = strVal(lfirst(lnext(lnext(cref->fields))));
-                       char   *name4 = strVal(lfirst(lnext(lnext(lnext(cref->fields)))));
-
-                       /*
-                        * We check the catalog name and then ignore it.
-                        */
-                       if (strcmp(name1, DatabaseName) != 0)
-                               elog(ERROR, "Cross-database references are not implemented");
-
-                       /* Whole-row reference? */
-                       if (strcmp(name4, "*") == 0)
                        {
-                               rv = makeNode(RangeVar);
-                               rv->schemaname = name2;
-                               rv->relname = name3;
-                               rv->inhOpt = INH_DEFAULT;
-                               node = (Node *) rv;
-                               break;
-                       }
+                               char       *name1 = strVal(lfirst(cref->fields));
+                               char       *name2 = strVal(lsecond(cref->fields));
+                               char       *name3 = strVal(lfirst(lnext(lnext(cref->fields))));
+                               char       *name4 = strVal(lfirst(lnext(lnext(lnext(cref->fields)))));
 
-                       /* Try to identify as a twice-qualified column */
-                       node = qualifiedNameToVar(pstate, name2, name3, name4, true);
-                       if (node == NULL)
-                       {
-                               /* Try it as a function call */
-                               rv = makeNode(RangeVar);
-                               rv->schemaname = name2;
-                               rv->relname = name3;
-                               rv->inhOpt = INH_DEFAULT;
-                               node = ParseFuncOrColumn(pstate,
-                                                                                makeList1(makeString(name4)),
-                                                                                makeList1(rv),
-                                                                                false, false, true);
+                               /*
+                                * We check the catalog name and then ignore it.
+                                */
+                               if (strcmp(name1, DatabaseName) != 0)
+                                       elog(ERROR, "Cross-database references are not implemented");
+
+                               /* Whole-row reference? */
+                               if (strcmp(name4, "*") == 0)
+                               {
+                                       rv = makeNode(RangeVar);
+                                       rv->schemaname = name2;
+                                       rv->relname = name3;
+                                       rv->inhOpt = INH_DEFAULT;
+                                       node = (Node *) rv;
+                                       break;
+                               }
+
+                               /* Try to identify as a twice-qualified column */
+                               node = qualifiedNameToVar(pstate, name2, name3, name4, true);
+                               if (node == NULL)
+                               {
+                                       /* Try it as a function call */
+                                       rv = makeNode(RangeVar);
+                                       rv->schemaname = name2;
+                                       rv->relname = name3;
+                                       rv->inhOpt = INH_DEFAULT;
+                                       node = ParseFuncOrColumn(pstate,
+                                                                                        makeList1(makeString(name4)),
+                                                                                        makeList1(rv),
+                                                                                        false, false, true);
+                               }
+                               break;
                        }
-                       break;
-               }
                default:
                        elog(ERROR, "Invalid qualified name syntax (too many names)");
                        node = NULL;            /* keep compiler quiet */
@@ -1095,8 +1104,9 @@ exprIsLengthCoercion(Node *expr, int32 *coercedTypmod)
        }
 
        /*
-        * Furthermore, the name and namespace of the function must be the same
-        * as its result type's name/namespace (cf. find_coercion_function).
+        * Furthermore, the name and namespace of the function must be the
+        * same as its result type's name/namespace (cf.
+        * find_coercion_function).
         */
        typeTuple = SearchSysCache(TYPEOID,
                                                           ObjectIdGetDatum(procStruct->prorettype),
@@ -1206,7 +1216,7 @@ parser_typecast_expression(ParseState *pstate,
        {
                expr = CoerceTargetExpr(pstate, expr, inputType,
                                                                targetType, typename->typmod,
-                                                               true); /* explicit coercion */
+                                                               true);  /* explicit coercion */
                if (expr == NULL)
                        elog(ERROR, "Cannot cast type '%s' to '%s'",
                                 format_type_be(inputType),
index 87e432b..648ddfb 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.135 2002/08/22 00:01:42 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.136 2002/09/04 20:31:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -45,14 +45,14 @@ static void make_arguments(ParseState *pstate,
                           Oid *input_typeids,
                           Oid *function_typeids);
 static int match_argtypes(int nargs,
-                                                 Oid *input_typeids,
-                                                 FuncCandidateList function_typeids,
-                                                 FuncCandidateList *candidates);
+                          Oid *input_typeids,
+                          FuncCandidateList function_typeids,
+                          FuncCandidateList *candidates);
 static FieldSelect *setup_field_select(Node *input, char *attname, Oid relid);
 static FuncCandidateList func_select_candidate(int nargs, Oid *input_typeids,
-                                                                 FuncCandidateList candidates);
+                                         FuncCandidateList candidates);
 static void unknown_attribute(const char *schemaname, const char *relname,
-                                                         const char *attname);
+                                 const char *attname);
 
 
 /*
@@ -111,8 +111,8 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
        /*
         * check for column projection: if function has one argument, and that
         * argument is of complex type, and function name is not qualified,
-        * then the "function call" could be a projection.  We also check
-        * that there wasn't any aggregate decoration.
+        * then the "function call" could be a projection.      We also check that
+        * there wasn't any aggregate decoration.
         */
        if (nargs == 1 && !agg_star && !agg_distinct && length(funcname) == 1)
        {
@@ -123,7 +123,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
                {
                        /* First arg is a relation. This could be a projection. */
                        retval = qualifiedNameToVar(pstate,
-                                                                               ((RangeVar *) first_arg)->schemaname,
+                                                                       ((RangeVar *) first_arg)->schemaname,
                                                                                ((RangeVar *) first_arg)->relname,
                                                                                cname,
                                                                                true);
@@ -144,9 +144,9 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
        }
 
        /*
-        * Okay, it's not a column projection, so it must really be a function.
-        * Extract arg type info and transform RangeVar arguments into varnodes
-        * of the appropriate form.
+        * Okay, it's not a column projection, so it must really be a
+        * function. Extract arg type info and transform RangeVar arguments
+        * into varnodes of the appropriate form.
         */
        MemSet(oid_array, 0, FUNC_MAX_ARGS * sizeof(Oid));
 
@@ -199,6 +199,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
                                        toid = exprType(rte->funcexpr);
                                        break;
                                default:
+
                                        /*
                                         * RTE is a join or subselect; must fail for lack of a
                                         * named tuple type
@@ -209,7 +210,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
                                        else
                                                elog(ERROR, "Cannot pass result of sub-select or join %s to a function",
                                                         relname);
-                                       toid = InvalidOid; /* keep compiler quiet */
+                                       toid = InvalidOid;      /* keep compiler quiet */
                                        break;
                        }
 
@@ -228,10 +229,10 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
 
        /*
         * func_get_detail looks up the function in the catalogs, does
-        * disambiguation for polymorphic functions, handles inheritance,
-        * and returns the funcid and type and set or singleton status of
-        * the function's return value.  it also returns the true argument
-        * types to the function.
+        * disambiguation for polymorphic functions, handles inheritance, and
+        * returns the funcid and type and set or singleton status of the
+        * function's return value.  it also returns the true argument types
+        * to the function.
         */
        fdresult = func_get_detail(funcname, fargs, nargs, oid_array,
                                                           &funcid, &rettype, &retset,
@@ -263,13 +264,13 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
                /*
                 * Oops.  Time to die.
                 *
-                * If we are dealing with the attribute notation rel.function,
-                * give an error message that is appropriate for that case.
+                * If we are dealing with the attribute notation rel.function, give
+                * an error message that is appropriate for that case.
                 */
                if (is_column)
                {
-                       char   *colname = strVal(lfirst(funcname));
-                       Oid             relTypeId;
+                       char       *colname = strVal(lfirst(funcname));
+                       Oid                     relTypeId;
 
                        Assert(nargs == 1);
                        if (IsA(first_arg, RangeVar))
@@ -284,6 +285,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
                                elog(ERROR, "Attribute \"%s\" not found in datatype %s",
                                         colname, format_type_be(relTypeId));
                }
+
                /*
                 * Else generate a detailed complaint for a function
                 */
@@ -351,7 +353,7 @@ static int
 match_argtypes(int nargs,
                           Oid *input_typeids,
                           FuncCandidateList function_typeids,
-                          FuncCandidateList *candidates) /* return value */
+                          FuncCandidateList *candidates)       /* return value */
 {
        FuncCandidateList current_candidate;
        FuncCandidateList next_candidate;
@@ -863,7 +865,7 @@ func_get_detail(List *funcname,
                ftup = SearchSysCache(PROCOID,
                                                          ObjectIdGetDatum(best_candidate->oid),
                                                          0, 0, 0);
-               if (!HeapTupleIsValid(ftup)) /* should not happen */
+               if (!HeapTupleIsValid(ftup))    /* should not happen */
                        elog(ERROR, "function %u not found", best_candidate->oid);
                pform = (Form_pg_proc) GETSTRUCT(ftup);
                *rettype = pform->prorettype;
@@ -1172,7 +1174,7 @@ setup_field_select(Node *input, char *attname, Oid relid)
  * ParseComplexProjection -
  *       handles function calls with a single argument that is of complex type.
  *       If the function call is actually a column projection, return a suitably
- *       transformed expression tree.  If not, return NULL.
+ *       transformed expression tree.  If not, return NULL.
  *
  * NB: argument is expected to be transformed already, ie, not a RangeVar.
  */
@@ -1194,7 +1196,8 @@ ParseComplexProjection(ParseState *pstate,
                return NULL;                    /* funcname does not match any column */
 
        /*
-        * Check for special cases where we don't want to return a FieldSelect.
+        * Check for special cases where we don't want to return a
+        * FieldSelect.
         */
        switch (nodeTag(first_arg))
        {
@@ -1208,8 +1211,8 @@ ParseComplexProjection(ParseState *pstate,
                                 */
                                if (var->varattno == InvalidAttrNumber)
                                {
-                                       Oid             vartype;
-                                       int32   vartypmod;
+                                       Oid                     vartype;
+                                       int32           vartypmod;
 
                                        get_atttypetypmod(argrelid, attnum,
                                                                          &vartype, &vartypmod);
@@ -1313,7 +1316,7 @@ find_aggregate_func(const char *caller, List *aggname, Oid basetype)
        ftup = SearchSysCache(PROCOID,
                                                  ObjectIdGetDatum(oid),
                                                  0, 0, 0);
-       if (!HeapTupleIsValid(ftup)) /* should not happen */
+       if (!HeapTupleIsValid(ftup))    /* should not happen */
                elog(ERROR, "function %u not found", oid);
        pform = (Form_pg_proc) GETSTRUCT(ftup);
 
@@ -1367,10 +1370,10 @@ LookupFuncName(List *funcname, int nargs, const Oid *argtypes)
 Oid
 LookupFuncNameTypeNames(List *funcname, List *argtypes, const char *caller)
 {
-       Oid             funcoid;
-       Oid             argoids[FUNC_MAX_ARGS];
-       int             argcount;
-       int             i;
+       Oid                     funcoid;
+       Oid                     argoids[FUNC_MAX_ARGS];
+       int                     argcount;
+       int                     i;
 
        MemSet(argoids, 0, FUNC_MAX_ARGS * sizeof(Oid));
        argcount = length(argtypes);
index 33ee300..391694f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.67 2002/08/26 17:53:58 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.68 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -135,8 +135,8 @@ make_op(List *opname, Node *ltree, Node *rtree)
 
        newop = makeOper(oprid(tup),    /* opno */
                                         InvalidOid,    /* opid */
-                                        opform->oprresult,     /* opresulttype */
-                                        get_func_retset(opform->oprcode));     /* opretset */
+                                        opform->oprresult, /* opresulttype */
+                                        get_func_retset(opform->oprcode)); /* opretset */
 
        result = makeNode(Expr);
        result->typeOid = opform->oprresult;
index 78128b4..ecf1a2a 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.58 2002/07/20 05:16:58 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.59 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "utils/fmgroids.h"
 #include "utils/syscache.h"
 
-static Oid     binary_oper_exact(Oid arg1, Oid arg2,
-                                                         FuncCandidateList candidates);
-static Oid     oper_select_candidate(int nargs, Oid *input_typeids,
-                                                                 FuncCandidateList candidates);
+static Oid binary_oper_exact(Oid arg1, Oid arg2,
+                                 FuncCandidateList candidates);
+static Oid oper_select_candidate(int nargs, Oid *input_typeids,
+                                         FuncCandidateList candidates);
 static void op_error(List *op, Oid arg1, Oid arg2);
 static void unary_op_error(List *op, Oid arg, bool is_left_op);
 
@@ -52,7 +52,7 @@ Oid
 LookupOperName(List *opername, Oid oprleft, Oid oprright)
 {
        FuncCandidateList clist;
-       char    oprkind;
+       char            oprkind;
 
        if (!OidIsValid(oprleft))
                oprkind = 'l';
@@ -85,9 +85,9 @@ Oid
 LookupOperNameTypeNames(List *opername, TypeName *oprleft,
                                                TypeName *oprright, const char *caller)
 {
-       Oid             operoid;
-       Oid             leftoid,
-                       rightoid;
+       Oid                     operoid;
+       Oid                     leftoid,
+                               rightoid;
 
        if (oprleft == NULL)
                leftoid = InvalidOid;
@@ -652,7 +652,10 @@ oper(List *opname, Oid ltypeId, Oid rtypeId, bool noError)
                         * Otherwise, search for the most suitable candidate.
                         */
 
-                       /* Unspecified type for one of the arguments? then use the other */
+                       /*
+                        * Unspecified type for one of the arguments? then use the
+                        * other
+                        */
                        if (rtypeId == InvalidOid)
                                rtypeId = ltypeId;
                        else if (ltypeId == InvalidOid)
index 174c057..65c386a 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.78 2002/08/29 00:17:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.79 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 static Node *scanNameSpaceForRefname(ParseState *pstate, Node *nsnode,
                                                const char *refname);
 static Node *scanNameSpaceForRelid(ParseState *pstate, Node *nsnode,
-                                                                  Oid relid);
+                                         Oid relid);
 static void scanNameSpaceForConflict(ParseState *pstate, Node *nsnode,
                                                 RangeTblEntry *rte1, const char *aliasname1);
 static Node *scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte,
                                 char *colname);
 static bool isForUpdate(ParseState *pstate, char *refname);
 static bool get_rte_attribute_is_dropped(RangeTblEntry *rte,
-                                                                                AttrNumber attnum);
+                                                        AttrNumber attnum);
 static int     specialAttNum(const char *attname);
 static void warnAutoRange(ParseState *pstate, RangeVar *relation);
 
@@ -64,7 +64,7 @@ static void warnAutoRange(ParseState *pstate, RangeVar *relation);
  *
  * A qualified refname (schemaname != NULL) can only match a relation RTE
  * that (a) has no alias and (b) is for the same relation identified by
- * schemaname.refname.  In this case we convert schemaname.refname to a
+ * schemaname.refname. In this case we convert schemaname.refname to a
  * relation OID and search by relid, rather than by alias name.  This is
  * peculiar, but it's what SQL92 says to do.
  */
@@ -189,7 +189,7 @@ scanNameSpaceForRefname(ParseState *pstate, Node *nsnode,
 
 /*
  * Recursively search a namespace for a relation RTE matching the
- * given relation OID.  Return the node if a unique match, or NULL
+ * given relation OID. Return the node if a unique match, or NULL
  * if no match.  Raise error if multiple matches (which shouldn't
  * happen if the namespace was checked correctly when it was created).
  *
@@ -313,9 +313,7 @@ checkNameSpaceConflicts(ParseState *pstate, Node *namespace1,
                List       *l;
 
                foreach(l, (List *) namespace1)
-               {
                        checkNameSpaceConflicts(pstate, lfirst(l), namespace2);
-               }
        }
        else
                elog(ERROR, "checkNameSpaceConflicts: unexpected node type %d",
@@ -353,6 +351,7 @@ scanNameSpaceForConflict(ParseState *pstate, Node *nsnode,
                        if (strcmp(j->alias->aliasname, aliasname1) == 0)
                                elog(ERROR, "Table name \"%s\" specified more than once",
                                         aliasname1);
+
                        /*
                         * Tables within an aliased join are invisible from outside
                         * the join, according to the scope rules of SQL92 (the join
@@ -368,9 +367,7 @@ scanNameSpaceForConflict(ParseState *pstate, Node *nsnode,
                List       *l;
 
                foreach(l, (List *) nsnode)
-               {
                        scanNameSpaceForConflict(pstate, lfirst(l), rte1, aliasname1);
-               }
        }
        else
                elog(ERROR, "scanNameSpaceForConflict: unexpected node type %d",
@@ -438,16 +435,16 @@ scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte, char *colname)
         * Scan the user column names (or aliases) for a match. Complain if
         * multiple matches.
         *
-        * Note: because eref->colnames may include names of dropped columns,
-        * we need to check for non-droppedness before accepting a match.
-        * This takes an extra cache lookup, but we can skip the lookup most
-        * of the time by exploiting the knowledge that dropped columns are
-        * assigned dummy names starting with '.', which is an unusual choice
-        * for actual column names.
+        * Note: because eref->colnames may include names of dropped columns, we
+        * need to check for non-droppedness before accepting a match. This
+        * takes an extra cache lookup, but we can skip the lookup most of the
+        * time by exploiting the knowledge that dropped columns are assigned
+        * dummy names starting with '.', which is an unusual choice for
+        * actual column names.
         *
-        * Should the user try to fool us by altering pg_attribute.attname
-        * for a dropped column, we'll still catch it by virtue of the checks
-        * in get_rte_attribute_type(), which is called by make_var().  That
+        * Should the user try to fool us by altering pg_attribute.attname for a
+        * dropped column, we'll still catch it by virtue of the checks in
+        * get_rte_attribute_type(), which is called by make_var().  That
         * routine has to do a cache lookup anyway, so the check there is
         * cheap.
         */
@@ -456,7 +453,7 @@ scanRTEForColumn(ParseState *pstate, RangeTblEntry *rte, char *colname)
                attnum++;
                if (strcmp(strVal(lfirst(c)), colname) == 0)
                {
-                       if (colname[0] == '.' && /* see note above */
+                       if (colname[0] == '.' &&        /* see note above */
                                get_rte_attribute_is_dropped(rte, attnum))
                                continue;
                        if (result)
@@ -903,8 +900,8 @@ addRangeTableEntryForFunction(ParseState *pstate,
        if (coldeflist != NIL)
        {
                /*
-                * we *only* allow a coldeflist for functions returning a
-                * RECORD pseudo-type
+                * we *only* allow a coldeflist for functions returning a RECORD
+                * pseudo-type
                 */
                if (funcrettype != RECORDOID)
                        elog(ERROR, "A column definition list is only allowed for functions returning RECORD");
@@ -935,14 +932,14 @@ addRangeTableEntryForFunction(ParseState *pstate,
                                 funcrettype);
 
                /*
-                * Get the rel's relcache entry.  This access ensures that we have an
-                * up-to-date relcache entry for the rel.
+                * Get the rel's relcache entry.  This access ensures that we have
+                * an up-to-date relcache entry for the rel.
                 */
                rel = relation_open(funcrelid, AccessShareLock);
 
                /*
-                * Since the rel is open anyway, let's check that the number of column
-                * aliases is reasonable.
+                * Since the rel is open anyway, let's check that the number of
+                * column aliases is reasonable.
                 */
                maxattrs = RelationGetNumberOfAttributes(rel);
                if (maxattrs < numaliases)
@@ -960,16 +957,16 @@ addRangeTableEntryForFunction(ParseState *pstate,
 
                /*
                 * Drop the rel refcount, but keep the access lock till end of
-                * transaction so that the table can't be deleted or have its schema
-                * modified underneath us.
+                * transaction so that the table can't be deleted or have its
+                * schema modified underneath us.
                 */
                relation_close(rel, NoLock);
        }
        else if (functyptype == 'b' || functyptype == 'd')
        {
                /*
-                * Must be a base data type, i.e. scalar.
-                * Just add one alias column named for the function.
+                * Must be a base data type, i.e. scalar. Just add one alias
+                * column named for the function.
                 */
                if (numaliases > 1)
                        elog(ERROR, "Too many column aliases specified for function %s",
@@ -1270,17 +1267,17 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
                case RTE_FUNCTION:
                        {
                                /* Function RTE */
-                               Oid     funcrettype = exprType(rte->funcexpr);
-                               char functyptype = get_typtype(funcrettype);
-                               List *coldeflist = rte->coldeflist;
+                               Oid                     funcrettype = exprType(rte->funcexpr);
+                               char            functyptype = get_typtype(funcrettype);
+                               List       *coldeflist = rte->coldeflist;
 
                                if (functyptype == 'c')
                                {
                                        /*
-                                        * Composite data type, i.e. a table's row type
-                                        * Same as ordinary relation RTE
+                                        * Composite data type, i.e. a table's row type Same
+                                        * as ordinary relation RTE
                                         */
-                                       Oid     funcrelid = typeidTypeRelid(funcrettype);
+                                       Oid                     funcrelid = typeidTypeRelid(funcrettype);
                                        Relation        rel;
                                        int                     maxattrs;
                                        int                     numaliases;
@@ -1373,10 +1370,10 @@ expandRTE(ParseState *pstate, RangeTblEntry *rte,
                                                        atttypid = typenameTypeId(colDef->typename);
 
                                                        varnode = makeVar(rtindex,
-                                                                                       attnum,
-                                                                                       atttypid,
-                                                                                       -1,
-                                                                                       sublevels_up);
+                                                                                         attnum,
+                                                                                         atttypid,
+                                                                                         -1,
+                                                                                         sublevels_up);
 
                                                        *colvars = lappend(*colvars, varnode);
                                                }
@@ -1495,9 +1492,9 @@ get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
 
        /*
         * If the RTE is a relation, go to the system catalogs not the
-        * eref->colnames list.  This is a little slower but it will give
-        * the right answer if the column has been renamed since the eref
-        * list was built (which can easily happen for rules).
+        * eref->colnames list.  This is a little slower but it will give the
+        * right answer if the column has been renamed since the eref list was
+        * built (which can easily happen for rules).
         */
        if (rte->rtekind == RTE_RELATION)
        {
@@ -1509,7 +1506,8 @@ get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
        }
 
        /*
-        * Otherwise use the column name from eref.  There should always be one.
+        * Otherwise use the column name from eref.  There should always be
+        * one.
         */
        if (attnum > 0 && attnum <= length(rte->eref->colnames))
                return strVal(nth(attnum - 1, rte->eref->colnames));
@@ -1544,13 +1542,14 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
                                        elog(ERROR, "Relation \"%s\" does not have attribute %d",
                                                 get_rel_name(rte->relid), attnum);
                                att_tup = (Form_pg_attribute) GETSTRUCT(tp);
+
                                /*
                                 * If dropped column, pretend it ain't there.  See notes
                                 * in scanRTEForColumn.
                                 */
                                if (att_tup->attisdropped)
                                        elog(ERROR, "Relation \"%s\" has no column \"%s\"",
-                                                get_rel_name(rte->relid), NameStr(att_tup->attname));
+                                       get_rel_name(rte->relid), NameStr(att_tup->attname));
                                *vartype = att_tup->atttypid;
                                *vartypmod = att_tup->atttypmod;
                                ReleaseSysCache(tp);
@@ -1579,19 +1578,19 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
                case RTE_FUNCTION:
                        {
                                /* Function RTE */
-                               Oid funcrettype = exprType(rte->funcexpr);
-                               char functyptype = get_typtype(funcrettype);
-                               List *coldeflist = rte->coldeflist;
+                               Oid                     funcrettype = exprType(rte->funcexpr);
+                               char            functyptype = get_typtype(funcrettype);
+                               List       *coldeflist = rte->coldeflist;
 
                                if (functyptype == 'c')
                                {
                                        /*
-                                        * Composite data type, i.e. a table's row type
-                                        * Same as ordinary relation RTE
+                                        * Composite data type, i.e. a table's row type Same
+                                        * as ordinary relation RTE
                                         */
-                                       Oid funcrelid = typeidTypeRelid(funcrettype);
-                                       HeapTuple                       tp;
-                                       Form_pg_attribute       att_tup;
+                                       Oid                     funcrelid = typeidTypeRelid(funcrettype);
+                                       HeapTuple       tp;
+                                       Form_pg_attribute att_tup;
 
                                        if (!OidIsValid(funcrelid))
                                                elog(ERROR, "Invalid typrelid for complex type %u",
@@ -1606,9 +1605,10 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
                                                elog(ERROR, "Relation \"%s\" does not have attribute %d",
                                                         get_rel_name(funcrelid), attnum);
                                        att_tup = (Form_pg_attribute) GETSTRUCT(tp);
+
                                        /*
-                                        * If dropped column, pretend it ain't there.  See notes
-                                        * in scanRTEForColumn.
+                                        * If dropped column, pretend it ain't there.  See
+                                        * notes in scanRTEForColumn.
                                         */
                                        if (att_tup->attisdropped)
                                                elog(ERROR, "Relation \"%s\" has no column \"%s\"",
@@ -1639,11 +1639,14 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
                        break;
                case RTE_JOIN:
                        {
-                               /* Join RTE --- get type info from join RTE's alias variable */
-                               Node   *aliasvar;
+                               /*
+                                * Join RTE --- get type info from join RTE's alias
+                                * variable
+                                */
+                               Node       *aliasvar;
 
                                Assert(attnum > 0 && attnum <= length(rte->joinaliasvars));
-                               aliasvar = (Node *) nth(attnum-1, rte->joinaliasvars);
+                               aliasvar = (Node *) nth(attnum - 1, rte->joinaliasvars);
                                *vartype = exprType(aliasvar);
                                *vartypmod = exprTypmod(aliasvar);
                        }
@@ -1661,7 +1664,7 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
 static bool
 get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
 {
-       bool result;
+       bool            result;
 
        switch (rte->rtekind)
        {
@@ -1698,11 +1701,11 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum)
                                if (OidIsValid(funcrelid))
                                {
                                        /*
-                                        * Composite data type, i.e. a table's row type
-                                        * Same as ordinary relation RTE
+                                        * Composite data type, i.e. a table's row type Same
+                                        * as ordinary relation RTE
                                         */
-                                       HeapTuple                       tp;
-                                       Form_pg_attribute       att_tup;
+                                       HeapTuple       tp;
+                                       Form_pg_attribute att_tup;
 
                                        tp = SearchSysCache(ATTNUM,
                                                                                ObjectIdGetDatum(funcrelid),
@@ -1748,7 +1751,7 @@ attnameAttNum(Relation rd, const char *attname, bool sysColOK)
 
        for (i = 0; i < rd->rd_rel->relnatts; i++)
        {
-               Form_pg_attribute       att = rd->rd_att->attrs[i];
+               Form_pg_attribute att = rd->rd_att->attrs[i];
 
                if (namestrcmp(&(att->attname), attname) == 0 && !att->attisdropped)
                        return i + 1;
index 26983c4..b9c5b6c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.88 2002/08/19 15:08:47 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.89 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -114,7 +114,7 @@ transformTargetList(ParseState *pstate, List *targetlist)
                                p_target = nconc(p_target,
                                                                 ExpandAllTables(pstate));
                        }
-                       else if (strcmp(strVal(nth(numnames-1, fields)), "*") == 0)
+                       else if (strcmp(strVal(nth(numnames - 1, fields)), "*") == 0)
                        {
                                /*
                                 * Target item is relation.*, expand that table (eg.
@@ -136,21 +136,22 @@ transformTargetList(ParseState *pstate, List *targetlist)
                                                relname = strVal(lsecond(fields));
                                                break;
                                        case 4:
-                                       {
-                                               char   *name1 = strVal(lfirst(fields));
-
-                                               /*
-                                                * We check the catalog name and then ignore it.
-                                                */
-                                               if (strcmp(name1, DatabaseName) != 0)
-                                                       elog(ERROR, "Cross-database references are not implemented");
-                                               schemaname = strVal(lsecond(fields));
-                                               relname = strVal(lfirst(lnext(lnext(fields))));
-                                               break;
-                                       }
+                                               {
+                                                       char       *name1 = strVal(lfirst(fields));
+
+                                                       /*
+                                                        * We check the catalog name and then ignore
+                                                        * it.
+                                                        */
+                                                       if (strcmp(name1, DatabaseName) != 0)
+                                                               elog(ERROR, "Cross-database references are not implemented");
+                                                       schemaname = strVal(lsecond(fields));
+                                                       relname = strVal(lfirst(lnext(lnext(fields))));
+                                                       break;
+                                               }
                                        default:
                                                elog(ERROR, "Invalid qualified name syntax (too many names)");
-                                               schemaname = NULL; /* keep compiler quiet */
+                                               schemaname = NULL;              /* keep compiler quiet */
                                                relname = NULL;
                                                break;
                                }
@@ -180,8 +181,8 @@ transformTargetList(ParseState *pstate, List *targetlist)
                        InsertDefault *newnode = makeNode(InsertDefault);
 
                        /*
-                        * If this is a DEFAULT element, we make a junk entry
-                        * which will get dropped on return to transformInsertStmt().
+                        * If this is a DEFAULT element, we make a junk entry which
+                        * will get dropped on return to transformInsertStmt().
                         */
                        p_target = lappend(p_target, newnode);
                }
@@ -385,7 +386,7 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
 
                for (i = 0; i < numcol; i++)
                {
-                       ResTarget          *col;
+                       ResTarget  *col;
 
                        if (attr[i]->attisdropped)
                                continue;
@@ -503,7 +504,7 @@ FigureColnameInternal(Node *node, char **name)
        {
                case T_ColumnRef:
                        {
-                               char     *cname = strVal(llast(((ColumnRef *) node)->fields));
+                               char       *cname = strVal(llast(((ColumnRef *) node)->fields));
 
                                if (strcmp(cname, "*") != 0)
                                {
@@ -514,7 +515,7 @@ FigureColnameInternal(Node *node, char **name)
                        break;
                case T_ExprFieldSelect:
                        {
-                               char     *fname = strVal(llast(((ExprFieldSelect *) node)->fields));
+                               char       *fname = strVal(llast(((ExprFieldSelect *) node)->fields));
 
                                if (strcmp(fname, "*") != 0)
                                {
index e75c193..26ae3c2 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.49 2002/08/31 22:10:46 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.50 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -112,7 +112,7 @@ LookupTypeName(const TypeName *typename)
                if (schemaname)
                {
                        /* Look in specific schema only */
-                       Oid             namespaceId;
+                       Oid                     namespaceId;
 
                        namespaceId = LookupExplicitNamespace(schemaname);
                        restype = GetSysCacheOid(TYPENAMENSP,
@@ -147,7 +147,7 @@ TypeNameToString(const TypeName *typename)
        if (typename->names != NIL)
        {
                /* Emit possibly-qualified name as-is */
-               List            *l;
+               List       *l;
 
                foreach(l, typename->names)
                {
@@ -218,7 +218,7 @@ typenameType(const TypeName *typename)
        if (!HeapTupleIsValid(tup))
                elog(ERROR, "Type \"%s\" does not exist",
                         TypeNameToString(typename));
-       if (! ((Form_pg_type) GETSTRUCT(tup))->typisdefined)
+       if (!((Form_pg_type) GETSTRUCT(tup))->typisdefined)
                elog(ERROR, "Type \"%s\" is only a shell",
                         TypeNameToString(typename));
        return (Type) tup;
@@ -431,7 +431,7 @@ parseTypeString(const char *str, Oid *type_id, int32 *typmod)
        List       *raw_parsetree_list;
        SelectStmt *stmt;
        ResTarget  *restarget;
-       TypeCast   *typecast;   
+       TypeCast   *typecast;
        TypeName   *typename;
 
        initStringInfo(&buf);
index 8c129cb..c8614b5 100644 (file)
@@ -14,7 +14,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.54 2002/08/27 04:55:11 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.55 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,7 +30,7 @@
 
 List      *parsetree;                  /* result of parsing is left here */
 
-static Oid     *param_type_info;       /* state for param_type() */
+static Oid *param_type_info;   /* state for param_type() */
 static int     param_count;
 
 static int     lookahead_token;        /* one-token lookahead */
index 79a707a..6a76ad0 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: bsdi.h,v 1.16 2002/06/20 20:29:33 momjian Exp $
+ * $Id: bsdi.h,v 1.17 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -46,7 +46,6 @@ do { \
        dld_unlink_by_file(handle, 1); \
        free(handle); \
 } while (0)
-
 #endif   /* not HAVE_DLOPEN */
 
 #endif   /* PORT_PROTOS_H */
index 2421a7e..ee1ed18 100644 (file)
@@ -21,7 +21,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/port/ipc_test.c,v 1.4 2002/08/10 20:29:18 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/port/ipc_test.c,v 1.5 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,7 +52,7 @@ int                   MaxBackends = DEF_MAXBACKENDS;
 int                    NBuffers = DEF_NBUFFERS;
 
 #ifndef assert_enabled
-bool         assert_enabled = true;
+bool           assert_enabled = true;
 #endif
 
 
@@ -87,7 +87,7 @@ shmem_exit(int code)
 }
 
 void
-on_shmem_exit(void (*function) (), Datum arg)
+                       on_shmem_exit(void (*function) (), Datum arg)
 {
        if (on_shmem_exit_index >= MAX_ON_EXITS)
                elog(FATAL, "Out of on_shmem_exit slots");
@@ -144,17 +144,17 @@ elog(int lev, const char *fmt,...)
 
 typedef struct MyStorage
 {
-       PGShmemHeader   header;
-       int                             flag;
-       PGSemaphoreData sem;
-} MyStorage;
+       PGShmemHeader header;
+       int                     flag;
+       PGSemaphoreData sem;
+}      MyStorage;
 
 
 int
 main(int argc, char **argv)
 {
-       MyStorage          *storage;
-       int                             cpid;
+       MyStorage  *storage;
+       int                     cpid;
 
        printf("Creating shared memory ... ");
        fflush(stdout);
index 207a5fb..21af7d3 100644 (file)
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/port/posix_sema.c,v 1.5 2002/06/20 20:29:33 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/port/posix_sema.c,v 1.6 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -95,15 +95,15 @@ PosixSemaphoreCreate(void)
        }
 
        /*
-        * Unlink the semaphore immediately, so it can't be accessed externally.
-        * This also ensures that it will go away if we crash.
+        * Unlink the semaphore immediately, so it can't be accessed
+        * externally. This also ensures that it will go away if we crash.
         */
        sem_unlink(semname);
 
        return mySem;
 }
 
-#else /* !USE_NAMED_POSIX_SEMAPHORES */
+#else                                                  /* !USE_NAMED_POSIX_SEMAPHORES */
 
 /*
  * PosixSemaphoreCreate
@@ -111,7 +111,7 @@ PosixSemaphoreCreate(void)
  * Attempt to create a new unnamed semaphore.
  */
 static void
-PosixSemaphoreCreate(sem_t *sem)
+PosixSemaphoreCreate(sem_t * sem)
 {
        if (sem_init(sem, 1, 1) < 0)
        {
@@ -120,15 +120,14 @@ PosixSemaphoreCreate(sem_t *sem)
                proc_exit(1);
        }
 }
-
-#endif /* USE_NAMED_POSIX_SEMAPHORES */
+#endif   /* USE_NAMED_POSIX_SEMAPHORES */
 
 
 /*
  * PosixSemaphoreKill  - removes a semaphore
  */
 static void
-PosixSemaphoreKill(sem_t *sem)
+PosixSemaphoreKill(sem_t * sem)
 {
 #ifdef USE_NAMED_POSIX_SEMAPHORES
        /* Got to use sem_close for named semaphores */
@@ -149,7 +148,7 @@ PosixSemaphoreKill(sem_t *sem)
  *
  * This is called during postmaster start or shared memory reinitialization.
  * It should do whatever is needed to be able to support up to maxSemas
- * subsequent PGSemaphoreCreate calls.  Also, if any system resources
+ * subsequent PGSemaphoreCreate calls. Also, if any system resources
  * are acquired here or in PGSemaphoreCreate, register an on_shmem_exit
  * callback to release them.
  *
@@ -197,7 +196,7 @@ ReleaseSemaphores(int status, Datum arg)
 void
 PGSemaphoreCreate(PGSemaphore sema)
 {
-       sem_t  *newsem;
+       sem_t      *newsem;
 
        /* Can't do this in a backend, because static state is postmaster's */
        Assert(!IsUnderPostmaster);
@@ -260,21 +259,21 @@ PGSemaphoreLock(PGSemaphore sema, bool interruptOK)
         *
         * Each time around the loop, we check for a cancel/die interrupt. We
         * assume that if such an interrupt comes in while we are waiting, it
-        * will cause the sem_wait() call to exit with errno == EINTR, so that we
-        * will be able to service the interrupt (if not in a critical section
-        * already).
+        * will cause the sem_wait() call to exit with errno == EINTR, so that
+        * we will be able to service the interrupt (if not in a critical
+        * section already).
         *
         * Once we acquire the lock, we do NOT check for an interrupt before
         * returning.  The caller needs to be able to record ownership of the
         * lock before any interrupt can be accepted.
         *
         * There is a window of a few instructions between CHECK_FOR_INTERRUPTS
-        * and entering the sem_wait() call.  If a cancel/die interrupt occurs in
-        * that window, we would fail to notice it until after we acquire the
-        * lock (or get another interrupt to escape the sem_wait()).  We can
-        * avoid this problem by temporarily setting ImmediateInterruptOK to
-        * true before we do CHECK_FOR_INTERRUPTS; then, a die() interrupt in
-        * this interval will execute directly.  However, there is a huge
+        * and entering the sem_wait() call.  If a cancel/die interrupt occurs
+        * in that window, we would fail to notice it until after we acquire
+        * the lock (or get another interrupt to escape the sem_wait()).  We
+        * can avoid this problem by temporarily setting ImmediateInterruptOK
+        * to true before we do CHECK_FOR_INTERRUPTS; then, a die() interrupt
+        * in this interval will execute directly.      However, there is a huge
         * pitfall: there is another window of a few instructions after the
         * sem_wait() before we are able to reset ImmediateInterruptOK.  If an
         * interrupt occurs then, we'll lose control, which means that the
index 0d69a76..ebc6abe 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/tstsem.c,v 1.7 2001/11/11 22:12:00 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/tstsem.c,v 1.8 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,7 +26,7 @@
 #define SEMMAX 16
 #define OPSMAX 1
 
-int MaxBackends = SEMMAX;
+int                    MaxBackends = SEMMAX;
 
 static int     semid;
 
index dc34786..cef6cc0 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/port/sysv_sema.c,v 1.3 2002/09/02 02:47:03 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/port/sysv_sema.c,v 1.4 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,19 +58,20 @@ typedef int IpcSemaphoreId;         /* semaphore ID returned by semget(2) */
 #define PGSemaMagic            537             /* must be less than SEMVMX */
 
 
-static IpcSemaphoreId *mySemaSets; /* IDs of sema sets acquired so far */
+static IpcSemaphoreId *mySemaSets;             /* IDs of sema sets acquired so
+                                                                                * far */
 static int     numSemaSets;            /* number of sema sets acquired so far */
 static int     maxSemaSets;            /* allocated size of mySemaSets array */
-static IpcSemaphoreKey nextSemaKey; /* next key to try using */
+static IpcSemaphoreKey nextSemaKey;            /* next key to try using */
 static int     nextSemaNumber;         /* next free sem num in last sema set */
 
 
 static IpcSemaphoreId InternalIpcSemaphoreCreate(IpcSemaphoreKey semKey,
-                                                                                                int numSems);
+                                                  int numSems);
 static void IpcSemaphoreInitialize(IpcSemaphoreId semId, int semNum,
-                                                                  int value);
+                                          int value);
 static void IpcSemaphoreKill(IpcSemaphoreId semId);
-static int IpcSemaphoreGetValue(IpcSemaphoreId semId, int semNum);
+static int     IpcSemaphoreGetValue(IpcSemaphoreId semId, int semNum);
 static pid_t IpcSemaphoreGetLastPID(IpcSemaphoreId semId, int semNum);
 static IpcSemaphoreId IpcSemaphoreCreate(int numSems);
 static void ReleaseSemaphores(int status, Datum arg);
@@ -113,7 +114,7 @@ InternalIpcSemaphoreCreate(IpcSemaphoreKey semKey, int numSems)
                 * Else complain and abort
                 */
                fprintf(stderr, "IpcSemaphoreCreate: semget(key=%d, num=%d, 0%o) failed: %s\n",
-                               (int) semKey, numSems, (IPC_CREAT | IPC_EXCL | IPCProtection),
+                  (int) semKey, numSems, (IPC_CREAT | IPC_EXCL | IPCProtection),
                                strerror(errno));
 
                if (errno == ENOSPC)
@@ -154,7 +155,7 @@ IpcSemaphoreInitialize(IpcSemaphoreId semId, int semNum, int value)
                if (errno == ERANGE)
                        fprintf(stderr,
                                        "You possibly need to raise your kernel's SEMVMX value to be at least\n"
-                                       "%d.  Look into the PostgreSQL documentation for details.\n",
+                       "%d.  Look into the PostgreSQL documentation for details.\n",
                                        value);
 
                proc_exit(1);
@@ -221,7 +222,7 @@ IpcSemaphoreCreate(int numSems)
        PGSemaphoreData mysema;
 
        /* Loop till we find a free IPC key */
-       for (nextSemaKey++; ; nextSemaKey++)
+       for (nextSemaKey++;; nextSemaKey++)
        {
                pid_t           creatorPID;
 
@@ -296,12 +297,12 @@ IpcSemaphoreCreate(int numSems)
  *
  * This is called during postmaster start or shared memory reinitialization.
  * It should do whatever is needed to be able to support up to maxSemas
- * subsequent PGSemaphoreCreate calls.  Also, if any system resources
+ * subsequent PGSemaphoreCreate calls. Also, if any system resources
  * are acquired here or in PGSemaphoreCreate, register an on_shmem_exit
  * callback to release them.
  *
  * The port number is passed for possible use as a key (for SysV, we use
- * it to generate the starting semaphore key).  In a standalone backend,
+ * it to generate the starting semaphore key). In a standalone backend,
  * zero will be passed.
  *
  * In the SysV implementation, we acquire semaphore sets on-demand; the
@@ -311,14 +312,15 @@ IpcSemaphoreCreate(int numSems)
 void
 PGReserveSemaphores(int maxSemas, int port)
 {
-       maxSemaSets = (maxSemas + SEMAS_PER_SET-1) / SEMAS_PER_SET;
+       maxSemaSets = (maxSemas + SEMAS_PER_SET - 1) / SEMAS_PER_SET;
        mySemaSets = (IpcSemaphoreId *)
                malloc(maxSemaSets * sizeof(IpcSemaphoreId));
        if (mySemaSets == NULL)
                elog(PANIC, "Out of memory in PGReserveSemaphores");
        numSemaSets = 0;
        nextSemaKey = port * 1000;
-       nextSemaNumber = SEMAS_PER_SET; /* force sema set alloc on 1st call */
+       nextSemaNumber = SEMAS_PER_SET;         /* force sema set alloc on 1st
+                                                                                * call */
 
        on_shmem_exit(ReleaseSemaphores, 0);
 }
@@ -359,7 +361,7 @@ PGSemaphoreCreate(PGSemaphore sema)
                nextSemaNumber = 0;
        }
        /* Assign the next free semaphore in the current set */
-       sema->semId = mySemaSets[numSemaSets-1];
+       sema->semId = mySemaSets[numSemaSets - 1];
        sema->semNum = nextSemaNumber++;
        /* Initialize it to count 1 */
        IpcSemaphoreInitialize(sema->semId, sema->semNum, 1);
index aadf3da..60e5d0b 100644 (file)
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/port/sysv_shmem.c,v 1.3 2002/09/02 02:47:03 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/port/sysv_shmem.c,v 1.4 2002/09/04 20:31:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -88,7 +88,7 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size)
                 * Else complain and abort
                 */
                fprintf(stderr, "IpcMemoryCreate: shmget(key=%d, size=%u, 0%o) failed: %s\n",
-                               (int) memKey, size, (IPC_CREAT | IPC_EXCL | IPCProtection),
+                         (int) memKey, size, (IPC_CREAT | IPC_EXCL | IPCProtection),
                                strerror(errno));
 
                if (errno == EINVAL)
@@ -147,7 +147,7 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, uint32 size)
        /* use intimate shared memory on SPARC Solaris */
        memAddress = shmat(shmid, 0, SHM_SHARE_MMU);
 #else
-       memAddress = shmat(shmid, 0, 0);
+       memAddress = shmat(shmid, 0, 0);
 #endif
 
        if (memAddress == (void *) -1)
@@ -283,11 +283,11 @@ PrivateMemoryDelete(int status, Datum memaddr)
  * the storage.
  *
  * Dead Postgres segments are recycled if found, but we do not fail upon
- * collision with non-Postgres shmem segments.  The idea here is to detect and
+ * collision with non-Postgres shmem segments. The idea here is to detect and
  * re-use keys that may have been assigned by a crashed postmaster or backend.
  *
  * The port number is passed for possible use as a key (for SysV, we use
- * it to generate the starting shmem key).  In a standalone backend,
+ * it to generate the starting shmem key).     In a standalone backend,
  * zero will be passed.
  */
 PGShmemHeader *
@@ -328,7 +328,7 @@ PGSharedMemoryCreate(uint32 size, bool makePrivate, int port)
                /* use intimate shared memory on SPARC Solaris */
                memAddress = shmat(shmid, 0, SHM_SHARE_MMU);
 #else
-               memAddress = shmat(shmid, 0, 0);
+               memAddress = shmat(shmid, 0, 0);
 #endif
 
                if (memAddress == (void *) -1)
index 9492cb6..4959550 100644 (file)
@@ -16,7 +16,7 @@
  *
  *     Copyright (c) 2001, PostgreSQL Global Development Group
  *
- *     $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.26 2002/09/02 02:47:03 momjian Exp $
+ *     $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.27 2002/09/04 20:31:24 momjian Exp $
  * ----------
  */
 #include "postgres.h"
@@ -431,7 +431,7 @@ pgstat_report_activity(char *what)
                return;
 
        len = strlen(what);
-       len = pg_mbcliplen((const unsigned char *)what, len, PGSTAT_ACTIVITY_SIZE - 1);
+       len = pg_mbcliplen((const unsigned char *) what, len, PGSTAT_ACTIVITY_SIZE - 1);
 
        memcpy(msg.m_what, what, len);
        msg.m_what[len] = '\0';
@@ -581,7 +581,7 @@ pgstat_vacuum_tabstat(void)
                if (msg.m_nentries >= PGSTAT_NUM_TABPURGE)
                {
                        len = offsetof(PgStat_MsgTabpurge, m_tableid[0])
-                               + msg.m_nentries * sizeof(Oid);
+                               +msg.m_nentries * sizeof(Oid);
 
                        pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_TABPURGE);
                        pgstat_send(&msg, len);
@@ -596,7 +596,7 @@ pgstat_vacuum_tabstat(void)
        if (msg.m_nentries > 0)
        {
                len = offsetof(PgStat_MsgTabpurge, m_tableid[0])
-                       + msg.m_nentries * sizeof(Oid);
+                       +msg.m_nentries * sizeof(Oid);
 
                pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_TABPURGE);
                pgstat_send(&msg, len);
@@ -1793,7 +1793,7 @@ pgstat_add_backend(PgStat_MsgHdr *msg)
                if (dbentry->tables == NULL)
                {
                        elog(LOG, "PGSTAT: failed to initialize hash table for "
-                                       "new database entry");
+                                "new database entry");
                        exit(1);
                }
        }
@@ -1918,7 +1918,7 @@ pgstat_write_statsfile(void)
                                                                HASH_REMOVE, NULL) == NULL)
                                {
                                        elog(LOG, "PGSTAT: database hash table corrupted "
-                                                       "during cleanup - abort");
+                                                "during cleanup - abort");
                                        exit(1);
                                }
                        }
@@ -1954,9 +1954,9 @@ pgstat_write_statsfile(void)
                                                                        HASH_REMOVE, NULL) == NULL)
                                        {
                                                elog(LOG, "PGSTAT: tables hash table for "
-                                                               "database %d corrupted during "
-                                                               "cleanup - abort",
-                                                               dbentry->databaseid);
+                                                        "database %d corrupted during "
+                                                        "cleanup - abort",
+                                                        dbentry->databaseid);
                                                exit(1);
                                        }
                                }
@@ -2029,7 +2029,7 @@ pgstat_write_statsfile(void)
                                                        HASH_REMOVE, NULL) == NULL)
                        {
                                elog(LOG, "PGSTAT: dead backend hash table corrupted "
-                                               "during cleanup - abort");
+                                        "during cleanup - abort");
                                exit(1);
                        }
                }
@@ -2520,7 +2520,7 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
                if (tabentry == NULL)
                {
                        elog(LOG, "PGSTAT: tables hash table out of memory for "
-                                       "database %d - abort", dbentry->databaseid);
+                                "database %d - abort", dbentry->databaseid);
                        exit(1);
                }
 
@@ -2700,7 +2700,7 @@ pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len)
        if (dbentry->tables == NULL)
        {
                elog(LOG, "PGSTAT: failed to reinitialize hash table for "
-                               "database entry");
+                        "database entry");
                exit(1);
        }
 }
index 2217fbb..8513918 100644 (file)
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.287 2002/09/02 02:47:03 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.288 2002/09/04 20:31:24 momjian Exp $
  *
  * NOTES
  *
 sigset_t       UnBlockSig,
                        BlockSig,
                        AuthBlockSig;
+
 #else
 int                    UnBlockSig,
                        BlockSig,
@@ -218,7 +219,8 @@ static int  Shutdown = NoShutdown;
 
 static bool FatalError = false; /* T if recovering from backend crash */
 
-bool ClientAuthInProgress = false;     /* T during new-client authentication */
+bool           ClientAuthInProgress = false;           /* T during new-client
+                                                                                                * authentication */
 
 /*
  * State for assigning random salts and cancel keys.
@@ -250,9 +252,9 @@ static void sigusr1_handler(SIGNAL_ARGS);
 static void dummy_handler(SIGNAL_ARGS);
 static void CleanupProc(int pid, int exitstatus);
 static void LogChildExit(int lev, const char *procname,
-                                                int pid, int exitstatus);
+                        int pid, int exitstatus);
 static int     DoBackend(Port *port);
-       void ExitPostmaster(int status);
+void           ExitPostmaster(int status);
 static void usage(const char *);
 static int     ServerLoop(void);
 static int     BackendStartup(Port *port);
@@ -271,7 +273,7 @@ static void SignalChildren(int signal);
 static int     CountChildren(void);
 static bool CreateOptsFile(int argc, char *argv[]);
 static pid_t SSDataBase(int xlop);
-       void
+void
 postmaster_error(const char *fmt,...)
 /* This lets gcc check the format string for consistency. */
 __attribute__((format(printf, 1, 2)));
@@ -281,11 +283,11 @@ __attribute__((format(printf, 1, 2)));
 #define ShutdownDataBase()             SSDataBase(BS_XLOG_SHUTDOWN)
 
 #ifdef USE_SSL
-extern int secure_initialize(void);
+extern int     secure_initialize(void);
 extern void secure_destroy(void);
-extern int secure_open_server(Port *);
+extern int     secure_open_server(Port *);
 extern void secure_close(Port *);
-#endif /* USE_SSL */
+#endif   /* USE_SSL */
 
 
 static void
@@ -293,6 +295,7 @@ checkDataDir(const char *checkdir)
 {
        char            path[MAXPGPATH];
        FILE       *fp;
+
 #ifndef __CYGWIN__
        struct stat stat_buf;
 #endif
@@ -311,9 +314,9 @@ checkDataDir(const char *checkdir)
        /*
         * Check if the directory has group or world access.  If so, reject.
         *
-        * XXX temporarily suppress check when on Windows, because there may
-        * not be proper support for Unix-y file permissions.  Need to think
-        * of a reasonable check to apply on Windows.
+        * XXX temporarily suppress check when on Windows, because there may not
+        * be proper support for Unix-y file permissions.  Need to think of a
+        * reasonable check to apply on Windows.
         */
 #ifndef __CYGWIN__
 
@@ -329,8 +332,7 @@ checkDataDir(const char *checkdir)
        if (stat_buf.st_mode & (S_IRWXG | S_IRWXO))
                elog(FATAL, "data directory %s has group or world access; permissions should be u=rwx (0700)",
                         checkdir);
-
-#endif /* !__CYGWIN__ */
+#endif   /* !__CYGWIN__ */
 
        /* Look for PG_VERSION before looking for pg_control */
        ValidatePgVersion(checkdir);
@@ -442,15 +444,16 @@ PostmasterMain(int argc, char *argv[])
                                potential_DataDir = optarg;
                                break;
                        case 'd':
-                       {
-                               /* Turn on debugging for the postmaster. */
-                               char *debugstr = palloc(strlen("debug") + strlen(optarg) + 1);
-                               sprintf(debugstr, "debug%s", optarg);
-                               SetConfigOption("server_min_messages", debugstr,
-                                                               PGC_POSTMASTER, PGC_S_ARGV);
-                               pfree(debugstr);
-                               break;
-                       }
+                               {
+                                       /* Turn on debugging for the postmaster. */
+                                       char       *debugstr = palloc(strlen("debug") + strlen(optarg) + 1);
+
+                                       sprintf(debugstr, "debug%s", optarg);
+                                       SetConfigOption("server_min_messages", debugstr,
+                                                                       PGC_POSTMASTER, PGC_S_ARGV);
+                                       pfree(debugstr);
+                                       break;
+                               }
                        case 'F':
                                SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV);
                                break;
@@ -582,7 +585,7 @@ PostmasterMain(int argc, char *argv[])
         * Force an exit if ReservedBackends is not less than MaxBackends.
         */
        if (ReservedBackends >= MaxBackends)
-               elog(FATAL,"superuser_reserved_connections must be less than max_connections.");
+               elog(FATAL, "superuser_reserved_connections must be less than max_connections.");
 
        /*
         * Now that we are done processing the postmaster arguments, reset
@@ -598,7 +601,7 @@ PostmasterMain(int argc, char *argv[])
                extern char **environ;
                char      **p;
 
-               elog(DEBUG2, "%s: PostmasterMain: initial environ dump:",       progname);
+               elog(DEBUG2, "%s: PostmasterMain: initial environ dump:", progname);
                elog(DEBUG2, "-----------------------------------------");
                for (p = environ; *p; ++p)
                        elog(DEBUG2, "\t%s", *p);
@@ -705,8 +708,8 @@ PostmasterMain(int argc, char *argv[])
        /*
         * Set up signal handlers for the postmaster process.
         *
-        * CAUTION: when changing this list, check for side-effects on the
-        * signal handling setup of child processes.  See tcop/postgres.c,
+        * CAUTION: when changing this list, check for side-effects on the signal
+        * handling setup of child processes.  See tcop/postgres.c,
         * bootstrap/bootstrap.c, and postmaster/pgstat.c.
         */
        pqinitmask();
@@ -737,8 +740,9 @@ PostmasterMain(int argc, char *argv[])
        /*
         * On many platforms, the first call of localtime() incurs significant
         * overhead to load timezone info from the system configuration files.
-        * By doing it once in the postmaster, we avoid having to do it in every
-        * started child process.  The savings are not huge, but they add up...
+        * By doing it once in the postmaster, we avoid having to do it in
+        * every started child process.  The savings are not huge, but they
+        * add up...
         */
        {
                time_t          now = time(NULL);
@@ -783,6 +787,7 @@ pmdaemonize(int argc, char *argv[])
 {
        int                     i;
        pid_t           pid;
+
 #ifdef LINUX_PROFILE
        struct itimerval prof_itimer;
 #endif
@@ -1128,7 +1133,7 @@ ProcessStartupPacket(Port *port, bool SSLdone)
 
 #ifdef USE_SSL
                if (SSLok == 'S' && secure_open_server(port) == -1)
-                               return STATUS_ERROR;
+                       return STATUS_ERROR;
 #endif
                /* regular startup packet, cancel, etc packet should follow... */
                /* but not another SSL negotiation request */
@@ -1174,20 +1179,21 @@ ProcessStartupPacket(Port *port, bool SSLdone)
                elog(FATAL, "no PostgreSQL user name specified in startup packet");
 
        if (Db_user_namespace)
-    {
+       {
                /*
-                *      If user@, it is a global user, remove '@'.
-                *      We only want to do this if there is an '@' at the end and no
-                *      earlier in the user string or they may fake as a local user
-                *      of another database attaching to this database.
+                * If user@, it is a global user, remove '@'. We only want to do
+                * this if there is an '@' at the end and no earlier in the user
+                * string or they may fake as a local user of another database
+                * attaching to this database.
                 */
-               if (strchr(port->user, '@') == port->user + strlen(port->user)-1)
+               if (strchr(port->user, '@') == port->user + strlen(port->user) - 1)
                        *strchr(port->user, '@') = '\0';
                else
                {
                        /* Append '@' and dbname */
-                       char hold_user[SM_DATABASE_USER+1];
-                       snprintf(hold_user, SM_DATABASE_USER+1, "%s@%s", port->user,
+                       char            hold_user[SM_DATABASE_USER + 1];
+
+                       snprintf(hold_user, SM_DATABASE_USER + 1, "%s@%s", port->user,
                                         port->database);
                        strcpy(port->user, hold_user);
                }
@@ -1263,7 +1269,7 @@ processCancelRequest(Port *port, void *pkt)
                        else
                                /* Right PID, wrong key: no way, Jose */
                                elog(DEBUG1, "bad key in cancel request for process %d",
-                                       backendPID);
+                                        backendPID);
                        return;
                }
        }
@@ -1388,8 +1394,8 @@ reset_shared(unsigned short port)
         *
         * Note: in each "cycle of life" we will normally assign the same IPC
         * keys (if using SysV shmem and/or semas), since the port number is
-        * used to determine IPC keys.  This helps ensure that we will clean up
-        * dead IPC objects if the postmaster crashes and is restarted.
+        * used to determine IPC keys.  This helps ensure that we will clean
+        * up dead IPC objects if the postmaster crashes and is restarted.
         */
        CreateSharedMemoryAndSemaphores(false, MaxBackends, port);
 }
@@ -1832,6 +1838,7 @@ BackendStartup(Port *port)
 {
        Backend    *bn;                         /* for backend cleanup */
        pid_t           pid;
+
 #ifdef LINUX_PROFILE
        struct itimerval prof_itimer;
 #endif
@@ -1866,11 +1873,13 @@ BackendStartup(Port *port)
        fflush(stderr);
 
 #ifdef LINUX_PROFILE
+
        /*
-        * Linux's fork() resets the profiling timer in the child process.
-        * If we want to profile child processes then we need to save and restore
-        * the timer setting.  This is a waste of time if not profiling, however,
-        * so only do it if commanded by specific -DLINUX_PROFILE switch.
+        * Linux's fork() resets the profiling timer in the child process. If
+        * we want to profile child processes then we need to save and restore
+        * the timer setting.  This is a waste of time if not profiling,
+        * however, so only do it if commanded by specific -DLINUX_PROFILE
+        * switch.
         */
        getitimer(ITIMER_PROF, &prof_itimer);
 #endif
@@ -1924,7 +1933,7 @@ BackendStartup(Port *port)
 
        /* in parent, normal */
        elog(DEBUG1, "BackendStartup: forked pid=%d socket=%d", (int) pid,
-               port->sock);
+                port->sock);
 
        /*
         * Everything's been successful, it's safe to add this backend to our
@@ -1940,7 +1949,7 @@ BackendStartup(Port *port)
 
 /*
  * Try to report backend fork() failure to client before we close the
- * connection.  Since we do not care to risk blocking the postmaster on
+ * connection. Since we do not care to risk blocking the postmaster on
  * this connection, we set the connection to non-blocking and try only once.
  *
  * This is grungy special-purpose code; we cannot use backend libpq since
@@ -1950,6 +1959,7 @@ static void
 report_fork_failure_to_client(Port *port, int errnum)
 {
        char            buffer[1000];
+
 #ifdef __BEOS__
        int                     on = 1;
 #endif
@@ -1968,7 +1978,7 @@ report_fork_failure_to_client(Port *port, int errnum)
                return;
 #endif
 
-       send(port->sock, buffer, strlen(buffer)+1, 0);
+       send(port->sock, buffer, strlen(buffer) + 1, 0);
 }
 
 
@@ -2033,7 +2043,7 @@ DoBackend(Port *port)
 
        IsUnderPostmaster = true;       /* we are a postmaster subprocess now */
 
-       ClientAuthInProgress = true; /* limit visibility of log messages */
+       ClientAuthInProgress = true;    /* limit visibility of log messages */
 
        /* We don't want the postmaster's proc_exit() handlers */
        on_exit_reset();
@@ -2260,7 +2270,8 @@ DoBackend(Port *port)
                elog(DEBUG2, "\t%s", av[i]);
        elog(DEBUG2, ")");
 
-       ClientAuthInProgress = false; /* client_min_messages is active now */
+       ClientAuthInProgress = false;           /* client_min_messages is active
+                                                                                * now */
 
        return (PostgresMain(ac, av, port->user));
 }
@@ -2459,6 +2470,7 @@ SSDataBase(int xlop)
 {
        pid_t           pid;
        Backend    *bn;
+
 #ifdef LINUX_PROFILE
        struct itimerval prof_itimer;
 #endif
@@ -2647,7 +2659,7 @@ CreateOptsFile(int argc, char *argv[])
 
 /*
  * This should be used only for reporting "interactive" errors (ie, errors
- * during startup.  Once the postmaster is launched, use elog.
+ * during startup.     Once the postmaster is launched, use elog.
  */
 void
 postmaster_error(const char *fmt,...)
index 2e2d7c6..71e69de 100644 (file)
 
 struct cclass
 {
-    char *name;
-    char *chars;
-    char *multis;
+       char       *name;
+       char       *chars;
+       char       *multis;
 };
-static struct cclasscclasses = NULL;
-static struct cclasscclass_init(void);
+static struct cclass *cclasses = NULL;
+static struct cclass *cclass_init(void);
 
 /*
  * parse structure, passed up and down to avoid global variables and
@@ -179,8 +179,8 @@ pg_regcomp(regex_t *preg, const char *pattern, int cflags)
        size_t          len;
        pg_wchar   *wcp;
 
-    if ( cclasses == NULL )
-        cclasses = cclass_init();
+       if (cclasses == NULL)
+               cclasses = cclass_init();
 
 #ifdef REDEBUG
 #define  GOODFLAGS(f)   (f)
@@ -862,7 +862,7 @@ p_b_cclass(struct parse * p, cset *cs)
        struct cclass *cp;
        size_t          len;
        char       *u;
-       unsigned char           c;
+       unsigned char c;
 
        while (MORE() && pg_isalpha(PEEK()))
                NEXT();
@@ -1684,77 +1684,105 @@ pg_ispunct(int c)
 static struct cclass *
 cclass_init(void)
 {
-    static struct cclass cclasses_C[] = {
-        { "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "" },
-        { "alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "" },
-        { "blank", " \t", "" },
-        { "cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177", "" },
-        { "digit", "0123456789", "" },
-        { "graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" },
-        { "lower", "abcdefghijklmnopqrstuvwxyz", "" },
-        { "print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", "" },
-        { "punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" },
-        { "space", "\t\n\v\f\r ", "" },
-        { "upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "" },
-        { "xdigit", "0123456789ABCDEFabcdef", "" },
-        { NULL, NULL, "" }
-    };
-    struct cclass *cp = NULL;
-    struct cclass *classes = NULL;
-    struct cclass_factory
-    {
-        char *name;
-        int (*func)(int);
-        char *chars;
-    } cclass_factories [] =
-        {
-            { "alnum", pg_isalnum, NULL },
-            { "alpha", pg_isalpha, NULL },
-            { "blank", NULL, " \t" },
-            { "cntrl", pg_iscntrl, NULL },
-            { "digit", NULL, "0123456789" },
-            { "graph", pg_isgraph, NULL },
-            { "lower", pg_islower, NULL },
-            { "print", pg_isprint, NULL },
-            { "punct", pg_ispunct, NULL },
-            { "space", NULL, "\t\n\v\f\r " },
-            { "upper", pg_isupper, NULL },
-            { "xdigit", NULL, "0123456789ABCDEFabcdef" },
-            { NULL, NULL, NULL }
-        };
-    struct cclass_factory *cf = NULL;
-
-    if ( strcmp( setlocale( LC_CTYPE, NULL ), "C" ) == 0 )
-        return cclasses_C;
-
-    classes = malloc(sizeof(struct cclass) * (sizeof(cclass_factories) / sizeof(struct cclass_factory)));
-    if (classes == NULL)
-        elog(ERROR,"cclass_init: out of memory");
-    
-    cp = classes;
-    for(cf = cclass_factories; cf->name != NULL; cf++)
-        {
-            cp->name = strdup(cf->name);
-            if ( cf->chars )
-                cp->chars = strdup(cf->chars);
-            else
-                {
-                    int x = 0, y = 0;
-                    cp->chars = malloc(sizeof(char) * 256);
-                    if (cp->chars == NULL)
-                        elog(ERROR,"cclass_init: out of memory");
-                    for (x = 0; x < 256; x++)
-                        {
-                            if((cf->func)(x))
-                                *(cp->chars + y++) = x;                            
-                        }
-                    *(cp->chars + y) = '\0';
-                }
-            cp->multis = "";
-            cp++;
-        }
-    cp->name = cp->chars = NULL;
-    cp->multis = "";
-    
-    return classes;
+       static struct cclass cclasses_C[] = {
+               {"alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", ""},
+               {"alpha", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", ""},
+               {"blank", " \t", ""},
+               {"cntrl", "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177", ""},
+               {"digit", "0123456789", ""},
+               {"graph", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", ""},
+               {"lower", "abcdefghijklmnopqrstuvwxyz", ""},
+               {"print", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", ""},
+               {"punct", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", ""},
+               {"space", "\t\n\v\f\r ", ""},
+               {"upper", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", ""},
+               {"xdigit", "0123456789ABCDEFabcdef", ""},
+               {NULL, NULL, ""}
+       };
+       struct cclass *cp = NULL;
+       struct cclass *classes = NULL;
+       struct cclass_factory
+       {
+               char       *name;
+               int                     (*func) (int);
+               char       *chars;
+       }                       cclass_factories[] =
+       {
+               {
+                       "alnum", pg_isalnum, NULL
+               },
+               {
+                       "alpha", pg_isalpha, NULL
+               },
+               {
+                       "blank", NULL, " \t"
+               },
+               {
+                       "cntrl", pg_iscntrl, NULL
+               },
+               {
+                       "digit", NULL, "0123456789"
+               },
+               {
+                       "graph", pg_isgraph, NULL
+               },
+               {
+                       "lower", pg_islower, NULL
+               },
+               {
+                       "print", pg_isprint, NULL
+               },
+               {
+                       "punct", pg_ispunct, NULL
+               },
+               {
+                       "space", NULL, "\t\n\v\f\r "
+               },
+               {
+                       "upper", pg_isupper, NULL
+               },
+               {
+                       "xdigit", NULL, "0123456789ABCDEFabcdef"
+               },
+               {
+                       NULL, NULL, NULL
+               }
+       };
+       struct cclass_factory *cf = NULL;
+
+       if (strcmp(setlocale(LC_CTYPE, NULL), "C") == 0)
+               return cclasses_C;
+
+       classes = malloc(sizeof(struct cclass) * (sizeof(cclass_factories) / sizeof(struct cclass_factory)));
+       if (classes == NULL)
+               elog(ERROR, "cclass_init: out of memory");
+
+       cp = classes;
+       for (cf = cclass_factories; cf->name != NULL; cf++)
+       {
+               cp->name = strdup(cf->name);
+               if (cf->chars)
+                       cp->chars = strdup(cf->chars);
+               else
+               {
+                       int                     x = 0,
+                                               y = 0;
+
+                       cp->chars = malloc(sizeof(char) * 256);
+                       if (cp->chars == NULL)
+                               elog(ERROR, "cclass_init: out of memory");
+                       for (x = 0; x < 256; x++)
+                       {
+                               if ((cf->func) (x))
+                                       *(cp->chars + y++) = x;
+                       }
+                       *(cp->chars + y) = '\0';
+               }
+               cp->multis = "";
+               cp++;
+       }
+       cp->name = cp->chars = NULL;
+       cp->multis = "";
+
+       return classes;
 }
index f276189..2aa4fdd 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.78 2002/09/02 02:13:01 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.79 2002/09/04 20:31:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -62,8 +62,8 @@ InsertRule(char *rulname,
        HeapTuple       tup,
                                oldtup;
        Oid                     rewriteObjectId;
-       ObjectAddress   myself,
-                                       referenced;
+       ObjectAddress myself,
+                               referenced;
        bool            is_update = false;
 
        /*
@@ -73,13 +73,13 @@ InsertRule(char *rulname,
 
        i = 0;
        namestrcpy(&rname, rulname);
-       values[i++] = NameGetDatum(&rname);                             /* rulename */
-       values[i++] = ObjectIdGetDatum(eventrel_oid);   /* ev_class */
-       values[i++] = Int16GetDatum(evslot_index);              /* ev_attr */
-       values[i++] = CharGetDatum(evtype + '0');               /* ev_type */
-       values[i++] = BoolGetDatum(evinstead);                  /* is_instead */
-       values[i++] = DirectFunctionCall1(textin, CStringGetDatum(evqual));     /* ev_qual */
-       values[i++] = DirectFunctionCall1(textin, CStringGetDatum(actiontree)); /* ev_action */
+       values[i++] = NameGetDatum(&rname); /* rulename */
+       values[i++] = ObjectIdGetDatum(eventrel_oid);           /* ev_class */
+       values[i++] = Int16GetDatum(evslot_index);      /* ev_attr */
+       values[i++] = CharGetDatum(evtype + '0');       /* ev_type */
+       values[i++] = BoolGetDatum(evinstead);          /* is_instead */
+       values[i++] = DirectFunctionCall1(textin, CStringGetDatum(evqual)); /* ev_qual */
+       values[i++] = DirectFunctionCall1(textin, CStringGetDatum(actiontree));         /* ev_action */
 
        /*
         * Ready to store new pg_rewrite tuple
@@ -97,7 +97,7 @@ InsertRule(char *rulname,
        if (HeapTupleIsValid(oldtup))
        {
                if (!replace)
-                       elog(ERROR,"Attempt to insert rule \"%s\" failed: already exists",
+                       elog(ERROR, "Attempt to insert rule \"%s\" failed: already exists",
                                 rulname);
 
                /*
@@ -138,8 +138,8 @@ InsertRule(char *rulname,
                                                                   rewriteObjectId);
 
        /*
-        * Install dependency on rule's relation to ensure it will go away
-        * on relation deletion.  If the rule is ON SELECT, make the dependency
+        * Install dependency on rule's relation to ensure it will go away on
+        * relation deletion.  If the rule is ON SELECT, make the dependency
         * implicit --- this prevents deleting a view's SELECT rule.  Other
         * kinds of rules can be AUTO.
         */
@@ -152,7 +152,7 @@ InsertRule(char *rulname,
        referenced.objectSubId = 0;
 
        recordDependencyOn(&myself, &referenced,
-                                          (evtype == CMD_SELECT) ? DEPENDENCY_INTERNAL : DEPENDENCY_AUTO);
+                (evtype == CMD_SELECT) ? DEPENDENCY_INTERNAL : DEPENDENCY_AUTO);
 
        /*
         * Also install dependencies on objects referenced in action and qual.
@@ -163,7 +163,7 @@ InsertRule(char *rulname,
        if (event_qual != NULL)
        {
                /* Find query containing OLD/NEW rtable entries */
-               Query  *qry = (Query *) lfirst(action);
+               Query      *qry = (Query *) lfirst(action);
 
                qry = getInsertSelectQuery(qry, NULL);
                recordDependencyOnExpr(&myself, event_qual, qry->rtable,
@@ -272,7 +272,7 @@ DefineQueryRewrite(RuleStmt *stmt)
                 * event relation, ...
                 */
                i = 0;
-               foreach (tllist, query->targetList)
+               foreach(tllist, query->targetList)
                {
                        TargetEntry *tle = (TargetEntry *) lfirst(tllist);
                        Resdom     *resdom = tle->resdom;
@@ -289,11 +289,12 @@ DefineQueryRewrite(RuleStmt *stmt)
                        attname = NameStr(attr->attname);
 
                        /*
-                        * Disallow dropped columns in the relation.  This won't happen
-                        * in the cases we actually care about (namely creating a view
-                        * via CREATE TABLE then CREATE RULE).  Trying to cope with it
-                        * is much more trouble than it's worth, because we'd have to
-                        * modify the rule to insert dummy NULLs at the right positions.
+                        * Disallow dropped columns in the relation.  This won't
+                        * happen in the cases we actually care about (namely creating
+                        * a view via CREATE TABLE then CREATE RULE).  Trying to cope
+                        * with it is much more trouble than it's worth, because we'd
+                        * have to modify the rule to insert dummy NULLs at the right
+                        * positions.
                         */
                        if (attr->attisdropped)
                                elog(ERROR, "cannot convert relation containing dropped columns to view");
@@ -343,11 +344,11 @@ DefineQueryRewrite(RuleStmt *stmt)
                        /*
                         * In versions before 7.3, the expected name was _RETviewname.
                         * For backwards compatibility with old pg_dump output, accept
-                        * that and silently change it to _RETURN.  Since this is just
+                        * that and silently change it to _RETURN.      Since this is just
                         * a quick backwards-compatibility hack, limit the number of
                         * characters checked to a few less than NAMEDATALEN; this
-                        * saves having to worry about where a multibyte character might
-                        * have gotten truncated.
+                        * saves having to worry about where a multibyte character
+                        * might have gotten truncated.
                         */
                        if (strncmp(stmt->rulename, "_RET", 4) != 0 ||
                                strncmp(stmt->rulename + 4, event_obj->relname,
index b183f85..d434e9e 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.107 2002/08/29 06:05:27 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.108 2002/09/04 20:31:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,7 +42,7 @@ static Query *rewriteRuleAction(Query *parsetree,
 static List *adjustJoinTreeList(Query *parsetree, bool removert, int rt_index);
 static void rewriteTargetList(Query *parsetree, Relation target_relation);
 static TargetEntry *process_matched_tle(TargetEntry *src_tle,
-                                                                               TargetEntry *prior_tle);
+                                       TargetEntry *prior_tle);
 static void markQueryForUpdate(Query *qry, bool skipOldNew);
 static List *matchLocks(CmdType event, RuleLock *rulelocks,
                   int varno, Query *parsetree);
@@ -239,7 +239,7 @@ adjustJoinTreeList(Query *parsetree, bool removert, int rt_index)
  * then junk fields (these in no particular order).
  *
  * We must do items 1 and 2 before firing rewrite rules, else rewritten
- * references to NEW.foo will produce wrong or incomplete results.  Item 3
+ * references to NEW.foo will produce wrong or incomplete results.     Item 3
  * is not needed for rewriting, but will be needed by the planner, and we
  * can do it essentially for free while handling items 1 and 2.
  */
@@ -261,7 +261,7 @@ rewriteTargetList(Query *parsetree, Relation target_relation)
 
        for (attrno = 1; attrno <= numattrs; attrno++)
        {
-               Form_pg_attribute att_tup = target_relation->rd_att->attrs[attrno-1];
+               Form_pg_attribute att_tup = target_relation->rd_att->attrs[attrno - 1];
                TargetEntry *new_tle = NULL;
 
                /* We can ignore deleted attributes */
@@ -269,7 +269,7 @@ rewriteTargetList(Query *parsetree, Relation target_relation)
                        continue;
 
                /*
-                * Look for targetlist entries matching this attr.  We match by
+                * Look for targetlist entries matching this attr.      We match by
                 * resno, but the resname should match too.
                 *
                 * Junk attributes are not candidates to be matched.
@@ -291,9 +291,9 @@ rewriteTargetList(Query *parsetree, Relation target_relation)
                if (new_tle == NULL && commandType == CMD_INSERT)
                {
                        /*
-                        * Didn't find a matching tlist entry; if it's an INSERT,
-                        * look for a default value, and add a tlist entry computing
-                        * the default if we find one.
+                        * Didn't find a matching tlist entry; if it's an INSERT, look
+                        * for a default value, and add a tlist entry computing the
+                        * default if we find one.
                         */
                        Node       *new_expr;
 
@@ -303,7 +303,7 @@ rewriteTargetList(Query *parsetree, Relation target_relation)
                                new_tle = makeTargetEntry(makeResdom(attrno,
                                                                                                         att_tup->atttypid,
                                                                                                         att_tup->atttypmod,
-                                                                                                        pstrdup(NameStr(att_tup->attname)),
+                                                                         pstrdup(NameStr(att_tup->attname)),
                                                                                                         false),
                                                                                  new_expr);
                }
@@ -448,30 +448,28 @@ build_column_default(Relation rel, int attrno)
        if (expr == NULL)
        {
                /*
-                * No per-column default, so look for a default for the type itself.
+                * No per-column default, so look for a default for the type
+                * itself.
                 */
                if (att_tup->attisset)
                {
                        /*
-                        * Set attributes are represented as OIDs no matter what the set
-                        * element type is, and the element type's default is irrelevant
-                        * too.
+                        * Set attributes are represented as OIDs no matter what the
+                        * set element type is, and the element type's default is
+                        * irrelevant too.
                         */
                }
                else
-               {
                        expr = get_typdefault(atttype);
-               }
        }
 
        if (expr == NULL)
                return NULL;                    /* No default anywhere */
 
        /*
-        * Make sure the value is coerced to the target column
-        * type (might not be right type yet if it's not a
-        * constant!)  This should match the parser's processing of
-        * non-defaulted expressions --- see
+        * Make sure the value is coerced to the target column type (might not
+        * be right type yet if it's not a constant!)  This should match the
+        * parser's processing of non-defaulted expressions --- see
         * updateTargetListEntry().
         */
        exprtype = exprType(expr);
@@ -482,8 +480,8 @@ build_column_default(Relation rel, int attrno)
                                                                atttype, atttypmod, false);
 
                /*
-                * This really shouldn't fail; should have checked the
-                * default's type when it was created ...
+                * This really shouldn't fail; should have checked the default's
+                * type when it was created ...
                 */
                if (expr == NULL)
                        elog(ERROR, "Column \"%s\" is of type %s"
@@ -495,8 +493,8 @@ build_column_default(Relation rel, int attrno)
        }
 
        /*
-        * If the column is a fixed-length type, it may need a
-        * length coercion as well as a type coercion.
+        * If the column is a fixed-length type, it may need a length coercion
+        * as well as a type coercion.
         */
        expr = coerce_type_typmod(NULL, expr, atttype, atttypmod);
 
index 87fe1c9..16eef1b 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.64 2002/06/20 20:29:34 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.65 2002/09/04 20:31:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -142,7 +142,7 @@ OffsetVarNodes_walker(Node *node, OffsetVarNodes_context *context)
        }
        if (IsA(node, JoinExpr))
        {
-               JoinExpr *j = (JoinExpr *) node;
+               JoinExpr   *j = (JoinExpr *) node;
 
                if (context->sublevels_up == 0)
                        j->rtindex += context->offset;
@@ -251,7 +251,7 @@ ChangeVarNodes_walker(Node *node, ChangeVarNodes_context *context)
        }
        if (IsA(node, JoinExpr))
        {
-               JoinExpr *j = (JoinExpr *) node;
+               JoinExpr   *j = (JoinExpr *) node;
 
                if (context->sublevels_up == 0 &&
                        j->rtindex == context->rt_index)
@@ -429,7 +429,7 @@ rangeTableEntry_used_walker(Node *node,
        }
        if (IsA(node, JoinExpr))
        {
-               JoinExpr *j = (JoinExpr *) node;
+               JoinExpr   *j = (JoinExpr *) node;
 
                if (j->rtindex == context->rt_index &&
                        context->sublevels_up == 0)
@@ -573,10 +573,10 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
         * they've been pushed down to the SELECT.
         */
        if (length(parsetree->rtable) >= 2 &&
-               strcmp(rt_fetch(PRS2_OLD_VARNO, parsetree->rtable)->eref->aliasname,
-                          "*OLD*") == 0 &&
-               strcmp(rt_fetch(PRS2_NEW_VARNO, parsetree->rtable)->eref->aliasname,
-                          "*NEW*") == 0)
+        strcmp(rt_fetch(PRS2_OLD_VARNO, parsetree->rtable)->eref->aliasname,
+                       "*OLD*") == 0 &&
+        strcmp(rt_fetch(PRS2_NEW_VARNO, parsetree->rtable)->eref->aliasname,
+                       "*NEW*") == 0)
                return parsetree;
        Assert(parsetree->jointree && IsA(parsetree->jointree, FromExpr));
        if (length(parsetree->jointree->fromlist) != 1)
@@ -589,10 +589,10 @@ getInsertSelectQuery(Query *parsetree, Query ***subquery_ptr)
                  selectquery->commandType == CMD_SELECT))
                elog(ERROR, "getInsertSelectQuery: expected to find SELECT subquery");
        if (length(selectquery->rtable) >= 2 &&
-        strcmp(rt_fetch(PRS2_OLD_VARNO, selectquery->rtable)->eref->aliasname,
-                       "*OLD*") == 0 &&
-        strcmp(rt_fetch(PRS2_NEW_VARNO, selectquery->rtable)->eref->aliasname,
-                       "*NEW*") == 0)
+       strcmp(rt_fetch(PRS2_OLD_VARNO, selectquery->rtable)->eref->aliasname,
+                  "*OLD*") == 0 &&
+       strcmp(rt_fetch(PRS2_NEW_VARNO, selectquery->rtable)->eref->aliasname,
+                  "*NEW*") == 0)
        {
                if (subquery_ptr)
                        *subquery_ptr = &(selectrte->subquery);
index 1fd5f36..deb4612 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.52 2002/07/20 05:16:58 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.53 2002/09/04 20:31:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -85,8 +85,8 @@ void
 RemoveRewriteRuleById(Oid ruleOid)
 {
        Relation        RewriteRelation;
-       ScanKeyData             skey[1];
-       SysScanDesc             rcscan;
+       ScanKeyData skey[1];
+       SysScanDesc rcscan;
        Relation        event_relation;
        HeapTuple       tuple;
        Oid                     eventRelationOid;
index 5e6650d..dd6478c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.51 2002/09/02 02:47:03 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.52 2002/09/04 20:31:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -231,6 +231,7 @@ InitBufferPoolAccess(void)
        BufferBlockPointers = (Block *) calloc(NBuffers, sizeof(Block));
        PrivateRefCount = (long *) calloc(NBuffers, sizeof(long));
        BufferLocks = (bits8 *) calloc(NBuffers, sizeof(bits8));
+
        /*
         * Convert shmem offsets into addresses as seen by this process. This
         * is just to speed up the BufferGetBlock() macro.
index bea4854..b6c9112 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.131 2002/09/02 02:47:03 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.132 2002/09/04 20:31:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -75,6 +75,7 @@ static Buffer ReadBufferInternal(Relation reln, BlockNumber blockNum,
 static BufferDesc *BufferAlloc(Relation reln, BlockNumber blockNum,
                        bool *foundPtr);
 static int     BufferReplace(BufferDesc *bufHdr);
+
 #ifdef NOT_USED
 void           PrintBufferDescs(void);
 #endif
@@ -552,7 +553,7 @@ BufferAlloc(Relation reln,
 
 /*
  * write_buffer -- common functionality for
- *                 WriteBuffer and WriteNoReleaseBuffer
+ *                                WriteBuffer and WriteNoReleaseBuffer
  */
 static void
 write_buffer(Buffer buffer, bool release)
@@ -870,14 +871,14 @@ ShowBufferUsage(void)
                localhitrate = (float) LocalBufferHitCount *100.0 / ReadLocalBufferCount;
 
        appendStringInfo(&str,
-                       "!\tShared blocks: %10ld read, %10ld written, buffer hit rate = %.2f%%\n",
+                                        "!\tShared blocks: %10ld read, %10ld written, buffer hit rate = %.2f%%\n",
                        ReadBufferCount - BufferHitCount, BufferFlushCount, hitrate);
        appendStringInfo(&str,
-                       "!\tLocal  blocks: %10ld read, %10ld written, buffer hit rate = %.2f%%\n",
-                       ReadLocalBufferCount - LocalBufferHitCount, LocalBufferFlushCount, localhitrate);
+                                        "!\tLocal  blocks: %10ld read, %10ld written, buffer hit rate = %.2f%%\n",
+                                        ReadLocalBufferCount - LocalBufferHitCount, LocalBufferFlushCount, localhitrate);
        appendStringInfo(&str,
-                       "!\tDirect blocks: %10ld read, %10ld written\n",
-                       NDirectFileRead, NDirectFileWrite);
+                                        "!\tDirect blocks: %10ld read, %10ld written\n",
+                                        NDirectFileRead, NDirectFileWrite);
 
        return str.data;
 }
@@ -917,7 +918,7 @@ AtEOXact_Buffers(bool isCommit)
                        if (isCommit)
                                elog(WARNING,
                                         "Buffer Leak: [%03d] (freeNext=%d, freePrev=%d, "
-                                        "rel=%u/%u, blockNum=%u, flags=0x%x, refcount=%d %ld)",
+                                 "rel=%u/%u, blockNum=%u, flags=0x%x, refcount=%d %ld)",
                                         i, buf->freeNext, buf->freePrev,
                                         buf->tag.rnode.tblNode, buf->tag.rnode.relNode,
                                         buf->tag.blockNum, buf->flags,
index 50168c8..5f4033b 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.45 2002/08/06 02:36:34 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.46 2002/09/04 20:31:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -83,8 +83,8 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
                elog(ERROR, "no empty local buffer.");
 
        /*
-        * this buffer is not referenced but it might still be dirty.
-        * if that's the case, write it out before reusing it!
+        * this buffer is not referenced but it might still be dirty. if
+        * that's the case, write it out before reusing it!
         */
        if (bufHdr->flags & BM_DIRTY || bufHdr->cntxDirty)
        {
@@ -108,9 +108,9 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
        /*
         * lazy memory allocation: allocate space on first use of a buffer.
         *
-        * Note this path cannot be taken for a buffer that was previously
-        * in use, so it's okay to do it (and possibly error out) before
-        * marking the buffer as valid.
+        * Note this path cannot be taken for a buffer that was previously in
+        * use, so it's okay to do it (and possibly error out) before marking
+        * the buffer as valid.
         */
        if (bufHdr->data == (SHMEM_OFFSET) 0)
        {
index 2c0eb3c..7dc91a4 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/freespace/freespace.c,v 1.12 2002/06/20 20:29:34 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/freespace/freespace.c,v 1.13 2002/09/04 20:31:25 momjian Exp $
  *
  *
  * NOTES:
@@ -850,7 +850,7 @@ insert_fsm_page_entry(FSMRelation *fsmrel, BlockNumber page, Size spaceAvail,
                        FSMChunk   *newChunk;
 
                        if ((newChunk = FreeSpaceMap->freeChunks) == NULL)
-                               return false;           /* can't do it */
+                               return false;   /* can't do it */
                        FreeSpaceMap->freeChunks = newChunk->next;
                        FreeSpaceMap->numFreeChunks--;
                        newChunk->next = NULL;
@@ -874,21 +874,25 @@ insert_fsm_page_entry(FSMRelation *fsmrel, BlockNumber page, Size spaceAvail,
                        }
                }
 
-               /* Try to insert it the easy way, ie, just move down subsequent data */
+               /*
+                * Try to insert it the easy way, ie, just move down subsequent
+                * data
+                */
                if (chunk &&
                        push_fsm_page_entry(page, spaceAvail, chunk, chunkRelIndex))
                {
                        fsmrel->numPages++;
-                       fsmrel->nextPage++;             /* don't return same page twice running */
+                       fsmrel->nextPage++; /* don't return same page twice running */
                        return true;
                }
 
                /*
-                * There is space available, but evidently it's before the place where
-                * the page entry needs to go.  Compact the list and try again. This
-                * will require us to redo the search for the appropriate place.
-                * Furthermore, compact_fsm_page_list deletes empty end chunks, so
-                * we may need to repeat the action of grabbing a new end chunk.
+                * There is space available, but evidently it's before the place
+                * where the page entry needs to go.  Compact the list and try
+                * again. This will require us to redo the search for the
+                * appropriate place. Furthermore, compact_fsm_page_list deletes
+                * empty end chunks, so we may need to repeat the action of
+                * grabbing a new end chunk.
                 */
                compact_fsm_page_list(fsmrel);
                if (lookup_fsm_page_entry(fsmrel, page, &chunk, &chunkRelIndex))
index e71bb0c..989ee1b 100644 (file)
@@ -4,7 +4,7 @@
  *       POSTGRES inter-process communication definitions.
  *
  * This file is misnamed, as it no longer has much of anything directly
- * to do with IPC.  The functionality here is concerned with managing
+ * to do with IPC.     The functionality here is concerned with managing
  * exit-time cleanup for either a postmaster or a backend.
  *
  *
@@ -13,7 +13,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.80 2002/06/20 20:29:34 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/ipc/ipc.c,v 1.81 2002/09/04 20:31:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
index 70dfb83..ff9a83a 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.66 2002/06/20 20:29:35 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.67 2002/09/04 20:31:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -133,6 +133,7 @@ ShmemAlloc(Size size)
 {
        uint32          newFree;
        void       *newSpace;
+
        /* use volatile pointer to prevent code rearrangement */
        volatile PGShmemHeader *shmemseghdr = ShmemSegHdr;
 
index a328ea4..87f7a29 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.51 2002/09/02 02:47:03 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.52 2002/09/04 20:31:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -96,7 +96,8 @@ ReceiveSharedInvalidMessages(
                 * The routines later in this file that use shared mode are okay with
                 * this, because they aren't looking at the ProcState fields
                 * associated with SI message transfer; they only use the
-                * ProcState array as an easy way to find all the PGPROC structures.
+                * ProcState array as an easy way to find all the PGPROC
+                * structures.
                 */
                LWLockAcquire(SInvalLock, LW_SHARED);
                getResult = SIGetDataEntry(shmInvalBuffer, MyBackendId, &data);
@@ -380,9 +381,9 @@ GetSnapshotData(bool serializable)
                         * running a transaction, and xacts started since we read the
                         * next transaction ID.  There's no need to store XIDs above
                         * what we got from ReadNewTransactionId, since we'll treat
-                        * them as running anyway.  We also assume that such xacts can't
-                        * compute an xmin older than ours, so they needn't be considered
-                        * in computing globalxmin.
+                        * them as running anyway.      We also assume that such xacts
+                        * can't compute an xmin older than ours, so they needn't be
+                        * considered in computing globalxmin.
                         */
                        if (proc == MyProc ||
                                !TransactionIdIsNormal(xid) ||
@@ -411,9 +412,9 @@ GetSnapshotData(bool serializable)
        Assert(TransactionIdIsValid(MyProc->xmin));
 
        /*
-        * Update globalxmin to include actual process xids.  This is a slightly
-        * different way of computing it than GetOldestXmin uses, but should give
-        * the same result.
+        * Update globalxmin to include actual process xids.  This is a
+        * slightly different way of computing it than GetOldestXmin uses, but
+        * should give the same result.
         */
        if (TransactionIdPrecedes(xmin, globalxmin))
                globalxmin = xmin;
@@ -551,7 +552,7 @@ BackendIdGetProc(BackendId procId)
 int
 CountEmptyBackendSlots(void)
 {
-       int count;
+       int                     count;
 
        LWLockAcquire(SInvalLock, LW_SHARED);
 
index cf6838c..155b1a4 100644 (file)
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.12 2002/07/19 00:17:40 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/deadlock.c,v 1.13 2002/09/04 20:31:25 momjian Exp $
  *
  *     Interface:
  *
@@ -66,7 +66,7 @@ static void PrintLockQueue(LOCK *lock, const char *info);
  */
 
 /* Workspace for FindLockCycle */
-static PGPROC **visitedProcs;          /* Array of visited procs */
+static PGPROC **visitedProcs;  /* Array of visited procs */
 static int     nVisitedProcs;
 
 /* Workspace for TopoSort */
@@ -77,7 +77,7 @@ static int *afterConstraints; /* List head for after-constraints */
 /* Output area for ExpandConstraints */
 static WAIT_ORDER *waitOrders; /* Array of proposed queue rearrangements */
 static int     nWaitOrders;
-static PGPROC **waitOrderProcs;        /* Space for waitOrders queue contents */
+static PGPROC **waitOrderProcs; /* Space for waitOrders queue contents */
 
 /* Current list of constraints being considered */
 static EDGE *curConstraints;
@@ -377,7 +377,7 @@ FindLockCycleRecurse(PGPROC *checkProc,
 {
        PGPROC     *proc;
        LOCK       *lock;
-       PROCLOCK           *holder;
+       PROCLOCK   *holder;
        SHM_QUEUE  *lockHolders;
        LOCKMETHODTABLE *lockMethodTable;
        PROC_QUEUE *waitQueue;
@@ -428,7 +428,7 @@ FindLockCycleRecurse(PGPROC *checkProc,
        lockHolders = &(lock->lockHolders);
 
        holder = (PROCLOCK *) SHMQueueNext(lockHolders, lockHolders,
-                                                                        offsetof(PROCLOCK, lockLink));
+                                                                          offsetof(PROCLOCK, lockLink));
 
        while (holder)
        {
@@ -452,7 +452,7 @@ FindLockCycleRecurse(PGPROC *checkProc,
                }
 
                holder = (PROCLOCK *) SHMQueueNext(lockHolders, &holder->lockLink,
-                                                                                offsetof(PROCLOCK, lockLink));
+                                                                                  offsetof(PROCLOCK, lockLink));
        }
 
        /*
index fd300a4..03d16d6 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.114 2002/09/02 02:47:03 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lock.c,v 1.115 2002/09/04 20:31:25 momjian Exp $
  *
  * NOTES
  *       Outside modules can create a lock table and acquire/release
@@ -127,9 +127,9 @@ inline static void
 PROCLOCK_PRINT(const char *where, const PROCLOCK *holderP)
 {
        if (
-        (((PROCLOCK_LOCKMETHOD(*holderP) == DEFAULT_LOCKMETHOD && Trace_locks)
-          || (PROCLOCK_LOCKMETHOD(*holderP) == USER_LOCKMETHOD && Trace_userlocks))
-         && (((LOCK *) MAKE_PTR(holderP->tag.lock))->tag.relId >= (Oid) Trace_lock_oidmin))
+       (((PROCLOCK_LOCKMETHOD(*holderP) == DEFAULT_LOCKMETHOD && Trace_locks)
+         || (PROCLOCK_LOCKMETHOD(*holderP) == USER_LOCKMETHOD && Trace_userlocks))
+        && (((LOCK *) MAKE_PTR(holderP->tag.lock))->tag.relId >= (Oid) Trace_lock_oidmin))
                || (Trace_lock_table && (((LOCK *) MAKE_PTR(holderP->tag.lock))->tag.relId == Trace_lock_table))
                )
                elog(LOG,
@@ -310,7 +310,7 @@ LockMethodTableInit(char *tabName,
        Assert(lockMethodTable->lockHash->hash == tag_hash);
 
        /*
-        * allocate a hash table for PROCLOCK structs.  This is used to store
+        * allocate a hash table for PROCLOCK structs.  This is used to store
         * per-lock-holder information.
         */
        info.keysize = sizeof(PROCLOCKTAG);
@@ -434,8 +434,8 @@ bool
 LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
                        TransactionId xid, LOCKMODE lockmode, bool dontWait)
 {
-       PROCLOCK           *holder;
-       PROCLOCKTAG     holdertag;
+       PROCLOCK   *holder;
+       PROCLOCKTAG holdertag;
        HTAB       *holderTable;
        bool            found;
        LOCK       *lock;
@@ -507,7 +507,7 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
        /*
         * Create the hash key for the holder table.
         */
-       MemSet(&holdertag, 0, sizeof(PROCLOCKTAG));     /* must clear padding,
+       MemSet(&holdertag, 0, sizeof(PROCLOCKTAG)); /* must clear padding,
                                                                                                 * needed */
        holdertag.lock = MAKE_OFFSET(lock);
        holdertag.proc = MAKE_OFFSET(MyProc);
@@ -518,8 +518,8 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
         */
        holderTable = lockMethodTable->holderHash;
        holder = (PROCLOCK *) hash_search(holderTable,
-                                                                       (void *) &holdertag,
-                                                                       HASH_ENTER, &found);
+                                                                         (void *) &holdertag,
+                                                                         HASH_ENTER, &found);
        if (!holder)
        {
                LWLockRelease(masterLock);
@@ -645,8 +645,8 @@ LockAcquire(LOCKMETHOD lockmethod, LOCKTAG *locktag,
                                SHMQueueDelete(&holder->lockLink);
                                SHMQueueDelete(&holder->procLink);
                                holder = (PROCLOCK *) hash_search(holderTable,
-                                                                                               (void *) holder,
-                                                                                               HASH_REMOVE, NULL);
+                                                                                                 (void *) holder,
+                                                                                                 HASH_REMOVE, NULL);
                                if (!holder)
                                        elog(WARNING, "LockAcquire: remove holder, table corrupted");
                        }
@@ -808,13 +808,13 @@ static void
 LockCountMyLocks(SHMEM_OFFSET lockOffset, PGPROC *proc, int *myHolding)
 {
        SHM_QUEUE  *procHolders = &(proc->procHolders);
-       PROCLOCK           *holder;
+       PROCLOCK   *holder;
        int                     i;
 
        MemSet(myHolding, 0, MAX_LOCKMODES * sizeof(int));
 
        holder = (PROCLOCK *) SHMQueueNext(procHolders, procHolders,
-                                                                        offsetof(PROCLOCK, procLink));
+                                                                          offsetof(PROCLOCK, procLink));
 
        while (holder)
        {
@@ -825,7 +825,7 @@ LockCountMyLocks(SHMEM_OFFSET lockOffset, PGPROC *proc, int *myHolding)
                }
 
                holder = (PROCLOCK *) SHMQueueNext(procHolders, &holder->procLink,
-                                                                                offsetof(PROCLOCK, procLink));
+                                                                                  offsetof(PROCLOCK, procLink));
        }
 }
 
@@ -978,8 +978,8 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
        LOCK       *lock;
        LWLockId        masterLock;
        LOCKMETHODTABLE *lockMethodTable;
-       PROCLOCK           *holder;
-       PROCLOCKTAG     holdertag;
+       PROCLOCK   *holder;
+       PROCLOCKTAG holdertag;
        HTAB       *holderTable;
        bool            wakeupNeeded = false;
 
@@ -1025,7 +1025,7 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
        /*
         * Find the holder entry for this holder.
         */
-       MemSet(&holdertag, 0, sizeof(PROCLOCKTAG));     /* must clear padding,
+       MemSet(&holdertag, 0, sizeof(PROCLOCKTAG)); /* must clear padding,
                                                                                                 * needed */
        holdertag.lock = MAKE_OFFSET(lock);
        holdertag.proc = MAKE_OFFSET(MyProc);
@@ -1033,8 +1033,8 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
 
        holderTable = lockMethodTable->holderHash;
        holder = (PROCLOCK *) hash_search(holderTable,
-                                                                       (void *) &holdertag,
-                                                                       HASH_FIND_SAVE, NULL);
+                                                                         (void *) &holdertag,
+                                                                         HASH_FIND_SAVE, NULL);
        if (!holder)
        {
                LWLockRelease(masterLock);
@@ -1135,8 +1135,8 @@ LockRelease(LOCKMETHOD lockmethod, LOCKTAG *locktag,
                SHMQueueDelete(&holder->lockLink);
                SHMQueueDelete(&holder->procLink);
                holder = (PROCLOCK *) hash_search(holderTable,
-                                                                               (void *) &holder,
-                                                                               HASH_REMOVE_SAVED, NULL);
+                                                                                 (void *) &holder,
+                                                                                 HASH_REMOVE_SAVED, NULL);
                if (!holder)
                {
                        LWLockRelease(masterLock);
@@ -1171,8 +1171,8 @@ LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
                           bool allxids, TransactionId xid)
 {
        SHM_QUEUE  *procHolders = &(proc->procHolders);
-       PROCLOCK           *holder;
-       PROCLOCK           *nextHolder;
+       PROCLOCK   *holder;
+       PROCLOCK   *nextHolder;
        LWLockId        masterLock;
        LOCKMETHODTABLE *lockMethodTable;
        int                     i,
@@ -1199,7 +1199,7 @@ LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
        LWLockAcquire(masterLock, LW_EXCLUSIVE);
 
        holder = (PROCLOCK *) SHMQueueNext(procHolders, procHolders,
-                                                                        offsetof(PROCLOCK, procLink));
+                                                                          offsetof(PROCLOCK, procLink));
 
        while (holder)
        {
@@ -1207,7 +1207,7 @@ LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
 
                /* Get link first, since we may unlink/delete this holder */
                nextHolder = (PROCLOCK *) SHMQueueNext(procHolders, &holder->procLink,
-                                                                                        offsetof(PROCLOCK, procLink));
+                                                                                  offsetof(PROCLOCK, procLink));
 
                Assert(holder->tag.proc == MAKE_OFFSET(proc));
 
@@ -1249,7 +1249,7 @@ LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
                                         * Read comments in LockRelease
                                         */
                                        if (!wakeupNeeded &&
-                                       lockMethodTable->conflictTab[i] & lock->waitMask)
+                                               lockMethodTable->conflictTab[i] & lock->waitMask)
                                                wakeupNeeded = true;
                                }
                        }
@@ -1287,9 +1287,9 @@ LockReleaseAll(LOCKMETHOD lockmethod, PGPROC *proc,
                 * remove the holder entry from the hashtable
                 */
                holder = (PROCLOCK *) hash_search(lockMethodTable->holderHash,
-                                                                               (void *) holder,
-                                                                               HASH_REMOVE,
-                                                                               NULL);
+                                                                                 (void *) holder,
+                                                                                 HASH_REMOVE,
+                                                                                 NULL);
                if (!holder)
                {
                        LWLockRelease(masterLock);
@@ -1340,8 +1340,7 @@ LockShmemSize(int maxBackends)
 
        size += MAXALIGN(sizeof(PROC_HDR)); /* ProcGlobal */
        size += maxBackends * MAXALIGN(sizeof(PGPROC));         /* each MyProc */
-       size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODTABLE)); /* each
-                                                                                                                                * lockMethodTable */
+       size += MAX_LOCK_METHODS * MAXALIGN(sizeof(LOCKMETHODTABLE));           /* each lockMethodTable */
 
        /* lockHash table */
        size += hash_estimate_size(max_table_size, sizeof(LOCK));
@@ -1375,11 +1374,11 @@ LockShmemSize(int maxBackends)
 LockData *
 GetLockStatusData(void)
 {
-       LockData        *data;
-       HTAB            *holderTable;
-       PROCLOCK        *holder;
+       LockData   *data;
+       HTAB       *holderTable;
+       PROCLOCK   *holder;
        HASH_SEQ_STATUS seqstat;
-       int i;
+       int                     i;
 
        data = (LockData *) palloc(sizeof(LockData));
 
@@ -1400,10 +1399,10 @@ GetLockStatusData(void)
        hash_seq_init(&seqstat, holderTable);
 
        i = 0;
-       while ( (holder = hash_seq_search(&seqstat)) )
+       while ((holder = hash_seq_search(&seqstat)))
        {
-               PGPROC  *proc = (PGPROC *) MAKE_PTR(holder->tag.proc);
-               LOCK    *lock = (LOCK *) MAKE_PTR(holder->tag.lock);
+               PGPROC     *proc = (PGPROC *) MAKE_PTR(holder->tag.proc);
+               LOCK       *lock = (LOCK *) MAKE_PTR(holder->tag.lock);
 
                data->holderaddrs[i] = MAKE_OFFSET(holder);
                memcpy(&(data->holders[i]), holder, sizeof(PROCLOCK));
@@ -1439,7 +1438,7 @@ DumpLocks(void)
 {
        PGPROC     *proc;
        SHM_QUEUE  *procHolders;
-       PROCLOCK           *holder;
+       PROCLOCK   *holder;
        LOCK       *lock;
        int                     lockmethod = DEFAULT_LOCKMETHOD;
        LOCKMETHODTABLE *lockMethodTable;
@@ -1459,7 +1458,7 @@ DumpLocks(void)
                LOCK_PRINT("DumpLocks: waiting on", proc->waitLock, 0);
 
        holder = (PROCLOCK *) SHMQueueNext(procHolders, procHolders,
-                                                                        offsetof(PROCLOCK, procLink));
+                                                                          offsetof(PROCLOCK, procLink));
 
        while (holder)
        {
@@ -1471,7 +1470,7 @@ DumpLocks(void)
                LOCK_PRINT("DumpLocks", lock, 0);
 
                holder = (PROCLOCK *) SHMQueueNext(procHolders, &holder->procLink,
-                                                                                offsetof(PROCLOCK, procLink));
+                                                                                  offsetof(PROCLOCK, procLink));
        }
 }
 
@@ -1482,7 +1481,7 @@ void
 DumpAllLocks(void)
 {
        PGPROC     *proc;
-       PROCLOCK           *holder;
+       PROCLOCK   *holder;
        LOCK       *lock;
        int                     lockmethod = DEFAULT_LOCKMETHOD;
        LOCKMETHODTABLE *lockMethodTable;
index 10f666a..e2559be 100644 (file)
@@ -15,7 +15,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lwlock.c,v 1.12 2002/06/20 20:29:35 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lwlock.c,v 1.13 2002/09/04 20:31:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -211,21 +211,21 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
        HOLD_INTERRUPTS();
 
        /*
-        * Loop here to try to acquire lock after each time we are signaled
-        * by LWLockRelease.
+        * Loop here to try to acquire lock after each time we are signaled by
+        * LWLockRelease.
         *
-        * NOTE: it might seem better to have LWLockRelease actually grant us
-        * the lock, rather than retrying and possibly having to go back to
-        * sleep.  But in practice that is no good because it means a process
-        * swap for every lock acquisition when two or more processes are
-        * contending for the same lock.  Since LWLocks are normally used to
-        * protect not-very-long sections of computation, a process needs to
-        * be able to acquire and release the same lock many times during a
-        * single CPU time slice, even in the presence of contention.  The
-        * efficiency of being able to do that outweighs the inefficiency of
-        * sometimes wasting a process dispatch cycle because the lock is not
-        * free when a released waiter finally gets to run.  See pgsql-hackers
-        * archives for 29-Dec-01.
+        * NOTE: it might seem better to have LWLockRelease actually grant us the
+        * lock, rather than retrying and possibly having to go back to sleep.
+        * But in practice that is no good because it means a process swap for
+        * every lock acquisition when two or more processes are contending
+        * for the same lock.  Since LWLocks are normally used to protect
+        * not-very-long sections of computation, a process needs to be able
+        * to acquire and release the same lock many times during a single CPU
+        * time slice, even in the presence of contention.      The efficiency of
+        * being able to do that outweighs the inefficiency of sometimes
+        * wasting a process dispatch cycle because the lock is not free when
+        * a released waiter finally gets to run.  See pgsql-hackers archives
+        * for 29-Dec-01.
         */
        for (;;)
        {
@@ -290,12 +290,12 @@ LWLockAcquire(LWLockId lockid, LWLockMode mode)
                 *
                 * Since we share the process wait semaphore with the regular lock
                 * manager and ProcWaitForSignal, and we may need to acquire an
-                * LWLock while one of those is pending, it is possible that we get
-                * awakened for a reason other than being signaled by LWLockRelease.
-                * If so, loop back and wait again.  Once we've gotten the LWLock,
-                * re-increment the sema by the number of additional signals
-                * received, so that the lock manager or signal manager will see
-                * the received signal when it next waits.
+                * LWLock while one of those is pending, it is possible that we
+                * get awakened for a reason other than being signaled by
+                * LWLockRelease. If so, loop back and wait again.      Once we've
+                * gotten the LWLock, re-increment the sema by the number of
+                * additional signals received, so that the lock manager or signal
+                * manager will see the received signal when it next waits.
                 */
                LOG_LWDEBUG("LWLockAcquire", lockid, "waiting");
 
@@ -455,9 +455,7 @@ LWLockRelease(LWLockId lockid)
                        {
                                while (proc->lwWaitLink != NULL &&
                                           !proc->lwWaitLink->lwExclusive)
-                               {
                                        proc = proc->lwWaitLink;
-                               }
                        }
                        /* proc is now the last PGPROC to be released */
                        lock->head = proc->lwWaitLink;
index c64b865..5dceb72 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.124 2002/07/19 00:17:40 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.125 2002/09/04 20:31:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -131,11 +131,12 @@ InitProcGlobal(int maxBackends)
                ProcGlobal->freeProcs = INVALID_OFFSET;
 
                /*
-                * Pre-create the PGPROC structures and create a semaphore for each.
+                * Pre-create the PGPROC structures and create a semaphore for
+                * each.
                 */
                for (i = 0; i < maxBackends; i++)
                {
-                       PGPROC   *proc;
+                       PGPROC     *proc;
 
                        proc = (PGPROC *) ShmemAlloc(sizeof(PGPROC));
                        if (!proc)
@@ -147,8 +148,9 @@ InitProcGlobal(int maxBackends)
                }
 
                /*
-                * Pre-allocate a PGPROC structure for dummy (checkpoint) processes,
-                * too.  This does not get linked into the freeProcs list.
+                * Pre-allocate a PGPROC structure for dummy (checkpoint)
+                * processes, too.      This does not get linked into the freeProcs
+                * list.
                 */
                DummyProc = (PGPROC *) ShmemAlloc(sizeof(PGPROC));
                if (!DummyProc)
@@ -170,6 +172,7 @@ void
 InitProcess(void)
 {
        SHMEM_OFFSET myOffset;
+
        /* use volatile pointer to prevent code rearrangement */
        volatile PROC_HDR *procglobal = ProcGlobal;
 
@@ -184,8 +187,8 @@ InitProcess(void)
                elog(ERROR, "InitProcess: you already exist");
 
        /*
-        * Try to get a proc struct from the free list.  If this fails,
-        * we must be out of PGPROC structures (not to mention semaphores).
+        * Try to get a proc struct from the free list.  If this fails, we
+        * must be out of PGPROC structures (not to mention semaphores).
         */
        SpinLockAcquire(ProcStructLock);
 
@@ -209,8 +212,8 @@ InitProcess(void)
        }
 
        /*
-        * Initialize all fields of MyProc, except for the semaphore which
-        * was prepared for us by InitProcGlobal.
+        * Initialize all fields of MyProc, except for the semaphore which was
+        * prepared for us by InitProcGlobal.
         */
        SHMQueueElemInit(&(MyProc->links));
        MyProc->errType = STATUS_OK;
@@ -638,7 +641,7 @@ ProcSleep(LOCKMETHODTABLE *lockMethodTable,
 
        /*
         * If someone wakes us between LWLockRelease and PGSemaphoreLock,
-        * PGSemaphoreLock will not block.  The wakeup is "saved" by the
+        * PGSemaphoreLock will not block.      The wakeup is "saved" by the
         * semaphore implementation.  Note also that if CheckDeadLock is
         * invoked but does not detect a deadlock, PGSemaphoreLock() will
         * continue to wait.  There used to be a loop here, but it was useless
@@ -930,12 +933,18 @@ bool
 enable_sig_alarm(int delayms, bool is_statement_timeout)
 {
 #ifndef __BEOS__
-       struct itimerval timeval, remaining;
+       struct itimerval timeval,
+                               remaining;
+
 #else
-       bigtime_t       time_interval, remaining;
+       bigtime_t       time_interval,
+                               remaining;
 #endif
 
-       /* Don't set timer if the statement timeout scheduled before next alarm. */
+       /*
+        * Don't set timer if the statement timeout scheduled before next
+        * alarm.
+        */
        if (alarm_is_statement_timeout &&
                !is_statement_timeout &&
                RemainingStatementTimeout <= delayms)
@@ -964,7 +973,7 @@ enable_sig_alarm(int delayms, bool is_statement_timeout)
 #ifndef __BEOS__
                        /* We lose precision here because we convert to milliseconds */
                        RemainingStatementTimeout = remaining.it_value.tv_sec * 1000 +
-                                                                               remaining.it_value.tv_usec / 1000;
+                               remaining.it_value.tv_usec / 1000;
 #else
                        RemainingStatementTimeout = remaining / 1000;
 #endif
@@ -983,7 +992,7 @@ enable_sig_alarm(int delayms, bool is_statement_timeout)
 #ifndef __BEOS__
                                remaining.it_value.tv_sec = RemainingStatementTimeout / 1000;
                                remaining.it_value.tv_usec = (RemainingStatementTimeout % 1000) * 1000;
-                               if (setitimer(ITIMER_REAL, &remaining, &timeval))
+                               if (setitimer(ITIMER_REAL, &remaining, &timeval))
                                        return false;
                                else
                                        return true;
@@ -1020,10 +1029,12 @@ bool
 disable_sig_alarm(bool is_statement_timeout)
 {
 #ifndef __BEOS__
-       struct itimerval timeval, remaining;
+       struct itimerval timeval,
+                               remaining;
+
        MemSet(&timeval, 0, sizeof(struct itimerval));
 #else
-       bigtime_t time_interval = 0;
+       bigtime_t       time_interval = 0;
 #endif
 
        if (!is_statement_timeout && RemainingStatementTimeout)
@@ -1034,7 +1045,7 @@ disable_sig_alarm(bool is_statement_timeout)
                        return false;
                /* Add remaining time back because the timer didn't complete */
                RemainingStatementTimeout += remaining.it_value.tv_sec * 1000 +
-                                                                        remaining.it_value.tv_usec / 1000;
+                       remaining.it_value.tv_usec / 1000;
                /* Prepare to set timer */
                timeval.it_value.tv_sec = RemainingStatementTimeout / 1000;
                timeval.it_value.tv_usec = (RemainingStatementTimeout % 1000) * 1000;
@@ -1048,9 +1059,10 @@ disable_sig_alarm(bool is_statement_timeout)
                /* Restore remaining statement timeout value */
                alarm_is_statement_timeout = true;
        }
+
        /*
-        *      Optimization: is_statement_timeout && RemainingStatementTimeout == 0
-        *  does nothing.  This is for cases where no timeout was set.
+        * Optimization: is_statement_timeout && RemainingStatementTimeout ==
+        * 0 does nothing.      This is for cases where no timeout was set.
         */
        if (!is_statement_timeout || RemainingStatementTimeout)
        {
@@ -1097,4 +1109,3 @@ handle_sig_alarm(SIGNAL_ARGS)
                disable_sig_alarm(false);
        }
 }
-
index ae19959..d7963b7 100644 (file)
@@ -16,7 +16,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/spin.c,v 1.9 2002/06/20 20:29:35 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/spin.c,v 1.10 2002/09/04 20:31:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,11 +52,11 @@ int
 SpinlockSemas(void)
 {
        /*
-        * It would be cleaner to distribute this logic into the affected modules,
-        * similar to the way shmem space estimation is handled.
+        * It would be cleaner to distribute this logic into the affected
+        * modules, similar to the way shmem space estimation is handled.
         *
-        * For now, though, we just need a few spinlocks (10 should be
-        * plenty) plus one for each LWLock.
+        * For now, though, we just need a few spinlocks (10 should be plenty)
+        * plus one for each LWLock.
         */
        return NumLWLocks() + 10;
 }
index 5f26320..83e0c33 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.49 2002/09/02 02:47:04 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.50 2002/09/04 20:31:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -117,7 +117,7 @@ PageAddItem(Page page,
                else
                {
                        if (offsetNumber < limit)
-                               needshuffle = true; /* need to move existing linp's */
+                               needshuffle = true;             /* need to move existing linp's */
                }
        }
        else
@@ -378,8 +378,8 @@ PageGetFreeSpace(Page page)
        int                     space;
 
        /*
-        * Use signed arithmetic here so that we behave sensibly if
-        * pd_lower > pd_upper.
+        * Use signed arithmetic here so that we behave sensibly if pd_lower >
+        * pd_upper.
         */
        space = (int) ((PageHeader) page)->pd_upper -
                (int) ((PageHeader) page)->pd_lower;
@@ -440,9 +440,9 @@ PageIndexTupleDelete(Page page, OffsetNumber offnum)
 
        /*
         * First, we want to get rid of the pd_linp entry for the index tuple.
-        * We copy all subsequent linp's back one slot in the array.
-        * We don't use PageGetItemId, because we are manipulating the _array_,
-        * not individual linp's.
+        * We copy all subsequent linp's back one slot in the array. We don't
+        * use PageGetItemId, because we are manipulating the _array_, not
+        * individual linp's.
         */
        nbytes = phdr->pd_lower -
                ((char *) &phdr->pd_linp[offidx + 1] - (char *) phdr);
@@ -480,7 +480,7 @@ PageIndexTupleDelete(Page page, OffsetNumber offnum)
        if (!PageIsEmpty(page))
        {
                nline--;                                /* there's one less than when we started */
-               for (i = nline; --i >= 0; )
+               for (i = nline; --i >= 0;)
                {
                        if (PageGetItemId(phdr, i + 1)->lp_off <= offset)
                                PageGetItemId(phdr, i + 1)->lp_off += size;
index dab9b5d..8b05fdf 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.59 2002/08/15 16:36:04 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.60 2002/09/04 20:31:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -66,7 +66,7 @@ static f_smgr smgrsw[] = {
        /* main memory */
        {mminit, mmshutdown, mmcreate, mmunlink, mmextend, mmopen, mmclose,
                mmread, mmwrite, mmblindwrt,
-               mmnblocks, NULL, mmcommit, mmabort, NULL},
+       mmnblocks, NULL, mmcommit, mmabort, NULL},
 #endif
 };
 
index a1acc24..01d8100 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.290 2002/09/02 05:25:37 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.291 2002/09/04 20:31:26 momjian Exp $
  *
  * NOTES
  *       this is the "main" module of the postgres backend and
 extern int     optind;
 extern char *optarg;
 
-char      *debug_query_string; /* for pgmonitor and log_min_error_statement*/
+char      *debug_query_string; /* for pgmonitor and
+                                                                * log_min_error_statement */
 
 /* Note: whereToSendOutput is initialized for the bootstrap/standalone case */
 CommandDest whereToSendOutput = Debug;
 
-extern int StatementTimeout;
+extern int     StatementTimeout;
 
 static bool dontExecute = false;
 
@@ -551,7 +552,7 @@ pg_plan_query(Query *querytree)
  */
 
 void
-pg_exec_query_string(StringInfo query_string,          /* string to execute */
+pg_exec_query_string(StringInfo query_string,  /* string to execute */
                                         CommandDest dest,      /* where results should go */
                                         MemoryContext parse_context)           /* context for
                                                                                                                 * parsetrees */
@@ -561,14 +562,15 @@ pg_exec_query_string(StringInfo query_string,             /* string to execute */
        List       *parsetree_list,
                           *parsetree_item;
        struct timezone tz;
-       struct timeval start_t, stop_t;
+       struct timeval start_t,
+                               stop_t;
        bool            save_Log_duration = Log_duration;
 
        debug_query_string = query_string->data;
 
        /*
-        *      We use save_Log_duration so setting Log_duration to true doesn't
-        *      report incorrect time because gettimeofday() wasn't called.
+        * We use save_Log_duration so setting Log_duration to true doesn't
+        * report incorrect time because gettimeofday() wasn't called.
         */
        if (save_Log_duration)
                gettimeofday(&start_t, &tz);
@@ -627,9 +629,9 @@ pg_exec_query_string(StringInfo query_string,               /* string to execute */
                isTransactionStmt = IsA(parsetree, TransactionStmt);
 
                /*
-                * First we set the command-completion tag to the main query
-                * (as opposed to each of the others that may be generated by
-                * analyze and rewrite).  Also set ps_status and do any special
+                * First we set the command-completion tag to the main query (as
+                * opposed to each of the others that may be generated by analyze
+                * and rewrite).  Also set ps_status and do any special
                 * start-of-SQL-command processing needed by the destination.
                 */
                commandTag = CreateCommandTag(parsetree);
@@ -807,15 +809,16 @@ pg_exec_query_string(StringInfo query_string,             /* string to execute */
                                finish_xact_command();
                                xact_started = false;
                        }
-               } /* end loop over queries generated from a parsetree */
+               }                                               /* end loop over queries generated from a
+                                                                * parsetree */
 
                /*
                 * If this is the last parsetree of the query string, close down
-                * transaction statement before reporting command-complete.  This is
-                * so that any end-of-transaction errors are reported before the
-                * command-complete message is issued, to avoid confusing clients
-                * who will expect either a command-complete message or an error,
-                * not one and then the other.  But for compatibility with
+                * transaction statement before reporting command-complete.  This
+                * is so that any end-of-transaction errors are reported before
+                * the command-complete message is issued, to avoid confusing
+                * clients who will expect either a command-complete message or an
+                * error, not one and then the other.  But for compatibility with
                 * historical Postgres behavior, we do not force a transaction
                 * boundary between queries appearing in a single query string.
                 */
@@ -826,12 +829,11 @@ pg_exec_query_string(StringInfo query_string,             /* string to execute */
                }
 
                /*
-                * It is possible that the original query was removed due to
-                * a DO INSTEAD rewrite rule.  In that case we will still have
-                * the default completion tag, which is fine for most purposes,
-                * but it may confuse clients if it's INSERT/UPDATE/DELETE.
-                * Clients expect those tags to have counts after them (cf.
-                * ProcessQuery).
+                * It is possible that the original query was removed due to a DO
+                * INSTEAD rewrite rule.  In that case we will still have the
+                * default completion tag, which is fine for most purposes, but it
+                * may confuse clients if it's INSERT/UPDATE/DELETE. Clients
+                * expect those tags to have counts after them (cf. ProcessQuery).
                 */
                if (strcmp(commandTag, "INSERT") == 0)
                        commandTag = "INSERT 0 0";
@@ -842,10 +844,10 @@ pg_exec_query_string(StringInfo query_string,             /* string to execute */
 
                /*
                 * Tell client that we're done with this query.  Note we emit
-                * exactly one EndCommand report for each raw parsetree, thus
-                * one for each SQL command the client sent, regardless of
-                * rewriting.  (But a command aborted by error will not send
-                * an EndCommand report at all.)
+                * exactly one EndCommand report for each raw parsetree, thus one
+                * for each SQL command the client sent, regardless of rewriting.
+                * (But a command aborted by error will not send an EndCommand
+                * report at all.)
                 */
                EndCommand(commandTag, dest);
        }                                                       /* end loop over parsetrees */
@@ -853,8 +855,8 @@ pg_exec_query_string(StringInfo query_string,               /* string to execute */
        disable_sig_alarm(true);
 
        /*
-        * Close down transaction statement, if one is open.
-        * (Note that this will only happen if the querystring was empty.)
+        * Close down transaction statement, if one is open. (Note that this
+        * will only happen if the querystring was empty.)
         */
        if (xact_started)
                finish_xact_command();
@@ -868,8 +870,8 @@ pg_exec_query_string(StringInfo query_string,               /* string to execute */
                        stop_t.tv_usec += 1000000;
                }
                elog(LOG, "duration: %ld.%06ld sec",
-                       (long int) stop_t.tv_sec - start_t.tv_sec,
-                       (long int) stop_t.tv_usec - start_t.tv_usec);
+                        (long int) stop_t.tv_sec - start_t.tv_sec,
+                        (long int) stop_t.tv_usec - start_t.tv_usec);
        }
 
        debug_query_string = NULL;
@@ -1165,9 +1167,7 @@ PostgresMain(int argc, char *argv[], const char *username)
         * If we are running under the postmaster, this is done already.
         */
        if (!IsUnderPostmaster)
-       {
                MemoryContextInit();
-       }
 
        set_ps_display("startup");
 
@@ -1244,14 +1244,16 @@ PostgresMain(int argc, char *argv[], const char *username)
                                        /* Set server debugging level. */
                                        if (atoi(optarg) != 0)
                                        {
-                                               char *debugstr = palloc(strlen("debug") + strlen(optarg) + 1);
+                                               char       *debugstr = palloc(strlen("debug") + strlen(optarg) + 1);
 
                                                sprintf(debugstr, "debug%s", optarg);
                                                SetConfigOption("server_min_messages", debugstr, ctx, gucsource);
                                                pfree(debugstr);
+
                                                /*
-                                                * -d is not the same as setting client_min_messages
-                                                * because it enables other output options.
+                                                * -d is not the same as setting
+                                                * client_min_messages because it enables other
+                                                * output options.
                                                 */
                                                if (atoi(optarg) >= 1)
                                                        SetConfigOption("log_connections", "true", ctx, gucsource);
@@ -1265,9 +1267,10 @@ PostgresMain(int argc, char *argv[], const char *username)
                                                        SetConfigOption("debug_print_rewritten", "true", ctx, gucsource);
                                        }
                                        else
+
                                                /*
-                                                *      -d 0 allows user to prevent postmaster debug from
-                                                *      propagating to backend.
+                                                * -d 0 allows user to prevent postmaster debug
+                                                * from propagating to backend.
                                                 */
                                                SetConfigOption("server_min_messages", "notice",
                                                                                ctx, gucsource);
@@ -1543,17 +1546,17 @@ PostgresMain(int argc, char *argv[], const char *username)
         * Also note: it's best not to use any signals that are SIG_IGNored in
         * the postmaster.      If such a signal arrives before we are able to
         * change the handler to non-SIG_IGN, it'll get dropped.  Instead,
-        * make a dummy handler in the postmaster to reserve the signal.
-        * (Of course, this isn't an issue for signals that are locally generated,
+        * make a dummy handler in the postmaster to reserve the signal. (Of
+        * course, this isn't an issue for signals that are locally generated,
         * such as SIGALRM and SIGPIPE.)
         */
 
        pqsignal(SIGHUP, SigHupHandler);        /* set flag to read config file */
-       pqsignal(SIGINT, StatementCancelHandler);               /* cancel current query */
+       pqsignal(SIGINT, StatementCancelHandler);       /* cancel current query */
        pqsignal(SIGTERM, die);         /* cancel current query and exit */
        pqsignal(SIGQUIT, quickdie);    /* hard crash time */
-       pqsignal(SIGALRM, handle_sig_alarm);    /* check for deadlock after
-                                                                                * timeout */
+       pqsignal(SIGALRM, handle_sig_alarm);            /* check for deadlock
+                                                                                                * after timeout */
 
        /*
         * Ignore failure to write to frontend. Note: if frontend closes
@@ -1686,7 +1689,7 @@ PostgresMain(int argc, char *argv[], const char *username)
        if (!IsUnderPostmaster)
        {
                puts("\nPOSTGRES backend interactive interface ");
-               puts("$Revision: 1.290 $ $Date: 2002/09/02 05:25:37 $\n");
+               puts("$Revision: 1.291 $ $Date: 2002/09/04 20:31:26 $\n");
        }
 
        /*
@@ -1873,9 +1876,10 @@ PostgresMain(int argc, char *argv[], const char *username)
                                if (HandleFunctionRequest() == EOF)
                                {
                                        /* lost frontend connection during F message input */
+
                                        /*
-                                        * Reset whereToSendOutput to prevent elog from attempting
-                                        * to send any more messages to client.
+                                        * Reset whereToSendOutput to prevent elog from
+                                        * attempting to send any more messages to client.
                                         */
                                        if (whereToSendOutput == Remote)
                                                whereToSendOutput = None;
@@ -1924,12 +1928,13 @@ PostgresMain(int argc, char *argv[], const char *username)
                                break;
 
                                /*
-                                *      'X' means that the frontend is closing down the socket.
-                                *      EOF means unexpected loss of frontend connection.
-                                *      Either way, perform normal shutdown.
+                                * 'X' means that the frontend is closing down the socket.
+                                * EOF means unexpected loss of frontend connection.
+                                * Either way, perform normal shutdown.
                                 */
                        case 'X':
                        case EOF:
+
                                /*
                                 * Reset whereToSendOutput to prevent elog from attempting
                                 * to send any more messages to client.
@@ -1995,7 +2000,7 @@ ShowUsage(const char *title)
        struct timeval elapse_t;
        struct timezone tz;
        struct rusage r;
-       char *bufusage;
+       char       *bufusage;
 
        getrusage(RUSAGE_SELF, &r);
        gettimeofday(&elapse_t, &tz);
@@ -2030,45 +2035,45 @@ ShowUsage(const char *title)
        appendStringInfo(&str, "! system usage stats:\n");
        appendStringInfo(&str,
                        "!\t%ld.%06ld elapsed %ld.%06ld user %ld.%06ld system sec\n",
-                       (long int) elapse_t.tv_sec - Save_t.tv_sec,
-                       (long int) elapse_t.tv_usec - Save_t.tv_usec,
-                       (long int) r.ru_utime.tv_sec - Save_r.ru_utime.tv_sec,
-                       (long int) r.ru_utime.tv_usec - Save_r.ru_utime.tv_usec,
-                       (long int) r.ru_stime.tv_sec - Save_r.ru_stime.tv_sec,
-                       (long int) r.ru_stime.tv_usec - Save_r.ru_stime.tv_usec);
+                                        (long int) elapse_t.tv_sec - Save_t.tv_sec,
+                                        (long int) elapse_t.tv_usec - Save_t.tv_usec,
+                                  (long int) r.ru_utime.tv_sec - Save_r.ru_utime.tv_sec,
+                                (long int) r.ru_utime.tv_usec - Save_r.ru_utime.tv_usec,
+                                  (long int) r.ru_stime.tv_sec - Save_r.ru_stime.tv_sec,
+                               (long int) r.ru_stime.tv_usec - Save_r.ru_stime.tv_usec);
        appendStringInfo(&str,
-                       "!\t[%ld.%06ld user %ld.%06ld sys total]\n",
-                       (long int) user.tv_sec,
-                       (long int) user.tv_usec,
-                       (long int) sys.tv_sec,
-                       (long int) sys.tv_usec);
+                                        "!\t[%ld.%06ld user %ld.%06ld sys total]\n",
+                                        (long int) user.tv_sec,
+                                        (long int) user.tv_usec,
+                                        (long int) sys.tv_sec,
+                                        (long int) sys.tv_usec);
 /* BeOS has rusage but only has some fields, and not these... */
 #if defined(HAVE_GETRUSAGE)
        appendStringInfo(&str,
-                       "!\t%ld/%ld [%ld/%ld] filesystem blocks in/out\n",
-                       r.ru_inblock - Save_r.ru_inblock,
+                                        "!\t%ld/%ld [%ld/%ld] filesystem blocks in/out\n",
+                                        r.ru_inblock - Save_r.ru_inblock,
        /* they only drink coffee at dec */
-                       r.ru_oublock - Save_r.ru_oublock,
-                       r.ru_inblock, r.ru_oublock);
+                                        r.ru_oublock - Save_r.ru_oublock,
+                                        r.ru_inblock, r.ru_oublock);
        appendStringInfo(&str,
                  "!\t%ld/%ld [%ld/%ld] page faults/reclaims, %ld [%ld] swaps\n",
-                       r.ru_majflt - Save_r.ru_majflt,
-                       r.ru_minflt - Save_r.ru_minflt,
-                       r.ru_majflt, r.ru_minflt,
-                       r.ru_nswap - Save_r.ru_nswap,
-                       r.ru_nswap);
+                                        r.ru_majflt - Save_r.ru_majflt,
+                                        r.ru_minflt - Save_r.ru_minflt,
+                                        r.ru_majflt, r.ru_minflt,
+                                        r.ru_nswap - Save_r.ru_nswap,
+                                        r.ru_nswap);
        appendStringInfo(&str,
         "!\t%ld [%ld] signals rcvd, %ld/%ld [%ld/%ld] messages rcvd/sent\n",
-                       r.ru_nsignals - Save_r.ru_nsignals,
-                       r.ru_nsignals,
-                       r.ru_msgrcv - Save_r.ru_msgrcv,
-                       r.ru_msgsnd - Save_r.ru_msgsnd,
-                       r.ru_msgrcv, r.ru_msgsnd);
+                                        r.ru_nsignals - Save_r.ru_nsignals,
+                                        r.ru_nsignals,
+                                        r.ru_msgrcv - Save_r.ru_msgrcv,
+                                        r.ru_msgsnd - Save_r.ru_msgsnd,
+                                        r.ru_msgrcv, r.ru_msgsnd);
        appendStringInfo(&str,
                 "!\t%ld/%ld [%ld/%ld] voluntary/involuntary context switches\n",
-                       r.ru_nvcsw - Save_r.ru_nvcsw,
-                       r.ru_nivcsw - Save_r.ru_nivcsw,
-                       r.ru_nvcsw, r.ru_nivcsw);
+                                        r.ru_nvcsw - Save_r.ru_nvcsw,
+                                        r.ru_nivcsw - Save_r.ru_nivcsw,
+                                        r.ru_nvcsw, r.ru_nivcsw);
 #endif   /* HAVE_GETRUSAGE */
 
        bufusage = ShowBufferUsage();
@@ -2076,7 +2081,7 @@ ShowUsage(const char *title)
        pfree(bufusage);
 
        /* remove trailing newline */
-       if (str.data[str.len-1] == '\n')
+       if (str.data[str.len - 1] == '\n')
                str.data[--str.len] = '\0';
 
        elog(LOG, "%s\n%s", title, str.data);
@@ -2094,7 +2099,7 @@ ShowUsage(const char *title)
 static const char *
 CreateCommandTag(Node *parsetree)
 {
-       const char   *tag;
+       const char *tag;
 
        switch (nodeTag(parsetree))
        {
@@ -2150,6 +2155,7 @@ CreateCommandTag(Node *parsetree)
                case T_FetchStmt:
                        {
                                FetchStmt  *stmt = (FetchStmt *) parsetree;
+
                                tag = (stmt->ismove) ? "MOVE" : "FETCH";
                        }
                        break;
@@ -2211,7 +2217,7 @@ CreateCommandTag(Node *parsetree)
                        break;
 
                case T_RenameStmt:
-                       if (((RenameStmt *)parsetree)->renameType == RENAME_TRIGGER)
+                       if (((RenameStmt *) parsetree)->renameType == RENAME_TRIGGER)
                                tag = "ALTER TRIGGER";
                        else
                                tag = "ALTER TABLE";
@@ -2224,6 +2230,7 @@ CreateCommandTag(Node *parsetree)
                case T_GrantStmt:
                        {
                                GrantStmt  *stmt = (GrantStmt *) parsetree;
+
                                tag = (stmt->is_grant) ? "GRANT" : "REVOKE";
                        }
                        break;
index fb1ff76..2990929 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.54 2002/06/20 20:29:36 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/tcop/pquery.c,v 1.55 2002/09/04 20:31:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -39,7 +39,7 @@ CreateQueryDesc(Query *parsetree,
        qd->parsetree = parsetree;      /* parse tree */
        qd->plantree = plantree;        /* plan */
        qd->dest = dest;                        /* output dest */
-       qd->portalName = portalName; /* name, if dest is a portal */
+       qd->portalName = portalName;    /* name, if dest is a portal */
        qd->tupDesc = NULL;                     /* until set by ExecutorStart */
 
        return qd;
@@ -168,8 +168,8 @@ ProcessQuery(Query *parsetree,
                         * SELECT INTO table (a/k/a CREATE AS ... SELECT).
                         *
                         * Override the normal communication destination; execMain.c
-                        * special-cases this case.  (Perhaps would be cleaner to
-                        * have an additional destination type?)
+                        * special-cases this case.  (Perhaps would be cleaner to have
+                        * an additional destination type?)
                         */
                        dest = None;
                }
@@ -186,7 +186,8 @@ ProcessQuery(Query *parsetree,
                oldContext = MemoryContextSwitchTo(PortalGetHeapMemory(portal));
                parsetree = copyObject(parsetree);
                plan = copyObject(plan);
-               intoName = parsetree->into->relname;    /* use copied name in QueryDesc */
+               intoName = parsetree->into->relname;    /* use copied name in
+                                                                                                * QueryDesc */
 
                /*
                 * We stay in portal's memory context for now, so that query desc,
@@ -225,7 +226,7 @@ ProcessQuery(Query *parsetree,
                /* Now we can return to caller's memory context. */
                MemoryContextSwitchTo(oldContext);
 
-               /* Set completion tag.  SQL calls this operation DECLARE CURSOR */
+               /* Set completion tag.  SQL calls this operation DECLARE CURSOR */
                if (completionTag)
                        strcpy(completionTag, "DECLARE CURSOR");
 
@@ -243,7 +244,7 @@ ProcessQuery(Query *parsetree,
         */
        if (completionTag)
        {
-               Oid             lastOid;
+               Oid                     lastOid;
 
                switch (operation)
                {
index 40dec9d..92d876b 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.176 2002/09/02 02:13:01 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.177 2002/09/04 20:31:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -207,17 +207,19 @@ ProcessUtility(Node *parsetree,
                                                BeginTransactionBlock();
                                                break;
 
-                                       /*
-                                        * START TRANSACTION, as defined by SQL99: Identical to BEGIN,
-                                        * except that it takes a few additional options.
-                                        */
+                                               /*
+                                                * START TRANSACTION, as defined by SQL99:
+                                                * Identical to BEGIN, except that it takes a few
+                                                * additional options.
+                                                */
                                        case START:
                                                {
                                                        BeginTransactionBlock();
 
                                                        /*
-                                                        * Currently, the only option that can be set by
-                                                        * START TRANSACTION is the isolation level.
+                                                        * Currently, the only option that can be set
+                                                        * by START TRANSACTION is the isolation
+                                                        * level.
                                                         */
                                                        if (stmt->options)
                                                        {
@@ -285,8 +287,8 @@ ProcessUtility(Node *parsetree,
                                                                                RELKIND_RELATION);
 
                                /*
-                                * Let AlterTableCreateToastTable decide if this one needs a
-                                * secondary relation too.
+                                * Let AlterTableCreateToastTable decide if this one needs
+                                * secondary relation too.
                                 */
                                CommandCounterIncrement();
                                AlterTableCreateToastTable(relOid, true);
@@ -300,7 +302,7 @@ ProcessUtility(Node *parsetree,
 
                                foreach(arg, stmt->objects)
                                {
-                                       List   *names = (List *) lfirst(arg);
+                                       List       *names = (List *) lfirst(arg);
                                        RangeVar   *rel;
 
                                        switch (stmt->removeType)
@@ -335,7 +337,11 @@ ProcessUtility(Node *parsetree,
                                                        break;
 
                                                case DROP_DOMAIN:
-                                                       /* RemoveDomain does its own permissions checks */
+
+                                                       /*
+                                                        * RemoveDomain does its own permissions
+                                                        * checks
+                                                        */
                                                        RemoveDomain(names, stmt->behavior);
                                                        break;
 
@@ -344,7 +350,11 @@ ProcessUtility(Node *parsetree,
                                                        break;
 
                                                case DROP_SCHEMA:
-                                                       /* RemoveSchema does its own permissions checks */
+
+                                                       /*
+                                                        * RemoveSchema does its own permissions
+                                                        * checks
+                                                        */
                                                        RemoveSchema(names, stmt->behavior);
                                                        break;
                                        }
@@ -359,7 +369,7 @@ ProcessUtility(Node *parsetree,
 
                case T_TruncateStmt:
                        {
-                               TruncateStmt    *stmt = (TruncateStmt *) parsetree;
+                               TruncateStmt *stmt = (TruncateStmt *) parsetree;
 
                                TruncateRelation(stmt->relation);
                        }
@@ -398,7 +408,7 @@ ProcessUtility(Node *parsetree,
                case T_RenameStmt:
                        {
                                RenameStmt *stmt = (RenameStmt *) parsetree;
-                               Oid             relid;
+                               Oid                     relid;
 
                                CheckOwnership(stmt->relation, true);
 
@@ -407,44 +417,44 @@ ProcessUtility(Node *parsetree,
                                switch (stmt->renameType)
                                {
                                        case RENAME_TABLE:
-                                       {
-                                               /*
-                                                * RENAME TABLE requires that we (still) hold CREATE
-                                                * rights on the containing namespace, as well as
-                                                * ownership of the table.
-                                                */
-                                               Oid                     namespaceId = get_rel_namespace(relid);
-                                               AclResult       aclresult;
+                                               {
+                                                       /*
+                                                        * RENAME TABLE requires that we (still) hold
+                                                        * CREATE rights on the containing namespace,
+                                                        * as well as ownership of the table.
+                                                        */
+                                                       Oid                     namespaceId = get_rel_namespace(relid);
+                                                       AclResult       aclresult;
 
-                                               aclresult = pg_namespace_aclcheck(namespaceId,
-                                                                                                                 GetUserId(),
-                                                                                                                 ACL_CREATE);
-                                               if (aclresult != ACLCHECK_OK)
-                                                       aclcheck_error(aclresult,
-                                                                                  get_namespace_name(namespaceId));
+                                                       aclresult = pg_namespace_aclcheck(namespaceId,
+                                                                                                                         GetUserId(),
+                                                                                                                         ACL_CREATE);
+                                                       if (aclresult != ACLCHECK_OK)
+                                                               aclcheck_error(aclresult,
+                                                                               get_namespace_name(namespaceId));
 
-                                               renamerel(relid, stmt->newname);
-                                               break;
-                                       }
+                                                       renamerel(relid, stmt->newname);
+                                                       break;
+                                               }
                                        case RENAME_COLUMN:
                                                renameatt(relid,
-                                                                 stmt->oldname,        /* old att name */
-                                                                 stmt->newname,        /* new att name */
-                                                                 interpretInhOption(stmt->relation->inhOpt),   /* recursive? */
-                                                                 false);                       /* recursing already? */
+                                                                 stmt->oldname,                /* old att name */
+                                                                 stmt->newname,                /* new att name */
+                                                         interpretInhOption(stmt->relation->inhOpt),           /* recursive? */
+                                                                 false);               /* recursing already? */
                                                break;
                                        case RENAME_TRIGGER:
                                                renametrig(relid,
-                                                                  stmt->oldname,       /* old att name */
-                                                                  stmt->newname);      /* new att name */
+                                                                  stmt->oldname,               /* old att name */
+                                                                  stmt->newname);              /* new att name */
                                                break;
                                        case RENAME_RULE:
                                                elog(ERROR, "ProcessUtility: Invalid target for RENAME: %d",
-                                                               stmt->renameType);
+                                                        stmt->renameType);
                                                break;
                                        default:
                                                elog(ERROR, "ProcessUtility: Invalid target for RENAME: %d",
-                                                               stmt->renameType);
+                                                        stmt->renameType);
                                }
                        }
                        break;
@@ -454,7 +464,7 @@ ProcessUtility(Node *parsetree,
                case T_AlterTableStmt:
                        {
                                AlterTableStmt *stmt = (AlterTableStmt *) parsetree;
-                               Oid             relid;
+                               Oid                     relid;
 
                                relid = RangeVarGetRelid(stmt->relation, false);
 
@@ -465,74 +475,80 @@ ProcessUtility(Node *parsetree,
                                switch (stmt->subtype)
                                {
                                        case 'A':       /* ADD COLUMN */
+
                                                /*
-                                                * Recursively add column to table and,
-                                                * if requested, to descendants
+                                                * Recursively add column to table and, if
+                                                * requested, to descendants
                                                 */
                                                AlterTableAddColumn(relid,
-                                                                                       interpretInhOption(stmt->relation->inhOpt),
+                                                         interpretInhOption(stmt->relation->inhOpt),
                                                                                        false,
                                                                                        (ColumnDef *) stmt->def);
                                                break;
                                        case 'T':       /* ALTER COLUMN DEFAULT */
+
                                                /*
                                                 * Recursively alter column default for table and,
                                                 * if requested, for descendants
                                                 */
                                                AlterTableAlterColumnDefault(relid,
-                                                                                                        interpretInhOption(stmt->relation->inhOpt),
+                                                         interpretInhOption(stmt->relation->inhOpt),
                                                                                                         stmt->name,
                                                                                                         stmt->def);
                                                break;
                                        case 'N':       /* ALTER COLUMN DROP NOT NULL */
                                                AlterTableAlterColumnDropNotNull(relid,
-                                                                               interpretInhOption(stmt->relation->inhOpt),
-                                                                                                       stmt->name);
+                                                         interpretInhOption(stmt->relation->inhOpt),
+                                                                                                                stmt->name);
                                                break;
                                        case 'O':       /* ALTER COLUMN SET NOT NULL */
                                                AlterTableAlterColumnSetNotNull(relid,
-                                                                               interpretInhOption(stmt->relation->inhOpt),
-                                                                                                       stmt->name);
+                                                         interpretInhOption(stmt->relation->inhOpt),
+                                                                                                               stmt->name);
                                                break;
                                        case 'S':       /* ALTER COLUMN STATISTICS */
-                                       case 'M':   /* ALTER COLUMN STORAGE */
+                                       case 'M':       /* ALTER COLUMN STORAGE */
+
                                                /*
-                                                * Recursively alter column statistics for table and,
-                                                * if requested, for descendants
+                                                * Recursively alter column statistics for table
+                                                * and, if requested, for descendants
                                                 */
                                                AlterTableAlterColumnFlags(relid,
-                                                                                                  interpretInhOption(stmt->relation->inhOpt),
+                                                         interpretInhOption(stmt->relation->inhOpt),
                                                                                                   stmt->name,
                                                                                                   stmt->def,
                                                                                                   &(stmt->subtype));
                                                break;
                                        case 'D':       /* DROP COLUMN */
-                                                /*
-                                                * Recursively drop column from table and,
-                                                * if requested, from descendants
+
+                                               /*
+                                                * Recursively drop column from table and, if
+                                                * requested, from descendants
                                                 */
                                                AlterTableDropColumn(relid,
-                                                                                        interpretInhOption(stmt->relation->inhOpt),
+                                                         interpretInhOption(stmt->relation->inhOpt),
                                                                                         false,
                                                                                         stmt->name,
                                                                                         stmt->behavior);
                                                break;
                                        case 'C':       /* ADD CONSTRAINT */
+
                                                /*
-                                                * Recursively add constraint to table and,
-                                                * if requested, to descendants
+                                                * Recursively add constraint to table and, if
+                                                * requested, to descendants
                                                 */
                                                AlterTableAddConstraint(relid,
-                                                                                               interpretInhOption(stmt->relation->inhOpt),
+                                                         interpretInhOption(stmt->relation->inhOpt),
                                                                                                (List *) stmt->def);
                                                break;
                                        case 'X':       /* DROP CONSTRAINT */
+
                                                /*
-                                                * Recursively drop constraint from table and,
-                                                * if requested, from descendants
+                                                * Recursively drop constraint from table and, if
+                                                * requested, from descendants
                                                 */
                                                AlterTableDropConstraint(relid,
-                                                                                                interpretInhOption(stmt->relation->inhOpt),
+                                                         interpretInhOption(stmt->relation->inhOpt),
                                                                                                 stmt->name,
                                                                                                 stmt->behavior);
                                                break;
@@ -585,7 +601,7 @@ ProcessUtility(Node *parsetree,
 
                case T_CompositeTypeStmt:               /* CREATE TYPE (composite) */
                        {
-                               CompositeTypeStmt   *stmt = (CompositeTypeStmt *) parsetree;
+                               CompositeTypeStmt *stmt = (CompositeTypeStmt *) parsetree;
 
                                DefineCompositeType(stmt->typevar, stmt->coldeflist);
                        }
@@ -599,7 +615,7 @@ ProcessUtility(Node *parsetree,
                        }
                        break;
 
-               case T_CreateFunctionStmt:      /* CREATE FUNCTION */
+               case T_CreateFunctionStmt:              /* CREATE FUNCTION */
                        CreateFunction((CreateFunctionStmt *) parsetree);
                        break;
 
@@ -609,10 +625,10 @@ ProcessUtility(Node *parsetree,
 
                                CheckOwnership(stmt->relation, true);
 
-                               DefineIndex(stmt->relation,                             /* relation */
-                                                       stmt->idxname,                          /* index name */
-                                                       stmt->accessMethod,             /* am name */
-                                                       stmt->indexParams,                      /* parameters */
+                               DefineIndex(stmt->relation,             /* relation */
+                                                       stmt->idxname,          /* index name */
+                                                       stmt->accessMethod, /* am name */
+                                                       stmt->indexParams,      /* parameters */
                                                        stmt->unique,
                                                        stmt->primary,
                                                        stmt->isconstraint,
@@ -740,7 +756,7 @@ ProcessUtility(Node *parsetree,
                case T_DropPropertyStmt:
                        {
                                DropPropertyStmt *stmt = (DropPropertyStmt *) parsetree;
-                               Oid             relId;
+                               Oid                     relId;
 
                                relId = RangeVarGetRelid(stmt->relation, false);
 
index aa65bd6..02d2e67 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.78 2002/09/03 22:17:35 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.79 2002/09/04 20:31:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -36,15 +36,15 @@ static const char *aclparse(const char *s, AclItem *aip, unsigned *modechg);
 static bool aclitemeq(const AclItem *a1, const AclItem *a2);
 static bool aclitemgt(const AclItem *a1, const AclItem *a2);
 
-static Oid convert_table_name(text *tablename);
+static Oid     convert_table_name(text *tablename);
 static AclMode convert_table_priv_string(text *priv_type_text);
-static Oid convert_database_name(text *databasename);
+static Oid     convert_database_name(text *databasename);
 static AclMode convert_database_priv_string(text *priv_type_text);
-static Oid convert_function_name(text *functionname);
+static Oid     convert_function_name(text *functionname);
 static AclMode convert_function_priv_string(text *priv_type_text);
-static Oid convert_language_name(text *languagename);
+static Oid     convert_language_name(text *languagename);
 static AclMode convert_language_priv_string(text *priv_type_text);
-static Oid convert_schema_name(text *schemaname);
+static Oid     convert_schema_name(text *schemaname);
 static AclMode convert_schema_priv_string(text *priv_type_text);
 
 
@@ -413,7 +413,7 @@ acldefault(GrantObjectType objtype, AclId ownerid)
                        owner_default = ACL_ALL_RIGHTS_RELATION;
                        break;
                case ACL_OBJECT_DATABASE:
-                       world_default = ACL_CREATE_TEMP; /* not NO_RIGHTS! */
+                       world_default = ACL_CREATE_TEMP;        /* not NO_RIGHTS! */
                        owner_default = ACL_ALL_RIGHTS_DATABASE;
                        break;
                case ACL_OBJECT_FUNCTION:
@@ -430,7 +430,7 @@ acldefault(GrantObjectType objtype, AclId ownerid)
                        break;
                default:
                        elog(ERROR, "acldefault: bogus objtype %d", (int) objtype);
-                       world_default = ACL_NO_RIGHTS; /* keep compiler quiet */
+                       world_default = ACL_NO_RIGHTS;          /* keep compiler quiet */
                        owner_default = ACL_NO_RIGHTS;
                        break;
        }
@@ -819,7 +819,7 @@ convert_table_name(text *tablename)
        RangeVar   *relrv;
 
        relrv = makeRangeVarFromNameList(textToQualifiedNameList(tablename,
-                                                                                                       "has_table_privilege"));
+                                                                                                "has_table_privilege"));
 
        return RangeVarGetRelid(relrv, false);
 }
@@ -834,7 +834,7 @@ convert_table_priv_string(text *priv_type_text)
        char       *priv_type;
 
        priv_type = DatumGetCString(DirectFunctionCall1(textout,
-                                                                                       PointerGetDatum(priv_type_text)));
+                                                                          PointerGetDatum(priv_type_text)));
 
        /*
         * Return mode from priv_type string
@@ -1030,7 +1030,7 @@ convert_database_name(text *databasename)
        Oid                     oid;
 
        dbname = DatumGetCString(DirectFunctionCall1(textout,
-                                                                                       PointerGetDatum(databasename)));
+                                                                                PointerGetDatum(databasename)));
 
        oid = get_database_oid(dbname);
        if (!OidIsValid(oid))
@@ -1049,7 +1049,7 @@ convert_database_priv_string(text *priv_type_text)
        char       *priv_type;
 
        priv_type = DatumGetCString(DirectFunctionCall1(textout,
-                                                                                       PointerGetDatum(priv_type_text)));
+                                                                          PointerGetDatum(priv_type_text)));
 
        /*
         * Return mode from priv_type string
@@ -1233,10 +1233,10 @@ convert_function_name(text *functionname)
        Oid                     oid;
 
        funcname = DatumGetCString(DirectFunctionCall1(textout,
-                                                                                       PointerGetDatum(functionname)));
+                                                                                PointerGetDatum(functionname)));
 
        oid = DatumGetObjectId(DirectFunctionCall1(regprocedurein,
-                                                                                          CStringGetDatum(funcname)));
+                                                                                        CStringGetDatum(funcname)));
 
        if (!OidIsValid(oid))
                elog(ERROR, "function \"%s\" does not exist", funcname);
@@ -1254,7 +1254,7 @@ convert_function_priv_string(text *priv_type_text)
        char       *priv_type;
 
        priv_type = DatumGetCString(DirectFunctionCall1(textout,
-                                                                                       PointerGetDatum(priv_type_text)));
+                                                                          PointerGetDatum(priv_type_text)));
 
        /*
         * Return mode from priv_type string
@@ -1432,7 +1432,7 @@ convert_language_name(text *languagename)
        Oid                     oid;
 
        langname = DatumGetCString(DirectFunctionCall1(textout,
-                                                                                       PointerGetDatum(languagename)));
+                                                                                PointerGetDatum(languagename)));
 
        oid = GetSysCacheOid(LANGNAME,
                                                 CStringGetDatum(langname),
@@ -1453,7 +1453,7 @@ convert_language_priv_string(text *priv_type_text)
        char       *priv_type;
 
        priv_type = DatumGetCString(DirectFunctionCall1(textout,
-                                                                                       PointerGetDatum(priv_type_text)));
+                                                                          PointerGetDatum(priv_type_text)));
 
        /*
         * Return mode from priv_type string
@@ -1631,7 +1631,7 @@ convert_schema_name(text *schemaname)
        Oid                     oid;
 
        nspname = DatumGetCString(DirectFunctionCall1(textout,
-                                                                                       PointerGetDatum(schemaname)));
+                                                                                  PointerGetDatum(schemaname)));
 
        oid = GetSysCacheOid(NAMESPACENAME,
                                                 CStringGetDatum(nspname),
@@ -1652,7 +1652,7 @@ convert_schema_priv_string(text *priv_type_text)
        char       *priv_type;
 
        priv_type = DatumGetCString(DirectFunctionCall1(textout,
-                                                                                       PointerGetDatum(priv_type_text)));
+                                                                          PointerGetDatum(priv_type_text)));
 
        /*
         * Return mode from priv_type string
index 53a4c83..5d53eca 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.79 2002/08/26 17:53:58 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.80 2002/09/04 20:31:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -80,27 +80,27 @@ static void system_cache_lookup(Oid element_type, bool input, int *typlen,
                                        bool *typbyval, char *typdelim, Oid *typelem,
                                        Oid *proc, char *typalign);
 static Datum ArrayCast(char *value, bool byval, int len);
-static int     ArrayCastAndSet(Datum src,
-                                                       int typlen, bool typbyval, char typalign,
-                                                       char *dest);
-static int     array_nelems_size(char *ptr, int nitems,
-                                                         int typlen, bool typbyval, char typalign);
+static int ArrayCastAndSet(Datum src,
+                               int typlen, bool typbyval, char typalign,
+                               char *dest);
+static int array_nelems_size(char *ptr, int nitems,
+                                 int typlen, bool typbyval, char typalign);
 static char *array_seek(char *ptr, int nitems,
-                                               int typlen, bool typbyval, char typalign);
-static int     array_copy(char *destptr, int nitems, char *srcptr,
-                                          int typlen, bool typbyval, char typalign);
+                  int typlen, bool typbyval, char typalign);
+static int array_copy(char *destptr, int nitems, char *srcptr,
+                  int typlen, bool typbyval, char typalign);
 static int array_slice_size(int ndim, int *dim, int *lb, char *arraydataptr,
-                                                       int *st, int *endp,
-                                                       int typlen, bool typbyval, char typalign);
+                                int *st, int *endp,
+                                int typlen, bool typbyval, char typalign);
 static void array_extract_slice(int ndim, int *dim, int *lb,
-                                                               char *arraydataptr,
-                                                               int *st, int *endp, char *destPtr,
-                                                               int typlen, bool typbyval, char typalign);
+                                       char *arraydataptr,
+                                       int *st, int *endp, char *destPtr,
+                                       int typlen, bool typbyval, char typalign);
 static void array_insert_slice(int ndim, int *dim, int *lb,
-                                                          char *origPtr, int origdatasize,
-                                                          char *destPtr,
-                                                          int *st, int *endp, char *srcPtr,
-                                                          int typlen, bool typbyval, char typalign);
+                                  char *origPtr, int origdatasize,
+                                  char *destPtr,
+                                  int *st, int *endp, char *srcPtr,
+                                  int typlen, bool typbyval, char typalign);
 
 
 /*---------------------------------------------------------------------
@@ -422,28 +422,28 @@ ReadArrayStr(char *arrayStr,
                                        elog(ERROR, "malformed array constant: %s", arrayStr);
                                        break;
                                case '\\':
-                               {
-                                       char   *cptr;
-
-                                       /* Crunch the string on top of the backslash. */
-                                       for (cptr = ptr; *cptr != '\0'; cptr++)
-                                               *cptr = *(cptr + 1);
-                                       if (*ptr == '\0')
-                                               elog(ERROR, "malformed array constant: %s", arrayStr);
-                                       break;
-                               }
+                                       {
+                                               char       *cptr;
+
+                                               /* Crunch the string on top of the backslash. */
+                                               for (cptr = ptr; *cptr != '\0'; cptr++)
+                                                       *cptr = *(cptr + 1);
+                                               if (*ptr == '\0')
+                                                       elog(ERROR, "malformed array constant: %s", arrayStr);
+                                               break;
+                                       }
                                case '\"':
-                               {
-                                       char   *cptr;
-
-                                       scanning_string = !scanning_string;
-                                       /* Crunch the string on top of the quote. */
-                                       for (cptr = ptr; *cptr != '\0'; cptr++)
-                                               *cptr = *(cptr + 1);
-                                       /* Back up to not miss following character. */
-                                       ptr--;
-                                       break;
-                               }
+                                       {
+                                               char       *cptr;
+
+                                               scanning_string = !scanning_string;
+                                               /* Crunch the string on top of the quote. */
+                                               for (cptr = ptr; *cptr != '\0'; cptr++)
+                                                       *cptr = *(cptr + 1);
+                                               /* Back up to not miss following character. */
+                                               ptr--;
+                                               break;
+                                       }
                                case '{':
                                        if (!scanning_string)
                                        {
@@ -452,9 +452,9 @@ ReadArrayStr(char *arrayStr,
                                                nest_level++;
                                                indx[nest_level - 1] = 0;
                                                /* skip leading whitespace */
-                                               while (isspace((unsigned char) *(ptr+1)))
+                                               while (isspace((unsigned char) *(ptr + 1)))
                                                        ptr++;
-                                               itemstart = ptr+1;
+                                               itemstart = ptr + 1;
                                        }
                                        break;
                                case '}':
@@ -471,11 +471,11 @@ ReadArrayStr(char *arrayStr,
                                                else
                                                {
                                                        /*
-                                                        * tricky coding: terminate item value string at
-                                                        * first '}', but don't process it till we see
-                                                        * a typdelim char or end of array.  This handles
-                                                        * case where several '}'s appear successively
-                                                        * in a multidimensional array.
+                                                        * tricky coding: terminate item value string
+                                                        * at first '}', but don't process it till we
+                                                        * see a typdelim char or end of array.  This
+                                                        * handles case where several '}'s appear
+                                                        * successively in a multidimensional array.
                                                         */
                                                        *ptr = '\0';
                                                        indx[nest_level - 1]++;
@@ -641,8 +641,8 @@ array_out(PG_FUNCTION_ARGS)
 
        /*
         * Convert all values to string form, count total space needed
-        * (including any overhead such as escaping backslashes),
-        * and detect whether each item needs double quotes.
+        * (including any overhead such as escaping backslashes), and detect
+        * whether each item needs double quotes.
         */
        values = (char **) palloc(nitems * sizeof(char *));
        needquotes = (bool *) palloc(nitems * sizeof(bool));
@@ -665,7 +665,7 @@ array_out(PG_FUNCTION_ARGS)
                nq = (values[i][0] == '\0');    /* force quotes for empty string */
                for (tmp = values[i]; *tmp; tmp++)
                {
-                       char    ch = *tmp;
+                       char            ch = *tmp;
 
                        overall_length += 1;
                        if (ch == '"' || ch == '\\')
@@ -716,7 +716,7 @@ array_out(PG_FUNCTION_ARGS)
 #ifndef TCL_ARRAYS
                        for (tmp = values[k]; *tmp; tmp++)
                        {
-                               char    ch = *tmp;
+                               char            ch = *tmp;
 
                                if (ch == '"' || ch == '\\')
                                        *p++ = '\\';
@@ -919,8 +919,8 @@ array_get_slice(ArrayType *array,
                elog(ERROR, "Slices of fixed-length arrays not implemented");
 
                /*
-                * fixed-length arrays -- these are assumed to be 1-d, 0-based
-                * XXX where would we get the correct ELEMTYPE from?
+                * fixed-length arrays -- these are assumed to be 1-d, 0-based XXX
+                * where would we get the correct ELEMTYPE from?
                 */
                ndim = 1;
                fixedDim[0] = arraylen / elmlen;
@@ -980,8 +980,9 @@ array_get_slice(ArrayType *array,
        newarray->flags = 0;
        newarray->elemtype = ARR_ELEMTYPE(array);
        memcpy(ARR_DIMS(newarray), span, ndim * sizeof(int));
+
        /*
-        * Lower bounds of the new array are set to 1.  Formerly (before 7.3)
+        * Lower bounds of the new array are set to 1.  Formerly (before 7.3)
         * we copied the given lowerIndx values ... but that seems confusing.
         */
        newlb = ARR_LBOUND(newarray);
@@ -1513,9 +1514,7 @@ construct_array(Datum *elems, int nelems,
 
        /* compute required space */
        if (elmlen > 0)
-       {
                nbytes = nelems * att_align(elmlen, elmalign);
-       }
        else
        {
                Assert(!elmbyval);
index 3664a60..c33bca6 100644 (file)
@@ -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.55 2002/09/03 21:45:42 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/cash.c,v 1.56 2002/09/04 20:31:27 momjian Exp $
  */
 
 #include "postgres.h"
@@ -662,8 +662,8 @@ cash_words(PG_FUNCTION_ARGS)
 
        m0 = val % 100;                         /* cents */
        m1 = (val / 100) % 1000;        /* hundreds */
-       m2 = (val / 100000) % 1000;     /* thousands */
-       m3 = val / 100000000 % 1000; /* millions */
+       m2 = (val / 100000) % 1000; /* thousands */
+       m3 = val / 100000000 % 1000;    /* millions */
 
        if (m3)
        {
index f02dee4..733b8fb 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.71 2002/09/03 19:41:28 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.72 2002/09/04 20:31:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "utils/timestamp.h"
 
 
-int time2tm(TimeADT time, struct tm * tm, fsec_t *fsec);
-int timetz2tm(TimeTzADT *time, struct tm * tm, fsec_t *fsec, int *tzp);
-int tm2time(struct tm * tm, fsec_t fsec, TimeADT *result);
-int tm2timetz(struct tm * tm, fsec_t fsec, int tz, TimeTzADT *result);
+int                    time2tm(TimeADT time, struct tm * tm, fsec_t *fsec);
+int                    timetz2tm(TimeTzADT *time, struct tm * tm, fsec_t *fsec, int *tzp);
+int                    tm2time(struct tm * tm, fsec_t fsec, TimeADT *result);
+int                    tm2timetz(struct tm * tm, fsec_t fsec, int tz, TimeTzADT *result);
 static void AdjustTimeForTypmod(TimeADT *time, int32 typmod);
 
 /*****************************************************************************
@@ -343,7 +343,7 @@ date_timestamptz(PG_FUNCTION_ARGS)
 
        if (IS_VALID_UTIME(tm->tm_year, tm->tm_mon, tm->tm_mday))
        {
-               int             tz;
+               int                     tz;
 
                tm->tm_hour = 0;
                tm->tm_min = 0;
@@ -494,6 +494,7 @@ Datum
 time_in(PG_FUNCTION_ARGS)
 {
        char       *str = PG_GETARG_CSTRING(0);
+
 #ifdef NOT_USED
        Oid                     typelem = PG_GETARG_OID(1);
 #endif
@@ -529,7 +530,7 @@ tm2time(struct tm * tm, fsec_t fsec, TimeADT *result)
 {
 #ifdef HAVE_INT64_TIMESTAMP
        *result = ((((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec)
-                          * INT64CONST(1000000)) + fsec);
+                               * INT64CONST(1000000)) + fsec);
 #else
        *result = ((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec + fsec);
 #endif
@@ -542,7 +543,7 @@ tm2time(struct tm * tm, fsec_t fsec, TimeADT *result)
  *     local time zone. If out of this range, leave as GMT. - tgl 97/05/27
  */
 int
-time2tm(TimeADT time, struct tm *tm, fsec_t *fsec)
+time2tm(TimeADT time, struct tm * tm, fsec_t *fsec)
 {
 #ifdef HAVE_INT64_TIMESTAMP
        tm->tm_hour = (time / INT64CONST(3600000000));
@@ -610,7 +611,7 @@ static void
 AdjustTimeForTypmod(TimeADT *time, int32 typmod)
 {
 #ifdef HAVE_INT64_TIMESTAMP
-       static const int64 TimeScales[MAX_TIMESTAMP_PRECISION+1] = {
+       static const int64 TimeScales[MAX_TIMESTAMP_PRECISION + 1] = {
                INT64CONST(1000000),
                INT64CONST(100000),
                INT64CONST(10000),
@@ -620,7 +621,7 @@ AdjustTimeForTypmod(TimeADT *time, int32 typmod)
                INT64CONST(1)
        };
 
-       static const int64 TimeOffsets[MAX_TIMESTAMP_PRECISION+1] = {
+       static const int64 TimeOffsets[MAX_TIMESTAMP_PRECISION + 1] = {
                INT64CONST(-500000),
                INT64CONST(-50000),
                INT64CONST(-5000),
@@ -629,8 +630,9 @@ AdjustTimeForTypmod(TimeADT *time, int32 typmod)
                INT64CONST(-5),
                INT64CONST(0)
        };
+
 #else
-       static const double TimeScales[MAX_TIMESTAMP_PRECISION+1] = {
+       static const double TimeScales[MAX_TIMESTAMP_PRECISION + 1] = {
                1,
                10,
                100,
@@ -640,7 +642,7 @@ AdjustTimeForTypmod(TimeADT *time, int32 typmod)
                1000000
        };
 
-       static const double TimeOffsets[MAX_TIMESTAMP_PRECISION+1] = {
+       static const double TimeOffsets[MAX_TIMESTAMP_PRECISION + 1] = {
                0.5,
                0.05,
                0.005,
@@ -674,7 +676,10 @@ AdjustTimeForTypmod(TimeADT *time, int32 typmod)
                }
                else
                {
-                       /* Scale and truncate first, then add to help the rounding behavior */
+                       /*
+                        * Scale and truncate first, then add to help the rounding
+                        * behavior
+                        */
                        *time = (rint((((double) *time) * TimeScales[typmod]) + TimeOffsets[typmod])
                                         / TimeScales[typmod]);
                }
@@ -915,8 +920,10 @@ timestamp_time(PG_FUNCTION_ARGS)
                elog(ERROR, "Unable to convert timestamp to time");
 
 #ifdef HAVE_INT64_TIMESTAMP
-       /* Could also do this with
-        * time = (timestamp / 86400000000 * 86400000000) - timestamp;
+
+       /*
+        * Could also do this with time = (timestamp / 86400000000 *
+        * 86400000000) - timestamp;
         */
        result = ((((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec)
                           * INT64CONST(1000000)) + fsec);
@@ -948,8 +955,10 @@ timestamptz_time(PG_FUNCTION_ARGS)
                elog(ERROR, "Unable to convert timestamptz to time");
 
 #ifdef HAVE_INT64_TIMESTAMP
-       /* Could also do this with
-        * time = (timestamp / 86400000000 * 86400000000) - timestamp;
+
+       /*
+        * Could also do this with time = (timestamp / 86400000000 *
+        * 86400000000) - timestamp;
         */
        result = ((((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec)
                           * INT64CONST(1000000)) + fsec);
@@ -1349,7 +1358,7 @@ timetz_out(PG_FUNCTION_ARGS)
  *     local time zone. If out of this range, leave as GMT. - tgl 97/05/27
  */
 int
-timetz2tm(TimeTzADT *time, struct tm *tm, fsec_t *fsec, int *tzp)
+timetz2tm(TimeTzADT *time, struct tm * tm, fsec_t *fsec, int *tzp)
 {
 #ifdef HAVE_INT64_TIMESTAMP
        tm->tm_hour = (time->time / INT64CONST(3600000000));
@@ -1537,6 +1546,7 @@ timetz_pl_interval(PG_FUNCTION_ARGS)
        TimeTzADT  *time = PG_GETARG_TIMETZADT_P(0);
        Interval   *span = PG_GETARG_INTERVAL_P(1);
        TimeTzADT  *result;
+
 #ifndef HAVE_INT64_TIMESTAMP
        TimeTzADT       time1;
 #endif
@@ -1569,6 +1579,7 @@ timetz_mi_interval(PG_FUNCTION_ARGS)
        TimeTzADT  *time = PG_GETARG_TIMETZADT_P(0);
        Interval   *span = PG_GETARG_INTERVAL_P(1);
        TimeTzADT  *result;
+
 #ifndef HAVE_INT64_TIMESTAMP
        TimeTzADT       time1;
 #endif
@@ -1798,7 +1809,7 @@ datetimetz_timestamptz(PG_FUNCTION_ARGS)
 
 #ifdef HAVE_INT64_TIMESTAMP
        result = (((date * INT64CONST(86400000000)) + time->time)
-               + (time->zone * INT64CONST(1000000)));
+                         + (time->zone * INT64CONST(1000000)));
 #else
        result = (((date * 86400.0) + time->time) + time->zone);
 #endif
index 40d1dbc..b4daa35 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.95 2002/09/03 19:46:32 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.96 2002/09/04 20:31:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -42,13 +42,13 @@ void                TrimTrailingZeros(char *str);
 
 int                    day_tab[2][13] = {
        {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0},
-       {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0}};
+{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0}};
 
 char      *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
-                                               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL};
+"Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL};
 
 char      *days[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
-                                         "Thursday", "Friday", "Saturday", NULL};
+"Thursday", "Friday", "Saturday", NULL};
 
 
 /*****************************************************************************
@@ -92,7 +92,7 @@ static datetkn datetktbl[] = {
        {"acst", DTZ, NEG(16)},         /* Atlantic/Porto Acre */
        {"act", TZ, NEG(20)},           /* Atlantic/Porto Acre */
        {DA_D, ADBC, AD},                       /* "ad" for years >= 0 */
-       {"abstime", IGNORE_DTF, 0},     /* for pre-v6.1 "Invalid Abstime" */
+       {"abstime", IGNORE_DTF, 0}, /* for pre-v6.1 "Invalid Abstime" */
        {"adt", DTZ, NEG(12)},          /* Atlantic Daylight Time */
        {"aesst", DTZ, POS(44)},        /* E. Australia */
        {"aest", TZ, POS(40)},          /* Australia Eastern Std Time */
@@ -100,7 +100,7 @@ static datetkn datetktbl[] = {
        {"ahst", TZ, NEG(40)},          /* Alaska-Hawaii Std Time */
        {"akdt", DTZ, NEG(32)},         /* Alaska Daylight Time */
        {"akst", DTZ, NEG(36)},         /* Alaska Standard Time */
-       {"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */
+       {"allballs", RESERV, DTK_ZULU},         /* 00:00:00 */
        {"almt", TZ, POS(24)},          /* Almaty Time */
        {"almst", TZ, POS(28)},         /* Almaty Savings Time */
        {"am", AMPM, AM},
@@ -112,14 +112,15 @@ static datetkn datetktbl[] = {
        {"anast", DTZ, POS(52)},        /* Anadyr Summer Time (Russia) */
        {"anat", TZ, POS(48)},          /* Anadyr Time (Russia) */
 #if 0
-aqtst
-aqtt
-arst
+       aqtst
+       aqtt
+       arst
 #endif
        {"art", TZ, NEG(12)},           /* Argentina Time */
 #if 0
-ashst
-ast /* Atlantic Standard Time, Arabia Standard Time, Acre Standard Time */
+       ashst
+       ast                                                     /* Atlantic Standard Time, Arabia Standard
+                                                                * Time, Acre Standard Time */
 #endif
        {"apr", MONTH, 4},
        {"april", MONTH, 4},
@@ -140,14 +141,14 @@ ast /* Atlantic Standard Time, Arabia Standard Time, Acre Standard Time */
        {"bnt", TZ, POS(32)},           /* Brunei Darussalam Time */
        {"bort", TZ, POS(32)},          /* Borneo Time (Indonesia) */
 #if 0
-bortst
-bost
+       bortst
+       bost
 #endif
        {"bot", TZ, NEG(16)},           /* Bolivia Time */
        {"bra", TZ, NEG(12)},           /* Brazil Time */
 #if 0
-brst
-brt
+       brst
+       brt
 #endif
        {"bst", DTZ, POS(4)},           /* British Summer Time */
 #if 0
@@ -165,23 +166,23 @@ brt
 #endif
        {"cdt", DTZ, NEG(20)},          /* Central Daylight Time */
        {"cest", DTZ, POS(8)},          /* Central European Dayl.Time */
-       {"cet", TZ, POS(4)},                    /* Central European Time */
+       {"cet", TZ, POS(4)},            /* Central European Time */
        {"cetdst", DTZ, POS(8)},        /* Central European Dayl.Time */
-       {"chadt", DTZ, POS(55)},                /* Chatham Island Daylight Time (13:45) */
+       {"chadt", DTZ, POS(55)},        /* Chatham Island Daylight Time (13:45) */
        {"chast", TZ, POS(51)},         /* Chatham Island Time (12:45) */
 #if 0
-ckhst
+       ckhst
 #endif
        {"ckt", TZ, POS(48)},           /* Cook Islands Time */
        {"clst", DTZ, NEG(12)},         /* Chile Summer Time */
        {"clt", TZ, NEG(16)},           /* Chile Time */
 #if 0
-cost
+       cost
 #endif
        {"cot", TZ, NEG(20)},           /* Columbia Time */
        {"cst", TZ, NEG(24)},           /* Central Standard Time */
 #if 0
-cvst
+       cvst
 #endif
        {"cvt", TZ, POS(28)},           /* Christmas Island Time (Indian Ocean) */
        {"cxt", TZ, POS(28)},           /* Christmas Island Time (Indian Ocean) */
@@ -214,7 +215,7 @@ cvst
        {"egst", DTZ, POS(0)},          /* East Greenland Summer Time */
        {"egt", TZ, NEG(4)},            /* East Greenland Time */
 #if 0
-ehdt
+       ehdt
 #endif
        {EPOCH, RESERV, DTK_EPOCH}, /* "epoch" reserved for system epoch time */
        {"est", TZ, NEG(20)},           /* Eastern Standard Time */
@@ -225,8 +226,8 @@ ehdt
        {"fkst", DTZ, NEG(12)},         /* Falkland Islands Summer Time */
        {"fkt", TZ, NEG(8)},            /* Falkland Islands Time */
 #if 0
-fnst
-fnt
+       fnst
+       fnt
 #endif
        {"fri", DOW, 5},
        {"friday", DOW, 5},
@@ -238,7 +239,7 @@ fnt
        {"get", TZ, POS(16)},           /* Georgia Time */
        {"gft", TZ, NEG(12)},           /* French Guiana Time */
 #if 0
-ghst
+       ghst
 #endif
        {"gilt", TZ, POS(48)},          /* Gilbert Islands Time */
        {"gmt", TZ, POS(0)},            /* Greenwish Mean Time */
@@ -246,37 +247,37 @@ ghst
        {"gyt", TZ, NEG(16)},           /* Guyana Time */
        {"h", UNITS, DTK_HOUR},         /* "hour" */
 #if 0
-hadt
-hast
+       hadt
+       hast
 #endif
        {"hdt", DTZ, NEG(36)},          /* Hawaii/Alaska Daylight Time */
 #if 0
-hkst
+       hkst
 #endif
        {"hkt", TZ, POS(32)},           /* Hong Kong Time */
 #if 0
        {"hmt", TZ, POS(12)},           /* Hellas ? ? */
-hovst
-hovt
+       hovst
+       hovt
 #endif
        {"hst", TZ, NEG(40)},           /* Hawaii Std Time */
 #if 0
-hwt
+       hwt
 #endif
        {"ict", TZ, POS(28)},           /* Indochina Time */
        {"idle", TZ, POS(48)},          /* Intl. Date Line, East */
        {"idlw", TZ, NEG(48)},          /* Intl. Date Line, West */
 #if 0
-idt /* Israeli, Iran, Indian Daylight Time */
+       idt                                                     /* Israeli, Iran, Indian Daylight Time */
 #endif
        {LATE, RESERV, DTK_LATE},       /* "infinity" reserved for "late time" */
-       {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for bad time */
+       {INVALID, RESERV, DTK_INVALID},         /* "invalid" reserved for bad time */
        {"iot", TZ, POS(20)},           /* Indian Chagos Time */
        {"irkst", DTZ, POS(36)},        /* Irkutsk Summer Time */
        {"irkt", TZ, POS(32)},          /* Irkutsk Time */
        {"irt", TZ, POS(14)},           /* Iran Time */
 #if 0
-isst
+       isst
 #endif
        {"ist", TZ, POS(8)},            /* Israel */
        {"it", TZ, POS(14)},            /* Iran Time */
@@ -303,7 +304,8 @@ isst
        {"lhdt", DTZ, POS(44)},         /* Lord Howe Daylight Time, Australia */
        {"lhst", TZ, POS(42)},          /* Lord Howe Standard Time, Australia */
        {"ligt", TZ, POS(40)},          /* From Melbourne, Australia */
-       {"lint", TZ, POS(56)},          /* Line Islands Time (Kiribati; +14 hours!) */
+       {"lint", TZ, POS(56)},          /* Line Islands Time (Kiribati; +14
+                                                                * hours!) */
        {"lkt", TZ, POS(24)},           /* Lanka Time */
        {"m", UNITS, DTK_MONTH},        /* "month" for ISO input */
        {"magst", DTZ, POS(48)},        /* Magadan Summer Time */
@@ -325,7 +327,7 @@ isst
        {"mon", DOW, 1},
        {"monday", DOW, 1},
 #if 0
-most
+       most
 #endif
        {"mpt", TZ, POS(40)},           /* North Mariana Islands Time */
        {"msd", DTZ, POS(16)},          /* Moscow Summer Time */
@@ -336,7 +338,7 @@ most
        {"mvt", TZ, POS(20)},           /* Maldives Island Time */
        {"myt", TZ, POS(32)},           /* Malaysia Time */
 #if 0
-ncst
+       ncst
 #endif
        {"nct", TZ, POS(44)},           /* New Caledonia Time */
        {"ndt", DTZ, NEG(10)},          /* Nfld. Daylight Time */
@@ -361,7 +363,7 @@ ncst
        {"on", IGNORE_DTF, 0},          /* "on" (throwaway) */
        {"pdt", DTZ, NEG(28)},          /* Pacific Daylight Time */
 #if 0
-pest
+       pest
 #endif
        {"pet", TZ, NEG(20)},           /* Peru Time */
        {"petst", DTZ, POS(52)},        /* Petropavlovsk-Kamchatski Summer Time */
@@ -369,14 +371,14 @@ pest
        {"pgt", TZ, POS(40)},           /* Papua New Guinea Time */
        {"phot", TZ, POS(52)},          /* Phoenix Islands (Kiribati) Time */
 #if 0
-phst
+       phst
 #endif
        {"pht", TZ, POS(32)},           /* Phillipine Time */
        {"pkt", TZ, POS(20)},           /* Pakistan Time */
        {"pm", AMPM, PM},
        {"pmdt", DTZ, NEG(8)},          /* Pierre & Miquelon Daylight Time */
 #if 0
-pmst
+       pmst
 #endif
        {"pont", TZ, POS(44)},          /* Ponape Time (Micronesia) */
        {"pst", TZ, NEG(32)},           /* Pacific Standard Time */
@@ -387,14 +389,14 @@ pmst
        {"s", UNITS, DTK_SECOND},       /* "seconds" for ISO input */
        {"sadt", DTZ, POS(42)},         /* S. Australian Dayl. Time */
 #if 0
-samst
-samt
+       samst
+       samt
 #endif
        {"sast", TZ, POS(38)},          /* South Australian Std Time */
        {"sat", DOW, 6},
        {"saturday", DOW, 6},
 #if 0
-sbt
+       sbt
 #endif
        {"sct", DTZ, POS(16)},          /* Mahe Island Time */
        {"sep", MONTH, 9},
@@ -402,14 +404,14 @@ sbt
        {"september", MONTH, 9},
        {"set", TZ, NEG(4)},            /* Seychelles Time ?? */
 #if 0
-sgt
+       sgt
 #endif
        {"sst", DTZ, POS(8)},           /* Swedish Summer Time */
        {"sun", DOW, 0},
        {"sunday", DOW, 0},
        {"swt", TZ, POS(4)},            /* Swedish Winter Time */
 #if 0
-syot
+       syot
 #endif
        {"t", ISOTIME, DTK_TIME},       /* Filler for ISO time fields */
        {"that", TZ, NEG(40)},          /* Tahiti Time */
@@ -424,11 +426,11 @@ syot
        {TODAY, RESERV, DTK_TODAY}, /* midnight */
        {TOMORROW, RESERV, DTK_TOMORROW},       /* tomorrow midnight */
 #if 0
-tost
+       tost
 #endif
        {"tot", TZ, POS(52)},           /* Tonga Time */
 #if 0
-tpt
+       tpt
 #endif
        {"truk", TZ, POS(40)},          /* Truk Time */
        {"tue", DOW, 2},
@@ -436,7 +438,7 @@ tpt
        {"tuesday", DOW, 2},
        {"tvt", TZ, POS(48)},           /* Tuvalu Time */
 #if 0
-uct
+       uct
 #endif
        {"ulast", DTZ, POS(36)},        /* Ulan Bator Summer Time */
        {"ulat", TZ, POS(32)},          /* Ulan Bator Time */
@@ -451,13 +453,13 @@ uct
        {"vlast", DTZ, POS(44)},        /* Vladivostok Summer Time */
        {"vlat", TZ, POS(40)},          /* Vladivostok Time */
 #if 0
-vust
+       vust
 #endif
        {"vut", TZ, POS(44)},           /* Vanuata Time */
        {"wadt", DTZ, POS(32)},         /* West Australian DST */
        {"wakt", TZ, POS(48)},          /* Wake Time */
 #if 0
-warst
+       warst
 #endif
        {"wast", TZ, POS(28)},          /* West Australian Std Time */
        {"wat", TZ, NEG(4)},            /* West Africa Time */
@@ -515,22 +517,22 @@ static datetkn deltatktbl[] = {
        {"days", UNITS, DTK_DAY},       /* "days" relative */
        {"dec", UNITS, DTK_DECADE}, /* "decade" relative */
        {"decs", UNITS, DTK_DECADE},    /* "decades" relative */
-       {DDECADE, UNITS, DTK_DECADE},   /* "decade" relative */
-       {"decades", UNITS, DTK_DECADE}, /* "decades" relative */
+       {DDECADE, UNITS, DTK_DECADE},           /* "decade" relative */
+       {"decades", UNITS, DTK_DECADE},         /* "decades" relative */
        {"h", UNITS, DTK_HOUR},         /* "hour" relative */
        {DHOUR, UNITS, DTK_HOUR},       /* "hour" relative */
        {"hours", UNITS, DTK_HOUR}, /* "hours" relative */
        {"hr", UNITS, DTK_HOUR},        /* "hour" relative */
        {"hrs", UNITS, DTK_HOUR},       /* "hours" relative */
-       {INVALID, RESERV, DTK_INVALID}, /* reserved for invalid time */
+       {INVALID, RESERV, DTK_INVALID},         /* reserved for invalid time */
        {"m", UNITS, DTK_MINUTE},       /* "minute" relative */
-       {"microsecon", UNITS, DTK_MICROSEC},    /* "microsecond" relative */
-       {"mil", UNITS, DTK_MILLENNIUM},                 /* "millennium" relative */
-       {"millennia", UNITS, DTK_MILLENNIUM},   /* "millennia" relative */
-       {DMILLENNIUM, UNITS, DTK_MILLENNIUM},   /* "millennium" relative */
-       {"millisecon", UNITS, DTK_MILLISEC},    /* relative */
-       {"mils", UNITS, DTK_MILLENNIUM},                /* "millennia" relative */
-       {"min", UNITS, DTK_MINUTE},             /* "minute" relative */
+       {"microsecon", UNITS, DTK_MICROSEC},            /* "microsecond" relative */
+       {"mil", UNITS, DTK_MILLENNIUM},         /* "millennium" relative */
+       {"millennia", UNITS, DTK_MILLENNIUM},           /* "millennia" relative */
+       {DMILLENNIUM, UNITS, DTK_MILLENNIUM},           /* "millennium" relative */
+       {"millisecon", UNITS, DTK_MILLISEC},            /* relative */
+       {"mils", UNITS, DTK_MILLENNIUM},        /* "millennia" relative */
+       {"min", UNITS, DTK_MINUTE}, /* "minute" relative */
        {"mins", UNITS, DTK_MINUTE},    /* "minutes" relative */
        {"mins", UNITS, DTK_MINUTE},    /* "minutes" relative */
        {DMINUTE, UNITS, DTK_MINUTE},           /* "minute" relative */
@@ -545,19 +547,19 @@ static datetkn deltatktbl[] = {
        {"mseconds", UNITS, DTK_MILLISEC},
        {"msecs", UNITS, DTK_MILLISEC},
        {"qtr", UNITS, DTK_QUARTER},    /* "quarter" relative */
-       {DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative */
-       {"reltime", IGNORE_DTF, 0},             /* pre-v6.1 "Undefined Reltime" */
+       {DQUARTER, UNITS, DTK_QUARTER},         /* "quarter" relative */
+       {"reltime", IGNORE_DTF, 0}, /* pre-v6.1 "Undefined Reltime" */
        {"s", UNITS, DTK_SECOND},
        {"sec", UNITS, DTK_SECOND},
        {DSECOND, UNITS, DTK_SECOND},
        {"seconds", UNITS, DTK_SECOND},
        {"secs", UNITS, DTK_SECOND},
-       {DTIMEZONE, UNITS, DTK_TZ},             /* "timezone" time offset */
+       {DTIMEZONE, UNITS, DTK_TZ}, /* "timezone" time offset */
        {"timezone", UNITS, DTK_TZ},    /* "timezone" time offset */
        {"timezone_h", UNITS, DTK_TZ_HOUR}, /* timezone hour units */
-       {"timezone_m", UNITS, DTK_TZ_MINUTE},   /* timezone minutes units */
+       {"timezone_m", UNITS, DTK_TZ_MINUTE},           /* timezone minutes units */
        {"undefined", RESERV, DTK_INVALID}, /* pre-v6.1 invalid time */
-       {"us", UNITS, DTK_MICROSEC},            /* "microsecond" relative */
+       {"us", UNITS, DTK_MICROSEC},    /* "microsecond" relative */
        {"usec", UNITS, DTK_MICROSEC},          /* "microsecond" relative */
        {DMICROSEC, UNITS, DTK_MICROSEC},       /* "microsecond" relative */
        {"useconds", UNITS, DTK_MICROSEC},      /* "microseconds" relative */
@@ -679,16 +681,16 @@ TrimTrailingZeros(char *str)
 /* ParseDateTime()
  * Break string into tokens based on a date/time context.
  * Several field types are assigned:
- *  DTK_NUMBER - digits and (possibly) a decimal point
- *  DTK_DATE - digits and two delimiters, or digits and text
- *  DTK_TIME - digits, colon delimiters, and possibly a decimal point
- *  DTK_STRING - text (no digits)
- *  DTK_SPECIAL - leading "+" or "-" followed by text
- *  DTK_TZ - leading "+" or "-" followed by digits
+ *     DTK_NUMBER - digits and (possibly) a decimal point
+ *     DTK_DATE - digits and two delimiters, or digits and text
+ *     DTK_TIME - digits, colon delimiters, and possibly a decimal point
+ *     DTK_STRING - text (no digits)
+ *     DTK_SPECIAL - leading "+" or "-" followed by text
+ *     DTK_TZ - leading "+" or "-" followed by digits
  * Note that some field types can hold unexpected items:
- *  DTK_NUMBER can hold date fields (yy.ddd)
- *  DTK_STRING can hold months (January) and time zones (PST)
- *  DTK_DATE can hold Posix time zones (GMT-8)
+ *     DTK_NUMBER can hold date fields (yy.ddd)
+ *     DTK_STRING can hold months (January) and time zones (PST)
+ *     DTK_DATE can hold Posix time zones (GMT-8)
  */
 int
 ParseDateTime(char *timestr, char *lowstr,
@@ -723,17 +725,20 @@ ParseDateTime(char *timestr, char *lowstr,
                        else if ((*cp == '-') || (*cp == '/') || (*cp == '.'))
                        {
                                /* save delimiting character to use later */
-                               char *dp = cp;
+                               char       *dp = cp;
 
                                *lp++ = *cp++;
                                /* second field is all digits? then no embedded text month */
                                if (isdigit((unsigned char) *cp))
                                {
-                                       ftype[nf] = ((*dp == '.')? DTK_NUMBER: DTK_DATE);
+                                       ftype[nf] = ((*dp == '.') ? DTK_NUMBER : DTK_DATE);
                                        while (isdigit((unsigned char) *cp))
                                                *lp++ = *cp++;
 
-                                       /* insist that the delimiters match to get a three-field date. */
+                                       /*
+                                        * insist that the delimiters match to get a
+                                        * three-field date.
+                                        */
                                        if (*cp == *dp)
                                        {
                                                ftype[nf] = DTK_DATE;
@@ -749,13 +754,13 @@ ParseDateTime(char *timestr, char *lowstr,
                                                *lp++ = tolower((unsigned char) *cp++);
                                }
                        }
-                       /* otherwise, number only and will determine
-                        * year, month, day, or concatenated fields later...
+
+                       /*
+                        * otherwise, number only and will determine year, month, day,
+                        * or concatenated fields later...
                         */
                        else
-                       {
                                ftype[nf] = DTK_NUMBER;
-                       }
                }
                /* Leading decimal point? Then fractional seconds... */
                else if (*cp == '.')
@@ -766,6 +771,7 @@ ParseDateTime(char *timestr, char *lowstr,
 
                        ftype[nf] = DTK_NUMBER;
                }
+
                /*
                 * text? then date string, month, day of week, special, or
                 * timezone
@@ -783,7 +789,7 @@ ParseDateTime(char *timestr, char *lowstr,
                         */
                        if ((*cp == '-') || (*cp == '/') || (*cp == '.'))
                        {
-                               char *dp = cp;
+                               char       *dp = cp;
 
                                ftype[nf] = DTK_DATE;
                                *lp++ = *cp++;
@@ -823,9 +829,7 @@ ParseDateTime(char *timestr, char *lowstr,
                        }
                        /* otherwise something wrong... */
                        else
-                       {
                                return -1;
-                       }
                }
                /* ignore punctuation but use as delimiter */
                else if (ispunct((unsigned char) *cp))
@@ -836,9 +840,7 @@ ParseDateTime(char *timestr, char *lowstr,
                }
                /* otherwise, something is not right... */
                else
-               {
                        return -1;
-               }
 
                /* force in a delimiter after each field */
                *lp++ = '\0';
@@ -880,7 +882,8 @@ DecodeDateTime(char **field, int *ftype, int nf,
        int                     fmask = 0,
                                tmask,
                                type;
-       int                     ptype = 0;      /* "prefix type" for ISO y2001m02d04 format */
+       int                     ptype = 0;              /* "prefix type" for ISO y2001m02d04
+                                                                * format */
        int                     i;
        int                     val;
        int                     mer = HR24;
@@ -948,7 +951,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
 
                                        if (isdigit((unsigned char) *field[i]) || ptype != 0)
                                        {
-                                               char *cp;
+                                               char       *cp;
 
                                                if (ptype != 0)
                                                {
@@ -958,8 +961,10 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                                        ptype = 0;
                                                }
 
-                                               /* Starts with a digit but we already have a time field?
-                                                * Then we are in trouble with a date and time already...
+                                               /*
+                                                * Starts with a digit but we already have a time
+                                                * field? Then we are in trouble with a date and
+                                                * time already...
                                                 */
                                                if ((fmask & DTK_TIME_M) == DTK_TIME_M)
                                                        return -1;
@@ -972,12 +977,18 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                                        return -1;
                                                *cp = '\0';
 
-                                               /* Then read the rest of the field as a concatenated time */
+                                               /*
+                                                * Then read the rest of the field as a
+                                                * concatenated time
+                                                */
                                                if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], fmask,
-                                                                                                                 &tmask, tm, fsec, &is2digits)) < 0)
+                                                                         &tmask, tm, fsec, &is2digits)) < 0)
                                                        return -1;
 
-                                               /* modify tmask after returning from DecodeNumberField() */
+                                               /*
+                                                * modify tmask after returning from
+                                                * DecodeNumberField()
+                                                */
                                                tmask |= DTK_M(TZ);
                                        }
                                        else
@@ -990,9 +1001,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                        }
                                }
                                else if (DecodeDate(field[i], fmask, &tmask, tm) != 0)
-                               {
                                        return -1;
-                               }
                                break;
 
                        case DTK_TIME:
@@ -1009,7 +1018,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
 
                        case DTK_TZ:
                                {
-                                       int tz;
+                                       int                     tz;
 
                                        if (tzp == NULL)
                                                return -1;
@@ -1038,6 +1047,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                break;
 
                        case DTK_NUMBER:
+
                                /*
                                 * Was this an "ISO date" with embedded field labels? An
                                 * example is "y2001m02d04" - thomas 2001-02-04
@@ -1048,7 +1058,11 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                        int                     val;
 
                                        val = strtol(field[i], &cp, 10);
-                                       /* only a few kinds are allowed to have an embedded decimal */
+
+                                       /*
+                                        * only a few kinds are allowed to have an embedded
+                                        * decimal
+                                        */
                                        if (*cp == '.')
                                                switch (ptype)
                                                {
@@ -1071,7 +1085,11 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                                        break;
 
                                                case DTK_MONTH:
-                                                       /* already have a month and hour? then assume minutes */
+
+                                                       /*
+                                                        * already have a month and hour? then assume
+                                                        * minutes
+                                                        */
                                                        if (((fmask & DTK_M(MONTH)) != 0)
                                                                && ((fmask & DTK_M(HOUR)) != 0))
                                                        {
@@ -1105,7 +1123,8 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                                        tmask = DTK_M(SECOND);
                                                        if (*cp == '.')
                                                        {
-                                                               double frac;
+                                                               double          frac;
+
                                                                frac = strtod(cp, &cp);
                                                                if (*cp != '\0')
                                                                        return -1;
@@ -1132,7 +1151,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                                        /* fractional Julian Day? */
                                                        if (*cp == '.')
                                                        {
-                                                               double time;
+                                                               double          time;
 
                                                                time = strtod(cp, &cp);
                                                                if (*cp != '\0')
@@ -1140,9 +1159,9 @@ DecodeDateTime(char **field, int *ftype, int nf,
 
                                                                tmask |= DTK_TIME_M;
 #ifdef HAVE_INT64_TIMESTAMP
-                                                               dt2time((time*86400000000), &tm->tm_hour, &tm->tm_min, &tm->tm_sec, fsec);
+                                                               dt2time((time * 86400000000), &tm->tm_hour, &tm->tm_min, &tm->tm_sec, fsec);
 #else
-                                                               dt2time((time*86400), &tm->tm_hour, &tm->tm_min, &tm->tm_sec, fsec);
+                                                               dt2time((time * 86400), &tm->tm_hour, &tm->tm_min, &tm->tm_sec, fsec);
 #endif
                                                        }
                                                        break;
@@ -1150,7 +1169,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                                case DTK_TIME:
                                                        /* previous field was "t" for ISO time */
                                                        if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], (fmask | DTK_DATE_M),
-                                                                                                                         &tmask, tm, fsec, &is2digits)) < 0)
+                                                                         &tmask, tm, fsec, &is2digits)) < 0)
                                                                return -1;
 
                                                        if (tmask != DTK_TIME_M)
@@ -1167,8 +1186,8 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                }
                                else
                                {
-                                       char *cp;
-                                       int flen;
+                                       char       *cp;
+                                       int                     flen;
 
                                        flen = strlen(field[i]);
                                        cp = strchr(field[i], '.');
@@ -1182,26 +1201,25 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                        /* embedded decimal and several digits before? */
                                        else if ((cp != NULL) && ((flen - strlen(cp)) > 2))
                                        {
-                                               /* Interpret as a concatenated date or time
-                                                * Set the type field to allow decoding other fields later.
-                                                * Example: 20011223 or 040506
+                                               /*
+                                                * Interpret as a concatenated date or time Set
+                                                * the type field to allow decoding other fields
+                                                * later. Example: 20011223 or 040506
                                                 */
                                                if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
-                                                                                                                 &tmask, tm, fsec, &is2digits)) < 0)
+                                                                         &tmask, tm, fsec, &is2digits)) < 0)
                                                        return -1;
                                        }
                                        else if (flen > 4)
                                        {
                                                if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
-                                                                                                                &tmask, tm, fsec, &is2digits)) < 0)
-                                               return -1;
+                                                                         &tmask, tm, fsec, &is2digits)) < 0)
+                                                       return -1;
                                        }
                                        /* otherwise it is a single date/time field... */
                                        else if (DecodeNumber(flen, field[i], fmask,
-                                                                                 &tmask, tm, fsec, &is2digits) != 0)
-                                       {
+                                                                         &tmask, tm, fsec, &is2digits) != 0)
                                                return -1;
-                                       }
                                }
                                break;
 
@@ -1350,9 +1368,11 @@ DecodeDateTime(char **field, int *ftype, int nf,
                                                break;
 
                                        case ISOTIME:
-                                               /* This is a filler field "t"
-                                                * indicating that the next field is time.
-                                                * Try to verify that this is sensible.
+
+                                               /*
+                                                * This is a filler field "t" indicating that the
+                                                * next field is time. Try to verify that this is
+                                                * sensible.
                                                 */
                                                tmask = 0;
 
@@ -1362,9 +1382,9 @@ DecodeDateTime(char **field, int *ftype, int nf,
 
                                                /***
                                                 * We will need one of the following fields:
-                                                *  DTK_NUMBER should be hhmmss.fff
-                                                *  DTK_TIME should be hh:mm:ss.fff
-                                                *  DTK_DATE should be hhmmss-zz
+                                                *      DTK_NUMBER should be hhmmss.fff
+                                                *      DTK_TIME should be hh:mm:ss.fff
+                                                *      DTK_DATE should be hhmmss-zz
                                                 ***/
                                                if ((i >= (nf - 1))
                                                        || ((ftype[i + 1] != DTK_NUMBER)
@@ -1522,34 +1542,38 @@ DetermineLocalTimeZone(struct tm * tm)
                                   date2j(1970, 1, 1));
                        mysec = tm->tm_sec + (tm->tm_min + (day * 24 + tm->tm_hour) * 60) * 60;
                        mytime = (time_t) mysec;
+
                        /*
-                        * Use localtime to convert that time_t to broken-down time, and
-                        * reassemble to get a representation of local time.
+                        * Use localtime to convert that time_t to broken-down time,
+                        * and reassemble to get a representation of local time.
                         */
                        tmp = localtime(&mytime);
                        day = (date2j(tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday) -
                                   date2j(1970, 1, 1));
                        locsec = tmp->tm_sec + (tmp->tm_min + (day * 24 + tmp->tm_hour) * 60) * 60;
+
                        /*
-                        * The local time offset corresponding to that GMT time is
-                        * now computable as mysec - locsec.
+                        * The local time offset corresponding to that GMT time is now
+                        * computable as mysec - locsec.
                         */
                        delta1 = mysec - locsec;
+
                        /*
-                        * However, if that GMT time and the local time we are actually
-                        * interested in are on opposite sides of a daylight-savings-time
-                        * transition, then this is not the time offset we want.  So,
-                        * adjust the time_t to be what we think the GMT time corresponding
-                        * to our target local time is, and repeat the localtime() call
-                        * and delta calculation.  We may have to do it twice before we
-                        * have a trustworthy delta.
+                        * However, if that GMT time and the local time we are
+                        * actually interested in are on opposite sides of a
+                        * daylight-savings-time transition, then this is not the time
+                        * offset we want.      So, adjust the time_t to be what we think
+                        * the GMT time corresponding to our target local time is, and
+                        * repeat the localtime() call and delta calculation.  We may
+                        * have to do it twice before we have a trustworthy delta.
                         *
                         * Note: think not to put a loop here, since if we've been given
-                        * an "impossible" local time (in the gap during a spring-forward
-                        * transition) we'd never get out of the loop.  Twice is enough
-                        * to give the behavior we want, which is that "impossible" times
-                        * are taken as standard time, while at a fall-back boundary
-                        * ambiguous times are also taken as standard.
+                        * an "impossible" local time (in the gap during a
+                        * spring-forward transition) we'd never get out of the loop.
+                        * Twice is enough to give the behavior we want, which is that
+                        * "impossible" times are taken as standard time, while at a
+                        * fall-back boundary ambiguous times are also taken as
+                        * standard.
                         */
                        mysec += delta1;
                        mytime = (time_t) mysec;
@@ -1604,7 +1628,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
        int                     fmask = 0,
                                tmask,
                                type;
-       int                     ptype = 0;      /* "prefix type" for ISO h04mm05s06 format */
+       int                     ptype = 0;              /* "prefix type" for ISO h04mm05s06 format */
        int                     i;
        int                     val;
        int                     is2digits = FALSE;
@@ -1626,16 +1650,17 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                switch (ftype[i])
                {
                        case DTK_DATE:
-                               /* Time zone not allowed?
-                                * Then should not accept dates or time zones
-                                * no matter what else!
+
+                               /*
+                                * Time zone not allowed? Then should not accept dates or
+                                * time zones no matter what else!
                                 */
                                if (tzp == NULL)
                                        return -1;
 
                                /* Under limited circumstances, we will accept a date... */
                                if ((i == 0) && (nf >= 2)
-                                       && ((ftype[nf-1] == DTK_DATE)
+                                       && ((ftype[nf - 1] == DTK_DATE)
                                                || (ftype[1] == DTK_TIME)))
                                {
                                        if (DecodeDate(field[i], fmask, &tmask, tm) != 0)
@@ -1646,15 +1671,20 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                                {
                                        if (isdigit((unsigned char) *field[i]))
                                        {
-                                               char *cp;
+                                               char       *cp;
 
-                                               /* Starts with a digit but we already have a time field?
-                                                * Then we are in trouble with time already...
+                                               /*
+                                                * Starts with a digit but we already have a time
+                                                * field? Then we are in trouble with time
+                                                * already...
                                                 */
                                                if ((fmask & DTK_TIME_M) == DTK_TIME_M)
                                                        return -1;
 
-                                               /* Should not get here and fail. Sanity check only... */
+                                               /*
+                                                * Should not get here and fail. Sanity check
+                                                * only...
+                                                */
                                                if ((cp = strchr(field[i], '-')) == NULL)
                                                        return -1;
 
@@ -1663,9 +1693,12 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                                                        return -1;
                                                *cp = '\0';
 
-                                               /* Then read the rest of the field as a concatenated time */
+                                               /*
+                                                * Then read the rest of the field as a
+                                                * concatenated time
+                                                */
                                                if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], (fmask | DTK_DATE_M),
-                                                                                                                 &tmask, tm, fsec, &is2digits)) < 0)
+                                                                         &tmask, tm, fsec, &is2digits)) < 0)
                                                        return -1;
 
                                                tmask |= DTK_M(TZ);
@@ -1716,6 +1749,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                                break;
 
                        case DTK_NUMBER:
+
                                /*
                                 * Was this an "ISO time" with embedded field labels? An
                                 * example is "h04m05s06" - thomas 2001-02-04
@@ -1739,7 +1773,11 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                                        }
 
                                        val = strtol(field[i], &cp, 10);
-                                       /* only a few kinds are allowed to have an embedded decimal */
+
+                                       /*
+                                        * only a few kinds are allowed to have an embedded
+                                        * decimal
+                                        */
                                        if (*cp == '.')
                                                switch (ptype)
                                                {
@@ -1762,7 +1800,11 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                                                        break;
 
                                                case DTK_MONTH:
-                                                       /* already have a month and hour? then assume minutes */
+
+                                                       /*
+                                                        * already have a month and hour? then assume
+                                                        * minutes
+                                                        */
                                                        if (((fmask & DTK_M(MONTH)) != 0)
                                                                && ((fmask & DTK_M(HOUR)) != 0))
                                                        {
@@ -1816,7 +1858,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                                                        j2date(val, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
                                                        if (*cp == '.')
                                                        {
-                                                               double time;
+                                                               double          time;
 
                                                                time = strtod(cp, &cp);
                                                                if (*cp != '\0')
@@ -1824,9 +1866,9 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
 
                                                                tmask |= DTK_TIME_M;
 #ifdef HAVE_INT64_TIMESTAMP
-                                                               dt2time((time*86400000000), &tm->tm_hour, &tm->tm_min, &tm->tm_sec, fsec);
+                                                               dt2time((time * 86400000000), &tm->tm_hour, &tm->tm_min, &tm->tm_sec, fsec);
 #else
-                                                               dt2time((time*86400), &tm->tm_hour, &tm->tm_min, &tm->tm_sec, fsec);
+                                                               dt2time((time * 86400), &tm->tm_hour, &tm->tm_min, &tm->tm_sec, fsec);
 #endif
                                                        }
                                                        break;
@@ -1834,7 +1876,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                                                case DTK_TIME:
                                                        /* previous field was "t" for ISO time */
                                                        if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], (fmask | DTK_DATE_M),
-                                                                                                                         &tmask, tm, fsec, &is2digits)) < 0)
+                                                                         &tmask, tm, fsec, &is2digits)) < 0)
                                                                return -1;
 
                                                        if (tmask != DTK_TIME_M)
@@ -1851,8 +1893,8 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                                }
                                else
                                {
-                                       char *cp;
-                                       int flen;
+                                       char       *cp;
+                                       int                     flen;
 
                                        flen = strlen(field[i]);
                                        cp = strchr(field[i], '.');
@@ -1860,8 +1902,11 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                                        /* Embedded decimal? */
                                        if (cp != NULL)
                                        {
-                                               /* Under limited circumstances, we will accept a date... */
-                                               if ((i == 0) && ((nf >= 2) && (ftype[nf-1] == DTK_DATE)))
+                                               /*
+                                                * Under limited circumstances, we will accept a
+                                                * date...
+                                                */
+                                               if ((i == 0) && ((nf >= 2) && (ftype[nf - 1] == DTK_DATE)))
                                                {
                                                        if (DecodeDate(field[i], fmask, &tmask, tm) != 0)
                                                                return -1;
@@ -1869,31 +1914,28 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                                                /* embedded decimal and several digits before? */
                                                else if ((flen - strlen(cp)) > 2)
                                                {
-                                                       /* Interpret as a concatenated date or time
-                                                        * Set the type field to allow decoding other fields later.
-                                                        * Example: 20011223 or 040506
+                                                       /*
+                                                        * Interpret as a concatenated date or time
+                                                        * Set the type field to allow decoding other
+                                                        * fields later. Example: 20011223 or 040506
                                                         */
                                                        if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
-                                                                                                                         &tmask, tm, fsec, &is2digits)) < 0)
+                                                                         &tmask, tm, fsec, &is2digits)) < 0)
                                                                return -1;
                                                }
                                                else
-                                               {
                                                        return -1;
-                                               }
                                        }
                                        else if (flen > 4)
                                        {
                                                if ((ftype[i] = DecodeNumberField(flen, field[i], fmask,
-                                                                                                                &tmask, tm, fsec, &is2digits)) < 0)
-                                               return -1;
+                                                                         &tmask, tm, fsec, &is2digits)) < 0)
+                                                       return -1;
                                        }
                                        /* otherwise it is a single date/time field... */
                                        else if (DecodeNumber(flen, field[i], fmask,
-                                                                                 &tmask, tm, fsec, &is2digits) != 0)
-                                       {
+                                                                         &tmask, tm, fsec, &is2digits) != 0)
                                                return -1;
-                                       }
                                }
                                break;
 
@@ -1987,9 +2029,9 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
 
                                                /***
                                                 * We will need one of the following fields:
-                                                *  DTK_NUMBER should be hhmmss.fff
-                                                *  DTK_TIME should be hh:mm:ss.fff
-                                                *  DTK_DATE should be hhmmss-zz
+                                                *      DTK_NUMBER should be hhmmss.fff
+                                                *      DTK_TIME should be hh:mm:ss.fff
+                                                *      DTK_DATE should be hhmmss-zz
                                                 ***/
                                                if ((i >= (nf - 1))
                                                        || ((ftype[i + 1] != DTK_NUMBER)
@@ -2051,9 +2093,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
                        return -1;
 
                if ((fmask & DTK_DATE_M) == 0)
-               {
                        GetCurrentDateTime(tmp);
-               }
                else
                {
                        tmp->tm_year = tm->tm_year;
@@ -2221,9 +2261,7 @@ DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, fsec_t *fsec)
                *fsec = 0;
        }
        else if (*cp != ':')
-       {
                return -1;
-       }
        else
        {
                str = cp + 1;
@@ -2233,15 +2271,16 @@ DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, fsec_t *fsec)
                else if (*cp == '.')
                {
 #ifdef HAVE_INT64_TIMESTAMP
-                       char fstr[MAXDATELEN + 1];
+                       char            fstr[MAXDATELEN + 1];
 
-                       /* OK, we have at most six digits to work with.
-                        * Let's construct a string and then do the conversion
-                        * to an integer.
+                       /*
+                        * OK, we have at most six digits to work with. Let's
+                        * construct a string and then do the conversion to an
+                        * integer.
                         */
-                       strncpy(fstr, (cp+1), 7);
-                       strcpy((fstr+strlen(fstr)), "000000");
-                       *(fstr+6) = '\0';
+                       strncpy(fstr, (cp + 1), 7);
+                       strcpy((fstr + strlen(fstr)), "000000");
+                       *(fstr + 6) = '\0';
                        *fsec = strtol(fstr, &cp, 10);
 #else
                        str = cp;
@@ -2291,10 +2330,9 @@ DecodeNumber(int flen, char *str, int fmask,
 
        if (*cp == '.')
        {
-               /* More than two digits?
-                * Then could be a date or a run-together time:
-                *  2001.360
-                *  20011225 040506.789
+               /*
+                * More than two digits? Then could be a date or a run-together
+                * time: 2001.360 20011225 040506.789
                 */
                if ((cp - str) > 2)
                        return DecodeNumberField(flen, str, (fmask | DTK_DATE_M),
@@ -2305,9 +2343,7 @@ DecodeNumber(int flen, char *str, int fmask,
                        return -1;
        }
        else if (*cp != '\0')
-       {
                return -1;
-       }
 
        /* Special case day of year? */
        if ((flen == 3) && (fmask & DTK_M(YEAR))
@@ -2397,26 +2433,27 @@ DecodeNumber(int flen, char *str, int fmask,
  */
 static int
 DecodeNumberField(int len, char *str, int fmask,
-                                 int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits)
+                               int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits)
 {
        char       *cp;
 
-       /* Have a decimal point?
-        * Then this is a date or something with a seconds field...
+       /*
+        * Have a decimal point? Then this is a date or something with a
+        * seconds field...
         */
        if ((cp = strchr(str, '.')) != NULL)
        {
 #ifdef HAVE_INT64_TIMESTAMP
-                       char fstr[MAXDATELEN + 1];
+               char            fstr[MAXDATELEN + 1];
 
-                       /* OK, we have at most six digits to care about.
-                        * Let's construct a string and then do the conversion
-                        * to an integer.
-                        */
-                       strcpy(fstr, (cp+1));
-                       strcpy((fstr+strlen(fstr)), "000000");
-                       *(fstr+6) = '\0';
-                       *fsec = strtol(fstr, NULL, 10);
+               /*
+                * OK, we have at most six digits to care about. Let's construct a
+                * string and then do the conversion to an integer.
+                */
+               strcpy(fstr, (cp + 1));
+               strcpy((fstr + strlen(fstr)), "000000");
+               *(fstr + 6) = '\0';
+               *fsec = strtol(fstr, NULL, 10);
 #else
                *fsec = strtod(cp, NULL);
 #endif
@@ -2515,9 +2552,7 @@ DecodeTimezone(char *str, int *tzp)
 
        /* explicit delimiter? */
        if (*cp == ':')
-       {
                min = strtol((cp + 1), &cp, 10);
-       }
        /* otherwise, might have run things together... */
        else if ((*cp == '\0') && ((len = strlen(str)) > 3))
        {
@@ -2531,9 +2566,7 @@ DecodeTimezone(char *str, int *tzp)
                        return -1;
        }
        else
-       {
                min = 0;
-       }
 
        tz = (hr * 60 + min) * 60;
        if (*str == '-')
@@ -2794,7 +2827,8 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse
                                                tm->tm_min += val;
                                                if (fval != 0)
                                                {
-                                                       int sec;
+                                                       int                     sec;
+
                                                        fval *= 60;
                                                        sec = fval;
                                                        tm->tm_sec += sec;
@@ -2811,7 +2845,8 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse
                                                tm->tm_hour += val;
                                                if (fval != 0)
                                                {
-                                                       int sec;
+                                                       int                     sec;
+
                                                        fval *= 3600;
                                                        sec = fval;
                                                        tm->tm_sec += sec;
@@ -2828,7 +2863,8 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse
                                                tm->tm_mday += val;
                                                if (fval != 0)
                                                {
-                                                       int sec;
+                                                       int                     sec;
+
                                                        fval *= 86400;
                                                        sec = fval;
                                                        tm->tm_sec += sec;
@@ -2845,8 +2881,9 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse
                                                tm->tm_mday += val * 7;
                                                if (fval != 0)
                                                {
-                                                       int sec;
-                                                       fval *= (7*86400);
+                                                       int                     sec;
+
+                                                       fval *= (7 * 86400);
                                                        sec = fval;
                                                        tm->tm_sec += sec;
 #ifdef HAVE_INT64_TIMESTAMP
@@ -2862,8 +2899,9 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse
                                                tm->tm_mon += val;
                                                if (fval != 0)
                                                {
-                                                       int sec;
-                                                       fval *= (30*86400);
+                                                       int                     sec;
+
+                                                       fval *= (30 * 86400);
                                                        sec = fval;
                                                        tm->tm_sec += sec;
 #ifdef HAVE_INT64_TIMESTAMP
@@ -2947,7 +2985,7 @@ DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm * tm, fse
 
        if (*fsec != 0)
        {
-               int             sec;
+               int                     sec;
 
 #ifdef HAVE_INT64_TIMESTAMP
                sec = (*fsec / INT64CONST(1000000));
@@ -3175,13 +3213,14 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
        int                     day,
                                hour,
                                min;
+
 #ifndef HAVE_INT64_TIMESTAMP
        fsec_t          sec;
 #endif
 
-       /* Why are we checking only the month field? Change this to an assert...
-        * if ((tm->tm_mon < 1) || (tm->tm_mon > 12))
-        *  return -1;
+       /*
+        * Why are we checking only the month field? Change this to an
+        * assert... if ((tm->tm_mon < 1) || (tm->tm_mon > 12)) return -1;
         */
        Assert((tm->tm_mon >= 1) && (tm->tm_mon <= 12));
 
@@ -3195,16 +3234,15 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
                        /* Compatible with ISO-8601 date formats */
 
                        sprintf(str, "%04d-%02d-%02d %02d:%02d",
-                                       ((tm->tm_year > 0)? tm->tm_year: -(tm->tm_year - 1)),
+                                 ((tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1)),
                                        tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min);
 
                        /*
-                        * If we have fractional seconds, then include a decimal
-                        * point We will do up to 6 fractional digits, and we have
-                        * rounded any inputs to eliminate anything to the right
-                        * of 6 digits anyway. If there are no fractional seconds,
-                        * then do not bother printing a decimal point at all. -
-                        * thomas 2001-09-29
+                        * If we have fractional seconds, then include a decimal point
+                        * We will do up to 6 fractional digits, and we have rounded
+                        * any inputs to eliminate anything to the right of 6 digits
+                        * anyway. If there are no fractional seconds, then do not
+                        * bother printing a decimal point at all. - thomas 2001-09-29
                         */
 #ifdef HAVE_INT64_TIMESTAMP
                        if (fsec != 0)
@@ -3219,22 +3257,16 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
                                TrimTrailingZeros(str);
                        }
                        else
-                       {
                                sprintf((str + strlen(str)), ":%02d", tm->tm_sec);
-                       }
 
                        if (tm->tm_year <= 0)
-                       {
                                sprintf((str + strlen(str)), " BC");
-                       }
 
                        /*
-                        * tzp == NULL indicates that we don't want *any* time
-                        * zone info in the output string.
-                        * *tzn != NULL indicates that we have alpha time zone
-                        * info available.
-                        * tm_isdst != -1 indicates that we have a valid time zone
-                        * translation.
+                        * tzp == NULL indicates that we don't want *any* time zone
+                        * info in the output string. *tzn != NULL indicates that we
+                        * have alpha time zone info available. tm_isdst != -1
+                        * indicates that we have a valid time zone translation.
                         */
                        if ((tzp != NULL) && (tm->tm_isdst >= 0))
                        {
@@ -3253,16 +3285,15 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
                                sprintf(str, "%02d/%02d", tm->tm_mon, tm->tm_mday);
 
                        sprintf((str + 5), "/%04d %02d:%02d",
-                                       ((tm->tm_year > 0)? tm->tm_year: -(tm->tm_year - 1)),
+                                 ((tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1)),
                                        tm->tm_hour, tm->tm_min);
 
                        /*
-                        * If we have fractional seconds, then include a decimal
-                        * point We will do up to 6 fractional digits, and we have
-                        * rounded any inputs to eliminate anything to the right
-                        * of 6 digits anyway. If there are no fractional seconds,
-                        * then do not bother printing a decimal point at all. -
-                        * thomas 2001-09-29
+                        * If we have fractional seconds, then include a decimal point
+                        * We will do up to 6 fractional digits, and we have rounded
+                        * any inputs to eliminate anything to the right of 6 digits
+                        * anyway. If there are no fractional seconds, then do not
+                        * bother printing a decimal point at all. - thomas 2001-09-29
                         */
 #ifdef HAVE_INT64_TIMESTAMP
                        if (fsec != 0)
@@ -3277,14 +3308,10 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
                                TrimTrailingZeros(str);
                        }
                        else
-                       {
                                sprintf((str + strlen(str)), ":%02d", tm->tm_sec);
-                       }
 
                        if (tm->tm_year <= 0)
-                       {
                                sprintf((str + strlen(str)), " BC");
-                       }
 
                        if ((tzp != NULL) && (tm->tm_isdst >= 0))
                        {
@@ -3305,16 +3332,15 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
                        sprintf(str, "%02d.%02d", tm->tm_mday, tm->tm_mon);
 
                        sprintf((str + 5), ".%04d %02d:%02d",
-                                       ((tm->tm_year > 0)? tm->tm_year: -(tm->tm_year - 1)),
+                                 ((tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1)),
                                        tm->tm_hour, tm->tm_min);
 
                        /*
-                        * If we have fractional seconds, then include a decimal
-                        * point We will do up to 6 fractional digits, and we have
-                        * rounded any inputs to eliminate anything to the right
-                        * of 6 digits anyway. If there are no fractional seconds,
-                        * then do not bother printing a decimal point at all. -
-                        * thomas 2001-09-29
+                        * If we have fractional seconds, then include a decimal point
+                        * We will do up to 6 fractional digits, and we have rounded
+                        * any inputs to eliminate anything to the right of 6 digits
+                        * anyway. If there are no fractional seconds, then do not
+                        * bother printing a decimal point at all. - thomas 2001-09-29
                         */
 #ifdef HAVE_INT64_TIMESTAMP
                        if (fsec != 0)
@@ -3329,14 +3355,10 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
                                TrimTrailingZeros(str);
                        }
                        else
-                       {
                                sprintf((str + strlen(str)), ":%02d", tm->tm_sec);
-                       }
 
                        if (tm->tm_year <= 0)
-                       {
                                sprintf((str + strlen(str)), " BC");
-                       }
 
                        if ((tzp != NULL) && (tm->tm_isdst >= 0))
                        {
@@ -3369,12 +3391,11 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
                        sprintf((str + 10), " %02d:%02d", tm->tm_hour, tm->tm_min);
 
                        /*
-                        * If we have fractional seconds, then include a decimal
-                        * point We will do up to 6 fractional digits, and we have
-                        * rounded any inputs to eliminate anything to the right
-                        * of 6 digits anyway. If there are no fractional seconds,
-                        * then do not bother printing a decimal point at all. -
-                        * thomas 2001-09-29
+                        * If we have fractional seconds, then include a decimal point
+                        * We will do up to 6 fractional digits, and we have rounded
+                        * any inputs to eliminate anything to the right of 6 digits
+                        * anyway. If there are no fractional seconds, then do not
+                        * bother printing a decimal point at all. - thomas 2001-09-29
                         */
 #ifdef HAVE_INT64_TIMESTAMP
                        if (fsec != 0)
@@ -3389,16 +3410,12 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
                                TrimTrailingZeros(str);
                        }
                        else
-                       {
                                sprintf((str + strlen(str)), ":%02d", tm->tm_sec);
-                       }
 
                        sprintf((str + strlen(str)), " %04d",
-                                       ((tm->tm_year > 0)? tm->tm_year: -(tm->tm_year - 1)));
+                                ((tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1)));
                        if (tm->tm_year <= 0)
-                       {
                                sprintf((str + strlen(str)), " BC");
-                       }
 
                        if ((tzp != NULL) && (tm->tm_isdst >= 0))
                        {
@@ -3407,11 +3424,11 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, int *tzp, char **tzn, int style, cha
                                else
                                {
                                        /*
-                                        * We have a time zone, but no string version. Use
-                                        * the numeric form, but be sure to include a
-                                        * leading space to avoid formatting something
-                                        * which would be rejected by the date/time parser
-                                        * later. - thomas 2001-10-19
+                                        * We have a time zone, but no string version. Use the
+                                        * numeric form, but be sure to include a leading
+                                        * space to avoid formatting something which would be
+                                        * rejected by the date/time parser later. - thomas
+                                        * 2001-10-19
                                         */
                                        hour = -(*tzp / 3600);
                                        min = ((abs(*tzp) / 60) % 60);
@@ -3497,7 +3514,7 @@ EncodeInterval(struct tm * tm, fsec_t fsec, int style, char *str)
 #ifdef HAVE_INT64_TIMESTAMP
                                        sprintf(cp, ":%02d", abs(tm->tm_sec));
                                        cp += strlen(cp);
-                                       sprintf(cp, ".%06d", ((fsec >= 0)? fsec: -(fsec)));
+                                       sprintf(cp, ".%06d", ((fsec >= 0) ? fsec : -(fsec)));
 #else
                                        fsec += tm->tm_sec;
                                        sprintf(cp, ":%013.10f", fabs(fsec));
index 0a751ff..9519ef2 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.24 2002/08/24 15:00:46 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/datum.c,v 1.25 2002/09/04 20:31:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -81,7 +81,7 @@ datumGetSize(Datum value, bool typByVal, int typLen)
                else if (typLen == -2)
                {
                        /* It is a cstring datatype */
-                       char *s = (char *) DatumGetPointer(value);
+                       char       *s = (char *) DatumGetPointer(value);
 
                        if (!PointerIsValid(s))
                                elog(ERROR, "datumGetSize: Invalid Datum Pointer");
@@ -175,9 +175,9 @@ datumIsEqual(Datum value1, Datum value2, bool typByVal, int typLen)
                /*
                 * just compare the two datums. NOTE: just comparing "len" bytes
                 * will not do the work, because we do not know how these bytes
-                * are aligned inside the "Datum".  We assume instead that any
-                * given datatype is consistent about how it fills extraneous
-                * bits in the Datum.
+                * are aligned inside the "Datum".      We assume instead that any
+                * given datatype is consistent about how it fills extraneous bits
+                * in the Datum.
                 */
                res = (value1 == value2);
        }
index 5edea78..7b1798d 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.80 2002/08/26 17:53:58 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.81 2002/09/04 20:31:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1515,7 +1515,7 @@ float8_accum(PG_FUNCTION_ARGS)
 
        result = construct_array(transdatums, 3,
                                                         FLOAT8OID,
-                                                        sizeof(float8), false /*float8 byval*/, 'd');
+                                                sizeof(float8), false /* float8 byval */ , 'd');
 
        PG_RETURN_ARRAYTYPE_P(result);
 }
@@ -1551,7 +1551,7 @@ float4_accum(PG_FUNCTION_ARGS)
 
        result = construct_array(transdatums, 3,
                                                         FLOAT8OID,
-                                                        sizeof(float8), false /*float8 byval*/, 'd');
+                                                sizeof(float8), false /* float8 byval */ , 'd');
 
        PG_RETURN_ARRAYTYPE_P(result);
 }
index 02e0dc8..c852ed2 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.33 2002/08/29 07:22:26 ishii Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.34 2002/09/04 20:31:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,8 +31,9 @@
 #define _textin(str) DirectFunctionCall1(textin, CStringGetDatum(str))
 
 static char *format_type_internal(Oid type_oid, int32 typemod,
-                                                                 bool typemod_given, bool allow_invalid);
-static char *psnprintf(size_t len, const char *fmt, ...)
+                                        bool typemod_given, bool allow_invalid);
+static char *
+psnprintf(size_t len, const char *fmt,...)
 /* This lets gcc check the format string for consistency. */
 __attribute__((format(printf, 2, 3)));
 
@@ -47,14 +48,14 @@ __attribute__((format(printf, 2, 3)));
  * double quoted if it contains funny characters or matches a keyword.
  *
  * If typemod is NULL then we are formatting a type name in a context where
- * no typemod is available, eg a function argument or result type.  This
+ * no typemod is available, eg a function argument or result type.     This
  * yields a slightly different result from specifying typemod = -1 in some
  * cases.  Given typemod = -1 we feel compelled to produce an output that
  * the parser will interpret as having typemod -1, so that pg_dump will
- * produce CREATE TABLE commands that recreate the original state.  But
+ * produce CREATE TABLE commands that recreate the original state.     But
  * given NULL typemod, we assume that the parser's interpretation of
  * typemod doesn't matter, and so we are willing to output a slightly
- * "prettier" representation of the same type.  For example, type = bpchar
+ * "prettier" representation of the same type. For example, type = bpchar
  * and typemod = NULL gets you "character", whereas typemod = -1 gets you
  * "bpchar" --- the former will be interpreted as character(1) by the
  * parser, which does not yield typemod -1.
@@ -77,9 +78,7 @@ format_type(PG_FUNCTION_ARGS)
        type_oid = PG_GETARG_OID(0);
 
        if (PG_ARGISNULL(1))
-       {
                result = format_type_internal(type_oid, -1, false, true);
-       }
        else
        {
                typemod = PG_GETARG_INT32(1);
@@ -141,7 +140,7 @@ format_type_internal(Oid type_oid, int32 typemod,
 
        /*
         * Check if it's an array (and not a domain --- we don't want to show
-        * the substructure of a domain type).  Fixed-length array types such
+        * the substructure of a domain type).  Fixed-length array types such
         * as "name" shouldn't get deconstructed either.
         */
        array_base_type = typeform->typelem;
@@ -171,15 +170,15 @@ format_type_internal(Oid type_oid, int32 typemod,
                is_array = false;
 
        /*
-        * See if we want to special-case the output for certain built-in types.
-        * Note that these special cases should all correspond to special
-        * productions in gram.y, to ensure that the type name will be taken as
-        * a system type, not a user type of the same name.
+        * See if we want to special-case the output for certain built-in
+        * types. Note that these special cases should all correspond to
+        * special productions in gram.y, to ensure that the type name will be
+        * taken as a system type, not a user type of the same name.
         *
-        * If we do not provide a special-case output here, the type name will
-        * be handled the same way as a user type name --- in particular, it
-        * will be double-quoted if it matches any lexer keyword.  This behavior
-        * is essential for some cases, such as types "bit" and "char".
+        * If we do not provide a special-case output here, the type name will be
+        * handled the same way as a user type name --- in particular, it will
+        * be double-quoted if it matches any lexer keyword.  This behavior is
+        * essential for some cases, such as types "bit" and "char".
         */
        buf = NULL;                                     /* flag for no special case */
 
@@ -277,36 +276,36 @@ format_type_internal(Oid type_oid, int32 typemod,
                                        case INTERVAL_MASK(SECOND):
                                                fieldstr = " second";
                                                break;
-                                       case INTERVAL_MASK(YEAR)
-                                         | INTERVAL_MASK(MONTH):
+                                               case INTERVAL_MASK(YEAR)
+                                       | INTERVAL_MASK(MONTH):
                                                fieldstr = " year to month";
                                                break;
-                                       case INTERVAL_MASK(DAY)
-                                         | INTERVAL_MASK(HOUR):
+                                               case INTERVAL_MASK(DAY)
+                                       | INTERVAL_MASK(HOUR):
                                                fieldstr = " day to hour";
                                                break;
-                                       case INTERVAL_MASK(DAY)
-                                         | INTERVAL_MASK(HOUR)
-                                         | INTERVAL_MASK(MINUTE):
+                                               case INTERVAL_MASK(DAY)
+                                                       | INTERVAL_MASK(HOUR)
+                                       | INTERVAL_MASK(MINUTE):
                                                fieldstr = " day to minute";
                                                break;
-                                       case INTERVAL_MASK(DAY)
-                                         | INTERVAL_MASK(HOUR)
-                                         | INTERVAL_MASK(MINUTE)
-                                         | INTERVAL_MASK(SECOND):
+                                               case INTERVAL_MASK(DAY)
+                                                       | INTERVAL_MASK(HOUR)
+                                                       | INTERVAL_MASK(MINUTE)
+                                       | INTERVAL_MASK(SECOND):
                                                fieldstr = " day to second";
                                                break;
-                                       case INTERVAL_MASK(HOUR)
-                                         | INTERVAL_MASK(MINUTE):
+                                               case INTERVAL_MASK(HOUR)
+                                       | INTERVAL_MASK(MINUTE):
                                                fieldstr = " hour to minute";
                                                break;
-                                       case INTERVAL_MASK(HOUR)
-                                         | INTERVAL_MASK(MINUTE)
-                                         | INTERVAL_MASK(SECOND):
+                                               case INTERVAL_MASK(HOUR)
+                                                       | INTERVAL_MASK(MINUTE)
+                                       | INTERVAL_MASK(SECOND):
                                                fieldstr = " hour to second";
                                                break;
-                                       case INTERVAL_MASK(MINUTE)
-                                         | INTERVAL_MASK(SECOND):
+                                               case INTERVAL_MASK(MINUTE)
+                                       | INTERVAL_MASK(SECOND):
                                                fieldstr = " minute to second";
                                                break;
                                        case INTERVAL_FULL_RANGE:
@@ -382,9 +381,9 @@ format_type_internal(Oid type_oid, int32 typemod,
        {
                /*
                 * Default handling: report the name as it appears in the catalog.
-                * Here, we must qualify the name if it is not visible in the search
-                * path, and we must double-quote it if it's not a standard identifier
-                * or if it matches any keyword.
+                * Here, we must qualify the name if it is not visible in the
+                * search path, and we must double-quote it if it's not a standard
+                * identifier or if it matches any keyword.
                 */
                char       *nspname;
                char       *typname;
@@ -518,7 +517,7 @@ oidvectortypes(PG_FUNCTION_ARGS)
 
 /* snprintf into a palloc'd string */
 static char *
-psnprintf(size_t len, const char *fmt, ...)
+psnprintf(size_t len, const char *fmt,...)
 {
        va_list         ap;
        char       *buf;
index 7d28d16..b92a14e 100644 (file)
@@ -1,7 +1,7 @@
 /* -----------------------------------------------------------------------
  * formatting.c
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.53 2002/04/21 19:48:12 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.54 2002/09/04 20:31:27 momjian Exp $
  *
  *
  *      Portions Copyright (c) 1999-2000, PostgreSQL Global Development Group
@@ -2438,9 +2438,8 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node, void *data)
                                sscanf(inout, "%03d", &tmfc->year);
 
                                /*
-                                * 3-digit year:
-                                *      '100' ... '999' = 1100 ... 1999
-                                *      '000' ... '099' = 2000 ... 2099
+                                * 3-digit year: '100' ... '999' = 1100 ... 1999 '000' ...
+                                * '099' = 2000 ... 2099
                                 */
                                if (tmfc->year >= 100)
                                        tmfc->year += 1000;
@@ -2469,9 +2468,8 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node, void *data)
                                sscanf(inout, "%02d", &tmfc->year);
 
                                /*
-                                * 2-digit year:
-                                * '00' ... '69'  = 2000 ... 2069
-                                * '70' ... '99'  = 1970 ... 1999
+                                * 2-digit year: '00' ... '69'  = 2000 ... 2069 '70' ...
+                                * '99'  = 1970 ... 1999
                                 */
                                if (tmfc->year < 70)
                                        tmfc->year += 2000;
index ec970bb..c19cbc4 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.64 2002/08/29 23:05:44 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.65 2002/09/04 20:31:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1236,7 +1236,7 @@ path_in(PG_FUNCTION_ARGS)
                depth++;
        }
 
-       size = offsetof(PATH, p[0]) + sizeof(path->p[0]) * npts;
+       size = offsetof(PATH, p[0]) +sizeof(path->p[0]) * npts;
        path = (PATH *) palloc(size);
 
        path->size = size;
@@ -2155,8 +2155,8 @@ dist_ps_internal(Point *pt, LSEG *lseg)
 #endif
 
        /*
-        * Calculate distance to the line segment
-        * or to the endpoints of the segment.
+        * Calculate distance to the line segment or to the endpoints of the
+        * segment.
         */
 
        /* intersection is on the line segment? */
@@ -2397,9 +2397,7 @@ interpt_sl(LSEG *lseg, LINE *line)
 #endif
                }
                else
-               {
                        p = NULL;
-               }
        }
 
        return p;
@@ -3610,7 +3608,7 @@ path_add(PG_FUNCTION_ARGS)
                PG_RETURN_NULL();
 
        base_size = sizeof(p1->p[0]) * (p1->npts + p2->npts);
-       size = offsetof(PATH, p[0]) + base_size;
+       size = offsetof(PATH, p[0]) +base_size;
 
        /* Check for integer overflow */
        if (base_size / sizeof(p1->p[0]) != (p1->npts + p2->npts) ||
@@ -4436,7 +4434,7 @@ circle_poly(PG_FUNCTION_ARGS)
                elog(ERROR, "Unable to convert circle to polygon");
 
        base_size = sizeof(poly->p[0]) * npts;
-       size = offsetof(POLYGON, p[0]) + base_size;
+       size = offsetof(POLYGON, p[0]) +base_size;
 
        /* Check for integer overflow */
        if (base_size / npts != sizeof(poly->p[0]) || size <= base_size)
index 33e0b41..267ad82 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.40 2002/06/20 20:29:37 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/int8.c,v 1.41 2002/09/04 20:31:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -70,14 +70,16 @@ int8in(PG_FUNCTION_ARGS)
        {
                ptr++;
                sign = -1;
+
                /*
-                * Do an explicit check for INT64_MIN.  Ugly though this is, it's
-                * cleaner than trying to get the loop below to handle it portably.
+                * Do an explicit check for INT64_MIN.  Ugly though this is, it's
+                * cleaner than trying to get the loop below to handle it
+                * portably.
                 */
 #ifndef INT64_IS_BUSTED
                if (strcmp(ptr, "9223372036854775808") == 0)
                {
-                       result = - INT64CONST(0x7fffffffffffffff) - 1;
+                       result = -INT64CONST(0x7fffffffffffffff) - 1;
                        PG_RETURN_INT64(result);
                }
 #endif
index a5dda27..ba85179 100644 (file)
@@ -2,11 +2,11 @@
  *
  * lockfuncs.c
  *             Set-returning functions to view the state of locks within the DB.
- * 
+ *
  * Copyright (c) 2002, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *             $Header: /cvsroot/pgsql/src/backend/utils/adt/lockfuncs.c,v 1.6 2002/09/02 01:05:06 tgl Exp $
+ *             $Header: /cvsroot/pgsql/src/backend/utils/adt/lockfuncs.c,v 1.7 2002/09/04 20:31:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,19 +33,22 @@ typedef struct
 Datum
 pg_lock_status(PG_FUNCTION_ARGS)
 {
-       FuncCallContext    *funcctx;
-       PG_Lock_Status     *mystatus;
+       FuncCallContext *funcctx;
+       PG_Lock_Status *mystatus;
        LockData   *lockData;
 
        if (SRF_IS_FIRSTCALL())
        {
-               TupleDesc               tupdesc;
-               MemoryContext   oldcontext;
+               TupleDesc       tupdesc;
+               MemoryContext oldcontext;
 
                /* create a function context for cross-call persistence */
                funcctx = SRF_FIRSTCALL_INIT();
 
-               /* switch to memory context appropriate for multiple function calls */
+               /*
+                * switch to memory context appropriate for multiple function
+                * calls
+                */
                oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
 
                /* build tupdesc for result tuples */
@@ -67,8 +70,8 @@ pg_lock_status(PG_FUNCTION_ARGS)
                funcctx->slot = TupleDescGetSlot(tupdesc);
 
                /*
-                * Collect all the locking information that we will format
-                * and send out as a result set.
+                * Collect all the locking information that we will format and
+                * send out as a result set.
                 */
                mystatus = (PG_Lock_Status *) palloc(sizeof(PG_Lock_Status));
                funcctx->user_fctx = (void *) mystatus;
@@ -79,25 +82,25 @@ pg_lock_status(PG_FUNCTION_ARGS)
                MemoryContextSwitchTo(oldcontext);
        }
 
-       funcctx = SRF_PERCALL_SETUP();
+       funcctx = SRF_PERCALL_SETUP();
        mystatus = (PG_Lock_Status *) funcctx->user_fctx;
        lockData = mystatus->lockData;
 
        while (mystatus->currIdx < lockData->nelements)
        {
-               PROCLOCK                 *holder;
-               LOCK                     *lock;
-               PGPROC                   *proc;
-               bool                    granted;
-               LOCKMODE                  mode;
-               Datum                   values[6];
-               char                    nulls[6];
-               HeapTuple                 tuple;
-               Datum                     result;
-
-               holder          = &(lockData->holders[mystatus->currIdx]);
-               lock            = &(lockData->locks[mystatus->currIdx]);
-               proc            = &(lockData->procs[mystatus->currIdx]);
+               PROCLOCK   *holder;
+               LOCK       *lock;
+               PGPROC     *proc;
+               bool            granted;
+               LOCKMODE        mode;
+               Datum           values[6];
+               char            nulls[6];
+               HeapTuple       tuple;
+               Datum           result;
+
+               holder = &(lockData->holders[mystatus->currIdx]);
+               lock = &(lockData->locks[mystatus->currIdx]);
+               proc = &(lockData->procs[mystatus->currIdx]);
 
                /*
                 * Look to see if there are any held lock modes in this PROCLOCK.
@@ -116,8 +119,8 @@ pg_lock_status(PG_FUNCTION_ARGS)
                }
 
                /*
-                * If no (more) held modes to report, see if PROC is waiting for
-                * lock on this lock.
+                * If no (more) held modes to report, see if PROC is waiting for a
+                * lock on this lock.
                 */
                if (!granted)
                {
@@ -125,6 +128,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
                        {
                                /* Yes, so report it with proper mode */
                                mode = proc->waitLockMode;
+
                                /*
                                 * We are now done with this PROCLOCK, so advance pointer
                                 * to continue with next one on next call.
@@ -134,8 +138,8 @@ pg_lock_status(PG_FUNCTION_ARGS)
                        else
                        {
                                /*
-                                * Okay, we've displayed all the locks associated with this
-                                * PROCLOCK, proceed to the next one.
+                                * Okay, we've displayed all the locks associated with
+                                * this PROCLOCK, proceed to the next one.
                                 */
                                mystatus->currIdx++;
                                continue;
@@ -166,7 +170,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
 
                values[3] = Int32GetDatum(proc->pid);
                values[4] = DirectFunctionCall1(textin,
-                                                                       CStringGetDatum(GetLockmodeName(mode)));
+                                                                CStringGetDatum(GetLockmodeName(mode)));
                values[5] = BoolGetDatum(granted);
 
                tuple = heap_formtuple(funcctx->slot->ttc_tupleDescriptor,
index c121639..e307542 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     PostgreSQL type definitions for MAC addresses.
  *
- *     $Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.25 2002/08/28 20:46:24 momjian Exp $
+ *     $Header: /cvsroot/pgsql/src/backend/utils/adt/mac.c,v 1.26 2002/09/04 20:31:28 momjian Exp $
  */
 
 #include "postgres.h"
@@ -81,7 +81,7 @@ macaddr_out(PG_FUNCTION_ARGS)
        result = (char *) palloc(32);
 
        snprintf(result, 32, "%02x:%02x:%02x:%02x:%02x:%02x",
-                       addr->a, addr->b, addr->c, addr->d, addr->e, addr->f);
+                        addr->a, addr->b, addr->c, addr->d, addr->e, addr->f);
 
        PG_RETURN_CSTRING(result);
 }
index 363b6ca..6b105fd 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.26 2002/09/02 02:47:04 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/misc.c,v 1.27 2002/09/04 20:31:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -119,7 +119,7 @@ userfntest(PG_FUNCTION_ARGS)
 Datum
 current_database(PG_FUNCTION_ARGS)
 {
-       Name   db;
+       Name            db;
 
        db = (Name) palloc(NAMEDATALEN);
 
index d96f544..3b9c3ac 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.98 2002/09/02 02:47:04 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/nabstime.c,v 1.99 2002/09/04 20:31:28 momjian Exp $
  *
  * NOTES
  *
@@ -980,8 +980,10 @@ interval_reltime(PG_FUNCTION_ARGS)
        RelativeTime time;
        int                     year,
                                month;
+
 #ifdef HAVE_INT64_TIMESTAMP
        int64           span;
+
 #else
        double          span;
 #endif
index 41eca44..63ea829 100644 (file)
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.40 2002/08/26 17:53:58 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.41 2002/09/04 20:31:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -51,7 +51,7 @@ namein(PG_FUNCTION_ARGS)
        if ((ermsg = pg_verifymbstr(s, len)))
                elog(ERROR, "%s", ermsg);
 
-       len = pg_mbcliplen(s, len, NAMEDATALEN-1);
+       len = pg_mbcliplen(s, len, NAMEDATALEN - 1);
 
        result = (NameData *) palloc(NAMEDATALEN);
        /* always keep it null-padded */
@@ -240,8 +240,8 @@ session_user(PG_FUNCTION_ARGS)
 Datum
 current_schema(PG_FUNCTION_ARGS)
 {
-       List   *search_path = fetch_search_path(false);
-       char   *nspname;
+       List       *search_path = fetch_search_path(false);
+       char       *nspname;
 
        if (search_path == NIL)
                PG_RETURN_NULL();
@@ -252,18 +252,18 @@ current_schema(PG_FUNCTION_ARGS)
 Datum
 current_schemas(PG_FUNCTION_ARGS)
 {
-       List   *search_path = fetch_search_path(PG_GETARG_BOOL(0));
-       int             nnames = length(search_path);
-       Datum  *names;
-       int             i;
-       ArrayType *array;
+       List       *search_path = fetch_search_path(PG_GETARG_BOOL(0));
+       int                     nnames = length(search_path);
+       Datum      *names;
+       int                     i;
+       ArrayType  *array;
 
        /* +1 here is just to avoid palloc(0) error */
        names = (Datum *) palloc((nnames + 1) * sizeof(Datum));
        i = 0;
        while (search_path)
        {
-               char   *nspname;
+               char       *nspname;
 
                nspname = get_namespace_name((Oid) lfirsti(search_path));
                names[i] = DirectFunctionCall1(namein, CStringGetDatum(nspname));
@@ -273,9 +273,9 @@ current_schemas(PG_FUNCTION_ARGS)
 
        array = construct_array(names, nnames,
                                                        NAMEOID,
-                                                       NAMEDATALEN, /* sizeof(Name) */
-                                                       false, /* Name is not by-val */
-                                                       'i'); /* alignment of Name */
+                                                       NAMEDATALEN,            /* sizeof(Name) */
+                                                       false,          /* Name is not by-val */
+                                                       'i');           /* alignment of Name */
 
        PG_RETURN_POINTER(array);
 }
index 7c6be45..ef29e06 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.31 2002/08/02 18:15:07 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.32 2002/09/04 20:31:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -60,8 +60,8 @@ int4notin(PG_FUNCTION_ARGS)
        nnames = length(names);
        if (nnames < 2)
                elog(ERROR, "int4notin: must provide relationname.attributename");
-       attribute = strVal(nth(nnames-1, names));
-       names = ltruncate(nnames-1, names);
+       attribute = strVal(nth(nnames - 1, names));
+       names = ltruncate(nnames - 1, names);
        relrv = makeRangeVarFromNameList(names);
 
        /* Open the relation and get a relation descriptor */
index acbf0bf..228c43c 100644 (file)
@@ -5,7 +5,7 @@
  *
  *     1998 Jan Wieck
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.52 2002/09/02 02:47:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.53 2002/09/04 20:31:28 momjian Exp $
  *
  * ----------
  */
@@ -152,7 +152,7 @@ static void add_var(NumericVar *var1, NumericVar *var2, NumericVar *result);
 static void sub_var(NumericVar *var1, NumericVar *var2, NumericVar *result);
 static void mul_var(NumericVar *var1, NumericVar *var2, NumericVar *result);
 static void div_var(NumericVar *var1, NumericVar *var2, NumericVar *result);
-static int select_div_scale(NumericVar *var1, NumericVar *var2);
+static int     select_div_scale(NumericVar *var1, NumericVar *var2);
 static void mod_var(NumericVar *var1, NumericVar *var2, NumericVar *result);
 static void ceil_var(NumericVar *var, NumericVar *result);
 static void floor_var(NumericVar *var, NumericVar *result);
@@ -1906,7 +1906,7 @@ numeric_variance(PG_FUNCTION_ARGS)
        }
        else
        {
-               mul_var(&vN, &vNminus1, &vNminus1);     /* N * (N - 1) */
+               mul_var(&vN, &vNminus1, &vNminus1);             /* N * (N - 1) */
                div_dscale = select_div_scale(&vsumX2, &vNminus1);
                div_var(&vsumX2, &vNminus1, &vsumX);    /* variance */
                vsumX.dscale = div_dscale;
@@ -1985,7 +1985,7 @@ numeric_stddev(PG_FUNCTION_ARGS)
        }
        else
        {
-               mul_var(&vN, &vNminus1, &vNminus1); /* N * (N - 1) */
+               mul_var(&vN, &vNminus1, &vNminus1);             /* N * (N - 1) */
                div_dscale = select_div_scale(&vsumX2, &vNminus1);
                div_var(&vsumX2, &vNminus1, &vsumX);    /* variance */
                vsumX.dscale = div_dscale;
index f14c10b..a88330c 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.53 2002/08/27 20:54:47 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/numutils.c,v 1.54 2002/09/04 20:31:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -63,8 +63,8 @@ pg_atoi(char *s, int size, int c)
        errno = 0;
 
        /*
-        * Some versions of strtol treat the empty string as an error, but some
-        * seem not to.  Make an explicit test to be sure we catch it.
+        * Some versions of strtol treat the empty string as an error, but
+        * some seem not to.  Make an explicit test to be sure we catch it.
         */
 
        if (s == (char *) NULL)
index e716047..48453c4 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *     $Header: /cvsroot/pgsql/src/backend/utils/adt/oracle_compat.c,v 1.42 2002/08/29 07:22:27 ishii Exp $
+ *     $Header: /cvsroot/pgsql/src/backend/utils/adt/oracle_compat.c,v 1.43 2002/09/04 20:31:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -850,8 +850,8 @@ repeat(PG_FUNCTION_ARGS)
        /* Check for integer overflow */
        if (slen != 0 && count != 0)
        {
-               int check = count * slen;
-               int check2 = check + VARHDRSZ;
+               int                     check = count * slen;
+               int                     check2 = check + VARHDRSZ;
 
                if ((check / slen) != count || check2 <= check)
                        elog(ERROR, "Requested buffer is too large.");
index 33a7a10..3b61145 100644 (file)
@@ -2,7 +2,7 @@
  *
  * PostgreSQL locale utilities
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_locale.c,v 1.18 2002/08/09 22:52:04 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_locale.c,v 1.19 2002/09/04 20:31:28 momjian Exp $
  *
  * Portions Copyright (c) 2002, PostgreSQL Global Development Group
  *
@@ -20,7 +20,7 @@
  *
  * The other categories, LC_MONETARY, LC_NUMERIC, and LC_TIME are also
  * settable at run-time.  However, we don't actually set those locale
- * categories permanently.  This would have bizzare effects like no
+ * categories permanently.     This would have bizzare effects like no
  * longer accepting standard floating-point literals in some locales.
  * Instead, we only set the locales briefly when needed, cache the
  * required information obtained from localeconv(), and set them back.
@@ -44,10 +44,10 @@ static bool CurrentLocaleConvValid = false;
 
 /* GUC storage area */
 
-char *locale_messages;
-char *locale_monetary;
-char *locale_numeric;
-char *locale_time;
+char      *locale_messages;
+char      *locale_monetary;
+char      *locale_numeric;
+char      *locale_time;
 
 
 /* GUC assign hooks */
@@ -60,7 +60,7 @@ char *locale_time;
 static const char *
 locale_xxx_assign(int category, const char *value, bool doit, bool interactive)
 {
-       char *save;
+       char       *save;
 
        save = setlocale(category, NULL);
        if (!save)
@@ -104,7 +104,10 @@ locale_time_assign(const char *value, bool doit, bool interactive)
 const char *
 locale_messages_assign(const char *value, bool doit, bool interactive)
 {
-       /* LC_MESSAGES category does not exist everywhere, but accept it anyway */
+       /*
+        * LC_MESSAGES category does not exist everywhere, but accept it
+        * anyway
+        */
 #ifdef LC_MESSAGES
        if (doit)
        {
@@ -113,15 +116,15 @@ locale_messages_assign(const char *value, bool doit, bool interactive)
        }
        else
        {
-               char *save;
+               char       *save;
 
                save = setlocale(LC_MESSAGES, NULL);
                if (!save)
                        return NULL;
-               
+
                if (!setlocale(LC_MESSAGES, value))
                        return NULL;
-               
+
                setlocale(LC_MESSAGES, save);
        }
 #endif
@@ -161,7 +164,7 @@ lc_collate_is_c(void)
  * itself.)
  */
 static void
-free_struct_lconv(struct lconv *s)
+free_struct_lconv(struct lconv * s)
 {
        if (s == NULL)
                return;
index 49886fe..c16e590 100644 (file)
@@ -1,7 +1,7 @@
 /* ----------
  * pg_lzcompress.c -
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.14 2001/11/17 06:09:30 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.15 2002/09/04 20:31:28 momjian Exp $
  *
  *             This is an implementation of LZ compression for PostgreSQL.
  *             It uses a simple history table and generates 2-3 byte tags
  * Local definitions
  * ----------
  */
-#define PGLZ_HISTORY_LISTS             8192 /* must be power of 2 */
+#define PGLZ_HISTORY_LISTS             8192    /* must be power of 2 */
 #define PGLZ_HISTORY_MASK              (PGLZ_HISTORY_LISTS - 1)
 #define PGLZ_HISTORY_SIZE              4096
 #define PGLZ_MAX_MATCH                 273
  */
 typedef struct PGLZ_HistEntry
 {
-       struct PGLZ_HistEntry *next; /* links for my hash key's list */
+       struct PGLZ_HistEntry *next;    /* links for my hash key's list */
        struct PGLZ_HistEntry *prev;
        int                     hindex;                 /* my current hash key */
        char       *pos;                        /* my input position */
@@ -418,8 +418,8 @@ pglz_find_match(PGLZ_HistEntry **hstart, char *input, char *end,
                 * the best so far. And if we already have a match of 16 or more
                 * bytes, it's worth the call overhead to use memcmp() to check if
                 * this match is equal for the same size. After that we must
-                * fallback to character by character comparison to know the
-                * exact position where the diff occured.
+                * fallback to character by character comparison to know the exact
+                * position where the diff occured.
                 */
                thislen = 0;
                if (len >= 16)
@@ -559,9 +559,8 @@ pglz_compress(char *source, int32 slen, PGLZ_Header *dest, PGLZ_Strategy *strate
                good_drop = 100;
 
        /*
-        * Initialize the history lists to empty.  We do not need to zero
-        * the hist_entries[] array; its entries are initialized as they
-        * are used.
+        * Initialize the history lists to empty.  We do not need to zero the
+        * hist_entries[] array; its entries are initialized as they are used.
         */
        memset((void *) hist_start, 0, sizeof(hist_start));
 
index 63f585f..b93d738 100644 (file)
@@ -6,7 +6,7 @@
  * A pseudo-type isn't really a type and never has any operations, but
  * we do need to supply input and output functions to satisfy the links
  * in the pseudo-type's entry in pg_type.  In most cases the functions
- * just throw an error if invoked.  (XXX the error messages here cover
+ * just throw an error if invoked.     (XXX the error messages here cover
  * the most common case, but might be confusing in some contexts.  Can
  * we do better?)
  *
@@ -16,7 +16,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/pseudotypes.c,v 1.3 2002/08/26 17:53:58 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/pseudotypes.c,v 1.4 2002/09/04 20:31:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -127,7 +127,7 @@ anyarray_out(PG_FUNCTION_ARGS)
  * void_in             - input routine for pseudo-type VOID.
  *
  * We allow this so that PL functions can return VOID without any special
- * hack in the PL handler.  Whatever value the PL thinks it's returning
+ * hack in the PL handler.     Whatever value the PL thinks it's returning
  * will just be ignored.
  */
 Datum
index 69d00f1..b64d6ed 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.41 2002/06/20 20:29:38 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.42 2002/09/04 20:31:28 momjian Exp $
  *
  *             Alistair Crooks added the code for the regex caching
  *             agc - cached the regular expressions used - there's a good chance
@@ -53,7 +53,7 @@ struct cached_re_str
 static int     rec = 0;                        /* # of cached re's */
 static struct cached_re_str rev[MAX_CACHED_RES];               /* cached re's */
 static unsigned long lru;              /* system lru tag */
-static int pg_lastrec = 0;
+static int     pg_lastrec = 0;
 
 /* attempt to compile `re' as an re, then match it against text */
 /* cflags - flag to regcomp indicates case sensitivity */
@@ -70,9 +70,9 @@ RE_compile_and_execute(text *text_re, char *text, int cflags,
        re = DatumGetCString(DirectFunctionCall1(textout,
                                                                                         PointerGetDatum(text_re)));
 
-       /* Find a previously compiled regular expression.
-        * Run the cache as a ring buffer, starting the search
-        * from the previous match if any.
+       /*
+        * Find a previously compiled regular expression. Run the cache as a
+        * ring buffer, starting the search from the previous match if any.
         */
        i = pg_lastrec;
        while (i < rec)
@@ -92,19 +92,16 @@ RE_compile_and_execute(text *text_re, char *text, int cflags,
                }
                i++;
 
-               /* If we were not at the first slot to start,
-                * then think about wrapping if necessary.
+               /*
+                * If we were not at the first slot to start, then think about
+                * wrapping if necessary.
                 */
                if (pg_lastrec != 0)
                {
                        if (i >= rec)
-                       {
                                i = 0;
-                       }
                        else if (i == pg_lastrec)
-                       {
                                break;
-                       }
                }
        }
 
@@ -119,9 +116,7 @@ RE_compile_and_execute(text *text_re, char *text, int cflags,
                }
        }
        else
-       {
                oldest = rec++;
-       }
 
        /* if there was an old re, then de-allocate the space it used */
        if (rev[oldest].cre_s != (char *) NULL)
@@ -148,6 +143,7 @@ RE_compile_and_execute(text *text_re, char *text, int cflags,
        if (regcomp_result == 0)
        {
                pg_lastrec = oldest;
+
                /*
                 * use malloc/free for the cre_s field because the storage has to
                 * persist across transactions
@@ -329,10 +325,11 @@ textregexsubstr(PG_FUNCTION_ARGS)
        sterm = (char *) palloc(len + 1);
        memcpy(sterm, VARDATA(s), len);
        sterm[len] = '\0';
-       /* We need the match info back from the pattern match
-        * to be able to actually extract the substring.
-        * It seems to be adequate to pass in a structure to return
-        * only one result.
+
+       /*
+        * We need the match info back from the pattern match to be able to
+        * actually extract the substring. It seems to be adequate to pass in
+        * a structure to return only one result.
         */
        match = RE_compile_and_execute(p, sterm, REG_EXTENDED, nmatch, &pmatch);
        pfree(sterm);
@@ -342,8 +339,8 @@ textregexsubstr(PG_FUNCTION_ARGS)
        {
                return (DirectFunctionCall3(text_substr,
                                                                        PointerGetDatum(s),
-                                                                       Int32GetDatum(pmatch.rm_so+1),
-                                                                       Int32GetDatum(pmatch.rm_eo-pmatch.rm_so)));
+                                                                       Int32GetDatum(pmatch.rm_so + 1),
+                                                       Int32GetDatum(pmatch.rm_eo - pmatch.rm_so)));
        }
 
        PG_RETURN_NULL();
index c39d176..22c93c4 100644 (file)
@@ -13,7 +13,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.74 2002/09/02 01:05:06 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.75 2002/09/04 20:31:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,8 +38,8 @@
 #include "utils/syscache.h"
 
 static void parseNameAndArgTypes(const char *string, const char *caller,
-                                                                bool allowNone,
-                                                                List **names, int *nargs, Oid *argtypes);
+                                        bool allowNone,
+                                        List **names, int *nargs, Oid *argtypes);
 
 
 /*****************************************************************************
@@ -87,7 +87,7 @@ regprocin(PG_FUNCTION_ARGS)
 
        /*
         * In bootstrap mode we assume the given name is not schema-qualified,
-        * and just search pg_proc for a unique match.  This is needed for
+        * and just search pg_proc for a unique match.  This is needed for
         * initializing other system catalogs (pg_namespace may not exist yet,
         * and certainly there are no schemas other than pg_catalog).
         */
@@ -96,7 +96,7 @@ regprocin(PG_FUNCTION_ARGS)
                int                     matches = 0;
                Relation        hdesc;
                ScanKeyData skey[1];
-               SysScanDesc     sysscan;
+               SysScanDesc sysscan;
                HeapTuple       tuple;
 
                ScanKeyEntryInitialize(&skey[0], 0x0,
@@ -127,8 +127,8 @@ regprocin(PG_FUNCTION_ARGS)
        }
 
        /*
-        * Normal case: parse the name into components and see if it
-        * matches any pg_proc entries in the current search path.
+        * Normal case: parse the name into components and see if it matches
+        * any pg_proc entries in the current search path.
         */
        names = stringToQualifiedNameList(pro_name_or_oid, "regprocin");
        clist = FuncnameGetCandidates(names, -1);
@@ -175,17 +175,15 @@ regprocout(PG_FUNCTION_ARGS)
                 * output anyway.)
                 */
                if (IsBootstrapProcessingMode())
-               {
                        result = pstrdup(proname);
-               }
                else
                {
                        char       *nspname;
                        FuncCandidateList clist;
 
                        /*
-                        * Would this proc be found (uniquely!) by regprocin?
-                        * If not, qualify it.
+                        * Would this proc be found (uniquely!) by regprocin? If not,
+                        * qualify it.
                         */
                        clist = FuncnameGetCandidates(makeList1(makeString(proname)), -1);
                        if (clist != NULL && clist->next == NULL &&
@@ -250,10 +248,10 @@ regprocedurein(PG_FUNCTION_ARGS)
        }
 
        /*
-        * Else it's a name and arguments.  Parse the name and arguments,
-        * look up potential matches in the current namespace search list,
-        * and scan to see which one exactly matches the given argument
-        * types.  (There will not be more than one match.)
+        * Else it's a name and arguments.  Parse the name and arguments, look
+        * up potential matches in the current namespace search list, and scan
+        * to see which one exactly matches the given argument types.  (There
+        * will not be more than one match.)
         *
         * XXX at present, this code will not work in bootstrap mode, hence this
         * datatype cannot be used for any system column that needs to receive
@@ -308,8 +306,8 @@ format_procedure(Oid procedure_oid)
                initStringInfo(&buf);
 
                /*
-                * Would this proc be found (given the right args) by regprocedurein?
-                * If not, we need to qualify it.
+                * Would this proc be found (given the right args) by
+                * regprocedurein? If not, we need to qualify it.
                 */
                if (FunctionIsVisible(procedure_oid))
                        nspname = NULL;
@@ -320,7 +318,7 @@ format_procedure(Oid procedure_oid)
                                                 quote_qualified_identifier(nspname, proname));
                for (i = 0; i < nargs; i++)
                {
-                       Oid             thisargtype = procform->proargtypes[i];
+                       Oid                     thisargtype = procform->proargtypes[i];
 
                        if (i > 0)
                                appendStringInfoChar(&buf, ',');
@@ -401,7 +399,7 @@ regoperin(PG_FUNCTION_ARGS)
 
        /*
         * In bootstrap mode we assume the given name is not schema-qualified,
-        * and just search pg_operator for a unique match.  This is needed for
+        * and just search pg_operator for a unique match.      This is needed for
         * initializing other system catalogs (pg_namespace may not exist yet,
         * and certainly there are no schemas other than pg_catalog).
         */
@@ -410,7 +408,7 @@ regoperin(PG_FUNCTION_ARGS)
                int                     matches = 0;
                Relation        hdesc;
                ScanKeyData skey[1];
-               SysScanDesc     sysscan;
+               SysScanDesc sysscan;
                HeapTuple       tuple;
 
                ScanKeyEntryInitialize(&skey[0], 0x0,
@@ -441,8 +439,8 @@ regoperin(PG_FUNCTION_ARGS)
        }
 
        /*
-        * Normal case: parse the name into components and see if it
-        * matches any pg_operator entries in the current search path.
+        * Normal case: parse the name into components and see if it matches
+        * any pg_operator entries in the current search path.
         */
        names = stringToQualifiedNameList(opr_name_or_oid, "regoperin");
        clist = OpernameGetCandidates(names, '\0');
@@ -489,16 +487,14 @@ regoperout(PG_FUNCTION_ARGS)
                 * output anyway.)
                 */
                if (IsBootstrapProcessingMode())
-               {
                        result = pstrdup(oprname);
-               }
                else
                {
                        FuncCandidateList clist;
 
                        /*
-                        * Would this oper be found (uniquely!) by regoperin?
-                        * If not, qualify it.
+                        * Would this oper be found (uniquely!) by regoperin? If not,
+                        * qualify it.
                         */
                        clist = OpernameGetCandidates(makeList1(makeString(oprname)),
                                                                                  '\0');
@@ -511,7 +507,7 @@ regoperout(PG_FUNCTION_ARGS)
 
                                nspname = get_namespace_name(operform->oprnamespace);
                                nspname = quote_identifier(nspname);
-                               result = (char *) palloc(strlen(nspname)+strlen(oprname)+2);
+                               result = (char *) palloc(strlen(nspname) + strlen(oprname) + 2);
                                sprintf(result, "%s.%s", nspname, oprname);
                        }
                }
@@ -520,7 +516,10 @@ regoperout(PG_FUNCTION_ARGS)
        }
        else
        {
-               /* If OID doesn't match any pg_operator entry, return it numerically */
+               /*
+                * If OID doesn't match any pg_operator entry, return it
+                * numerically
+                */
                result = (char *) palloc(NAMEDATALEN);
                snprintf(result, NAMEDATALEN, "%u", oprid);
        }
@@ -570,10 +569,10 @@ regoperatorin(PG_FUNCTION_ARGS)
        }
 
        /*
-        * Else it's a name and arguments.  Parse the name and arguments,
-        * look up potential matches in the current namespace search list,
-        * and scan to see which one exactly matches the given argument
-        * types.  (There will not be more than one match.)
+        * Else it's a name and arguments.  Parse the name and arguments, look
+        * up potential matches in the current namespace search list, and scan
+        * to see which one exactly matches the given argument types.  (There
+        * will not be more than one match.)
         *
         * XXX at present, this code will not work in bootstrap mode, hence this
         * datatype cannot be used for any system column that needs to receive
@@ -637,8 +636,8 @@ format_operator(Oid operator_oid)
                initStringInfo(&buf);
 
                /*
-                * Would this oper be found (given the right args) by regoperatorin?
-                * If not, we need to qualify it.
+                * Would this oper be found (given the right args) by
+                * regoperatorin? If not, we need to qualify it.
                 */
                if (!OperatorIsVisible(operator_oid))
                {
@@ -667,7 +666,10 @@ format_operator(Oid operator_oid)
        }
        else
        {
-               /* If OID doesn't match any pg_operator entry, return it numerically */
+               /*
+                * If OID doesn't match any pg_operator entry, return it
+                * numerically
+                */
                result = (char *) palloc(NAMEDATALEN);
                snprintf(result, NAMEDATALEN, "%u", operator_oid);
        }
@@ -715,12 +717,12 @@ regclassin(PG_FUNCTION_ARGS)
        /* Numeric OID? */
        if (class_name_or_oid[0] >= '0' &&
                class_name_or_oid[0] <= '9' &&
-               strspn(class_name_or_oid, "0123456789") == strlen(class_name_or_oid))
+       strspn(class_name_or_oid, "0123456789") == strlen(class_name_or_oid))
        {
                Oid                     searchOid;
 
                searchOid = DatumGetObjectId(DirectFunctionCall1(oidin,
-                                                                         CStringGetDatum(class_name_or_oid)));
+                                                                       CStringGetDatum(class_name_or_oid)));
                result = GetSysCacheOid(RELOID,
                                                                ObjectIdGetDatum(searchOid),
                                                                0, 0, 0);
@@ -741,7 +743,7 @@ regclassin(PG_FUNCTION_ARGS)
        {
                Relation        hdesc;
                ScanKeyData skey[1];
-               SysScanDesc     sysscan;
+               SysScanDesc sysscan;
                HeapTuple       tuple;
 
                ScanKeyEntryInitialize(&skey[0], 0x0,
@@ -767,8 +769,8 @@ regclassin(PG_FUNCTION_ARGS)
        }
 
        /*
-        * Normal case: parse the name into components and see if it
-        * matches any pg_class entries in the current search path.
+        * Normal case: parse the name into components and see if it matches
+        * any pg_class entries in the current search path.
         */
        names = stringToQualifiedNameList(class_name_or_oid, "regclassin");
 
@@ -808,16 +810,14 @@ regclassout(PG_FUNCTION_ARGS)
                 * output anyway.)
                 */
                if (IsBootstrapProcessingMode())
-               {
                        result = pstrdup(classname);
-               }
                else
                {
                        char       *nspname;
 
                        /*
-                        * Would this class be found by regclassin?
-                        * If not, qualify it.
+                        * Would this class be found by regclassin? If not, qualify
+                        * it.
                         */
                        if (RelationIsVisible(classid))
                                nspname = NULL;
@@ -894,7 +894,7 @@ regtypein(PG_FUNCTION_ARGS)
        {
                Relation        hdesc;
                ScanKeyData skey[1];
-               SysScanDesc     sysscan;
+               SysScanDesc sysscan;
                HeapTuple       tuple;
 
                ScanKeyEntryInitialize(&skey[0], 0x0,
@@ -920,8 +920,8 @@ regtypein(PG_FUNCTION_ARGS)
        }
 
        /*
-        * Normal case: invoke the full parser to deal with special cases
-        * such as array syntax.
+        * Normal case: invoke the full parser to deal with special cases such
+        * as array syntax.
         */
        parseTypeString(typ_name_or_oid, &result, &typmod);
 
@@ -964,9 +964,7 @@ regtypeout(PG_FUNCTION_ARGS)
                        result = pstrdup(typname);
                }
                else
-               {
                        result = format_type_be(typid);
-               }
 
                ReleaseSysCache(typetup);
        }
@@ -1003,7 +1001,7 @@ stringToQualifiedNameList(const char *string, const char *caller)
 
        foreach(l, namelist)
        {
-               char   *curname = (char *) lfirst(l);
+               char       *curname = (char *) lfirst(l);
 
                result = lappend(result, makeString(pstrdup(curname)));
        }
@@ -1020,7 +1018,7 @@ stringToQualifiedNameList(const char *string, const char *caller)
 
 /*
  * Given a C string, parse it into a qualified function or operator name
- * followed by a parenthesized list of type names.  Reduce the
+ * followed by a parenthesized list of type names.     Reduce the
  * type names to an array of OIDs (returned into *nargs and *argtypes;
  * the argtypes array should be of size FUNC_MAX_ARGS).  The function or
  * operator name is returned to *names as a List of Strings.
index f6d56d0..d66fe4d 100644 (file)
@@ -17,7 +17,7 @@
  *
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.41 2002/09/02 06:11:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.42 2002/09/04 20:31:28 momjian Exp $
  *
  * ----------
  */
@@ -131,9 +131,9 @@ static void ri_BuildQueryKeyFull(RI_QueryKey *key, Oid constr_id,
                                         Relation fk_rel, Relation pk_rel,
                                         int argc, char **argv);
 static void ri_BuildQueryKeyPkCheck(RI_QueryKey *key, Oid constr_id,
-                                        int32 constr_queryno,
-                                        Relation pk_rel,
-                                        int argc, char **argv);
+                                               int32 constr_queryno,
+                                               Relation pk_rel,
+                                               int argc, char **argv);
 static bool ri_KeysEqual(Relation rel, HeapTuple oldtup, HeapTuple newtup,
                         RI_QueryKey *key, int pairidx);
 static bool ri_AllKeysUnequal(Relation rel, HeapTuple oldtup, HeapTuple newtup,
@@ -141,8 +141,8 @@ static bool ri_AllKeysUnequal(Relation rel, HeapTuple oldtup, HeapTuple newtup,
 static bool ri_OneKeyEqual(Relation rel, int column, HeapTuple oldtup,
                           HeapTuple newtup, RI_QueryKey *key, int pairidx);
 static bool ri_AttributesEqual(Oid typeid, Datum oldvalue, Datum newvalue);
-static bool ri_Check_Pk_Match(Relation pk_rel, HeapTuple old_row, 
-                               Oid tgoid, int match_type, int tgnargs, char **tgargs);
+static bool ri_Check_Pk_Match(Relation pk_rel, HeapTuple old_row,
+                                 Oid tgoid, int match_type, int tgnargs, char **tgargs);
 
 static void ri_InitHashTables(void);
 static void *ri_FetchPreparedPlan(RI_QueryKey *key);
@@ -205,8 +205,8 @@ RI_FKey_check(PG_FUNCTION_ARGS)
         * Get the relation descriptors of the FK and PK tables and the new
         * tuple.
         *
-        * pk_rel is opened in RowShareLock mode since that's what our
-        * eventual SELECT FOR UPDATE will get on it.
+        * pk_rel is opened in RowShareLock mode since that's what our eventual
+        * SELECT FOR UPDATE will get on it.
         */
        fk_rel = trigdata->tg_relation;
        pk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowShareLock);
@@ -223,11 +223,13 @@ RI_FKey_check(PG_FUNCTION_ARGS)
 
        /*
         * We should not even consider checking the row if it is no longer
-        * valid since it was either deleted (doesn't matter) or updated
-        * (in which case it'll be checked with its final values).
+        * valid since it was either deleted (doesn't matter) or updated (in
+        * which case it'll be checked with its final values).
         */
-       if (new_row) {
-               if (!HeapTupleSatisfiesItself(new_row->t_data)) {
+       if (new_row)
+       {
+               if (!HeapTupleSatisfiesItself(new_row->t_data))
+               {
                        heap_close(pk_rel, RowShareLock);
                        return PointerGetDatum(NULL);
                }
@@ -263,7 +265,7 @@ RI_FKey_check(PG_FUNCTION_ARGS)
                         */
                        quoteRelationName(pkrelname, pk_rel);
                        snprintf(querystr, sizeof(querystr), "SELECT 1 FROM ONLY %s x FOR UPDATE OF x",
-                                       pkrelname);
+                                        pkrelname);
 
                        /*
                         * Prepare, save and remember the new plan.
@@ -418,9 +420,9 @@ RI_FKey_check(PG_FUNCTION_ARGS)
                for (i = 0; i < qkey.nkeypairs; i++)
                {
                        quoteOneName(attname,
-                                                tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_PK_IDX]);
+                        tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_PK_IDX]);
                        snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d",
-                                       querysep, attname, i+1);
+                                        querysep, attname, i + 1);
                        querysep = "AND";
                        queryoids[i] = SPI_gettypeid(fk_rel->rd_att,
                                                                         qkey.keypair[i][RI_KEYPAIR_FK_IDX]);
@@ -521,32 +523,36 @@ RI_FKey_check_upd(PG_FUNCTION_ARGS)
 /* ----------
  * ri_Check_Pk_Match
  *
- *     Check for matching value of old pk row in current state for
+ *     Check for matching value of old pk row in current state for
  * noaction triggers. Returns false if no row was found and a fk row
  * could potentially be referencing this row, true otherwise.
  * ----------
  */
 static bool
-ri_Check_Pk_Match(Relation pk_rel, HeapTuple old_row, Oid tgoid, int match_type, int tgnargs, char **tgargs) {
-       void *qplan;
+ri_Check_Pk_Match(Relation pk_rel, HeapTuple old_row, Oid tgoid, int match_type, int tgnargs, char **tgargs)
+{
+       void       *qplan;
        RI_QueryKey qkey;
-       bool isnull;
+       bool            isnull;
        Datum           check_values[RI_MAX_NUMKEYS];
        char            check_nulls[RI_MAX_NUMKEYS + 1];
-       int i;
+       int                     i;
        Oid                     save_uid;
-       bool                    result;
+       bool            result;
+
        save_uid = GetUserId();
 
        ri_BuildQueryKeyPkCheck(&qkey, tgoid,
-                                                RI_PLAN_CHECK_LOOKUPPK, pk_rel,
-                                                tgnargs, tgargs);
+                                                       RI_PLAN_CHECK_LOOKUPPK, pk_rel,
+                                                       tgnargs, tgargs);
 
        switch (ri_NullCheck(pk_rel, old_row, &qkey, RI_KEYPAIR_PK_IDX))
        {
                case RI_KEYS_ALL_NULL:
+
                        /*
-                        * No check - nothing could have been referencing this row anyway.
+                        * No check - nothing could have been referencing this row
+                        * anyway.
                         */
                        return true;
 
@@ -560,10 +566,10 @@ ri_Check_Pk_Match(Relation pk_rel, HeapTuple old_row, Oid tgoid, int match_type,
                        {
                                case RI_MATCH_TYPE_FULL:
                                case RI_MATCH_TYPE_UNSPECIFIED:
-                                       
+
                                        /*
-                                        * MATCH <unspecified>/FULL  - if ANY column is null, we
-                                        * can't be matching to this row already.
+                                        * MATCH <unspecified>/FULL  - if ANY column is null,
+                                        * we can't be matching to this row already.
                                         */
                                        return true;
 
@@ -619,9 +625,9 @@ ri_Check_Pk_Match(Relation pk_rel, HeapTuple old_row, Oid tgoid, int match_type,
                for (i = 0; i < qkey.nkeypairs; i++)
                {
                        quoteOneName(attname,
-                                                tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_PK_IDX]);
+                        tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_PK_IDX]);
                        snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d",
-                                       querysep, attname, i+1);
+                                        querysep, attname, i + 1);
                        querysep = "AND";
                        queryoids[i] = SPI_gettypeid(pk_rel->rd_att,
                                                                         qkey.keypair[i][RI_KEYPAIR_PK_IDX]);
@@ -644,7 +650,7 @@ ri_Check_Pk_Match(Relation pk_rel, HeapTuple old_row, Oid tgoid, int match_type,
        {
                check_values[i] = SPI_getbinval(old_row,
                                                                                pk_rel->rd_att,
-                                                                               qkey.keypair[i][RI_KEYPAIR_PK_IDX],
+                                                                         qkey.keypair[i][RI_KEYPAIR_PK_IDX],
                                                                                &isnull);
                if (isnull)
                        check_nulls[i] = 'n';
@@ -664,7 +670,7 @@ ri_Check_Pk_Match(Relation pk_rel, HeapTuple old_row, Oid tgoid, int match_type,
 
        SetUserId(save_uid);
 
-       result = (SPI_processed!=0);
+       result = (SPI_processed != 0);
 
        if (SPI_finish() != SPI_OK_FINISH)
                elog(WARNING, "SPI_finish() failed in ri_Check_Pk_Match()");
@@ -736,8 +742,8 @@ RI_FKey_noaction_del(PG_FUNCTION_ARGS)
         * Get the relation descriptors of the FK and PK tables and the old
         * tuple.
         *
-        * fk_rel is opened in RowShareLock mode since that's what our
-        * eventual SELECT FOR UPDATE will get on it.
+        * fk_rel is opened in RowShareLock mode since that's what our eventual
+        * SELECT FOR UPDATE will get on it.
         */
        fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowShareLock);
        pk_rel = trigdata->tg_relation;
@@ -745,10 +751,11 @@ RI_FKey_noaction_del(PG_FUNCTION_ARGS)
 
        match_type = ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]);
        if (ri_Check_Pk_Match(pk_rel, old_row, trigdata->tg_trigger->tgoid,
-                       match_type, tgnargs, tgargs)) {
-               /* 
-                * There's either another row, or no row could match this
-                * one.  In either case, we don't need to do the check.
+                                                 match_type, tgnargs, tgargs))
+       {
+               /*
+                * There's either another row, or no row could match this one.  In
+                * either case, we don't need to do the check.
                 */
                heap_close(fk_rel, RowShareLock);
                return PointerGetDatum(NULL);
@@ -800,7 +807,7 @@ RI_FKey_noaction_del(PG_FUNCTION_ARGS)
                        if ((qplan = ri_FetchPreparedPlan(&qkey)) == NULL)
                        {
                                char            querystr[MAX_QUOTED_REL_NAME_LEN + 100 +
-                                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
+                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
                                char            fkrelname[MAX_QUOTED_REL_NAME_LEN];
                                char            attname[MAX_QUOTED_NAME_LEN];
                                const char *querysep;
@@ -823,7 +830,7 @@ RI_FKey_noaction_del(PG_FUNCTION_ARGS)
                                        quoteOneName(attname,
                                                                 tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]);
                                        snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d",
-                                                       querysep, attname, i+1);
+                                                        querysep, attname, i + 1);
                                        querysep = "AND";
                                        queryoids[i] = SPI_gettypeid(pk_rel->rd_att,
                                                                         qkey.keypair[i][RI_KEYPAIR_PK_IDX]);
@@ -959,8 +966,8 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
         * Get the relation descriptors of the FK and PK tables and the new
         * and old tuple.
         *
-        * fk_rel is opened in RowShareLock mode since that's what our
-        * eventual SELECT FOR UPDATE will get on it.
+        * fk_rel is opened in RowShareLock mode since that's what our eventual
+        * SELECT FOR UPDATE will get on it.
         */
        fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowShareLock);
        pk_rel = trigdata->tg_relation;
@@ -969,10 +976,11 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
 
        match_type = ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]);
        if (ri_Check_Pk_Match(pk_rel, old_row, trigdata->tg_trigger->tgoid,
-                       match_type, tgnargs, tgargs)) {
-               /* 
-                * There's either another row, or no row could match this
-                * one.  In either case, we don't need to do the check.
+                                                 match_type, tgnargs, tgargs))
+       {
+               /*
+                * There's either another row, or no row could match this one.  In
+                * either case, we don't need to do the check.
                 */
                heap_close(fk_rel, RowShareLock);
                return PointerGetDatum(NULL);
@@ -1034,7 +1042,7 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
                        if ((qplan = ri_FetchPreparedPlan(&qkey)) == NULL)
                        {
                                char            querystr[MAX_QUOTED_REL_NAME_LEN + 100 +
-                                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
+                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
                                char            fkrelname[MAX_QUOTED_REL_NAME_LEN];
                                char            attname[MAX_QUOTED_NAME_LEN];
                                const char *querysep;
@@ -1057,7 +1065,7 @@ RI_FKey_noaction_upd(PG_FUNCTION_ARGS)
                                        quoteOneName(attname,
                                                                 tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]);
                                        snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d",
-                                                       querysep, attname, i+1);
+                                                        querysep, attname, i + 1);
                                        querysep = "AND";
                                        queryoids[i] = SPI_gettypeid(pk_rel->rd_att,
                                                                         qkey.keypair[i][RI_KEYPAIR_PK_IDX]);
@@ -1241,7 +1249,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
                        if ((qplan = ri_FetchPreparedPlan(&qkey)) == NULL)
                        {
                                char            querystr[MAX_QUOTED_REL_NAME_LEN + 100 +
-                                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
+                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
                                char            fkrelname[MAX_QUOTED_REL_NAME_LEN];
                                char            attname[MAX_QUOTED_NAME_LEN];
                                const char *querysep;
@@ -1264,7 +1272,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
                                        quoteOneName(attname,
                                                                 tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]);
                                        snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d",
-                                                       querysep, attname, i+1);
+                                                        querysep, attname, i + 1);
                                        querysep = "AND";
                                        queryoids[i] = SPI_gettypeid(pk_rel->rd_att,
                                                                         qkey.keypair[i][RI_KEYPAIR_PK_IDX]);
@@ -1455,7 +1463,7 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
                        if ((qplan = ri_FetchPreparedPlan(&qkey)) == NULL)
                        {
                                char            querystr[MAX_QUOTED_REL_NAME_LEN + 100 +
-                                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS * 2];
+                                                                                                (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS * 2];
                                char            qualstr[(MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
                                char            fkrelname[MAX_QUOTED_REL_NAME_LEN];
                                char            attname[MAX_QUOTED_NAME_LEN];
@@ -1483,9 +1491,9 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
                                        quoteOneName(attname,
                                                                 tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]);
                                        snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), "%s %s = $%d",
-                                                       querysep, attname, i+1);
+                                                        querysep, attname, i + 1);
                                        snprintf(qualstr + strlen(qualstr), sizeof(qualstr) - strlen(qualstr), " %s %s = $%d",
-                                                       qualsep, attname, j+1);
+                                                        qualsep, attname, j + 1);
                                        querysep = ",";
                                        qualsep = "AND";
                                        queryoids[i] = SPI_gettypeid(pk_rel->rd_att,
@@ -1628,8 +1636,8 @@ RI_FKey_restrict_del(PG_FUNCTION_ARGS)
         * Get the relation descriptors of the FK and PK tables and the old
         * tuple.
         *
-        * fk_rel is opened in RowShareLock mode since that's what our
-        * eventual SELECT FOR UPDATE will get on it.
+        * fk_rel is opened in RowShareLock mode since that's what our eventual
+        * SELECT FOR UPDATE will get on it.
         */
        fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowShareLock);
        pk_rel = trigdata->tg_relation;
@@ -1682,7 +1690,7 @@ RI_FKey_restrict_del(PG_FUNCTION_ARGS)
                        if ((qplan = ri_FetchPreparedPlan(&qkey)) == NULL)
                        {
                                char            querystr[MAX_QUOTED_REL_NAME_LEN + 100 +
-                                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
+                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
                                char            fkrelname[MAX_QUOTED_REL_NAME_LEN];
                                char            attname[MAX_QUOTED_NAME_LEN];
                                const char *querysep;
@@ -1705,7 +1713,7 @@ RI_FKey_restrict_del(PG_FUNCTION_ARGS)
                                        quoteOneName(attname,
                                                                 tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]);
                                        snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d",
-                                                       querysep, attname, i+1);
+                                                        querysep, attname, i + 1);
                                        querysep = "AND";
                                        queryoids[i] = SPI_gettypeid(pk_rel->rd_att,
                                                                         qkey.keypair[i][RI_KEYPAIR_PK_IDX]);
@@ -1845,8 +1853,8 @@ RI_FKey_restrict_upd(PG_FUNCTION_ARGS)
         * Get the relation descriptors of the FK and PK tables and the new
         * and old tuple.
         *
-        * fk_rel is opened in RowShareLock mode since that's what our
-        * eventual SELECT FOR UPDATE will get on it.
+        * fk_rel is opened in RowShareLock mode since that's what our eventual
+        * SELECT FOR UPDATE will get on it.
         */
        fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowShareLock);
        pk_rel = trigdata->tg_relation;
@@ -1910,7 +1918,7 @@ RI_FKey_restrict_upd(PG_FUNCTION_ARGS)
                        if ((qplan = ri_FetchPreparedPlan(&qkey)) == NULL)
                        {
                                char            querystr[MAX_QUOTED_REL_NAME_LEN + 100 +
-                                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
+                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
                                char            fkrelname[MAX_QUOTED_REL_NAME_LEN];
                                char            attname[MAX_QUOTED_NAME_LEN];
                                const char *querysep;
@@ -1933,7 +1941,7 @@ RI_FKey_restrict_upd(PG_FUNCTION_ARGS)
                                        quoteOneName(attname,
                                                                 tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]);
                                        snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), " %s %s = $%d",
-                                                       querysep, attname, i+1);
+                                                        querysep, attname, i + 1);
                                        querysep = "AND";
                                        queryoids[i] = SPI_gettypeid(pk_rel->rd_att,
                                                                         qkey.keypair[i][RI_KEYPAIR_PK_IDX]);
@@ -2121,7 +2129,7 @@ RI_FKey_setnull_del(PG_FUNCTION_ARGS)
                        if ((qplan = ri_FetchPreparedPlan(&qkey)) == NULL)
                        {
                                char            querystr[MAX_QUOTED_REL_NAME_LEN + 100 +
-                                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS * 2];
+                                                                                                (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS * 2];
                                char            qualstr[(MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
                                char            fkrelname[MAX_QUOTED_REL_NAME_LEN];
                                char            attname[MAX_QUOTED_NAME_LEN];
@@ -2149,9 +2157,9 @@ RI_FKey_setnull_del(PG_FUNCTION_ARGS)
                                        quoteOneName(attname,
                                                                 tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]);
                                        snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), "%s %s = NULL",
-                                                       querysep, attname);
+                                                        querysep, attname);
                                        snprintf(qualstr + strlen(qualstr), sizeof(qualstr) - strlen(qualstr), " %s %s = $%d",
-                                                       qualsep, attname, i+1);
+                                                        qualsep, attname, i + 1);
                                        querysep = ",";
                                        qualsep = "AND";
                                        queryoids[i] = SPI_gettypeid(pk_rel->rd_att,
@@ -2365,7 +2373,7 @@ RI_FKey_setnull_upd(PG_FUNCTION_ARGS)
                                (qplan = ri_FetchPreparedPlan(&qkey)) == NULL)
                        {
                                char            querystr[MAX_QUOTED_REL_NAME_LEN + 100 +
-                                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS * 2];
+                                                                                                (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS * 2];
                                char            qualstr[(MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
                                char            fkrelname[MAX_QUOTED_REL_NAME_LEN];
                                char            attname[MAX_QUOTED_NAME_LEN];
@@ -2392,6 +2400,7 @@ RI_FKey_setnull_upd(PG_FUNCTION_ARGS)
                                {
                                        quoteOneName(attname,
                                                                 tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]);
+
                                        /*
                                         * MATCH <unspecified> - only change columns
                                         * corresponding to changed columns in pk_rel's key
@@ -2401,11 +2410,11 @@ RI_FKey_setnull_upd(PG_FUNCTION_ARGS)
                                                                          RI_KEYPAIR_PK_IDX))
                                        {
                                                snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), "%s %s = NULL",
-                                                               querysep, attname);
+                                                                querysep, attname);
                                                querysep = ",";
                                        }
                                        snprintf(qualstr + strlen(qualstr), sizeof(qualstr) - strlen(qualstr), " %s %s = $%d",
-                                                       qualsep, attname, i+1);
+                                                        qualsep, attname, i + 1);
                                        qualsep = "AND";
                                        queryoids[i] = SPI_gettypeid(pk_rel->rd_att,
                                                                         qkey.keypair[i][RI_KEYPAIR_PK_IDX]);
@@ -2592,7 +2601,7 @@ RI_FKey_setdefault_del(PG_FUNCTION_ARGS)
                         */
                        {
                                char            querystr[MAX_QUOTED_REL_NAME_LEN + 100 +
-                                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS * 2];
+                                                                                                (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS * 2];
                                char            qualstr[(MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
                                char            fkrelname[MAX_QUOTED_REL_NAME_LEN];
                                char            attname[MAX_QUOTED_NAME_LEN];
@@ -2625,9 +2634,9 @@ RI_FKey_setdefault_del(PG_FUNCTION_ARGS)
                                        quoteOneName(attname,
                                                                 tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]);
                                        snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), "%s %s = NULL",
-                                                       querysep, attname);
+                                                        querysep, attname);
                                        snprintf(qualstr + strlen(qualstr), sizeof(qualstr) - strlen(qualstr), " %s %s = $%d",
-                                                       qualsep, attname, i+1);
+                                                        qualsep, attname, i + 1);
                                        querysep = ",";
                                        qualsep = "AND";
                                        queryoids[i] = SPI_gettypeid(pk_rel->rd_att,
@@ -2861,7 +2870,7 @@ RI_FKey_setdefault_upd(PG_FUNCTION_ARGS)
                         */
                        {
                                char            querystr[MAX_QUOTED_REL_NAME_LEN + 100 +
-                                                                       (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS * 2];
+                                                                                                (MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS * 2];
                                char            qualstr[(MAX_QUOTED_NAME_LEN + 32) * RI_MAX_NUMKEYS];
                                char            fkrelname[MAX_QUOTED_REL_NAME_LEN];
                                char            attname[MAX_QUOTED_NAME_LEN];
@@ -2893,6 +2902,7 @@ RI_FKey_setdefault_upd(PG_FUNCTION_ARGS)
                                {
                                        quoteOneName(attname,
                                                                 tgargs[RI_FIRST_ATTNAME_ARGNO + i * 2 + RI_KEYPAIR_FK_IDX]);
+
                                        /*
                                         * MATCH <unspecified> - only change columns
                                         * corresponding to changed columns in pk_rel's key
@@ -2902,11 +2912,11 @@ RI_FKey_setdefault_upd(PG_FUNCTION_ARGS)
                                                                          new_row, &qkey, RI_KEYPAIR_PK_IDX))
                                        {
                                                snprintf(querystr + strlen(querystr), sizeof(querystr) - strlen(querystr), "%s %s = NULL",
-                                                               querysep, attname);
+                                                                querysep, attname);
                                                querysep = ",";
                                        }
                                        snprintf(qualstr + strlen(qualstr), sizeof(qualstr) - strlen(qualstr), " %s %s = $%d",
-                                                       qualsep, attname, i+1);
+                                                        qualsep, attname, i + 1);
                                        qualsep = "AND";
                                        queryoids[i] = SPI_gettypeid(pk_rel->rd_att,
                                                                         qkey.keypair[i][RI_KEYPAIR_PK_IDX]);
@@ -3245,8 +3255,8 @@ ri_BuildQueryKeyFull(RI_QueryKey *key, Oid constr_id, int32 constr_queryno,
  */
 static void
 ri_BuildQueryKeyPkCheck(RI_QueryKey *key, Oid constr_id, int32 constr_queryno,
-                                        Relation pk_rel,
-                                        int argc, char **argv)
+                                               Relation pk_rel,
+                                               int argc, char **argv)
 {
        int                     i;
        int                     j;
@@ -3588,7 +3598,7 @@ ri_AttributesEqual(Oid typeid, Datum oldvalue, Datum newvalue)
                                                                                  typeid, typeid, true);
                if (!OidIsValid(opr_proc))
                        elog(ERROR,
-                                "ri_AttributesEqual(): cannot find '=' operator for type %u",
+                       "ri_AttributesEqual(): cannot find '=' operator for type %u",
                                 typeid);
 
                /*
@@ -3616,4 +3626,3 @@ ri_AttributesEqual(Oid typeid, Datum oldvalue, Datum newvalue)
        return DatumGetBool(FunctionCall2(&(entry->oprfmgrinfo),
                                                                          oldvalue, newvalue));
 }
-
index c7da14a..740dde3 100644 (file)
@@ -3,7 +3,7 @@
  *                             back to source text
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.120 2002/08/31 22:10:46 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.121 2002/09/04 20:31:28 momjian Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -124,29 +124,29 @@ static char *query_getviewrule = "SELECT * FROM pg_catalog.pg_rewrite WHERE ev_c
  */
 static text *pg_do_getviewdef(Oid viewoid);
 static void decompile_column_index_array(Datum column_index_array, Oid relId,
-                                                                                StringInfo buf);
+                                                        StringInfo buf);
 static void make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc);
 static void make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc);
 static void get_query_def(Query *query, StringInfo buf, List *parentnamespace,
-                                                 TupleDesc resultDesc);
+                         TupleDesc resultDesc);
 static void get_select_query_def(Query *query, deparse_context *context,
-                                                                TupleDesc resultDesc);
+                                        TupleDesc resultDesc);
 static void get_insert_query_def(Query *query, deparse_context *context);
 static void get_update_query_def(Query *query, deparse_context *context);
 static void get_delete_query_def(Query *query, deparse_context *context);
 static void get_utility_query_def(Query *query, deparse_context *context);
 static void get_basic_select_query(Query *query, deparse_context *context,
-                                                                  TupleDesc resultDesc);
+                                          TupleDesc resultDesc);
 static void get_setop_query(Node *setOp, Query *query,
-                                                       deparse_context *context,
-                                                       TupleDesc resultDesc);
+                               deparse_context *context,
+                               TupleDesc resultDesc);
 static Node *get_rule_sortgroupclause(SortClause *srt, List *tlist,
                                                 bool force_colno,
                                                 deparse_context *context);
 static void get_names_for_var(Var *var, deparse_context *context,
                                  char **schemaname, char **refname, char **attname);
 static RangeTblEntry *find_rte_by_refname(const char *refname,
-                                                                                 deparse_context *context);
+                                       deparse_context *context);
 static void get_rule_expr(Node *node, deparse_context *context);
 static void get_oper_expr(Expr *expr, deparse_context *context);
 static void get_func_expr(Expr *expr, deparse_context *context);
@@ -159,7 +159,7 @@ static void get_from_clause(Query *query, deparse_context *context);
 static void get_from_clause_item(Node *jtnode, Query *query,
                                         deparse_context *context);
 static void get_from_clause_coldeflist(List *coldeflist,
-                                                                          deparse_context *context);
+                                                  deparse_context *context);
 static void get_opclass_name(Oid opclass, Oid actual_datatype,
                                 StringInfo buf);
 static bool tleIsArrayAssign(TargetEntry *tle);
@@ -284,7 +284,7 @@ pg_get_viewdef_name(PG_FUNCTION_ARGS)
        text       *ruledef;
 
        viewrel = makeRangeVarFromNameList(textToQualifiedNameList(viewname,
-                                                                                                                          "get_viewdef"));
+                                                                                                                "get_viewdef"));
        viewoid = RangeVarGetRelid(viewrel, false);
 
        ruledef = pg_do_getviewdef(viewoid);
@@ -425,8 +425,8 @@ pg_get_indexdef(PG_FUNCTION_ARGS)
        amrec = (Form_pg_am) GETSTRUCT(ht_am);
 
        /*
-        * Start the index definition.  Note that the index's name should never
-        * be schema-qualified, but the indexed rel's name may be.
+        * Start the index definition.  Note that the index's name should
+        * never be schema-qualified, but the indexed rel's name may be.
         */
        initStringInfo(&buf);
        appendStringInfo(&buf, "CREATE %sINDEX %s ON %s USING %s (",
@@ -551,15 +551,15 @@ pg_get_indexdef(PG_FUNCTION_ARGS)
 Datum
 pg_get_constraintdef(PG_FUNCTION_ARGS)
 {
-       Oid                             constraintId = PG_GETARG_OID(0);
-       text               *result;
-       StringInfoData  buf;
-       int                             len;
-       Relation                conDesc;
-       SysScanDesc             conscan;
-       ScanKeyData             skey[1];
-       HeapTuple               tup;
-       Form_pg_constraint      conForm;
+       Oid                     constraintId = PG_GETARG_OID(0);
+       text       *result;
+       StringInfoData buf;
+       int                     len;
+       Relation        conDesc;
+       SysScanDesc conscan;
+       ScanKeyData skey[1];
+       HeapTuple       tup;
+       Form_pg_constraint conForm;
 
        /*
         * Fetch the pg_constraint row.  There's no syscache for pg_constraint
@@ -584,111 +584,111 @@ pg_get_constraintdef(PG_FUNCTION_ARGS)
        switch (conForm->contype)
        {
                case CONSTRAINT_FOREIGN:
-               {
-                       Datum                   val;
-                       bool                    isnull;
-                       const char         *string;
+                       {
+                               Datum           val;
+                               bool            isnull;
+                               const char *string;
 
-                       /* Start off the constraint definition */
-                       appendStringInfo(&buf, "FOREIGN KEY (");
+                               /* Start off the constraint definition */
+                               appendStringInfo(&buf, "FOREIGN KEY (");
 
-                       /* Fetch and build referencing-column list */
-                       val = heap_getattr(tup, Anum_pg_constraint_conkey,
-                                                          RelationGetDescr(conDesc), &isnull);
-                       if (isnull)
-                               elog(ERROR, "pg_get_constraintdef: Null conkey for constraint %u",
-                                        constraintId);
+                               /* Fetch and build referencing-column list */
+                               val = heap_getattr(tup, Anum_pg_constraint_conkey,
+                                                                  RelationGetDescr(conDesc), &isnull);
+                               if (isnull)
+                                       elog(ERROR, "pg_get_constraintdef: Null conkey for constraint %u",
+                                                constraintId);
 
-                       decompile_column_index_array(val, conForm->conrelid, &buf);
+                               decompile_column_index_array(val, conForm->conrelid, &buf);
 
-                       /* add foreign relation name */
-                       appendStringInfo(&buf, ") REFERENCES %s(",
+                               /* add foreign relation name */
+                               appendStringInfo(&buf, ") REFERENCES %s(",
                                                         generate_relation_name(conForm->confrelid));
 
-                       /* Fetch and build referenced-column list */
-                       val = heap_getattr(tup, Anum_pg_constraint_confkey,
-                                                          RelationGetDescr(conDesc), &isnull);
-                       if (isnull)
-                               elog(ERROR, "pg_get_constraintdef: Null confkey for constraint %u",
-                                        constraintId);
+                               /* Fetch and build referenced-column list */
+                               val = heap_getattr(tup, Anum_pg_constraint_confkey,
+                                                                  RelationGetDescr(conDesc), &isnull);
+                               if (isnull)
+                                       elog(ERROR, "pg_get_constraintdef: Null confkey for constraint %u",
+                                                constraintId);
 
-                       decompile_column_index_array(val, conForm->confrelid, &buf);
+                               decompile_column_index_array(val, conForm->confrelid, &buf);
 
-                       appendStringInfo(&buf, ")");
+                               appendStringInfo(&buf, ")");
 
-                       /* Add match type */
-                       switch (conForm->confmatchtype)
-                       {
-                               case FKCONSTR_MATCH_FULL:
-                                       string = " MATCH FULL";
-                                       break;
-                               case FKCONSTR_MATCH_PARTIAL:
-                                       string = " MATCH PARTIAL";
-                                       break;
-                               case FKCONSTR_MATCH_UNSPECIFIED:
-                                       string = "";
-                                       break;
-                               default:
-                                       elog(ERROR, "pg_get_constraintdef: Unknown confmatchtype '%c' for constraint %u",
-                                                conForm->confmatchtype, constraintId);
-                                       string = ""; /* keep compiler quiet */
-                                       break;
-                       }
-                       appendStringInfo(&buf, "%s", string);
+                               /* Add match type */
+                               switch (conForm->confmatchtype)
+                               {
+                                       case FKCONSTR_MATCH_FULL:
+                                               string = " MATCH FULL";
+                                               break;
+                                       case FKCONSTR_MATCH_PARTIAL:
+                                               string = " MATCH PARTIAL";
+                                               break;
+                                       case FKCONSTR_MATCH_UNSPECIFIED:
+                                               string = "";
+                                               break;
+                                       default:
+                                               elog(ERROR, "pg_get_constraintdef: Unknown confmatchtype '%c' for constraint %u",
+                                                        conForm->confmatchtype, constraintId);
+                                               string = "";    /* keep compiler quiet */
+                                               break;
+                               }
+                               appendStringInfo(&buf, "%s", string);
 
-                       /* Add ON UPDATE and ON DELETE clauses */
-                       switch (conForm->confupdtype)
-                       {
-                               case FKCONSTR_ACTION_NOACTION:
-                                       string = "NO ACTION";
-                                       break;
-                               case FKCONSTR_ACTION_RESTRICT:
-                                       string = "RESTRICT";
-                                       break;
-                               case FKCONSTR_ACTION_CASCADE:
-                                       string = "CASCADE";
-                                       break;
-                               case FKCONSTR_ACTION_SETNULL:
-                                       string = "SET NULL";
-                                       break;
-                               case FKCONSTR_ACTION_SETDEFAULT:
-                                       string = "SET DEFAULT";
-                                       break;
-                               default:
-                                       elog(ERROR, "pg_get_constraintdef: Unknown confupdtype '%c' for constraint %u",
-                                                conForm->confupdtype, constraintId);
-                                       string = ""; /* keep compiler quiet */
-                                       break;
-                       }
-                       appendStringInfo(&buf, " ON UPDATE %s", string);
+                               /* Add ON UPDATE and ON DELETE clauses */
+                               switch (conForm->confupdtype)
+                               {
+                                       case FKCONSTR_ACTION_NOACTION:
+                                               string = "NO ACTION";
+                                               break;
+                                       case FKCONSTR_ACTION_RESTRICT:
+                                               string = "RESTRICT";
+                                               break;
+                                       case FKCONSTR_ACTION_CASCADE:
+                                               string = "CASCADE";
+                                               break;
+                                       case FKCONSTR_ACTION_SETNULL:
+                                               string = "SET NULL";
+                                               break;
+                                       case FKCONSTR_ACTION_SETDEFAULT:
+                                               string = "SET DEFAULT";
+                                               break;
+                                       default:
+                                               elog(ERROR, "pg_get_constraintdef: Unknown confupdtype '%c' for constraint %u",
+                                                        conForm->confupdtype, constraintId);
+                                               string = "";    /* keep compiler quiet */
+                                               break;
+                               }
+                               appendStringInfo(&buf, " ON UPDATE %s", string);
 
-                       switch (conForm->confdeltype)
-                       {
-                               case FKCONSTR_ACTION_NOACTION:
-                                       string = "NO ACTION";
-                                       break;
-                               case FKCONSTR_ACTION_RESTRICT:
-                                       string = "RESTRICT";
-                                       break;
-                               case FKCONSTR_ACTION_CASCADE:
-                                       string = "CASCADE";
-                                       break;
-                               case FKCONSTR_ACTION_SETNULL:
-                                       string = "SET NULL";
-                                       break;
-                               case FKCONSTR_ACTION_SETDEFAULT:
-                                       string = "SET DEFAULT";
-                                       break;
-                               default:
-                                       elog(ERROR, "pg_get_constraintdef: Unknown confdeltype '%c' for constraint %u",
-                                                conForm->confdeltype, constraintId);
-                                       string = ""; /* keep compiler quiet */
-                                       break;
-                       }
-                       appendStringInfo(&buf, " ON DELETE %s", string);
+                               switch (conForm->confdeltype)
+                               {
+                                       case FKCONSTR_ACTION_NOACTION:
+                                               string = "NO ACTION";
+                                               break;
+                                       case FKCONSTR_ACTION_RESTRICT:
+                                               string = "RESTRICT";
+                                               break;
+                                       case FKCONSTR_ACTION_CASCADE:
+                                               string = "CASCADE";
+                                               break;
+                                       case FKCONSTR_ACTION_SETNULL:
+                                               string = "SET NULL";
+                                               break;
+                                       case FKCONSTR_ACTION_SETDEFAULT:
+                                               string = "SET DEFAULT";
+                                               break;
+                                       default:
+                                               elog(ERROR, "pg_get_constraintdef: Unknown confdeltype '%c' for constraint %u",
+                                                        conForm->confdeltype, constraintId);
+                                               string = "";    /* keep compiler quiet */
+                                               break;
+                               }
+                               appendStringInfo(&buf, " ON DELETE %s", string);
 
-                       break;
-               }
+                               break;
+                       }
 
                        /*
                         * XXX Add more code here for other contypes
@@ -735,7 +735,7 @@ decompile_column_index_array(Datum column_index_array, Oid relId,
        {
                char       *colName;
 
-               colName = get_attname(relId, DatumGetInt16(keys[j]));
+               colName = get_attname(relId, DatumGetInt16(keys[j]));
 
                if (j == 0)
                        appendStringInfo(buf, "%s",
@@ -875,7 +875,7 @@ deparse_expression(Node *expr, List *dpcontext, bool forceprefix)
  *
  * Given the reference name (alias) and OID of a relation, build deparsing
  * context for an expression referencing only that relation (as varno 1,
- * varlevelsup 0).  This is sufficient for many uses of deparse_expression.
+ * varlevelsup 0).     This is sufficient for many uses of deparse_expression.
  * ----------
  */
 List *
@@ -972,7 +972,7 @@ deparse_context_for_subplan(const char *name, List *tlist,
        foreach(tl, tlist)
        {
                TargetEntry *tle = lfirst(tl);
-               Resdom *resdom = tle->resdom;
+               Resdom     *resdom = tle->resdom;
 
                nattrs++;
                Assert(resdom->resno == nattrs);
@@ -983,13 +983,13 @@ deparse_context_for_subplan(const char *name, List *tlist,
                }
                if (tle->expr && IsA(tle->expr, Var))
                {
-                       Var        *var = (Var *) tle->expr;
+                       Var                *var = (Var *) tle->expr;
 
                        /* varno/varattno won't be any good, but varnoold might be */
                        if (var->varnoold > 0 && var->varnoold <= rtablelength)
                        {
                                RangeTblEntry *varrte = rt_fetch(var->varnoold, rtable);
-                               char *varname;
+                               char       *varname;
 
                                varname = get_rte_attribute_name(varrte, var->varoattno);
                                attrs = lappend(attrs, makeString(varname));
@@ -1001,7 +1001,7 @@ deparse_context_for_subplan(const char *name, List *tlist,
                attrs = lappend(attrs, makeString(pstrdup(buf)));
        }
 
-       rte->rtekind = RTE_SPECIAL;     /* XXX */
+       rte->rtekind = RTE_SPECIAL; /* XXX */
        rte->relid = InvalidOid;
        rte->eref = makeAlias(name, attrs);
        rte->inh = false;
@@ -1127,9 +1127,9 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc)
                query = (Query *) lfirst(actions);
 
                /*
-                * If the action is INSERT...SELECT, OLD/NEW have been pushed
-                * down into the SELECT, and that's what we need to look at.
-                * (Ugly kluge ... try to fix this when we redesign querytrees.)
+                * If the action is INSERT...SELECT, OLD/NEW have been pushed down
+                * into the SELECT, and that's what we need to look at. (Ugly
+                * kluge ... try to fix this when we redesign querytrees.)
                 */
                query = getInsertSelectQuery(query, NULL);
 
@@ -1434,13 +1434,13 @@ get_basic_select_query(Query *query, deparse_context *context,
                get_rule_expr(tle->expr, context);
 
                /*
-                * Figure out what the result column should be called.  In the
+                * Figure out what the result column should be called.  In the
                 * context of a view, use the view's tuple descriptor (so as to
-                * pick up the effects of any column RENAME that's been done on the
-                * view).  Otherwise, just use what we can find in the TLE.
+                * pick up the effects of any column RENAME that's been done on
+                * the view).  Otherwise, just use what we can find in the TLE.
                 */
                if (resultDesc && colno <= resultDesc->natts)
-                       colname = NameStr(resultDesc->attrs[colno-1]->attname);
+                       colname = NameStr(resultDesc->attrs[colno - 1]->attname);
                else
                        colname = tle->resdom->resname;
 
@@ -1751,8 +1751,8 @@ get_utility_query_def(Query *query, deparse_context *context)
                NotifyStmt *stmt = (NotifyStmt *) query->utilityStmt;
 
                appendStringInfo(buf, "NOTIFY %s",
-                                                quote_qualified_identifier(stmt->relation->schemaname,
-                                                                                                       stmt->relation->relname));
+                                  quote_qualified_identifier(stmt->relation->schemaname,
+                                                                                         stmt->relation->relname));
        }
        else
                elog(ERROR, "get_utility_query_def: unexpected statement type");
@@ -1762,7 +1762,7 @@ get_utility_query_def(Query *query, deparse_context *context)
 /*
  * Get the schemaname, refname and attname for a (possibly nonlocal) Var.
  *
- * schemaname is usually returned as NULL.  It will be non-null only if
+ * schemaname is usually returned as NULL.     It will be non-null only if
  * use of the unqualified refname would find the wrong RTE.
  *
  * refname will be returned as NULL if the Var references an unnamed join.
@@ -1813,9 +1813,10 @@ get_names_for_var(Var *var, deparse_context *context,
                if (rte->rtekind == RTE_RELATION)
                {
                        /*
-                        * It's possible that use of the bare refname would find another
-                        * more-closely-nested RTE, or be ambiguous, in which case
-                        * we need to specify the schemaname to avoid these errors.
+                        * It's possible that use of the bare refname would find
+                        * another more-closely-nested RTE, or be ambiguous, in which
+                        * case we need to specify the schemaname to avoid these
+                        * errors.
                         */
                        if (find_rte_by_refname(rte->eref->aliasname, context) != rte)
                                *schemaname =
@@ -1864,7 +1865,7 @@ find_rte_by_refname(const char *refname, deparse_context *context)
                        if (strcmp(rte->eref->aliasname, refname) == 0)
                        {
                                if (result)
-                                       return NULL; /* it's ambiguous */
+                                       return NULL;    /* it's ambiguous */
                                result = rte;
                        }
                }
@@ -1964,8 +1965,8 @@ get_rule_expr(Node *node, deparse_context *context)
                                                Assert(length(args) == 2);
                                                {
                                                        /* binary operator */
-                                                       Node   *arg1 = (Node *) lfirst(args);
-                                                       Node   *arg2 = (Node *) lsecond(args);
+                                                       Node       *arg1 = (Node *) lfirst(args);
+                                                       Node       *arg2 = (Node *) lsecond(args);
 
                                                        get_rule_expr(arg1, context);
                                                        appendStringInfo(buf, " IS DISTINCT FROM ");
@@ -2007,10 +2008,11 @@ get_rule_expr(Node *node, deparse_context *context)
                                                break;
 
                                        case SUBPLAN_EXPR:
+
                                                /*
-                                                * We cannot see an already-planned subplan in rule
-                                                * deparsing, only while EXPLAINing a query plan.
-                                                * For now, just punt.
+                                                * We cannot see an already-planned subplan in
+                                                * rule deparsing, only while EXPLAINing a query
+                                                * plan. For now, just punt.
                                                 */
                                                appendStringInfo(buf, "(subplan)");
                                                break;
@@ -2089,6 +2091,7 @@ get_rule_expr(Node *node, deparse_context *context)
                                ReleaseSysCache(typetup);
                                fieldname = get_relid_attribute_name(typrelid,
                                                                                                         fselect->fieldnum);
+
                                /*
                                 * If the argument is simple enough, we could emit
                                 * arg.fieldname, but most cases where FieldSelect is used
@@ -2108,7 +2111,7 @@ get_rule_expr(Node *node, deparse_context *context)
                                get_rule_expr(relabel->arg, context);
                                appendStringInfo(buf, ")::%s",
                                                        format_type_with_typemod(relabel->resulttype,
-                                                                                                        relabel->resulttypmod));
+                                                                                                relabel->resulttypmod));
                        }
                        break;
 
@@ -2246,8 +2249,8 @@ get_oper_expr(Expr *expr, deparse_context *context)
        if (length(args) == 2)
        {
                /* binary operator */
-               Node   *arg1 = (Node *) lfirst(args);
-               Node   *arg2 = (Node *) lsecond(args);
+               Node       *arg1 = (Node *) lfirst(args);
+               Node       *arg2 = (Node *) lsecond(args);
 
                get_rule_expr(arg1, context);
                appendStringInfo(buf, " %s ",
@@ -2332,9 +2335,9 @@ get_func_expr(Expr *expr, deparse_context *context)
                /*
                 * Show typename with appropriate length decoration. Note that
                 * since exprIsLengthCoercion succeeded, the function's output
-                * type is the right thing to report.  Also note we don't need
-                * to quote the result of format_type_with_typemod: it takes
-                * care of double-quoting any identifier that needs it.
+                * type is the right thing to report.  Also note we don't need to
+                * quote the result of format_type_with_typemod: it takes care of
+                * double-quoting any identifier that needs it.
                 */
                typdesc = format_type_with_typemod(rettype, coercedTypmod);
                appendStringInfo(buf, ")::%s", typdesc);
@@ -2344,8 +2347,8 @@ get_func_expr(Expr *expr, deparse_context *context)
        }
 
        /*
-        * Normal function: display as proname(args).  First we need to extract
-        * the argument datatypes.
+        * Normal function: display as proname(args).  First we need to
+        * extract the argument datatypes.
         */
        nargs = 0;
        foreach(l, expr->args)
@@ -2354,7 +2357,7 @@ get_func_expr(Expr *expr, deparse_context *context)
                argtypes[nargs] = exprType((Node *) lfirst(l));
                nargs++;
        }
-       
+
        appendStringInfo(buf, "%s(",
                                         generate_function_name(funcoid, nargs, argtypes));
 
@@ -2378,7 +2381,7 @@ get_agg_expr(Aggref *aggref, deparse_context *context)
        Oid                     argtype = exprType(aggref->target);
 
        appendStringInfo(buf, "%s(%s",
-                                        generate_function_name(aggref->aggfnoid, 1, &argtype),
+                                  generate_function_name(aggref->aggfnoid, 1, &argtype),
                                         aggref->aggdistinct ? "DISTINCT " : "");
        if (aggref->aggstar)
                appendStringInfo(buf, "*");
@@ -2438,8 +2441,8 @@ strip_type_coercion(Node *expr, Oid resultType)
                }
                /* See if function has is actually declared as a cast */
                castTuple = SearchSysCache(CASTSOURCETARGET,
-                                                                  ObjectIdGetDatum(procStruct->proargtypes[0]),
-                                                                  ObjectIdGetDatum(procStruct->prorettype),
+                                                       ObjectIdGetDatum(procStruct->proargtypes[0]),
+                                                               ObjectIdGetDatum(procStruct->prorettype),
                                                                   0, 0);
                if (!HeapTupleIsValid(castTuple))
                {
@@ -2519,11 +2522,11 @@ get_const_expr(Const *constval, deparse_context *context)
        if (constval->constisnull)
        {
                /*
-                * Always label the type of a NULL constant to prevent misdecisions
-                * about type when reparsing.
+                * Always label the type of a NULL constant to prevent
+                * misdecisions about type when reparsing.
                 */
                appendStringInfo(buf, "NULL::%s",
-                                                format_type_with_typemod(constval->consttype, -1));
+                                         format_type_with_typemod(constval->consttype, -1));
                return;
        }
 
@@ -2549,23 +2552,23 @@ get_const_expr(Const *constval, deparse_context *context)
                case FLOAT4OID:
                case FLOAT8OID:
                case NUMERICOID:
-               {
-                       /*
-                        * These types are printed without quotes unless they
-                        * contain values that aren't accepted by the scanner
-                        * unquoted (e.g., 'NaN').  Note that strtod() and friends
-                        * might accept NaN, so we can't use that to test.
-                        *
-                        * In reality we only need to defend against infinity and
-                        * NaN, so we need not get too crazy about pattern
-                        * matching here.
-                        */
-                       if (strspn(extval, "0123456789 +-eE.") == strlen(extval))
-                               appendStringInfo(buf, extval);
-                       else
-                               appendStringInfo(buf, "'%s'", extval);
-               }
-               break;
+                       {
+                               /*
+                                * These types are printed without quotes unless they
+                                * contain values that aren't accepted by the scanner
+                                * unquoted (e.g., 'NaN').      Note that strtod() and friends
+                                * might accept NaN, so we can't use that to test.
+                                *
+                                * In reality we only need to defend against infinity and
+                                * NaN, so we need not get too crazy about pattern
+                                * matching here.
+                                */
+                               if (strspn(extval, "0123456789 +-eE.") == strlen(extval))
+                                       appendStringInfo(buf, extval);
+                               else
+                                       appendStringInfo(buf, "'%s'", extval);
+                       }
+                       break;
 
                case BITOID:
                case VARBITOID:
@@ -2573,13 +2576,14 @@ get_const_expr(Const *constval, deparse_context *context)
                        break;
 
                case BOOLOID:
-                       if (strcmp(extval, "t")==0)
+                       if (strcmp(extval, "t") == 0)
                                appendStringInfo(buf, "true");
                        else
                                appendStringInfo(buf, "false");
                        break;
 
                default:
+
                        /*
                         * We must quote any funny characters in the constant's
                         * representation. XXX Any MULTIBYTE considerations here?
@@ -2665,9 +2669,10 @@ get_sublink_expr(Node *node, deparse_context *context)
 
        /*
         * XXX we assume here that we can get away without qualifying the
-        * operator name.  Since the name may imply multiple physical operators
-        * it's rather difficult to do otherwise --- in fact, if the operators
-        * are in different namespaces any attempt to qualify would surely fail.
+        * operator name.  Since the name may imply multiple physical
+        * operators it's rather difficult to do otherwise --- in fact, if the
+        * operators are in different namespaces any attempt to qualify would
+        * surely fail.
         */
        switch (sublink->subLinkType)
        {
@@ -2812,13 +2817,13 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
                        }
                }
                else if (rte->rtekind == RTE_RELATION &&
-                                strcmp(rte->eref->aliasname, get_rel_name(rte->relid)) != 0)
+                        strcmp(rte->eref->aliasname, get_rel_name(rte->relid)) != 0)
                {
                        /*
-                        * Apparently the rel has been renamed since the rule was made.
-                        * Emit a fake alias clause so that variable references will
-                        * still work.  This is not a 100% solution but should work in
-                        * most reasonable situations.
+                        * Apparently the rel has been renamed since the rule was
+                        * made. Emit a fake alias clause so that variable references
+                        * will still work.  This is not a 100% solution but should
+                        * work in most reasonable situations.
                         */
                        appendStringInfo(buf, " %s",
                                                         quote_identifier(rte->eref->aliasname));
@@ -2981,7 +2986,7 @@ get_opclass_name(Oid opclass, Oid actual_datatype,
        opcrec = (Form_pg_opclass) GETSTRUCT(ht_opc);
        if (actual_datatype != opcrec->opcintype || !opcrec->opcdefault)
        {
-               /* Okay, we need the opclass name.  Do we need to qualify it? */
+               /* Okay, we need the opclass name.      Do we need to qualify it? */
                opcname = NameStr(opcrec->opcname);
                if (OpclassIsVisible(opclass))
                        appendStringInfo(buf, " %s", quote_identifier(opcname));
@@ -3031,9 +3036,10 @@ const char *
 quote_identifier(const char *ident)
 {
        /*
-        * Can avoid quoting if ident starts with a lowercase letter or underscore
-        * and contains only lowercase letters, digits, and underscores, *and* is
-        * not any SQL keyword.  Otherwise, supply quotes.
+        * Can avoid quoting if ident starts with a lowercase letter or
+        * underscore and contains only lowercase letters, digits, and
+        * underscores, *and* is not any SQL keyword.  Otherwise, supply
+        * quotes.
         */
        int                     nquotes = 0;
        bool            safe;
@@ -3187,8 +3193,8 @@ generate_function_name(Oid funcid, int nargs, Oid *argtypes)
 
        /*
         * The idea here is to schema-qualify only if the parser would fail to
-        * resolve the correct function given the unqualified func name
-        * with the specified argtypes.
+        * resolve the correct function given the unqualified func name with
+        * the specified argtypes.
         */
        p_result = func_get_detail(makeList1(makeString(proname)),
                                                           NIL, nargs, argtypes,
@@ -3239,8 +3245,8 @@ generate_operator_name(Oid operid, Oid arg1, Oid arg2)
 
        /*
         * The idea here is to schema-qualify only if the parser would fail to
-        * resolve the correct operator given the unqualified op name
-        * with the specified argtypes.
+        * resolve the correct operator given the unqualified op name with the
+        * specified argtypes.
         */
        switch (operform->oprkind)
        {
index 44037b1..c5a7b33 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.116 2002/09/03 21:45:42 petere Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.117 2002/09/04 20:31:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -855,9 +855,12 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype)
                return 0.0;
        constval = ((Const *) other)->constvalue;
 
-       /* the right-hand const is type text or bytea for all supported operators */
+       /*
+        * the right-hand const is type text or bytea for all supported
+        * operators
+        */
        Assert(((Const *) other)->consttype == TEXTOID ||
-                               ((Const *) other)->consttype == BYTEAOID);
+                  ((Const *) other)->consttype == BYTEAOID);
 
        /* divide pattern into fixed prefix and remainder */
        patt = (Const *) other;
@@ -1860,11 +1863,12 @@ get_var_maximum(Query *root, Var *var, Oid sortop, Datum *max)
        get_typlenbyval(var->vartype, &typLen, &typByVal);
 
        /*
-        * If there is a histogram, grab the last or first value as appropriate.
+        * If there is a histogram, grab the last or first value as
+        * appropriate.
         *
-        * If there is a histogram that is sorted with some other operator
-        * than the one we want, fail --- this suggests that there is data
-        * we can't use.
+        * If there is a histogram that is sorted with some other operator than
+        * the one we want, fail --- this suggests that there is data we can't
+        * use.
         */
        if (get_attstatsslot(statsTuple, var->vartype, var->vartypmod,
                                                 STATISTIC_KIND_HISTOGRAM, sortop,
@@ -1873,14 +1877,14 @@ get_var_maximum(Query *root, Var *var, Oid sortop, Datum *max)
        {
                if (nvalues > 0)
                {
-                       tmax = datumCopy(values[nvalues-1], typByVal, typLen);
+                       tmax = datumCopy(values[nvalues - 1], typByVal, typLen);
                        have_max = true;
                }
                free_attstatsslot(var->vartype, values, nvalues, NULL, 0);
        }
        else
        {
-               Oid             rsortop = get_commutator(sortop);
+               Oid                     rsortop = get_commutator(sortop);
 
                if (OidIsValid(rsortop) &&
                        get_attstatsslot(statsTuple, var->vartype, var->vartypmod,
@@ -1907,8 +1911,8 @@ get_var_maximum(Query *root, Var *var, Oid sortop, Datum *max)
        }
 
        /*
-        * If we have most-common-values info, look for a large MCV.  This
-        * is needed even if we also have a histogram, since the histogram
+        * If we have most-common-values info, look for a large MCV.  This is
+        * needed even if we also have a histogram, since the histogram
         * excludes the MCVs.  However, usually the MCVs will not be the
         * extreme values, so avoid unnecessary data copying.
         */
@@ -1917,7 +1921,7 @@ get_var_maximum(Query *root, Var *var, Oid sortop, Datum *max)
                                                 &values, &nvalues,
                                                 NULL, NULL))
        {
-               bool    large_mcv = false;
+               bool            large_mcv = false;
                FmgrInfo        opproc;
 
                fmgr_info(get_opcode(sortop), &opproc);
@@ -2724,7 +2728,7 @@ like_fixed_prefix(Const *patt_const, bool case_insensitive,
                patt = DatumGetCString(DirectFunctionCall1(byteaout, patt_const->constvalue));
                pattlen = toast_raw_datum_size(patt_const->constvalue) - VARHDRSZ;
        }
-       
+
        prefix = match = palloc(pattlen + 1);
        match_pos = 0;
 
@@ -2760,8 +2764,8 @@ like_fixed_prefix(Const *patt_const, bool case_insensitive,
        match[match_pos] = '\0';
        rest = &patt[pos];
 
-   *prefix_const = string_to_const(prefix, typeid);
-   *rest_const = string_to_const(rest, typeid);
+       *prefix_const = string_to_const(prefix, typeid);
+       *rest_const = string_to_const(rest, typeid);
 
        pfree(patt);
        pfree(match);
@@ -2807,8 +2811,8 @@ regex_fixed_prefix(Const *patt_const, bool case_insensitive,
        {
                rest = patt;
 
-          *prefix_const = NULL;
-          *rest_const = string_to_const(rest, typeid);
+               *prefix_const = NULL;
+               *rest_const = string_to_const(rest, typeid);
 
                return Pattern_Prefix_None;
        }
@@ -2824,8 +2828,8 @@ regex_fixed_prefix(Const *patt_const, bool case_insensitive,
                {
                        rest = patt;
 
-                  *prefix_const = NULL;
-                  *rest_const = string_to_const(rest, typeid);
+                       *prefix_const = NULL;
+                       *rest_const = string_to_const(rest, typeid);
 
                        return Pattern_Prefix_None;
                }
@@ -2898,14 +2902,14 @@ regex_fixed_prefix(Const *patt_const, bool case_insensitive,
        {
                rest = &patt[pos + 1];
 
-          *prefix_const = string_to_const(prefix, typeid);
-          *rest_const = string_to_const(rest, typeid);
+               *prefix_const = string_to_const(prefix, typeid);
+               *rest_const = string_to_const(rest, typeid);
 
                return Pattern_Prefix_Exact;    /* pattern specifies exact match */
        }
 
-   *prefix_const = string_to_const(prefix, typeid);
-   *rest_const = string_to_const(rest, typeid);
+       *prefix_const = string_to_const(prefix, typeid);
+       *rest_const = string_to_const(rest, typeid);
 
        pfree(patt);
        pfree(match);
@@ -3279,7 +3283,7 @@ pattern_selectivity(Const *patt, Pattern_Type ptype)
  * we must be able to generate another string "fop" that is greater
  * than all strings "foobar" starting with "foo".  Unfortunately, a
  * non-C locale may have arbitrary collation rules in which "fop" >
- * "foo" is not sufficient to ensure "fop" > "foobar".  Until we can
+ * "foo" is not sufficient to ensure "fop" > "foobar". Until we can
  * come up with a more bulletproof way of generating the upper-bound
  * string, the optimization is disabled in all non-C locales.
  *
@@ -3356,8 +3360,8 @@ make_greater_string(const Const *str_const)
                        (*lastchar)++;
                        if (string_lessthan(str, workstr, datatype))
                        {
-                                /* Success! */
-                               Const *workstr_const = string_to_const(workstr, datatype);
+                               /* Success! */
+                               Const      *workstr_const = string_to_const(workstr, datatype);
 
                                pfree(str);
                                pfree(workstr);
@@ -3372,7 +3376,7 @@ make_greater_string(const Const *str_const)
                if (datatype != BYTEAOID && pg_database_encoding_max_length() > 1)
                        len = pg_mbcliplen((const unsigned char *) workstr, len, len - 1);
                else
-                       len -= - 1;
+                       len -= -1;
 
                if (datatype != BYTEAOID)
                        workstr[len] = '\0';
index 321b9c6..3c4838c 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.53 2002/09/02 01:05:06 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.54 2002/09/04 20:31:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -54,19 +54,19 @@ SetDefine(char *querystr, Oid elemType)
        char            repl[Natts_pg_proc];
 
        setoid = ProcedureCreate(procname,      /* changed below, after oid known */
-                                                        PG_CATALOG_NAMESPACE, /* XXX wrong */
+                                                        PG_CATALOG_NAMESPACE,          /* XXX wrong */
                                                         false,         /* don't replace */
                                                         true,          /* returnsSet */
                                                         elemType,      /* returnType */
-                                                        SQLlanguageId, /* language */
+                                                        SQLlanguageId,         /* language */
                                                         F_FMGR_SQL_VALIDATOR,
                                                         querystr,      /* prosrc */
                                                         fileName,      /* probin */
                                                         false,         /* not aggregate */
                                                         false,         /* security invoker */
                                                         false,         /* isStrict (irrelevant, no args) */
-                                                        PROVOLATILE_VOLATILE,  /* assume unsafe */
-                                                        0,                     /* parameterCount */
+                                                        PROVOLATILE_VOLATILE,          /* assume unsafe */
+                                                        0, /* parameterCount */
                                                         NULL);         /* parameterTypes */
 
        /*
index d90c20a..4940008 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.35 2002/08/29 00:17:05 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.36 2002/09/04 20:31:29 momjian Exp $
  *
  * NOTES
  *       input routine largely stolen from boxin().
@@ -154,14 +154,16 @@ setLastTid(const ItemPointer tid)
  *             correspond to the CTID of a base relation.
  */
 static Datum
-currtid_for_view(Relation viewrel, ItemPointer tid) 
+currtid_for_view(Relation viewrel, ItemPointer tid)
 {
        TupleDesc       att = RelationGetDescr(viewrel);
-       RuleLock        *rulelock;
-       RewriteRule     *rewrite;
-       int     i, natts = att->natts, tididx = -1;
+       RuleLock   *rulelock;
+       RewriteRule *rewrite;
+       int                     i,
+                               natts = att->natts,
+                               tididx = -1;
 
-       for (i = 0; i < natts ; i++)
+       for (i = 0; i < natts; i++)
        {
                if (strcasecmp(NameStr(att->attrs[i]->attname), "ctid") == 0)
                {
@@ -179,7 +181,7 @@ currtid_for_view(Relation viewrel, ItemPointer tid)
                rewrite = rulelock->rules[i];
                if (rewrite->event == CMD_SELECT)
                {
-                       Query   *query;
+                       Query      *query;
                        TargetEntry *tle;
 
                        if (length(rewrite->actions) != 1)
@@ -188,8 +190,9 @@ currtid_for_view(Relation viewrel, ItemPointer tid)
                        tle = (TargetEntry *) nth(tididx, query->targetList);
                        if (tle && tle->expr && nodeTag(tle->expr) == T_Var)
                        {
-                               Var *var = (Var *) tle->expr;
+                               Var                *var = (Var *) tle->expr;
                                RangeTblEntry *rte;
+
                                if (var->varno > 0 && var->varno < INNER && var->varattno == SelfItemPointerAttributeNumber)
                                {
                                        rte = (RangeTblEntry *) nth(var->varno - 1, query->rtable);
@@ -244,7 +247,7 @@ currtid_byrelname(PG_FUNCTION_ARGS)
        Relation        rel;
 
        relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname,
-                                                                                                               "currtid_byrelname"));
+                                                                                                  "currtid_byrelname"));
        rel = heap_openrv(relrv, AccessShareLock);
        if (rel->rd_rel->relkind == RELKIND_VIEW)
                return currtid_for_view(rel, tid);
index a381fd4..bfdb7d0 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.72 2002/09/03 22:55:54 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.73 2002/09/04 20:31:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,6 +31,7 @@
 
 #ifdef HAVE_INT64_TIMESTAMP
 static int64 time2t(const int hour, const int min, const int sec, const fsec_t fsec);
+
 #else
 static double time2t(const int hour, const int min, const int sec, const fsec_t fsec);
 #endif
@@ -155,7 +156,7 @@ static void
 AdjustTimestampForTypmod(Timestamp *time, int32 typmod)
 {
 #ifdef HAVE_INT64_TIMESTAMP
-       static const int64 TimestampScales[MAX_TIMESTAMP_PRECISION+1] = {
+       static const int64 TimestampScales[MAX_TIMESTAMP_PRECISION + 1] = {
                INT64CONST(1000000),
                INT64CONST(100000),
                INT64CONST(10000),
@@ -165,7 +166,7 @@ AdjustTimestampForTypmod(Timestamp *time, int32 typmod)
                INT64CONST(1)
        };
 
-       static const int64 TimestampOffsets[MAX_TIMESTAMP_PRECISION+1] = {
+       static const int64 TimestampOffsets[MAX_TIMESTAMP_PRECISION + 1] = {
                INT64CONST(-500000),
                INT64CONST(-50000),
                INT64CONST(-5000),
@@ -174,8 +175,9 @@ AdjustTimestampForTypmod(Timestamp *time, int32 typmod)
                INT64CONST(-5),
                INT64CONST(0)
        };
+
 #else
-       static const double TimestampScales[MAX_TIMESTAMP_PRECISION+1] = {
+       static const double TimestampScales[MAX_TIMESTAMP_PRECISION + 1] = {
                1,
                10,
                100,
@@ -185,7 +187,7 @@ AdjustTimestampForTypmod(Timestamp *time, int32 typmod)
                1000000
        };
 
-       static const double TimestampOffsets[MAX_TIMESTAMP_PRECISION+1] = {
+       static const double TimestampOffsets[MAX_TIMESTAMP_PRECISION + 1] = {
                0.5,
                0.05,
                0.005,
@@ -224,7 +226,10 @@ AdjustTimestampForTypmod(Timestamp *time, int32 typmod)
                }
                else
                {
-                       /* Scale and truncate first, then add to help the rounding behavior */
+                       /*
+                        * Scale and truncate first, then add to help the rounding
+                        * behavior
+                        */
                        *time = (rint((((double) *time) * TimestampScales[typmod]) + TimestampOffsets[typmod])
                                         / TimestampScales[typmod]);
                }
@@ -450,7 +455,7 @@ static void
 AdjustIntervalForTypmod(Interval *interval, int32 typmod)
 {
 #ifdef HAVE_INT64_TIMESTAMP
-       static const int64 IntervalScales[MAX_INTERVAL_PRECISION+1] = {
+       static const int64 IntervalScales[MAX_INTERVAL_PRECISION + 1] = {
                INT64CONST(1000000),
                INT64CONST(100000),
                INT64CONST(10000),
@@ -460,7 +465,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
                INT64CONST(1)
        };
 
-       static const int64 IntervalOffsets[MAX_INTERVAL_PRECISION+1] = {
+       static const int64 IntervalOffsets[MAX_INTERVAL_PRECISION + 1] = {
                INT64CONST(-500000),
                INT64CONST(-50000),
                INT64CONST(-5000),
@@ -469,8 +474,9 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
                INT64CONST(-5),
                INT64CONST(0)
        };
+
 #else
-       static const double IntervalScales[MAX_INTERVAL_PRECISION+1] = {
+       static const double IntervalScales[MAX_INTERVAL_PRECISION + 1] = {
                1,
                10,
                100,
@@ -480,7 +486,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
                1000000
        };
 
-       static const double IntervalOffsets[MAX_INTERVAL_PRECISION+1] = {
+       static const double IntervalOffsets[MAX_INTERVAL_PRECISION + 1] = {
                0.5,
                0.05,
                0.005,
@@ -491,7 +497,8 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
        };
 #endif
 
-       /* Unspecified range and precision? Then not necessary to adjust.
+       /*
+        * Unspecified range and precision? Then not necessary to adjust.
         * Setting typmod to -1 is the convention for all types.
         */
        if (typmod != -1)
@@ -515,9 +522,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
                }
                /* YEAR TO MONTH */
                else if (range == (INTERVAL_MASK(YEAR) | INTERVAL_MASK(MONTH)))
-               {
                        interval->time = 0;
-               }
                else if (range == INTERVAL_MASK(DAY))
                {
                        interval->month = 0;
@@ -532,6 +537,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
                {
 #ifdef HAVE_INT64_TIMESTAMP
                        int64           day;
+
 #else
                        double          day;
 #endif
@@ -551,6 +557,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
                {
 #ifdef HAVE_INT64_TIMESTAMP
                        int64           hour;
+
 #else
                        double          hour;
 #endif
@@ -570,6 +577,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
                {
 #ifdef HAVE_INT64_TIMESTAMP
                        int64           minute;
+
 #else
                        double          minute;
 #endif
@@ -613,15 +621,14 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
                                                   INTERVAL_MASK(HOUR) |
                                                   INTERVAL_MASK(MINUTE) |
                                                   INTERVAL_MASK(SECOND)))
-               {
                        interval->month = 0;
-               }
                /* HOUR TO MINUTE */
                else if (range == (INTERVAL_MASK(HOUR) |
                                                   INTERVAL_MASK(MINUTE)))
                {
 #ifdef HAVE_INT64_TIMESTAMP
                        int64           day;
+
 #else
                        double          day;
 #endif
@@ -644,6 +651,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
                {
 #ifdef HAVE_INT64_TIMESTAMP
                        int64           day;
+
 #else
                        double          day;
 #endif
@@ -662,6 +670,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
                {
 #ifdef HAVE_INT64_TIMESTAMP
                        int64           hour;
+
 #else
                        double          hour;
 #endif
@@ -706,7 +715,7 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod)
                        else
                        {
                                interval->time = (rint((((double) interval->time) + IntervalOffsets[precision])
-                                                                          * IntervalScales[precision]) / IntervalScales[precision]);
+                               * IntervalScales[precision]) / IntervalScales[precision]);
                        }
 #endif
                }
@@ -756,6 +765,7 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
 {
 #ifdef HAVE_INT64_TIMESTAMP
        int64           time;
+
 #else
        double          time;
 #endif
@@ -794,18 +804,19 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
  *     local time zone. If out of this range, leave as GMT. - tgl 97/05/27
  */
 int
-timestamp2tm(Timestamp dt, int *tzp, struct tm *tm, fsec_t *fsec, char **tzn)
+timestamp2tm(Timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, char **tzn)
 {
 #ifdef HAVE_INT64_TIMESTAMP
-       int             date,
-                       date0;
-       int64   time;
+       int                     date,
+                               date0;
+       int64           time;
+
 #else
-       double  date,
-                       date0;
-       double  time;
+       double          date,
+                               date0;
+       double          time;
 #endif
-       time_t  utime;
+       time_t          utime;
 
 #if defined(HAVE_TM_ZONE) || defined(HAVE_INT_TIMEZONE)
        struct tm  *tx;
@@ -880,7 +891,7 @@ timestamp2tm(Timestamp dt, int *tzp, struct tm *tm, fsec_t *fsec, char **tzn)
                {
 #ifdef HAVE_INT64_TIMESTAMP
                        utime = ((dt / INT64CONST(1000000))
-                                        + ((date0 - date2j(1970, 1, 1)) * INT64CONST(86400)));
+                                  + ((date0 - date2j(1970, 1, 1)) * INT64CONST(86400)));
 #else
                        utime = (dt + ((date0 - date2j(1970, 1, 1)) * 86400));
 #endif
@@ -963,8 +974,9 @@ int
 tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, Timestamp *result)
 {
 #ifdef HAVE_INT64_TIMESTAMP
-       int             date;
-       int64   time;
+       int                     date;
+       int64           time;
+
 #else
        double          date,
                                time;
@@ -996,6 +1008,7 @@ interval2tm(Interval span, struct tm * tm, fsec_t *fsec)
 {
 #ifdef HAVE_INT64_TIMESTAMP
        int64           time;
+
 #else
        double          time;
 #endif
@@ -1040,9 +1053,9 @@ tm2interval(struct tm * tm, fsec_t fsec, Interval *span)
        span->month = ((tm->tm_year * 12) + tm->tm_mon);
 #ifdef HAVE_INT64_TIMESTAMP
        span->time = ((((((((tm->tm_mday * INT64CONST(24))
-                                         + tm->tm_hour) * INT64CONST(60))
-                                       + tm->tm_min) * INT64CONST(60))
-                                 + tm->tm_sec) * INT64CONST(1000000)) + fsec);
+                                               + tm->tm_hour) * INT64CONST(60))
+                                         + tm->tm_min) * INT64CONST(60))
+                                       + tm->tm_sec) * INT64CONST(1000000)) + fsec);
 #else
        span->time = ((((((tm->tm_mday * 24.0)
                                          + tm->tm_hour) * 60.0)
@@ -1060,6 +1073,7 @@ time2t(const int hour, const int min, const int sec, const fsec_t fsec)
 {
        return ((((((hour * 60) + min) * 60) + sec) * INT64CONST(1000000)) + fsec);
 }      /* time2t() */
+
 #else
 static double
 time2t(const int hour, const int min, const int sec, const fsec_t fsec)
@@ -1226,6 +1240,7 @@ interval_cmp_internal(Interval *interval1, Interval *interval2)
 #ifdef HAVE_INT64_TIMESTAMP
        int64           span1,
                                span2;
+
 #else
        double          span1,
                                span2;
@@ -1532,9 +1547,7 @@ timestamp_pl_span(PG_FUNCTION_ARGS)
        Timestamp       result;
 
        if (TIMESTAMP_NOT_FINITE(timestamp))
-       {
                result = timestamp;
-       }
        else
        {
                if (span->month != 0)
@@ -1702,9 +1715,11 @@ interval_smaller(PG_FUNCTION_ARGS)
        Interval   *interval1 = PG_GETARG_INTERVAL_P(0);
        Interval   *interval2 = PG_GETARG_INTERVAL_P(1);
        Interval   *result;
+
 #ifdef HAVE_INT64_TIMESTAMP
        int64           span1,
                                span2;
+
 #else
        double          span1,
                                span2;
@@ -1746,9 +1761,11 @@ interval_larger(PG_FUNCTION_ARGS)
        Interval   *interval1 = PG_GETARG_INTERVAL_P(0);
        Interval   *interval2 = PG_GETARG_INTERVAL_P(1);
        Interval   *result;
+
 #ifdef HAVE_INT64_TIMESTAMP
        int64           span1,
                                span2;
+
 #else
        double          span1,
                                span2;
@@ -1828,8 +1845,10 @@ interval_mul(PG_FUNCTION_ARGS)
        Interval   *span1 = PG_GETARG_INTERVAL_P(0);
        float8          factor = PG_GETARG_FLOAT8(1);
        Interval   *result;
+
 #ifdef HAVE_INT64_TIMESTAMP
        int64           months;
+
 #else
        double          months;
 #endif
@@ -1868,6 +1887,7 @@ interval_div(PG_FUNCTION_ARGS)
        Interval   *span = PG_GETARG_INTERVAL_P(0);
        float8          factor = PG_GETARG_FLOAT8(1);
        Interval   *result;
+
 #ifndef HAVE_INT64_TIMESTAMP
        double          months;
 #endif
@@ -1882,7 +1902,7 @@ interval_div(PG_FUNCTION_ARGS)
        result->time = (span->time / factor);
        /* evaluate fractional months as 30 days */
        result->time += (((span->month - (result->month * factor))
-                                         * INT64CONST(30) * INT64CONST(86400000000)) / factor);
+                                  * INT64CONST(30) * INT64CONST(86400000000)) / factor);
 #else
        months = (span->month / factor);
        result->month = rint(months);
@@ -1928,8 +1948,8 @@ interval_accum(PG_FUNCTION_ARGS)
         * objects on machines where double requires 8-byte alignment. That
         * should be fixed, but in the meantime...
         *
-        * Note: must use DatumGetPointer here, not DatumGetIntervalP,
-        * else some compilers optimize into double-aligned load/store anyway.
+        * Note: must use DatumGetPointer here, not DatumGetIntervalP, else some
+        * compilers optimize into double-aligned load/store anyway.
         */
        memcpy((void *) &sumX, DatumGetPointer(transdatums[0]), sizeof(Interval));
        memcpy((void *) &N, DatumGetPointer(transdatums[1]), sizeof(Interval));
@@ -1970,8 +1990,8 @@ interval_avg(PG_FUNCTION_ARGS)
         * objects on machines where double requires 8-byte alignment. That
         * should be fixed, but in the meantime...
         *
-        * Note: must use DatumGetPointer here, not DatumGetIntervalP,
-        * else some compilers optimize into double-aligned load/store anyway.
+        * Note: must use DatumGetPointer here, not DatumGetIntervalP, else some
+        * compilers optimize into double-aligned load/store anyway.
         */
        memcpy((void *) &sumX, DatumGetPointer(transdatums[0]), sizeof(Interval));
        memcpy((void *) &N, DatumGetPointer(transdatums[1]), sizeof(Interval));
@@ -3131,29 +3151,29 @@ interval_part(PG_FUNCTION_ARGS)
                {
                        switch (val)
                        {
-                       case DTK_MICROSEC:
+                               case DTK_MICROSEC:
 #ifdef HAVE_INT64_TIMESTAMP
-                               result = ((tm->tm_sec * 1000000e0) + fsec);
+                                       result = ((tm->tm_sec * 1000000e0) + fsec);
 #else
-                               result = (tm->tm_sec + fsec) * 1000000;
+                                       result = (tm->tm_sec + fsec) * 1000000;
 #endif
-                               break;
+                                       break;
 
-                       case DTK_MILLISEC:
+                               case DTK_MILLISEC:
 #ifdef HAVE_INT64_TIMESTAMP
-                               result = ((tm->tm_sec * 1000e0) + (fsec / 1000e0));
+                                       result = ((tm->tm_sec * 1000e0) + (fsec / 1000e0));
 #else
-                               result = (tm->tm_sec + fsec) * 1000;
+                                       result = (tm->tm_sec + fsec) * 1000;
 #endif
-                               break;
+                                       break;
 
-                       case DTK_SECOND:
+                               case DTK_SECOND:
 #ifdef HAVE_INT64_TIMESTAMP
-                               result = (tm->tm_sec + (fsec / 1000000e0));
+                                       result = (tm->tm_sec + (fsec / 1000000e0));
 #else
-                               result = (tm->tm_sec + fsec);
+                                       result = (tm->tm_sec + fsec);
 #endif
-                               break;
+                                       break;
 
                                case DTK_MINUTE:
                                        result = tm->tm_min;
@@ -3234,7 +3254,7 @@ interval_part(PG_FUNCTION_ARGS)
 /* timestamp_zone()
  * Encode timestamp type with specified time zone.
  * Returns timestamp with time zone, with the input
- *  rotated from local time to the specified zone.
+ *     rotated from local time to the specified zone.
  */
 Datum
 timestamp_zone(PG_FUNCTION_ARGS)
index 97c3567..f0c31a3 100644 (file)
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.24 2002/08/26 17:53:59 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.25 2002/09/04 20:31:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1138,8 +1138,8 @@ bitfromint8(PG_FUNCTION_ARGS)
        VARBITLEN(result) = sizeof(a) * BITS_PER_BYTE;
 
        /*
-        * masks and shifts here are just too painful and we know that an int64
-        * has got 8 bytes
+        * masks and shifts here are just too painful and we know that an
+        * int64 has got 8 bytes
         */
        r = VARBITS(result);
        r[0] = (bits8) ((a >> (7 * BITS_PER_BYTE)) & BITMASK);
index 819e312..780daf7 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.93 2002/09/03 21:45:42 petere Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.94 2002/09/04 20:31:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -182,6 +182,7 @@ bpchar(PG_FUNCTION_ARGS)
 
        int                     charlen;                /* number of charcters in the input string
                                                                 * + VARHDRSZ */
+
        len = VARSIZE(source);
 
        charlen = pg_mbstrlen_with_len(VARDATA(source), len - VARHDRSZ) + VARHDRSZ;
index 12230a7..e21e59e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.91 2002/09/03 21:45:42 petere Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.92 2002/09/04 20:31:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,11 +30,11 @@ typedef struct varlena unknown;
 #define PG_GETARG_UNKNOWN_P(n)         DatumGetUnknownP(PG_GETARG_DATUM(n))
 #define PG_RETURN_UNKNOWN_P(x)         PG_RETURN_POINTER(x)
 #define PG_TEXTARG_GET_STR(arg_) \
-    DatumGetCString(DirectFunctionCall1(textout, PG_GETARG_DATUM(arg_)))
+       DatumGetCString(DirectFunctionCall1(textout, PG_GETARG_DATUM(arg_)))
 #define PG_TEXT_GET_STR(textp_) \
-    DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(textp_)))
+       DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(textp_)))
 #define PG_STR_GET_TEXT(str_) \
-    DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(str_)))
+       DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum(str_)))
 #define TEXTLEN(textp) \
        text_length(PointerGetDatum(textp))
 #define TEXTPOS(buf_text, from_sub_text) \
@@ -54,9 +54,9 @@ static int    text_cmp(text *arg1, text *arg2);
 static int32 text_length(Datum str);
 static int32 text_position(Datum str, Datum search_str, int matchnum);
 static text *text_substring(Datum str,
-                                                       int32 start,
-                                                       int32 length,
-                                                       bool length_not_specified);
+                          int32 start,
+                          int32 length,
+                          bool length_not_specified);
 
 
 /*****************************************************************************
@@ -266,7 +266,7 @@ Datum
 unknownin(PG_FUNCTION_ARGS)
 {
        char       *inputStr = PG_GETARG_CSTRING(0);
-       unknown    *result;
+       unknown    *result;
        int                     len;
 
        len = strlen(inputStr) + VARHDRSZ;
@@ -286,7 +286,7 @@ unknownin(PG_FUNCTION_ARGS)
 Datum
 unknownout(PG_FUNCTION_ARGS)
 {
-       unknown    *t = PG_GETARG_UNKNOWN_P(0);
+       unknown    *t = PG_GETARG_UNKNOWN_P(0);
        int                     len;
        char       *result;
 
@@ -330,12 +330,12 @@ text_length(Datum str)
                text       *t = DatumGetTextP(str);
 
                PG_RETURN_INT32(pg_mbstrlen_with_len(VARDATA(t),
-                                                                        VARSIZE(t) - VARHDRSZ));
+                                                                                        VARSIZE(t) - VARHDRSZ));
        }
 
        /* should never get here */
        elog(ERROR, "Invalid backend encoding; encoding max length "
-                               "is less than one.");
+                "is less than one.");
 
        /* not reached: suppress compiler warning */
        return 0;
@@ -425,7 +425,7 @@ textcat(PG_FUNCTION_ARGS)
  * behaviors conflicting with SQL92 to meet SQL92 (if E = S + L < S throw
  * error; if E < 1, return '', not entire string). Fixed MB related bug when
  * S > LC and < LC + 4 sometimes garbage characters are returned.
- * - Joe Conway 2002-08-10 
+ * - Joe Conway 2002-08-10
  */
 Datum
 text_substr(PG_FUNCTION_ARGS)
@@ -455,25 +455,26 @@ text_substr_no_len(PG_FUNCTION_ARGS)
  *     This is broken out so it can be called directly by other string processing
  *     functions.
  */
-static text*
+static text *
 text_substring(Datum str, int32 start, int32 length, bool length_not_specified)
 {
        int32           eml = pg_database_encoding_max_length();
-       int32           S = start;                              /* start position */
-       int32           S1;                                             /* adjusted start position */
-       int32           L1;                                             /* adjusted substring length */
+       int32           S = start;              /* start position */
+       int32           S1;                             /* adjusted start position */
+       int32           L1;                             /* adjusted substring length */
 
        /* life is easy if the encoding max length is 1 */
        if (eml == 1)
        {
                S1 = Max(S, 1);
 
-               if (length_not_specified)       /* special case - get length to end of string */
+               if (length_not_specified)               /* special case - get length to
+                                                                                * end of string */
                        L1 = -1;
                else
                {
                        /* end position */
-                       int     E = S + length;
+                       int                     E = S + length;
 
                        /*
                         * A negative value for L is the only way for the end position
@@ -482,9 +483,10 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified)
                        if (E < S)
                                elog(ERROR, "negative substring length not allowed");
 
-                       /* 
-                        * A zero or negative value for the end position can happen if the start
-                        * was negative or one. SQL99 says to return a zero-length string.
+                       /*
+                        * A zero or negative value for the end position can happen if
+                        * the start was negative or one. SQL99 says to return a
+                        * zero-length string.
                         */
                        if (E < 1)
                                return PG_STR_GET_TEXT("");
@@ -492,11 +494,10 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified)
                        L1 = E - S1;
                }
 
-               /* 
-                * If the start position is past the end of the string,
-                * SQL99 says to return a zero-length string -- 
-                * PG_GETARG_TEXT_P_SLICE() will do that for us.
-                * Convert to zero-based starting position
+               /*
+                * If the start position is past the end of the string, SQL99 says
+                * to return a zero-length string -- PG_GETARG_TEXT_P_SLICE() will
+                * do that for us. Convert to zero-based starting position
                 */
                return DatumGetTextPSlice(str, S1 - 1, L1);
        }
@@ -504,13 +505,13 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified)
        {
                /*
                 * When encoding max length is > 1, we can't get LC without
-                * detoasting, so we'll grab a conservatively large slice
-                * now and go back later to do the right thing
+                * detoasting, so we'll grab a conservatively large slice now and
+                * go back later to do the right thing
                 */
                int32           slice_start;
                int32           slice_size;
                int32           slice_strlen;
-               text            *slice;
+               text       *slice;
                int32           E1;
                int32           i;
                char       *p;
@@ -518,23 +519,24 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified)
                text       *ret;
 
                /*
-                * if S is past the end of the string, the tuple toaster
-                * will return a zero-length string to us
+                * if S is past the end of the string, the tuple toaster will
+                * return a zero-length string to us
                 */
                S1 = Max(S, 1);
 
                /*
-                * We need to start at position zero because there is no
-                * way to know in advance which byte offset corresponds to 
-                * the supplied start position.
+                * We need to start at position zero because there is no way to
+                * know in advance which byte offset corresponds to the supplied
+                * start position.
                 */
                slice_start = 0;
 
-               if (length_not_specified)       /* special case - get length to end of string */
+               if (length_not_specified)               /* special case - get length to
+                                                                                * end of string */
                        slice_size = L1 = -1;
                else
                {
-                       int     E = S + length;
+                       int                     E = S + length;
 
                        /*
                         * A negative value for L is the only way for the end position
@@ -543,22 +545,24 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified)
                        if (E < S)
                                elog(ERROR, "negative substring length not allowed");
 
-                       /* 
-                        * A zero or negative value for the end position can happen if the start
-                        * was negative or one. SQL99 says to return a zero-length string.
+                       /*
+                        * A zero or negative value for the end position can happen if
+                        * the start was negative or one. SQL99 says to return a
+                        * zero-length string.
                         */
                        if (E < 1)
                                return PG_STR_GET_TEXT("");
 
                        /*
-                        * if E is past the end of the string, the tuple toaster
-                        * will truncate the length for us
+                        * if E is past the end of the string, the tuple toaster will
+                        * truncate the length for us
                         */
                        L1 = E - S1;
 
                        /*
-                        * Total slice size in bytes can't be any longer than the start
-                        * position plus substring length times the encoding max length.
+                        * Total slice size in bytes can't be any longer than the
+                        * start position plus substring length times the encoding max
+                        * length.
                         */
                        slice_size = (S1 + L1) * eml;
                }
@@ -569,9 +573,10 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified)
                        return PG_STR_GET_TEXT("");
 
                /* Now we can get the actual length of the slice in MB characters */
-               slice_strlen = pg_mbstrlen_with_len (VARDATA(slice), VARSIZE(slice) - VARHDRSZ);
+               slice_strlen = pg_mbstrlen_with_len(VARDATA(slice), VARSIZE(slice) - VARHDRSZ);
 
-               /* Check that the start position wasn't > slice_strlen. If so,
+               /*
+                * Check that the start position wasn't > slice_strlen. If so,
                 * SQL99 says to return a zero-length string.
                 */
                if (S1 > slice_strlen)
@@ -579,16 +584,17 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified)
 
                /*
                 * Adjust L1 and E1 now that we know the slice string length.
-                * Again remember that S1 is one based, and slice_start is zero based.
+                * Again remember that S1 is one based, and slice_start is zero
+                * based.
                 */
                if (L1 > -1)
-                       E1 = Min(S1 + L1 , slice_start + 1 + slice_strlen);
+                       E1 = Min(S1 + L1, slice_start + 1 + slice_strlen);
                else
                        E1 = slice_start + 1 + slice_strlen;
 
                /*
-                * Find the start position in the slice;
-                * remember S1 is not zero based
+                * Find the start position in the slice; remember S1 is not zero
+                * based
                 */
                p = VARDATA(slice);
                for (i = 0; i < S1 - 1; i++)
@@ -598,8 +604,8 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified)
                s = p;
 
                /*
-                * Count the actual bytes used by the substring of 
-                * the requested length.
+                * Count the actual bytes used by the substring of the requested
+                * length.
                 */
                for (i = S1; i < E1; i++)
                        p += pg_mblen(p);
@@ -612,7 +618,7 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified)
        }
        else
                elog(ERROR, "Invalid backend encoding; encoding max length "
-                                       "is less than one.");
+                        "is less than one.");
 
        /* not reached: suppress compiler warning */
        return PG_STR_GET_TEXT("");
@@ -650,8 +656,8 @@ text_position(Datum str, Datum search_str, int matchnum)
                                len1,
                                len2;
 
-       if(matchnum == 0)
-               return 0;               /* result for 0th match */
+       if (matchnum == 0)
+               return 0;                               /* result for 0th match */
 
        if (VARSIZE(t2) <= VARHDRSZ)
                PG_RETURN_INT32(1);             /* result for empty pattern */
@@ -662,10 +668,10 @@ text_position(Datum str, Datum search_str, int matchnum)
        /* no use in searching str past point where search_str will fit */
        px = (len1 - len2);
 
-       if (eml == 1)   /* simple case - single byte encoding */
+       if (eml == 1)                           /* simple case - single byte encoding */
        {
-               char   *p1,
-                          *p2;
+               char       *p1,
+                                  *p2;
 
                p1 = VARDATA(t1);
                p2 = VARDATA(t2);
@@ -683,7 +689,7 @@ text_position(Datum str, Datum search_str, int matchnum)
                        p1++;
                }
        }
-       else if (eml > 1)       /* not as simple - multibyte encoding */
+       else if (eml > 1)                       /* not as simple - multibyte encoding */
        {
                pg_wchar   *p1,
                                   *p2,
@@ -715,7 +721,7 @@ text_position(Datum str, Datum search_str, int matchnum)
        }
        else
                elog(ERROR, "Invalid backend encoding; encoding max length "
-                                       "is less than one.");
+                        "is less than one.");
 
        PG_RETURN_INT32(pos);
 }
@@ -734,10 +740,10 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2)
                           *a2p;
 
        /*
-        * Unfortunately, there is no strncoll(), so in the non-C locale
-        * case we have to do some memory copying.  This turns out to be
-        * significantly slower, so we optimize the case where LC_COLLATE
-        * is C.
+        * Unfortunately, there is no strncoll(), so in the non-C locale case
+        * we have to do some memory copying.  This turns out to be
+        * significantly slower, so we optimize the case where LC_COLLATE is
+        * C.
         */
        if (!lc_collate_is_c())
        {
@@ -990,7 +996,7 @@ byteacat(PG_FUNCTION_ARGS)
 }
 
 #define PG_STR_GET_BYTEA(str_) \
-    DatumGetByteaP(DirectFunctionCall1(byteain, CStringGetDatum(str_)))
+       DatumGetByteaP(DirectFunctionCall1(byteain, CStringGetDatum(str_)))
 /*
  * bytea_substr()
  * Return a substring starting at the specified position.
@@ -1009,36 +1015,37 @@ byteacat(PG_FUNCTION_ARGS)
 Datum
 bytea_substr(PG_FUNCTION_ARGS)
 {
-       int             S = PG_GETARG_INT32(1); /* start position */
-       int             S1;                                             /* adjusted start position */
-       int             L1;                                             /* adjusted substring length */
+       int                     S = PG_GETARG_INT32(1); /* start position */
+       int                     S1;                             /* adjusted start position */
+       int                     L1;                             /* adjusted substring length */
 
        S1 = Max(S, 1);
 
        if (fcinfo->nargs == 2)
        {
                /*
-                * Not passed a length - PG_GETARG_BYTEA_P_SLICE()
-                * grabs everything to the end of the string if we pass it
-                * a negative value for length.
+                * Not passed a length - PG_GETARG_BYTEA_P_SLICE() grabs
+                * everything to the end of the string if we pass it a negative
+                * value for length.
                 */
                L1 = -1;
        }
        else
        {
                /* end position */
-               int     E = S + PG_GETARG_INT32(2);
+               int                     E = S + PG_GETARG_INT32(2);
 
                /*
-                * A negative value for L is the only way for the end position
-                * to be before the start. SQL99 says to throw an error.
+                * A negative value for L is the only way for the end position to
+                * be before the start. SQL99 says to throw an error.
                 */
                if (E < S)
                        elog(ERROR, "negative substring length not allowed");
 
-               /* 
-                * A zero or negative value for the end position can happen if the start
-                * was negative or one. SQL99 says to return a zero-length string.
+               /*
+                * A zero or negative value for the end position can happen if the
+                * start was negative or one. SQL99 says to return a zero-length
+                * string.
                 */
                if (E < 1)
                        PG_RETURN_BYTEA_P(PG_STR_GET_BYTEA(""));
@@ -1046,13 +1053,12 @@ bytea_substr(PG_FUNCTION_ARGS)
                L1 = E - S1;
        }
 
-       /* 
-        * If the start position is past the end of the string,
-        * SQL99 says to return a zero-length string -- 
-        * PG_GETARG_TEXT_P_SLICE() will do that for us.
-        * Convert to zero-based starting position
+       /*
+        * If the start position is past the end of the string, SQL99 says to
+        * return a zero-length string -- PG_GETARG_TEXT_P_SLICE() will do
+        * that for us. Convert to zero-based starting position
         */
-       PG_RETURN_BYTEA_P(PG_GETARG_BYTEA_P_SLICE (0, S1 - 1, L1));
+       PG_RETURN_BYTEA_P(PG_GETARG_BYTEA_P_SLICE(0, S1 - 1, L1));
 }
 
 /*
@@ -1343,7 +1349,7 @@ textToQualifiedNameList(text *textval, const char *caller)
        /* Convert to C string (handles possible detoasting). */
        /* Note we rely on being able to modify rawname below. */
        rawname = DatumGetCString(DirectFunctionCall1(textout,
-                                                                                                 PointerGetDatum(textval)));
+                                                                                         PointerGetDatum(textval)));
 
        if (!SplitIdentifierString(rawname, '.', &namelist))
                elog(ERROR, "%s: invalid name syntax", caller);
@@ -1353,7 +1359,7 @@ textToQualifiedNameList(text *textval, const char *caller)
 
        foreach(l, namelist)
        {
-               char   *curname = (char *) lfirst(l);
+               char       *curname = (char *) lfirst(l);
 
                result = lappend(result, makeString(pstrdup(curname)));
        }
@@ -1368,15 +1374,15 @@ textToQualifiedNameList(text *textval, const char *caller)
  * SplitIdentifierString --- parse a string containing identifiers
  *
  * This is the guts of textToQualifiedNameList, and is exported for use in
- * other situations such as parsing GUC variables.  In the GUC case, it's
+ * other situations such as parsing GUC variables.     In the GUC case, it's
  * important to avoid memory leaks, so the API is designed to minimize the
  * amount of stuff that needs to be allocated and freed.
  *
  * Inputs:
- *     rawstring: the input string; must be overwritable!  On return, it's
+ *     rawstring: the input string; must be overwritable!      On return, it's
  *                        been modified to contain the separated identifiers.
  *     separator: the separator punctuation expected between identifiers
- *                        (typically '.' or ',').  Whitespace may also appear around
+ *                        (typically '.' or ',').      Whitespace may also appear around
  *                        identifiers.
  * Outputs:
  *     namelist: filled with a palloc'd list of pointers to identifiers within
@@ -1417,11 +1423,11 @@ SplitIdentifierString(char *rawstring, char separator,
                        {
                                endp = strchr(nextp + 1, '\"');
                                if (endp == NULL)
-                                       return false; /* mismatched quotes */
+                                       return false;           /* mismatched quotes */
                                if (endp[1] != '\"')
                                        break;          /* found end of quoted name */
                                /* Collapse adjacent quotes into one quote, and look again */
-                               memmove(endp, endp+1, strlen(endp));
+                               memmove(endp, endp + 1, strlen(endp));
                                nextp = endp;
                        }
                        /* endp now points at the terminating quote */
@@ -1435,8 +1441,8 @@ SplitIdentifierString(char *rawstring, char separator,
                                   !isspace((unsigned char) *nextp))
                        {
                                /*
-                                * It's important that this match the identifier downcasing
-                                * code used by backend/parser/scan.l.
+                                * It's important that this match the identifier
+                                * downcasing code used by backend/parser/scan.l.
                                 */
                                if (isupper((unsigned char) *nextp))
                                        *nextp = tolower((unsigned char) *nextp);
@@ -1647,24 +1653,24 @@ byteacmp(PG_FUNCTION_ARGS)
  * replace_text
  * replace all occurences of 'old_sub_str' in 'orig_str'
  * with 'new_sub_str' to form 'new_str'
- * 
+ *
  * returns 'orig_str' if 'old_sub_str' == '' or 'orig_str' == ''
- * otherwise returns 'new_str' 
+ * otherwise returns 'new_str'
  */
 Datum
 replace_text(PG_FUNCTION_ARGS)
 {
-       text            *left_text;
-       text            *right_text;
-       text            *buf_text;
-       text            *ret_text;
+       text       *left_text;
+       text       *right_text;
+       text       *buf_text;
+       text       *ret_text;
        int                     curr_posn;
-       text            *src_text = PG_GETARG_TEXT_P(0);
+       text       *src_text = PG_GETARG_TEXT_P(0);
        int                     src_text_len = TEXTLEN(src_text);
-       text            *from_sub_text = PG_GETARG_TEXT_P(1);
+       text       *from_sub_text = PG_GETARG_TEXT_P(1);
        int                     from_sub_text_len = TEXTLEN(from_sub_text);
-       text            *to_sub_text = PG_GETARG_TEXT_P(2);
-       char            *to_sub_str = PG_TEXT_GET_STR(to_sub_text);
+       text       *to_sub_text = PG_GETARG_TEXT_P(2);
+       char       *to_sub_str = PG_TEXT_GET_STR(to_sub_text);
        StringInfo      str = makeStringInfo();
 
        if (src_text_len == 0 || from_sub_text_len == 0)
@@ -1713,7 +1719,7 @@ split_text(PG_FUNCTION_ARGS)
        int                     fldnum = PG_GETARG_INT32(2);
        int                     start_posn = 0;
        int                     end_posn = 0;
-       text            *result_text;
+       text       *result_text;
 
        /* return empty string for empty input string */
        if (inputstring_len < 1)
@@ -1722,9 +1728,11 @@ split_text(PG_FUNCTION_ARGS)
        /* empty field separator */
        if (fldsep_len < 1)
        {
-               if (fldnum == 1)        /* first field - just return the input string */
+               if (fldnum == 1)                /* first field - just return the input
+                                                                * string */
                        PG_RETURN_TEXT_P(inputstring);
-               else                            /* otherwise return an empty string */
+               else
+/* otherwise return an empty string */
                        PG_RETURN_TEXT_P(PG_STR_GET_TEXT(""));
        }
 
@@ -1733,17 +1741,19 @@ split_text(PG_FUNCTION_ARGS)
                elog(ERROR, "field position must be > 0");
 
        start_posn = text_position(PointerGetDatum(inputstring),
-                                                               PointerGetDatum(fldsep),
-                                                               fldnum - 1);
+                                                          PointerGetDatum(fldsep),
+                                                          fldnum - 1);
        end_posn = text_position(PointerGetDatum(inputstring),
-                                                               PointerGetDatum(fldsep),
-                                                               fldnum);
+                                                        PointerGetDatum(fldsep),
+                                                        fldnum);
 
        if ((start_posn == 0) && (end_posn == 0))       /* fldsep not found */
        {
-               if (fldnum == 1)        /* first field - just return the input string */
+               if (fldnum == 1)                /* first field - just return the input
+                                                                * string */
                        PG_RETURN_TEXT_P(inputstring);
-               else                            /* otherwise return an empty string */
+               else
+/* otherwise return an empty string */
                        PG_RETURN_TEXT_P(PG_STR_GET_TEXT(""));
        }
        else if ((start_posn != 0) && (end_posn == 0))
@@ -1774,11 +1784,11 @@ split_text(PG_FUNCTION_ARGS)
 Datum
 to_hex32(PG_FUNCTION_ARGS)
 {
-       static char             digits[] = "0123456789abcdef";
-       char                    buf[32];        /* bigger than needed, but reasonable */
-       char               *ptr;
-       text               *result_text;
-       int32                   value = PG_GETARG_INT32(0);
+       static char digits[] = "0123456789abcdef";
+       char            buf[32];                /* bigger than needed, but reasonable */
+       char       *ptr;
+       text       *result_text;
+       int32           value = PG_GETARG_INT32(0);
 
        ptr = buf + sizeof(buf) - 1;
        *ptr = '\0';
@@ -1800,11 +1810,11 @@ to_hex32(PG_FUNCTION_ARGS)
 Datum
 to_hex64(PG_FUNCTION_ARGS)
 {
-       static char             digits[] = "0123456789abcdef";
-       char                    buf[32];        /* bigger than needed, but reasonable */
-       char                    *ptr;
-       text                    *result_text;
-       int64                   value = PG_GETARG_INT64(0);
+       static char digits[] = "0123456789abcdef";
+       char            buf[32];                /* bigger than needed, but reasonable */
+       char       *ptr;
+       text       *result_text;
+       int64           value = PG_GETARG_INT64(0);
 
        ptr = buf + sizeof(buf) - 1;
        *ptr = '\0';
@@ -1818,4 +1828,3 @@ to_hex64(PG_FUNCTION_ARGS)
        result_text = PG_STR_GET_TEXT(ptr);
        PG_RETURN_TEXT_P(result_text);
 }
-
index 5703bf1..c84abb8 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.98 2002/09/02 01:05:06 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.99 2002/09/04 20:31:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,7 +34,7 @@
 #include "utils/syscache.h"
 
 
-/* #define CACHEDEBUG */       /* turns DEBUG elogs on */
+ /* #define CACHEDEBUG */      /* turns DEBUG elogs on */
 
 /*
  * Constants related to size of the catcache.
@@ -102,6 +102,7 @@ static uint32 CatalogCacheComputeHashValue(CatCache *cache, int nkeys,
                                                         ScanKey cur_skey);
 static uint32 CatalogCacheComputeTupleHashValue(CatCache *cache,
                                                                  HeapTuple tuple);
+
 #ifdef CATCACHE_STATS
 static void CatCachePrintStats(void);
 #endif
@@ -109,8 +110,8 @@ static void CatCacheRemoveCTup(CatCache *cache, CatCTup *ct);
 static void CatCacheRemoveCList(CatCache *cache, CatCList *cl);
 static void CatalogCacheInitializeCache(CatCache *cache);
 static CatCTup *CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp,
-                                                                               uint32 hashValue, Index hashIndex,
-                                                                               bool negative);
+                                               uint32 hashValue, Index hashIndex,
+                                               bool negative);
 static HeapTuple build_dummy_tuple(CatCache *cache, int nkeys, ScanKey skeys);
 
 
@@ -325,8 +326,7 @@ CatCachePrintStats(void)
                 cc_lsearches,
                 cc_lhits);
 }
-
-#endif /* CATCACHE_STATS */
+#endif   /* CATCACHE_STATS */
 
 
 /*
@@ -372,7 +372,7 @@ CatCacheRemoveCList(CatCache *cache, CatCList *cl)
        Assert(cl->my_cache == cache);
 
        /* delink from member tuples */
-       for (i = cl->n_members; --i >= 0; )
+       for (i = cl->n_members; --i >= 0;)
        {
                CatCTup    *ct = cl->members[i];
 
@@ -397,11 +397,11 @@ CatCacheRemoveCList(CatCache *cache, CatCList *cl)
  *     item pointer.  Positive entries are deleted if they match the item
  *     pointer.  Negative entries must be deleted if they match the hash
  *     value (since we do not have the exact key of the tuple that's being
- *     inserted).  But this should only rarely result in loss of a cache
+ *     inserted).      But this should only rarely result in loss of a cache
  *     entry that could have been kept.
  *
  *     Note that it's not very relevant whether the tuple identified by
- *     the item pointer is being inserted or deleted.  We don't expect to
+ *     the item pointer is being inserted or deleted.  We don't expect to
  *     find matching positive entries in the one case, and we don't expect
  *     to find matching negative entries in the other; but we will do the
  *     right things in any case.
@@ -435,8 +435,8 @@ CatalogCacheIdInvalidate(int cacheId,
 
                /*
                 * We don't bother to check whether the cache has finished
-                * initialization yet; if not, there will be no entries in it
-                * so no problem.
+                * initialization yet; if not, there will be no entries in it so
+                * no problem.
                 */
 
                /*
@@ -819,7 +819,7 @@ InitCatCache(int id,
        cp->id = id;
        cp->cc_relname = relname;
        cp->cc_indname = indname;
-       cp->cc_reloid = InvalidOid;     /* temporary */
+       cp->cc_reloid = InvalidOid; /* temporary */
        cp->cc_relisshared = false; /* temporary */
        cp->cc_tupdesc = (TupleDesc) NULL;
        cp->cc_reloidattr = reloidattr;
@@ -1015,8 +1015,8 @@ IndexScanOK(CatCache *cache, ScanKey cur_skey)
        {
                /*
                 * Since the OIDs of indexes aren't hardwired, it's painful to
-                * figure out which is which.  Just force all pg_index searches
-                * to be heap scans while building the relcaches.
+                * figure out which is which.  Just force all pg_index searches to
+                * be heap scans while building the relcaches.
                 */
                if (!criticalRelcachesBuilt)
                        return false;
@@ -1037,7 +1037,7 @@ IndexScanOK(CatCache *cache, ScanKey cur_skey)
                if (!criticalRelcachesBuilt)
                {
                        /* Looking for an OID comparison function? */
-                       Oid             lookup_oid = DatumGetObjectId(cur_skey[0].sk_argument);
+                       Oid                     lookup_oid = DatumGetObjectId(cur_skey[0].sk_argument);
 
                        if (lookup_oid >= MIN_OIDCMP && lookup_oid <= MAX_OIDCMP)
                                return false;
@@ -1055,7 +1055,7 @@ IndexScanOK(CatCache *cache, ScanKey cur_skey)
  *             if necessary (on the first access to a particular cache).
  *
  *             The result is NULL if not found, or a pointer to a HeapTuple in
- *             the cache.  The caller must not modify the tuple, and must call
+ *             the cache.      The caller must not modify the tuple, and must call
  *             ReleaseCatCache() when done with it.
  *
  * The search key values should be expressed as Datums of the key columns'
@@ -1077,7 +1077,7 @@ SearchCatCache(CatCache *cache,
        Dlelem     *elt;
        CatCTup    *ct;
        Relation        relation;
-       SysScanDesc     scandesc;
+       SysScanDesc scandesc;
        HeapTuple       ntp;
 
        /*
@@ -1134,18 +1134,18 @@ SearchCatCache(CatCache *cache,
                        continue;
 
                /*
-                * we found a match in the cache: move it to the front of the global
-                * LRU list.  We also move it to the front of the list for its
-                * hashbucket, in order to speed subsequent searches.  (The most
-                * frequently accessed elements in any hashbucket will tend to be
-                * near the front of the hashbucket's list.)
+                * we found a match in the cache: move it to the front of the
+                * global LRU list.  We also move it to the front of the list for
+                * its hashbucket, in order to speed subsequent searches.  (The
+                * most frequently accessed elements in any hashbucket will tend
+                * to be near the front of the hashbucket's list.)
                 */
                DLMoveToFront(&ct->lrulist_elem);
                DLMoveToFront(&ct->cache_elem);
 
                /*
-                * If it's a positive entry, bump its refcount and return it.
-                * If it's negative, we can report failure to the caller.
+                * If it's a positive entry, bump its refcount and return it. If
+                * it's negative, we can report failure to the caller.
                 */
                if (!ct->negative)
                {
@@ -1175,8 +1175,8 @@ SearchCatCache(CatCache *cache,
 
        /*
         * Tuple was not found in cache, so we have to try to retrieve it
-        * directly from the relation.  If found, we will add it to the
-        * cache; if not found, we will add a negative cache entry instead.
+        * directly from the relation.  If found, we will add it to the cache;
+        * if not found, we will add a negative cache entry instead.
         *
         * NOTE: it is possible for recursive cache lookups to occur while
         * reading the relation --- for example, due to shared-cache-inval
@@ -1213,8 +1213,8 @@ SearchCatCache(CatCache *cache,
 
        /*
         * If tuple was not found, we need to build a negative cache entry
-        * containing a fake tuple.  The fake tuple has the correct key columns,
-        * but nulls everywhere else.
+        * containing a fake tuple.  The fake tuple has the correct key
+        * columns, but nulls everywhere else.
         */
        if (ct == NULL)
        {
@@ -1307,7 +1307,7 @@ SearchCatCacheList(CatCache *cache,
        List       *ctlist;
        int                     nmembers;
        Relation        relation;
-       SysScanDesc     scandesc;
+       SysScanDesc scandesc;
        bool            ordered;
        HeapTuple       ntp;
        MemoryContext oldcxt;
@@ -1336,8 +1336,8 @@ SearchCatCacheList(CatCache *cache,
 
        /*
         * compute a hash value of the given keys for faster search.  We don't
-        * presently divide the CatCList items into buckets, but this still lets
-        * us skip non-matching items quickly most of the time.
+        * presently divide the CatCList items into buckets, but this still
+        * lets us skip non-matching items quickly most of the time.
         */
        lHashValue = CatalogCacheComputeHashValue(cache, nkeys, cur_skey);
 
@@ -1373,11 +1373,11 @@ SearchCatCacheList(CatCache *cache,
 
                /*
                 * we found a matching list: move each of its members to the front
-                * of the global LRU list.  Also move the list itself to the front
-                * of the cache's list-of-lists, to speed subsequent searches.
-                * (We do not move the members to the fronts of their hashbucket
+                * of the global LRU list.      Also move the list itself to the front
+                * of the cache's list-of-lists, to speed subsequent searches. (We
+                * do not move the members to the fronts of their hashbucket
                 * lists, however, since there's no point in that unless they are
-                * searched for individually.)  Also bump the members' refcounts.
+                * searched for individually.)  Also bump the members' refcounts.
                 */
                for (i = 0; i < cl->n_members; i++)
                {
@@ -1400,9 +1400,9 @@ SearchCatCacheList(CatCache *cache,
        }
 
        /*
-        * List was not found in cache, so we have to build it by reading
-        * the relation.  For each matching tuple found in the relation,
-        * use an existing cache entry if possible, else build a new one.
+        * List was not found in cache, so we have to build it by reading the
+        * relation.  For each matching tuple found in the relation, use an
+        * existing cache entry if possible, else build a new one.
         */
        relation = heap_open(cache->cc_reloid, AccessShareLock);
 
@@ -1438,17 +1438,17 @@ SearchCatCacheList(CatCache *cache,
                        ct = (CatCTup *) DLE_VAL(elt);
 
                        if (ct->dead || ct->negative)
-                               continue;                       /* ignore dead and negative entries */
+                               continue;               /* ignore dead and negative entries */
 
                        if (ct->hash_value != hashValue)
-                               continue;                       /* quickly skip entry if wrong hash val */
+                               continue;               /* quickly skip entry if wrong hash val */
 
                        if (!ItemPointerEquals(&(ct->tuple.t_self), &(ntp->t_self)))
-                               continue;                       /* not same tuple */
+                               continue;               /* not same tuple */
 
                        /*
-                        * Found a match, but can't use it if it belongs to another list
-                        * already
+                        * Found a match, but can't use it if it belongs to another
+                        * list already
                         */
                        if (ct->c_list)
                                continue;
@@ -1498,7 +1498,7 @@ SearchCatCacheList(CatCache *cache,
        cl->hash_value = lHashValue;
        cl->n_members = nmembers;
        /* The list is backwards because we built it with lcons */
-       for (i = nmembers; --i >= 0; )
+       for (i = nmembers; --i >= 0;)
        {
                cl->members[i] = ct = (CatCTup *) lfirst(ctlist);
                Assert(ct->c_list == NULL);
@@ -1531,7 +1531,7 @@ ReleaseCatCacheList(CatCList *list)
        Assert(list->cl_magic == CL_MAGIC);
        Assert(list->refcount > 0);
 
-       for (i = list->n_members; --i >= 0; )
+       for (i = list->n_members; --i >= 0;)
        {
                CatCTup    *ct = list->members[i];
 
@@ -1558,7 +1558,7 @@ ReleaseCatCacheList(CatCList *list)
 /*
  * CatalogCacheCreateEntry
  *             Create a new CatCTup entry, copying the given HeapTuple and other
- *             supplied data into it.  The new entry is given refcount 1.
+ *             supplied data into it.  The new entry is given refcount 1.
  */
 static CatCTup *
 CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp,
@@ -1568,7 +1568,8 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp,
        MemoryContext oldcxt;
 
        /*
-        * Allocate CatCTup header in cache memory, and copy the tuple there too.
+        * Allocate CatCTup header in cache memory, and copy the tuple there
+        * too.
         */
        oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
        ct = (CatCTup *) palloc(sizeof(CatCTup));
@@ -1655,27 +1656,26 @@ build_dummy_tuple(CatCache *cache, int nkeys, ScanKey skeys)
 
        for (i = 0; i < nkeys; i++)
        {
-               int             attindex = cache->cc_key[i];
-               Datum   keyval = skeys[i].sk_argument;
+               int                     attindex = cache->cc_key[i];
+               Datum           keyval = skeys[i].sk_argument;
 
                if (attindex > 0)
                {
                        /*
-                        * Here we must be careful in case the caller passed a
-                        * C string where a NAME is wanted: convert the given
-                        * argument to a correctly padded NAME.  Otherwise the
-                        * memcpy() done in heap_formtuple could fall off the
-                        * end of memory.
+                        * Here we must be careful in case the caller passed a C
+                        * string where a NAME is wanted: convert the given argument
+                        * to a correctly padded NAME.  Otherwise the memcpy() done in
+                        * heap_formtuple could fall off the end of memory.
                         */
                        if (cache->cc_isname[i])
                        {
-                               Name    newval = &tempNames[i];
+                               Name            newval = &tempNames[i];
 
                                namestrcpy(newval, DatumGetCString(keyval));
                                keyval = NameGetDatum(newval);
                        }
-                       values[attindex-1] = keyval;
-                       nulls[attindex-1] = ' ';
+                       values[attindex - 1] = keyval;
+                       nulls[attindex - 1] = ' ';
                }
                else
                {
@@ -1727,7 +1727,7 @@ build_dummy_tuple(CatCache *cache, int nkeys, ScanKey skeys)
 void
 PrepareToInvalidateCacheTuple(Relation relation,
                                                          HeapTuple tuple,
-                                                void (*function) (int, uint32, ItemPointer, Oid))
+                                               void (*function) (int, uint32, ItemPointer, Oid))
 {
        CatCache   *ccp;
        Oid                     reloid;
index d64f5bf..6aa5ab6 100644 (file)
@@ -10,7 +10,7 @@
  *     ie, until the next CommandCounterIncrement() or transaction commit.
  *     (See utils/time/tqual.c, and note that system catalogs are generally
  *     scanned under SnapshotNow rules by the system, or plain user snapshots
- *     for user queries.)  At the command boundary, the old tuple stops
+ *     for user queries.)      At the command boundary, the old tuple stops
  *     being valid and the new version, if any, becomes valid.  Therefore,
  *     we cannot simply flush a tuple from the system caches during heap_update()
  *     or heap_delete().  The tuple is still good at that point; what's more,
  *
  *     If we successfully complete the transaction, we have to broadcast all
  *     these invalidation events to other backends (via the SI message queue)
- *     so that they can flush obsolete entries from their caches.  Note we have
+ *     so that they can flush obsolete entries from their caches.      Note we have
  *     to record the transaction commit before sending SI messages, otherwise
  *     the other backends won't see our updated tuples as good.
  *
  *     In short, we need to remember until xact end every insert or delete
- *     of a tuple that might be in the system caches.  Updates are treated as
+ *     of a tuple that might be in the system caches.  Updates are treated as
  *     two events, delete + insert, for simplicity.  (There are cases where
  *     it'd be possible to record just one event, but we don't currently try.)
  *
@@ -74,7 +74,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.54 2002/09/02 01:05:06 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.55 2002/09/04 20:31:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -129,7 +129,7 @@ static InvalidationListHeader CurrentCmdInvalidMsgs;
 /* head of previous-commands event list */
 static InvalidationListHeader PriorCmdInvalidMsgs;
 
-static bool RelcacheInitFileInval; /* init file must be invalidated? */
+static bool RelcacheInitFileInval;             /* init file must be invalidated? */
 
 /*
  * Dynamically-registered callback functions.  Current implementation
@@ -395,6 +395,7 @@ RegisterRelcacheInvalidation(Oid dbId, Oid relId)
 {
        AddRelcacheInvalidationMessage(&CurrentCmdInvalidMsgs,
                                                                   dbId, relId);
+
        /*
         * If the relation being invalidated is one of those cached in the
         * relcache init file, mark that we need to zap that file at commit.
@@ -505,10 +506,11 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple,
         */
        if (!IsSystemRelation(relation))
                return;
-       /* 
-        * TOAST tuples can likewise be ignored here.
-        * Note that TOAST tables are considered system relations
-        * so they are not filtered by the above test.
+
+       /*
+        * TOAST tuples can likewise be ignored here. Note that TOAST tables
+        * are considered system relations so they are not filtered by the
+        * above test.
         */
        if (IsToastRelation(relation))
                return;
@@ -573,12 +575,12 @@ AcceptInvalidationMessages(void)
  * If isCommit, we must send out the messages in our PriorCmdInvalidMsgs list
  * to the shared invalidation message queue.  Note that these will be read
  * not only by other backends, but also by our own backend at the next
- * transaction start (via AcceptInvalidationMessages).  This means that
+ * transaction start (via AcceptInvalidationMessages). This means that
  * we can skip immediate local processing of anything that's still in
  * CurrentCmdInvalidMsgs, and just send that list out too.
  *
  * If not isCommit, we are aborting, and must locally process the messages
- * in PriorCmdInvalidMsgs.  No messages need be sent to other backends,
+ * in PriorCmdInvalidMsgs.     No messages need be sent to other backends,
  * since they'll not have seen our changed tuples anyway.  We can forget
  * about CurrentCmdInvalidMsgs too, since those changes haven't touched
  * the caches yet.
@@ -596,9 +598,9 @@ AtEOXactInvalidationMessages(bool isCommit)
        if (isCommit)
        {
                /*
-                * Relcache init file invalidation requires processing both
-                * before and after we send the SI messages.  However, we need
-                * not do anything unless we committed.
+                * Relcache init file invalidation requires processing both before
+                * and after we send the SI messages.  However, we need not do
+                * anything unless we committed.
                 */
                if (RelcacheInitFileInval)
                        RelationCacheInitFileInvalidate(true);
@@ -694,7 +696,7 @@ CacheInvalidateRelcache(Oid relationId)
  *
  * NOTE: currently, the OID argument to the callback routine is not
  * provided for syscache callbacks; the routine doesn't really get any
- * useful info as to exactly what changed.  It should treat every call
+ * useful info as to exactly what changed.     It should treat every call
  * as a "cache flush" request.
  */
 void
index 4054b29..2672ed3 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.82 2002/08/31 22:10:47 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.83 2002/09/04 20:31:30 momjian Exp $
  *
  * NOTES
  *       Eventually, the index information should go through here, too.
@@ -349,7 +349,7 @@ op_mergejoinable(Oid opno, Oid ltype, Oid rtype, Oid *leftOp, Oid *rightOp)
  *
  *             Returns the cross-type comparison operators (ltype "<" rtype and
  *             ltype ">" rtype) for an operator previously determined to be
- *             mergejoinable.  Optionally, fetches the regproc ids of these
+ *             mergejoinable.  Optionally, fetches the regproc ids of these
  *             operators, as well as their operator OIDs.
  */
 void
@@ -651,7 +651,7 @@ get_relname_relid(const char *relname, Oid relnamespace)
 Oid
 get_system_catalog_relid(const char *catname)
 {
-       Oid             relid;
+       Oid                     relid;
 
        relid = GetSysCacheOid(RELNAMENSP,
                                                   PointerGetDatum(catname),
@@ -737,7 +737,7 @@ get_rel_namespace(Oid relid)
        if (HeapTupleIsValid(tp))
        {
                Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
-               Oid             result;
+               Oid                     result;
 
                result = reltup->relnamespace;
                ReleaseSysCache(tp);
@@ -766,7 +766,7 @@ get_rel_type_id(Oid relid)
        if (HeapTupleIsValid(tp))
        {
                Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
-               Oid             result;
+               Oid                     result;
 
                result = reltup->reltype;
                ReleaseSysCache(tp);
@@ -1105,8 +1105,8 @@ getBaseTypeMod(Oid typid, int32 typmod)
                /*
                 * The typmod applied to a domain should always be -1.
                 *
-                * We substitute the domain's typmod as we switch attention to
-                * the base type.
+                * We substitute the domain's typmod as we switch attention to the
+                * base type.
                 */
                Assert(typmod < 0);
 
index 1b33371..a0eeff1 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.174 2002/09/02 02:47:05 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.175 2002/09/04 20:31:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -81,7 +81,7 @@ static FormData_pg_attribute Desc_pg_type[Natts_pg_type] = {Schema_pg_type};
  *             Relations are looked up two ways, by OID and by name,
  *             thus there are two hash tables for referencing them.
  *
- *             The OID index covers all relcache entries.  The name index
+ *             The OID index covers all relcache entries.      The name index
  *             covers *only* system relations (only those in PG_CATALOG_NAMESPACE).
  */
 static HTAB *RelationIdCache;
@@ -98,7 +98,7 @@ static HTAB *RelationNodeCache;
  * This flag is false until we have prepared the critical relcache entries
  * that are needed to do indexscans on the tables read by relcache building.
  */
-bool criticalRelcachesBuilt = false;
+bool           criticalRelcachesBuilt = false;
 
 /*
  * This flag is set if we discover that we need to write a new relcache
@@ -108,7 +108,7 @@ static bool needNewCacheFile = false;
 
 /*
  * This counter counts relcache inval events received since backend startup
- * (but only for rels that are actually in cache).  Presently, we use it only
+ * (but only for rels that are actually in cache).     Presently, we use it only
  * to detect whether data about to be written by write_relcache_init_file()
  * might already be obsolete.
  */
@@ -260,8 +260,8 @@ typedef struct opclasscacheent
        StrategyNumber numStrats;       /* max # of strategies (from pg_am) */
        StrategyNumber numSupport;      /* max # of support procs (from pg_am) */
        Oid                *operatorOids;       /* strategy operators' OIDs */
-       RegProcedure *operatorProcs; /* strategy operators' procs */
-       RegProcedure *supportProcs;     /* support procs */
+       RegProcedure *operatorProcs;    /* strategy operators' procs */
+       RegProcedure *supportProcs; /* support procs */
 } OpClassCacheEnt;
 
 static HTAB *OpClassCache = NULL;
@@ -292,15 +292,15 @@ static void AttrDefaultFetch(Relation relation);
 static void CheckConstraintFetch(Relation relation);
 static List *insert_ordered_oid(List *list, Oid datum);
 static void IndexSupportInitialize(Form_pg_index iform,
-                                                                  IndexStrategy indexStrategy,
-                                                                  Oid *indexOperator,
-                                                                  RegProcedure *indexSupport,
-                                                                  StrategyNumber maxStrategyNumber,
-                                                                  StrategyNumber maxSupportNumber,
-                                                                  AttrNumber maxAttributeNumber);
+                                          IndexStrategy indexStrategy,
+                                          Oid *indexOperator,
+                                          RegProcedure *indexSupport,
+                                          StrategyNumber maxStrategyNumber,
+                                          StrategyNumber maxSupportNumber,
+                                          AttrNumber maxAttributeNumber);
 static OpClassCacheEnt *LookupOpclassInfo(Oid operatorClassOid,
-                                                                                 StrategyNumber numStrats,
-                                                                                 StrategyNumber numSupport);
+                                 StrategyNumber numStrats,
+                                 StrategyNumber numSupport);
 
 
 /*
@@ -345,7 +345,7 @@ ScanPgRelation(RelationBuildDescInfo buildinfo)
                        ScanKeyEntryInitialize(&key[1], 0,
                                                                   Anum_pg_class_relnamespace,
                                                                   F_OIDEQ,
-                                                                  ObjectIdGetDatum(PG_CATALOG_NAMESPACE));
+                                                                ObjectIdGetDatum(PG_CATALOG_NAMESPACE));
                        nkeys = 2;
                        indexRelname = ClassNameNspIndex;
                        break;
@@ -356,9 +356,9 @@ ScanPgRelation(RelationBuildDescInfo buildinfo)
        }
 
        /*
-        * Open pg_class and fetch a tuple.  Force heap scan if we haven't
-        * yet built the critical relcache entries (this includes initdb
-        * and startup without a pg_internal.init file).
+        * Open pg_class and fetch a tuple.  Force heap scan if we haven't yet
+        * built the critical relcache entries (this includes initdb and
+        * startup without a pg_internal.init file).
         */
        pg_class_desc = heap_openr(RelationRelationName, AccessShareLock);
        pg_class_scan = systable_beginscan(pg_class_desc, indexRelname,
@@ -481,9 +481,9 @@ RelationBuildTupleDesc(RelationBuildDescInfo buildinfo,
                                                   Int16GetDatum(0));
 
        /*
-        * Open pg_attribute and begin a scan.  Force heap scan if we haven't
-        * yet built the critical relcache entries (this includes initdb
-        * and startup without a pg_internal.init file).
+        * Open pg_attribute and begin a scan.  Force heap scan if we haven't
+        * yet built the critical relcache entries (this includes initdb and
+        * startup without a pg_internal.init file).
         */
        pg_attribute_desc = heap_openr(AttributeRelationName, AccessShareLock);
        pg_attribute_scan = systable_beginscan(pg_attribute_desc,
@@ -653,8 +653,8 @@ RelationBuildRuleLock(Relation relation)
        relation->rd_rulescxt = rulescxt;
 
        /*
-        * allocate an array to hold the rewrite rules (the array is extended if
-        * necessary)
+        * allocate an array to hold the rewrite rules (the array is extended
+        * if necessary)
         */
        maxlocks = 4;
        rules = (RewriteRule **)
@@ -672,14 +672,14 @@ RelationBuildRuleLock(Relation relation)
        /*
         * open pg_rewrite and begin a scan
         *
-        * Note: since we scan the rules using RewriteRelRulenameIndex,
-        * we will be reading the rules in name order, except possibly
-        * during emergency-recovery operations (ie, IsIgnoringSystemIndexes).
-        * This in turn ensures that rules will be fired in name order.
+        * Note: since we scan the rules using RewriteRelRulenameIndex, we will
+        * be reading the rules in name order, except possibly during
+        * emergency-recovery operations (ie, IsIgnoringSystemIndexes). This
+        * in turn ensures that rules will be fired in name order.
         */
        rewrite_desc = heap_openr(RewriteRelationName, AccessShareLock);
        rewrite_tupdesc = RelationGetDescr(rewrite_desc);
-       rewrite_scan = systable_beginscan(rewrite_desc, 
+       rewrite_scan = systable_beginscan(rewrite_desc,
                                                                          RewriteRelRulenameIndex,
                                                                          true, SnapshotNow,
                                                                          1, &key);
@@ -723,7 +723,7 @@ RelationBuildRuleLock(Relation relation)
                                                                   &isnull);
                Assert(!isnull);
                rule_evqual_str = DatumGetCString(DirectFunctionCall1(textout,
-                                                                                                                         rule_evqual));
+                                                                                                                  rule_evqual));
                oldcxt = MemoryContextSwitchTo(rulescxt);
                rule->qual = (Node *) stringToNode(rule_evqual_str);
                MemoryContextSwitchTo(oldcxt);
@@ -767,9 +767,9 @@ equalRuleLocks(RuleLock *rlock1, RuleLock *rlock2)
        int                     i;
 
        /*
-        * As of 7.3 we assume the rule ordering is repeatable,
-        * because RelationBuildRuleLock should read 'em in a
-        * consistent order.  So just compare corresponding slots.
+        * As of 7.3 we assume the rule ordering is repeatable, because
+        * RelationBuildRuleLock should read 'em in a consistent order.  So
+        * just compare corresponding slots.
         */
        if (rlock1 != NULL)
        {
@@ -860,9 +860,10 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
        RelationSetReferenceCount(relation, 1);
 
        /*
-        * normal relations are not nailed into the cache; nor can a pre-existing
-        * relation be new.  It could be temp though.  (Actually, it could be new
-        * too, but it's okay to forget that fact if forced to flush the entry.)
+        * normal relations are not nailed into the cache; nor can a
+        * pre-existing relation be new.  It could be temp though.      (Actually,
+        * it could be new too, but it's okay to forget that fact if forced to
+        * flush the entry.)
         */
        relation->rd_isnailed = false;
        relation->rd_isnew = false;
@@ -950,8 +951,8 @@ RelationInitIndexAccessInfo(Relation relation)
        uint16          amsupport;
 
        /*
-        * Make a copy of the pg_index entry for the index.  Note that this
-        * is a variable-length tuple.
+        * Make a copy of the pg_index entry for the index.  Note that this is
+        * a variable-length tuple.
         */
        tuple = SearchSysCache(INDEXRELID,
                                                   ObjectIdGetDatum(RelationGetRelid(relation)),
@@ -1116,6 +1117,7 @@ IndexSupportInitialize(Form_pg_index iform,
                                        MemSet(mapentry, 0, sizeof(*mapentry));
                                        mapentry->sk_flags = 0;
                                        mapentry->sk_procedure = opcentry->operatorProcs[strategy];
+
                                        /*
                                         * Mark mapentry->sk_func invalid, until and unless
                                         * someone sets it up.
@@ -1387,7 +1389,7 @@ formrdesc(const char *relationName,
        /*
         * It's important to distinguish between shared and non-shared
         * relations, even at bootstrap time, to make sure we know where they
-        * are stored.  At present, all relations that formrdesc is used for
+        * are stored.  At present, all relations that formrdesc is used for
         * are not shared.
         */
        relation->rd_rel->relisshared = false;
@@ -1401,12 +1403,12 @@ formrdesc(const char *relationName,
        /*
         * initialize attribute tuple form
         *
-        * Unlike the case with the relation tuple, this data had better be
-        * right because it will never be replaced.  The input values must be
+        * Unlike the case with the relation tuple, this data had better be right
+        * because it will never be replaced.  The input values must be
         * correctly defined by macros in src/include/catalog/ headers.
         */
        relation->rd_att = CreateTemplateTupleDesc(natts,
-                                                                                          relation->rd_rel->relhasoids);
+                                                                                  relation->rd_rel->relhasoids);
 
        /*
         * initialize tuple desc info
@@ -1799,10 +1801,11 @@ RelationClearRelation(Relation relation, bool rebuild)
                        FreeTriggerDesc(old_trigdesc);
 
                /*
-                * Update rd_nblocks.  This is kind of expensive, but I think we must
-                * do it in case relation has been truncated... we definitely must
-                * do it if the rel is new or temp, since RelationGetNumberOfBlocks
-                * will subsequently assume that the block count is correct.
+                * Update rd_nblocks.  This is kind of expensive, but I think we
+                * must do it in case relation has been truncated... we definitely
+                * must do it if the rel is new or temp, since
+                * RelationGetNumberOfBlocks will subsequently assume that the
+                * block count is correct.
                 */
                RelationUpdateNumberOfBlocks(relation);
        }
@@ -1971,12 +1974,13 @@ AtEOXact_RelationCache(bool commit)
                /*
                 * Is it a relation created in the current transaction?
                 *
-                * During commit, reset the flag to false, since we are now out of the
-                * creating transaction.  During abort, simply delete the relcache
-                * entry --- it isn't interesting any longer.  (NOTE: if we have
-                * forgotten the isnew state of a new relation due to a forced cache
-                * flush, the entry will get deleted anyway by shared-cache-inval
-                * processing of the aborted pg_class insertion.)
+                * During commit, reset the flag to false, since we are now out of
+                * the creating transaction.  During abort, simply delete the
+                * relcache entry --- it isn't interesting any longer.  (NOTE: if
+                * we have forgotten the isnew state of a new relation due to a
+                * forced cache flush, the entry will get deleted anyway by
+                * shared-cache-inval processing of the aborted pg_class
+                * insertion.)
                 */
                if (relation->rd_isnew)
                {
@@ -1991,18 +1995,18 @@ AtEOXact_RelationCache(bool commit)
 
                /*
                 * During transaction abort, we must also reset relcache entry ref
-                * counts to their normal not-in-a-transaction state.  A ref count may
-                * be too high because some routine was exited by elog() between
-                * incrementing and decrementing the count.
+                * counts to their normal not-in-a-transaction state.  A ref count
+                * may be too high because some routine was exited by elog()
+                * between incrementing and decrementing the count.
                 *
-                * During commit, we should not have to do this, but it's still useful
-                * to check that the counts are correct to catch missed relcache
-                * closes.
+                * During commit, we should not have to do this, but it's still
+                * useful to check that the counts are correct to catch missed
+                * relcache closes.
                 *
                 * In bootstrap mode, do NOT reset the refcnt nor complain that it's
                 * nonzero --- the bootstrap code expects relations to stay open
-                * across start/commit transaction calls.  (That seems bogus, but it's
-                * not worth fixing.)
+                * across start/commit transaction calls.  (That seems bogus, but
+                * it's not worth fixing.)
                 */
                expected_refcnt = relation->rd_isnailed ? 1 : 0;
 
@@ -2083,10 +2087,10 @@ RelationBuildLocalRelation(const char *relname,
        /*
         * create a new tuple descriptor from the one passed in.  We do this
         * partly to copy it into the cache context, and partly because the
-        * new relation can't have any defaults or constraints yet; they
-        * have to be added in later steps, because they require additions
-        * to multiple system catalogs.  We can copy attnotnull constraints
-        * here, however.
+        * new relation can't have any defaults or constraints yet; they have
+        * to be added in later steps, because they require additions to
+        * multiple system catalogs.  We can copy attnotnull constraints here,
+        * however.
         */
        rel->rd_att = CreateTupleDescCopy(tupDesc);
        for (i = 0; i < natts; i++)
@@ -2184,12 +2188,12 @@ RelationCacheInitialize(void)
                                                                        &ctl, HASH_ELEM | HASH_FUNCTION);
 
        /*
-        * Try to load the relcache cache file.  If successful, we're done
-        * for now.  Otherwise, initialize the cache with pre-made descriptors
-        * for the critical "nailed-in" system catalogs.
+        * Try to load the relcache cache file.  If successful, we're done for
+        * now.  Otherwise, initialize the cache with pre-made descriptors for
+        * the critical "nailed-in" system catalogs.
         */
        if (IsBootstrapProcessingMode() ||
-               ! load_relcache_init_file())
+               !load_relcache_init_file())
        {
                formrdesc(RelationRelationName,
                                  Natts_pg_class, Desc_pg_class);
@@ -2228,22 +2232,23 @@ RelationCacheInitializePhase2(void)
         * If we didn't get the critical system indexes loaded into relcache,
         * do so now.  These are critical because the catcache depends on them
         * for catcache fetches that are done during relcache load.  Thus, we
-        * have an infinite-recursion problem.  We can break the recursion
-        * by doing heapscans instead of indexscans at certain key spots.
-        * To avoid hobbling performance, we only want to do that until we
-        * have the critical indexes loaded into relcache.  Thus, the flag
-        * criticalRelcachesBuilt is used to decide whether to do heapscan
-        * or indexscan at the key spots, and we set it true after we've loaded
+        * have an infinite-recursion problem.  We can break the recursion by
+        * doing heapscans instead of indexscans at certain key spots. To
+        * avoid hobbling performance, we only want to do that until we have
+        * the critical indexes loaded into relcache.  Thus, the flag
+        * criticalRelcachesBuilt is used to decide whether to do heapscan or
+        * indexscan at the key spots, and we set it true after we've loaded
         * the critical indexes.
         *
         * The critical indexes are marked as "nailed in cache", partly to make
         * it easy for load_relcache_init_file to count them, but mainly
         * because we cannot flush and rebuild them once we've set
-        * criticalRelcachesBuilt to true.  (NOTE: perhaps it would be possible
-        * to reload them by temporarily setting criticalRelcachesBuilt to
-        * false again.  For now, though, we just nail 'em in.)
+        * criticalRelcachesBuilt to true.      (NOTE: perhaps it would be
+        * possible to reload them by temporarily setting
+        * criticalRelcachesBuilt to false again.  For now, though, we just
+        * nail 'em in.)
         */
-       if (! criticalRelcachesBuilt)
+       if (!criticalRelcachesBuilt)
        {
                RelationBuildDescInfo buildinfo;
                Relation        ird;
@@ -2265,7 +2270,7 @@ RelationCacheInitializePhase2(void)
                LOAD_CRIT_INDEX(AccessMethodProcedureIndex);
                LOAD_CRIT_INDEX(OperatorOidIndex);
 
-#define NUM_CRITICAL_INDEXES   7       /* fix if you change list above */
+#define NUM_CRITICAL_INDEXES   7               /* fix if you change list above */
 
                criticalRelcachesBuilt = true;
        }
@@ -2273,10 +2278,10 @@ RelationCacheInitializePhase2(void)
        /*
         * Now, scan all the relcache entries and update anything that might
         * be wrong in the results from formrdesc or the relcache cache file.
-        * If we faked up relcache entries using formrdesc, then read
-        * the real pg_class rows and replace the fake entries with them.
-        * Also, if any of the relcache entries have rules or triggers,
-        * load that info the hard way since it isn't recorded in the cache file.
+        * If we faked up relcache entries using formrdesc, then read the real
+        * pg_class rows and replace the fake entries with them. Also, if any
+        * of the relcache entries have rules or triggers, load that info the
+        * hard way since it isn't recorded in the cache file.
         */
        hash_seq_init(&status, RelationIdCache);
 
@@ -2293,12 +2298,13 @@ RelationCacheInitializePhase2(void)
                        Form_pg_class relp;
 
                        htup = SearchSysCache(RELOID,
-                                                                 ObjectIdGetDatum(RelationGetRelid(relation)),
+                                                       ObjectIdGetDatum(RelationGetRelid(relation)),
                                                                  0, 0, 0);
                        if (!HeapTupleIsValid(htup))
                                elog(FATAL, "RelationCacheInitializePhase2: no pg_class entry for %s",
                                         RelationGetRelationName(relation));
                        relp = (Form_pg_class) GETSTRUCT(htup);
+
                        /*
                         * Copy tuple to relation->rd_rel. (See notes in
                         * AllocateRelationDesc())
@@ -2335,11 +2341,11 @@ RelationCacheInitializePhase3(void)
        if (needNewCacheFile)
        {
                /*
-                * Force all the catcaches to finish initializing and thereby
-                * open the catalogs and indexes they use.  This will preload
-                * the relcache with entries for all the most important system
-                * catalogs and indexes, so that the init file will be most
-                * useful for future backends.
+                * Force all the catcaches to finish initializing and thereby open
+                * the catalogs and indexes they use.  This will preload the
+                * relcache with entries for all the most important system
+                * catalogs and indexes, so that the init file will be most useful
+                * for future backends.
                 */
                InitCatalogCachePhase2();
 
@@ -2509,7 +2515,7 @@ CheckConstraintFetch(Relation relation)
                                 RelationGetRelationName(relation));
 
                check[found].ccname = MemoryContextStrdup(CacheMemoryContext,
-                                                                                                 NameStr(conform->conname));
+                                                                                         NameStr(conform->conname));
 
                /* Grab and test conbin is actually set */
                val = fastgetattr(htup,
@@ -2559,7 +2565,7 @@ List *
 RelationGetIndexList(Relation relation)
 {
        Relation        indrel;
-       SysScanDesc     indscan;
+       SysScanDesc indscan;
        ScanKeyData skey;
        HeapTuple       htup;
        List       *result;
@@ -2724,7 +2730,7 @@ load_relcache_init_file(void)
        nailed_rels = nailed_indexes = 0;
        initFileRelationIds = NIL;
 
-       for (relno = 0; ; relno++)
+       for (relno = 0;; relno++)
        {
                Size            len;
                size_t          nread;
@@ -2820,9 +2826,9 @@ load_relcache_init_file(void)
                         */
                        indexcxt = AllocSetContextCreate(CacheMemoryContext,
                                                                                         RelationGetRelationName(rel),
-                                                                                        0,             /* minsize */
-                                                                                        512,   /* initsize */
-                                                                                        1024); /* maxsize */
+                                                                                        0, /* minsize */
+                                                                                        512,           /* initsize */
+                                                                                        1024);         /* maxsize */
                        rel->rd_indexcxt = indexcxt;
 
                        /* next, read the index strategy map */
@@ -2883,8 +2889,9 @@ load_relcache_init_file(void)
                /*
                 * Rules and triggers are not saved (mainly because the internal
                 * format is complex and subject to change).  They must be rebuilt
-                * if needed by RelationCacheInitializePhase2.  This is not expected
-                * to be a big performance hit since few system catalogs have such.
+                * if needed by RelationCacheInitializePhase2.  This is not
+                * expected to be a big performance hit since few system catalogs
+                * have such.
                 */
                rel->rd_rules = NULL;
                rel->rd_rulescxt = NULL;
@@ -2917,8 +2924,8 @@ load_relcache_init_file(void)
        }
 
        /*
-        * We reached the end of the init file without apparent problem.
-        * Did we get the right number of nailed items?  (This is a useful
+        * We reached the end of the init file without apparent problem. Did
+        * we get the right number of nailed items?  (This is a useful
         * crosscheck in case the set of critical rels or indexes changes.)
         */
        if (nailed_rels != NUM_CRITICAL_RELS ||
@@ -2945,9 +2952,9 @@ load_relcache_init_file(void)
        return true;
 
        /*
-        * init file is broken, so do it the hard way.  We don't bother
-        * trying to free the clutter we just allocated; it's not in the
-        * relcache so it won't hurt.
+        * init file is broken, so do it the hard way.  We don't bother trying
+        * to free the clutter we just allocated; it's not in the relcache so
+        * it won't hurt.
         */
 read_failed:
        pfree(rels);
@@ -3052,7 +3059,7 @@ write_relcache_init_file(void)
                         * afresh using the syscache, and write that.
                         */
                        tuple = SearchSysCache(INDEXRELID,
-                                                                  ObjectIdGetDatum(RelationGetRelid(rel)),
+                                                                ObjectIdGetDatum(RelationGetRelid(rel)),
                                                                   0, 0, 0);
                        if (!HeapTupleIsValid(tuple))
                                elog(ERROR, "write_relcache_init_file: no pg_index entry for index %u",
@@ -3109,14 +3116,14 @@ write_relcache_init_file(void)
 
        /*
         * Now we have to check whether the data we've so painstakingly
-        * accumulated is already obsolete due to someone else's just-committed
-        * catalog changes.  If so, we just delete the temp file and leave it
-        * to the next backend to try again.  (Our own relcache entries will be
-        * updated by SI message processing, but we can't be sure whether what
-        * we wrote out was up-to-date.)
+        * accumulated is already obsolete due to someone else's
+        * just-committed catalog changes.      If so, we just delete the temp
+        * file and leave it to the next backend to try again.  (Our own
+        * relcache entries will be updated by SI message processing, but we
+        * can't be sure whether what we wrote out was up-to-date.)
         *
-        * This mustn't run concurrently with RelationCacheInitFileInvalidate,
-        * so grab a serialization lock for the duration.
+        * This mustn't run concurrently with RelationCacheInitFileInvalidate, so
+        * grab a serialization lock for the duration.
         */
        LWLockAcquire(RelCacheInitLock, LW_EXCLUSIVE);
 
@@ -3140,9 +3147,10 @@ write_relcache_init_file(void)
                if (rename(tempfilename, finalfilename) < 0)
                {
                        elog(WARNING, "Cannot rename init file %s to %s: %m\n\tContinuing anyway, but there's something wrong.", tempfilename, finalfilename);
+
                        /*
-                        * If we fail, try to clean up the useless temp file; don't bother
-                        * to complain if this fails too.
+                        * If we fail, try to clean up the useless temp file; don't
+                        * bother to complain if this fails too.
                         */
                        unlink(tempfilename);
                }
@@ -3206,13 +3214,13 @@ RelationCacheInitFileInvalidate(bool beforeSend)
        else
        {
                /*
-                * We need to interlock this against write_relcache_init_file,
-                * to guard against possibility that someone renames a new-but-
+                * We need to interlock this against write_relcache_init_file, to
+                * guard against possibility that someone renames a new-but-
                 * already-obsolete init file into place just after we unlink.
                 * With the interlock, it's certain that write_relcache_init_file
-                * will notice our SI inval message before renaming into place,
-                * or else that we will execute second and successfully unlink
-                * the file.
+                * will notice our SI inval message before renaming into place, or
+                * else that we will execute second and successfully unlink the
+                * file.
                 */
                LWLockAcquire(RelCacheInitLock, LW_EXCLUSIVE);
                unlink(initfilename);
index 357829b..3eca49b 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.86 2002/08/05 03:29:17 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.87 2002/09/04 20:31:30 momjian Exp $
  *
  * NOTES
  *       These routines allow the parser/planner/executor to perform
@@ -174,7 +174,7 @@ static const struct cachedesc cacheinfo[] = {
                        0
        }},
        {
-               CastRelationName,                       /* CASTSOURCETARGET */
+               CastRelationName,               /* CASTSOURCETARGET */
                CastSourceTargetIndex,
                0,
                2,
@@ -204,7 +204,7 @@ static const struct cachedesc cacheinfo[] = {
                        0,
                        0
        }},
-       {ConversionRelationName, /* CONDEFAULT */
+       {ConversionRelationName,        /* CONDEFAULT */
                ConversionDefaultIndex,
                0,
                4,
@@ -214,7 +214,7 @@ static const struct cachedesc cacheinfo[] = {
                        Anum_pg_conversion_contoencoding,
                        ObjectIdAttributeNumber,
        }},
-       {ConversionRelationName, /* CONNAMENSP */
+       {ConversionRelationName,        /* CONNAMENSP */
                ConversionNameNspIndex,
                0,
                2,
@@ -224,7 +224,7 @@ static const struct cachedesc cacheinfo[] = {
                        0,
                        0
        }},
-       {ConversionRelationName, /* CONOID */
+       {ConversionRelationName,        /* CONOID */
                ConversionOidIndex,
                0,
                1,
@@ -436,7 +436,8 @@ static const struct cachedesc cacheinfo[] = {
        }}
 };
 
-static CatCache *SysCache[lengthof(cacheinfo)];
+static CatCache *SysCache[
+                                                 lengthof(cacheinfo)];
 static int     SysCacheSize = lengthof(cacheinfo);
 static bool CacheInitialized = false;
 
@@ -501,9 +502,7 @@ InitCatalogCachePhase2(void)
        Assert(CacheInitialized);
 
        for (cacheId = 0; cacheId < SysCacheSize; cacheId++)
-       {
                InitCatCachePhase2(SysCache[cacheId]);
-       }
 }
 
 
@@ -531,7 +530,7 @@ SearchSysCache(int cacheId,
                           Datum key4)
 {
        if (cacheId < 0 || cacheId >= SysCacheSize ||
-               ! PointerIsValid(SysCache[cacheId]))
+               !PointerIsValid(SysCache[cacheId]))
                elog(ERROR, "SearchSysCache: Bad cache id %d", cacheId);
 
        return SearchCatCache(SysCache[cacheId], key1, key2, key3, key4);
@@ -731,7 +730,7 @@ SearchSysCacheList(int cacheId, int nkeys,
                                   Datum key1, Datum key2, Datum key3, Datum key4)
 {
        if (cacheId < 0 || cacheId >= SysCacheSize ||
-               ! PointerIsValid(SysCache[cacheId]))
+               !PointerIsValid(SysCache[cacheId]))
                elog(ERROR, "SearchSysCacheList: Bad cache id %d", cacheId);
 
        return SearchCatCacheList(SysCache[cacheId], nkeys,
index 81fe83c..f03dbf5 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.22 2002/08/10 20:29:18 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.23 2002/09/04 20:31:30 momjian Exp $
  *
  * NOTE
  *       This should eventually work with elog()
@@ -31,9 +31,7 @@ ExceptionalCondition(char *conditionName,
        if (!PointerIsValid(conditionName)
                || !PointerIsValid(fileName)
                || !PointerIsValid(errorType))
-       {
                fprintf(stderr, "TRAP: ExceptionalCondition: bad arguments\n");
-       }
        else
        {
                fprintf(stderr, "TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
index 9258dd9..f730fb9 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.102 2002/09/02 05:42:54 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.103 2002/09/04 20:31:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -91,6 +91,7 @@ void
 elog(int lev, const char *fmt,...)
 {
        va_list         ap;
+
        /*
         * The expanded format and final output message are dynamically
         * allocated if necessary, but not if they fit in the "reasonable
@@ -103,22 +104,22 @@ elog(int lev, const char *fmt,...)
         * Note that we use malloc() not palloc() because we want to retain
         * control if we run out of memory.  palloc() would recursively call
         * elog(ERROR), which would be all right except if we are working on a
-        * FATAL or PANIC error.        We'd lose track of the fatal condition
-        * and report a mere ERROR to outer loop, which would be a Bad Thing.
-        * So, we substitute an appropriate message in-place, without
-        * downgrading the level if it's above ERROR.
+        * FATAL or PANIC error.        We'd lose track of the fatal condition and
+        * report a mere ERROR to outer loop, which would be a Bad Thing. So,
+        * we substitute an appropriate message in-place, without downgrading
+        * the level if it's above ERROR.
         */
        char            fmt_fixedbuf[128];
        char            msg_fixedbuf[256];
        char       *fmt_buf = fmt_fixedbuf;
        char       *msg_buf = msg_fixedbuf;
-       char            copylineno_buf[32];     /* for COPY line numbers */
+       char            copylineno_buf[32];             /* for COPY line numbers */
        const char *errorstr;
        const char *prefix;
        const char *cp;
        char       *bp;
        size_t          space_needed;
-       size_t          timestamp_size; /* prefix len for timestamp+pid */
+       size_t          timestamp_size; /* prefix len for timestamp+pid */
        bool            output_to_server = false;
        bool            output_to_client = false;
 
@@ -206,13 +207,13 @@ elog(int lev, const char *fmt,...)
         * calculation simple, we only allow one %m.
         */
        space_needed = timestamp_size + strlen(prefix) +
-                                  strlen(fmt) + strlen(errorstr) + 1;
+               strlen(fmt) + strlen(errorstr) + 1;
 
        if (copy_lineno)
        {
                /*
-                * Prints the failure line of the COPY.  Wow, what a hack!  bjm
-                * Translator:  Error message will be truncated at 31 characters.
+                * Prints the failure line of the COPY.  Wow, what a hack!      bjm
+                * Translator:  Error message will be truncated at 31 characters.
                 */
                snprintf(copylineno_buf, 32, gettext("copy: line %d, "), copy_lineno);
                space_needed += strlen(copylineno_buf);
@@ -427,13 +428,14 @@ elog(int lev, const char *fmt,...)
        if (msg_buf != msg_fixedbuf)
                free(msg_buf);
 
-       /* If the user wants this elog() generating query logged,
-        * do so. We only want to log if the query has been
-        * written to debug_query_string. Also, avoid infinite loops.
+       /*
+        * If the user wants this elog() generating query logged, do so. We
+        * only want to log if the query has been written to
+        * debug_query_string. Also, avoid infinite loops.
         */
 
-       if(lev != LOG && lev >= log_min_error_statement && debug_query_string)
-               elog(LOG,"statement: %s",debug_query_string);
+       if (lev != LOG && lev >= log_min_error_statement && debug_query_string)
+               elog(LOG, "statement: %s", debug_query_string);
 
        /*
         * Perform error recovery action as specified by lev.
@@ -445,7 +447,8 @@ elog(int lev, const char *fmt,...)
 
                /*
                 * If we just reported a startup failure, the client will
-                * disconnect on receiving it, so don't send any more to the client.
+                * disconnect on receiving it, so don't send any more to the
+                * client.
                 */
                if (!Warn_restart_ready && whereToSendOutput == Remote)
                        whereToSendOutput = None;
@@ -506,7 +509,7 @@ elog(int lev, const char *fmt,...)
                proc_exit(2);
        }
 
-       /* We reach here if lev <= WARNING.     OK to return to caller. */
+       /* We reach here if lev <= WARNING. OK to return to caller. */
 }
 
 
@@ -744,8 +747,8 @@ send_message_to_frontend(int type, const char *msg)
        AssertArg(type <= ERROR);
 
        pq_beginmessage(&buf);
-       pq_sendbyte(&buf, type != ERROR ? 'N' : 'E'); /* N is INFO, NOTICE,
-                                                                                                  * or WARNING */
+       pq_sendbyte(&buf, type != ERROR ? 'N' : 'E');           /* N is INFO, NOTICE, or
+                                                                                                                * WARNING */
        pq_sendstring(&buf, msg);
        pq_endmessage(&buf);
 
@@ -835,6 +838,3 @@ elog_message_prefix(int lev)
        Assert(prefix != NULL);
        return prefix;
 }
-
-
-
index 7e3204c..c0cef75 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.61 2002/08/13 17:22:08 petere Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.62 2002/09/04 20:31:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,7 +58,7 @@ typedef struct
 
 
 static void fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt,
-                                                                  bool ignore_security);
+                                          bool ignore_security);
 static void fmgr_info_C_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedureTuple);
 static void fmgr_info_other_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedureTuple);
 static Datum fmgr_oldstyle(PG_FUNCTION_ARGS);
@@ -339,8 +339,8 @@ fmgr_info_other_lang(Oid functionId, FmgrInfo *finfo, HeapTuple procedureTuple)
 
        /*
         * If lookup of the PL handler function produced nonnull fn_extra,
-        * complain --- it must be an oldstyle function! We no longer
-        * support oldstyle PL handlers.
+        * complain --- it must be an oldstyle function! We no longer support
+        * oldstyle PL handlers.
         */
        if (plfinfo.fn_extra != NULL)
                elog(ERROR, "fmgr_info: language %u has old-style handler",
index 0df872c..9597565 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright (c) 2002, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/fmgr/funcapi.c,v 1.5 2002/08/30 19:56:49 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/fmgr/funcapi.c,v 1.6 2002/09/04 20:31:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -62,7 +62,8 @@ init_MultiFuncCall(PG_FUNCTION_ARGS)
                 */
                fcinfo->flinfo->fn_extra = retval;
        }
-       else    /* second and subsequent calls */
+       else
+/* second and subsequent calls */
        {
                elog(ERROR, "init_MultiFuncCall may not be called more than once");
 
@@ -75,7 +76,7 @@ init_MultiFuncCall(PG_FUNCTION_ARGS)
 
 /*
  * per_MultiFuncCall
- * 
+ *
  * Do Multi-function per-call setup
  */
 FuncCallContext *
@@ -87,8 +88,8 @@ per_MultiFuncCall(PG_FUNCTION_ARGS)
         * Clear the TupleTableSlot, if present.  This is for safety's sake:
         * the Slot will be in a long-lived context (it better be, if the
         * FuncCallContext is pointing to it), but in most usage patterns the
-        * tuples stored in it will be in the function's per-tuple context.
-        * So at the beginning of each call, the Slot will hold a dangling
+        * tuples stored in it will be in the function's per-tuple context. So
+        * at the beginning of each call, the Slot will hold a dangling
         * pointer to an already-recycled tuple.  We clear it out here.  (See
         * also the definition of TupleGetDatum() in funcapi.h!)
         */
@@ -109,8 +110,8 @@ end_MultiFuncCall(PG_FUNCTION_ARGS, FuncCallContext *funcctx)
        fcinfo->flinfo->fn_extra = NULL;
 
        /*
-        * Caller is responsible to free up memory for individual
-        * struct elements other than att_in_funcinfo and elements.
+        * Caller is responsible to free up memory for individual struct
+        * elements other than att_in_funcinfo and elements.
         */
        if (funcctx->attinmeta != NULL)
                pfree(funcctx->attinmeta);
index 6c9698d..3c5e040 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.29 2002/09/02 02:47:05 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.30 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -115,7 +115,7 @@ ValidateBinary(char *path)
                        is_x = buf.st_mode & S_IXGRP;
                        if (!(is_r && is_x))
                                elog(DEBUG2, "ValidateBinary: \"%s\" is not group read/execute",
-                                       path);
+                                        path);
                        return is_x ? (is_r ? 0 : -2) : -1;
                }
        }
@@ -123,7 +123,7 @@ ValidateBinary(char *path)
        is_x = buf.st_mode & S_IXOTH;
        if (!(is_r && is_x))
                elog(DEBUG2, "ValidateBinary: \"%s\" is not other read/execute",
-                       path);
+                        path);
        return is_x ? (is_r ? 0 : -2) : -1;
 }
 
@@ -207,7 +207,7 @@ FindExec(char *full_path, const char *argv0, const char *binary_name)
                                case 0: /* found ok */
                                        strncpy(full_path, buf, MAXPGPATH);
                                        elog(DEBUG1, "FindExec: found \"%s\" using PATH",
-                                               full_path);
+                                                full_path);
                                        free(path);
                                        return 0;
                                case -1:                /* wasn't even a candidate, keep looking */
index 51a729c..91c3ba0 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.66 2002/08/12 00:36:11 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.67 2002/09/04 20:31:31 momjian Exp $
  *
  * NOTES
  *       Globals used all over the place should be declared here and not
@@ -39,6 +39,7 @@ struct Port *MyProcPort;
 long           MyCancelKey;
 
 char      *DataDir = NULL;
+
  /*
   * The PGDATA directory user says to use, or defaults to via environment
   * variable.  NULL if no option given and no environment variable set
index df67988..f417068 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.95 2002/09/02 02:47:05 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.96 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -176,8 +176,8 @@ SetDataDir(const char *dir)
         * generating funny-looking paths to individual files.
         */
        newlen = strlen(new);
-       if (newlen > 1 && new[newlen-1] == '/')
-               new[newlen-1] = '\0';
+       if (newlen > 1 && new[newlen - 1] == '/')
+               new[newlen - 1] = '\0';
 
        if (DataDir)
                free(DataDir);
@@ -470,7 +470,6 @@ GetCharSetByHost(char *TableName, int host, const char *DataDir)
                pfree(ChArray[i]);
        }
 }
-
 #endif   /* CYR_RECODE */
 
 
@@ -561,22 +560,22 @@ InitializeSessionUserId(const char *username)
        AuthenticatedUserId = usesysid;
        AuthenticatedUserIsSuperuser = ((Form_pg_shadow) GETSTRUCT(userTup))->usesuper;
 
-       SetSessionUserId(usesysid);     /* sets CurrentUserId too */
+       SetSessionUserId(usesysid); /* sets CurrentUserId too */
 
        /* Record username as a config option too */
        SetConfigOption("session_authorization", username,
                                        PGC_BACKEND, PGC_S_OVERRIDE);
 
        /*
-        * Set up user-specific configuration variables.  This is a good
-        * place to do it so we don't have to read pg_shadow twice during
-        * session startup.
+        * Set up user-specific configuration variables.  This is a good place
+        * to do it so we don't have to read pg_shadow twice during session
+        * startup.
         */
        datum = SysCacheGetAttr(SHADOWNAME, userTup,
                                                        Anum_pg_shadow_useconfig, &isnull);
        if (!isnull)
        {
-               ArrayType *a = DatumGetArrayTypeP(datum);
+               ArrayType  *a = DatumGetArrayTypeP(datum);
 
                ProcessGUCArray(a, PGC_S_USER);
        }
@@ -952,7 +951,7 @@ RecordSharedMemoryInLockFile(unsigned long id1, unsigned long id2)
        ptr++;
 
        /*
-        * Append key information.  Format to try to keep it the same length
+        * Append key information.      Format to try to keep it the same length
         * always (trailing junk won't hurt, but might confuse humans).
         */
        sprintf(ptr, "%9lu %9lu\n", id1, id2);
index 7de6eb2..ee4abdf 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.115 2002/09/03 21:45:42 petere Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.116 2002/09/04 20:31:31 momjian Exp $
  *
  *
  *-------------------------------------------------------------------------
@@ -124,13 +124,14 @@ ReverifyMyDatabase(const char *name)
                         name);
 
        /*
-        * OK, we're golden.  Only other to-do item is to save the
-        * encoding info out of the pg_database tuple.
+        * OK, we're golden.  Only other to-do item is to save the encoding
+        * info out of the pg_database tuple.
         */
        SetDatabaseEncoding(dbform->encoding);
        /* If we have no other source of client_encoding, use server encoding */
        SetConfigOption("client_encoding", GetDatabaseEncodingName(),
                                        PGC_BACKEND, PGC_S_DEFAULT);
+
        /*
         * Set up database-specific configuration variables.
         */
@@ -143,7 +144,7 @@ ReverifyMyDatabase(const char *name)
                                                         RelationGetDescr(pgdbrel), &isnull);
                if (!isnull)
                {
-                       ArrayType *a = DatumGetArrayTypeP(datum);
+                       ArrayType  *a = DatumGetArrayTypeP(datum);
 
                        ProcessGUCArray(a, PGC_S_DATABASE);
                }
@@ -277,8 +278,8 @@ InitPostgres(const char *dbname, const char *username)
         */
 
        /*
-        * Set up my per-backend PGPROC struct in shared memory.        (We need to
-        * know MyDatabaseId before we can do this, since it's entered into
+        * Set up my per-backend PGPROC struct in shared memory.        (We need
+        * to know MyDatabaseId before we can do this, since it's entered into
         * the PGPROC struct.)
         */
        InitProcess();
@@ -304,9 +305,9 @@ InitPostgres(const char *dbname, const char *username)
        AmiTransactionOverride(bootstrap);
 
        /*
-        * Initialize the relation descriptor cache.  This must create
-        * at least the minimum set of "nailed-in" cache entries.  No
-        * catalog access happens here.
+        * Initialize the relation descriptor cache.  This must create at
+        * least the minimum set of "nailed-in" cache entries.  No catalog
+        * access happens here.
         */
        RelationCacheInitialize();
 
@@ -367,25 +368,26 @@ InitPostgres(const char *dbname, const char *username)
                ReverifyMyDatabase(dbname);
 
        /*
-        * Final phase of relation cache startup: write a new cache file
-        * if necessary.  This is done after ReverifyMyDatabase to avoid
-        * writing a cache file into a dead database.
+        * Final phase of relation cache startup: write a new cache file if
+        * necessary.  This is done after ReverifyMyDatabase to avoid writing
+        * a cache file into a dead database.
         */
        RelationCacheInitializePhase3();
 
        /*
-        * Initialize various default states that can't be set up until
-        * we've selected the active user and done ReverifyMyDatabase.
+        * Initialize various default states that can't be set up until we've
+        * selected the active user and done ReverifyMyDatabase.
         */
 
        /* set default namespace search path */
        InitializeSearchPath();
 
        /*
-        * Set up process-exit callback to do pre-shutdown cleanup.  This should
-        * be last because we want shmem_exit to call this routine before the exit
-        * callbacks that are registered by buffer manager, lock manager, etc.
-        * We need to run this code before we close down database access!
+        * Set up process-exit callback to do pre-shutdown cleanup.  This
+        * should be last because we want shmem_exit to call this routine
+        * before the exit callbacks that are registered by buffer manager,
+        * lock manager, etc. We need to run this code before we close down
+        * database access!
         */
        on_shmem_exit(ShutdownPostgres, 0);
 
@@ -395,10 +397,11 @@ InitPostgres(const char *dbname, const char *username)
 
        /*
         * Check a normal user hasn't connected to a superuser reserved slot.
-        * Do this here since we need the user information and that only happens
-        * after we've started bringing the shared memory online. So we wait
-        * until we've registered exit handlers and potentially shut an open
-        * transaction down for an as safety conscious rejection as possible.
+        * Do this here since we need the user information and that only
+        * happens after we've started bringing the shared memory online. So
+        * we wait until we've registered exit handlers and potentially shut
+        * an open transaction down for an as safety conscious rejection as
+        * possible.
         */
        if (CountEmptyBackendSlots() < ReservedBackends && !superuser())
                elog(ERROR, "Non-superuser connection limit exceeded");
index 98b6b27..a41f9ab 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conv.c,v 1.42 2002/08/14 02:45:10 ishii Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conv.c,v 1.43 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,11 +52,12 @@ gb180302mic(unsigned char *gb18030, unsigned char *p, int len)
                        len--;
                        *p++ = c1;
                }
-               else if(c1 >= 0x81 && c1 <= 0xfe)
+               else if (c1 >= 0x81 && c1 <= 0xfe)
                {
                        c2 = *gb18030++;
-                       
-                       if(c2 >= 0x30 && c2 <= 0x69){
+
+                       if (c2 >= 0x30 && c2 <= 0x69)
+                       {
                                len -= 4;
                                *p++ = c1;
                                *p++ = c2;
@@ -64,13 +65,15 @@ gb180302mic(unsigned char *gb18030, unsigned char *p, int len)
                                *p++ = *gb18030++;
                                *p++ = *gb18030++;
                        }
-                       else if ((c2 >=0x40 && c2 <= 0x7e) ||(c2 >=0x80 && c2 <= 0xfe)){
+                       else if ((c2 >= 0x40 && c2 <= 0x7e) || (c2 >= 0x80 && c2 <= 0xfe))
+                       {
                                len -= 2;
                                *p++ = c1;
                                *p++ = c2;
                                *p++ = *gb18030++;
                        }
-                       else{   /*throw the strange code*/
+                       else
+                       {                                       /* throw the strange code */
                                len--;
                        }
                }
@@ -92,39 +95,40 @@ mic2gb18030(unsigned char *mic, unsigned char *p, int len)
        {
                len -= pg_mic_mblen(mic++);
 
-               if (c1 <= 0x7f) /*ASCII*/
-               {                                       
+               if (c1 <= 0x7f)                 /* ASCII */
                        *p++ = c1;
-               }
                else if (c1 >= 0x81 && c1 <= 0xfe)
-               {               
+               {
                        c2 = *mic++;
-                       
-                       if((c2 >= 0x40 && c2 <= 0x7e) || (c2 >= 0x80 && c2 <= 0xfe)){
+
+                       if ((c2 >= 0x40 && c2 <= 0x7e) || (c2 >= 0x80 && c2 <= 0xfe))
+                       {
                                *p++ = c1;
                                *p++ = c2;
                        }
-                       else if(c2 >= 0x30 && c2 <= 0x39){
+                       else if (c2 >= 0x30 && c2 <= 0x39)
+                       {
                                *p++ = c1;
                                *p++ = c2;
                                *p++ = *mic++;
                                *p++ = *mic++;
-                       }       
-                       else{
+                       }
+                       else
+                       {
                                mic--;
                                pg_print_bogus_char(&mic, &p);
                                mic--;
                                pg_print_bogus_char(&mic, &p);
-                       }               
+                       }
                }
-               else{
+               else
+               {
                        mic--;
                        pg_print_bogus_char(&mic, &p);
                }
        }
        *p = '\0';
 }
-
 #endif
 
 /*
@@ -387,7 +391,7 @@ UtfToLocal(unsigned char *utf, unsigned char *iso,
  */
 void
 LocalToUtf(unsigned char *iso, unsigned char *utf,
-                        pg_local_to_utf *map, int size, int encoding, int len)
+                  pg_local_to_utf *map, int size, int encoding, int len)
 {
        unsigned int iiso;
        int                     l;
index 2c827e8..4f3199e 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.3 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,7 +37,7 @@ ascii_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_SQL_ASCII);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -53,7 +53,7 @@ mic_to_ascii(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_SQL_ASCII);
index a870dee..7d4b8f4 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.3 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -79,12 +79,12 @@ static void mic2win1251(unsigned char *mic, unsigned char *p, int len);
 static void alt2mic(unsigned char *l, unsigned char *p, int len);
 static void mic2alt(unsigned char *mic, unsigned char *p, int len);
 
-Datum 
+Datum
 koi8r_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_KOI8R);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -95,12 +95,12 @@ koi8r_to_mic(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 mic_to_koi8r(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_KOI8R);
@@ -116,7 +116,7 @@ iso_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -132,7 +132,7 @@ mic_to_iso(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5);
@@ -148,7 +148,7 @@ win1251_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_WIN1251);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -164,7 +164,7 @@ mic_to_win1251(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_WIN1251);
@@ -180,7 +180,7 @@ alt_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_ALT);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -196,7 +196,7 @@ mic_to_alt(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_ALT);
@@ -212,7 +212,7 @@ koi8r_to_win1251(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_KOI8R);
@@ -227,12 +227,12 @@ koi8r_to_win1251(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 win1251_to_koi8r(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_WIN1251);
@@ -252,7 +252,7 @@ koi8r_to_alt(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_KOI8R);
@@ -267,12 +267,12 @@ koi8r_to_alt(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 alt_to_koi8r(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_ALT);
@@ -287,12 +287,12 @@ alt_to_koi8r(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 alt_to_win1251(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_ALT);
@@ -307,12 +307,12 @@ alt_to_win1251(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 win1251_to_alt(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_WIN1251);
@@ -327,12 +327,12 @@ win1251_to_alt(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 iso_to_koi8r(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5);
@@ -347,12 +347,12 @@ iso_to_koi8r(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 koi8r_to_iso(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_KOI8R);
@@ -367,12 +367,12 @@ koi8r_to_iso(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 iso_to_win1251(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5);
@@ -387,12 +387,12 @@ iso_to_win1251(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 win1251_to_iso(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_WIN1251);
@@ -407,12 +407,12 @@ win1251_to_iso(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 iso_to_alt(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5);
@@ -427,12 +427,12 @@ iso_to_alt(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 alt_to_iso(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_ALT);
@@ -627,4 +627,3 @@ mic2alt(unsigned char *mic, unsigned char *p, int len)
 
        mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2alt);
 }
-
index c443aa8..bddaddf 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.3 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,7 +40,7 @@ euc_cn_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_EUC_CN);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -56,7 +56,7 @@ mic_to_euc_cn(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_EUC_CN);
index cc98298..6ba2407 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c,v 1.3 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -64,7 +64,7 @@ euc_jp_to_sjis(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_EUC_JP);
@@ -84,7 +84,7 @@ sjis_to_euc_jp(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_SJIS);
@@ -104,7 +104,7 @@ euc_jp_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_EUC_JP);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -120,7 +120,7 @@ mic_to_euc_jp(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_EUC_JP);
@@ -136,7 +136,7 @@ sjis_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_SJIS);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -152,7 +152,7 @@ mic_to_sjis(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_SJIS);
index 43e69f7..c850cfa 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.3 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,7 +40,7 @@ euc_kr_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_EUC_KR);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -56,7 +56,7 @@ mic_to_euc_kr(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_EUC_KR);
@@ -122,4 +122,3 @@ mic2euc_kr(unsigned char *mic, unsigned char *p, int len)
        }
        *p = '\0';
 }
-
index 4e1844c..ad50967 100644 (file)
@@ -7,7 +7,7 @@
  *
  * 1999/1/15 Tatsuo Ishii
  *
- * $Id: big5.c,v 1.1 2002/07/16 09:25:05 ishii Exp $
+ * $Id: big5.c,v 1.2 2002/09/04 20:31:31 momjian Exp $
  */
 
 /* can be used in either frontend or backend */
@@ -19,7 +19,7 @@ typedef struct
 {
        unsigned short code,
                                peer;
-} codes_t;
+}      codes_t;
 
 /* map Big5 Level 1 to CNS 11643-1992 Plane 1 */
 static codes_t big5Level1ToCnsPlane1[25] = {   /* range */
@@ -205,7 +205,7 @@ static unsigned short b2c3[][2] = {
 };
 
 static unsigned short BinarySearchRange
-                       (codes_t *array, int high, unsigned short code)
+                       (codes_t * array, int high, unsigned short code)
 {
        int                     low,
                                mid,
index 112bdc1..a4e1a00 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c,v 1.3 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,7 +52,7 @@ euc_tw_to_big5(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_EUC_TW);
@@ -72,7 +72,7 @@ big5_to_euc_tw(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_BIG5);
@@ -92,7 +92,7 @@ euc_tw_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_EUC_TW);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -108,7 +108,7 @@ mic_to_euc_tw(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_EUC_TW);
@@ -124,7 +124,7 @@ big5_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_BIG5);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -140,7 +140,7 @@ mic_to_big5(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_BIG5);
index f3a6476..3122776 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.2 2002/08/22 00:01:44 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.3 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -47,12 +47,12 @@ static void mic2latin2(unsigned char *mic, unsigned char *p, int len);
 static void win12502mic(unsigned char *l, unsigned char *p, int len);
 static void mic2win1250(unsigned char *mic, unsigned char *p, int len);
 
-Datum 
+Datum
 latin2_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_LATIN2);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -63,12 +63,12 @@ latin2_to_mic(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 mic_to_latin2(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_LATIN2);
@@ -84,7 +84,7 @@ win1250_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_WIN1250);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -100,7 +100,7 @@ mic_to_win1250(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_WIN1250);
@@ -116,7 +116,7 @@ latin2_to_win1250(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_LATIN2);
@@ -136,7 +136,7 @@ win1250_to_latin2(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned char *buf;
 
        Assert(PG_GETARG_INT32(0) == PG_WIN1250);
index e6122f4..d08470d 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.3 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -47,12 +47,12 @@ static void mic2latin3(unsigned char *mic, unsigned char *p, int len);
 static void latin42mic(unsigned char *l, unsigned char *p, int len);
 static void mic2latin4(unsigned char *mic, unsigned char *p, int len);
 
-Datum 
+Datum
 latin1_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_LATIN1);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -63,12 +63,12 @@ latin1_to_mic(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 mic_to_latin1(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_LATIN1);
@@ -79,12 +79,12 @@ mic_to_latin1(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 latin3_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_LATIN3);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -95,12 +95,12 @@ latin3_to_mic(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 mic_to_latin3(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_LATIN3);
@@ -111,12 +111,12 @@ mic_to_latin3(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum 
+Datum
 latin4_to_mic(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_LATIN4);
        Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
@@ -127,11 +127,12 @@ latin4_to_mic(PG_FUNCTION_ARGS)
        PG_RETURN_INT32(0);
 }
 
-Datum mic_to_latin4(PG_FUNCTION_ARGS)
+Datum
+mic_to_latin4(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
        Assert(PG_GETARG_INT32(1) == PG_LATIN4);
@@ -172,4 +173,3 @@ mic2latin4(unsigned char *mic, unsigned char *p, int len)
 {
        mic2latin(mic, p, len, LC_ISO8859_4);
 }
-
index 581cebb..71448e3 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.3 2002/09/04 20:31:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,7 +37,7 @@ ascii_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_SQL_ASCII);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
@@ -53,7 +53,7 @@ utf8_to_ascii(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_SQL_ASCII);
index 7b6c16a..f2adecb 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,7 +38,7 @@ big5_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_BIG5);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
@@ -55,7 +55,7 @@ utf8_to_big5(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_BIG5);
index 3135d15..31693a1 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -51,14 +51,14 @@ utf8_to_koi8r(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_KOI8R);
        Assert(len > 0);
 
-       UtfToLocal(src, dest, ULmap_KOI8R, 
-                  sizeof(ULmap_KOI8R) / sizeof(pg_utf_to_local), len);
+       UtfToLocal(src, dest, ULmap_KOI8R,
+                          sizeof(ULmap_KOI8R) / sizeof(pg_utf_to_local), len);
 
        PG_RETURN_INT32(0);
 }
@@ -68,14 +68,14 @@ koi8r_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_KOI8R);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
        Assert(len > 0);
 
-       LocalToUtf(src, dest, LUmapKOI8R, 
-                  sizeof(LUmapKOI8R) / sizeof(pg_local_to_utf), PG_KOI8R, len);
+       LocalToUtf(src, dest, LUmapKOI8R,
+                       sizeof(LUmapKOI8R) / sizeof(pg_local_to_utf), PG_KOI8R, len);
 
        PG_RETURN_INT32(0);
 }
@@ -85,14 +85,14 @@ utf8_to_win1251(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_WIN1251);
        Assert(len > 0);
 
-       UtfToLocal(src, dest, ULmap_WIN1251, 
-                  sizeof(ULmap_WIN1251) / sizeof(pg_utf_to_local), len);
+       UtfToLocal(src, dest, ULmap_WIN1251,
+                          sizeof(ULmap_WIN1251) / sizeof(pg_utf_to_local), len);
 
        PG_RETURN_INT32(0);
 }
@@ -102,14 +102,14 @@ win1251_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_WIN1251);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
        Assert(len > 0);
 
-       LocalToUtf(src, dest, LUmapWIN1251, 
-                  sizeof(LUmapWIN1251) / sizeof(pg_local_to_utf), PG_WIN1251, len);
+       LocalToUtf(src, dest, LUmapWIN1251,
+               sizeof(LUmapWIN1251) / sizeof(pg_local_to_utf), PG_WIN1251, len);
 
        PG_RETURN_INT32(0);
 }
@@ -119,14 +119,14 @@ utf8_to_alt(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_ALT);
        Assert(len > 0);
 
-       UtfToLocal(src, dest, ULmap_ALT, 
-                  sizeof(ULmap_ALT) / sizeof(pg_utf_to_local), len);
+       UtfToLocal(src, dest, ULmap_ALT,
+                          sizeof(ULmap_ALT) / sizeof(pg_utf_to_local), len);
 
        PG_RETURN_INT32(0);
 }
@@ -136,14 +136,14 @@ alt_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_ALT);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
        Assert(len > 0);
 
-       LocalToUtf(src, dest, LUmapALT, 
-                  sizeof(LUmapALT) / sizeof(pg_local_to_utf), PG_ALT, len);
+       LocalToUtf(src, dest, LUmapALT,
+                          sizeof(LUmapALT) / sizeof(pg_local_to_utf), PG_ALT, len);
 
        PG_RETURN_INT32(0);
 }
index b021301..cfedb30 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,14 +38,14 @@ euc_cn_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_EUC_CN);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
        Assert(len > 0);
 
        LocalToUtf(src, dest, LUmapEUC_CN,
-                          sizeof(LUmapEUC_CN) / sizeof(pg_local_to_utf), PG_EUC_CN, len);
+                 sizeof(LUmapEUC_CN) / sizeof(pg_local_to_utf), PG_EUC_CN, len);
 
        PG_RETURN_INT32(0);
 }
@@ -55,7 +55,7 @@ utf8_to_euc_cn(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_EUC_CN);
index d71af15..7ea81cd 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,14 +38,14 @@ euc_jp_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_EUC_JP);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
        Assert(len > 0);
 
        LocalToUtf(src, dest, LUmapEUC_JP,
-                          sizeof(LUmapEUC_JP) / sizeof(pg_local_to_utf), PG_EUC_JP, len);
+                 sizeof(LUmapEUC_JP) / sizeof(pg_local_to_utf), PG_EUC_JP, len);
 
        PG_RETURN_INT32(0);
 }
@@ -55,7 +55,7 @@ utf8_to_euc_jp(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_EUC_JP);
index 7833950..6700b73 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,14 +38,14 @@ euc_kr_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_EUC_KR);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
        Assert(len > 0);
 
        LocalToUtf(src, dest, LUmapEUC_KR,
-                          sizeof(LUmapEUC_KR) / sizeof(pg_local_to_utf), PG_EUC_KR, len);
+                 sizeof(LUmapEUC_KR) / sizeof(pg_local_to_utf), PG_EUC_KR, len);
 
        PG_RETURN_INT32(0);
 }
@@ -55,7 +55,7 @@ utf8_to_euc_kr(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_EUC_KR);
index 7a8bff0..b094cf1 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,14 +38,14 @@ euc_tw_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_EUC_TW);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
        Assert(len > 0);
 
        LocalToUtf(src, dest, LUmapEUC_TW,
-                          sizeof(LUmapEUC_TW) / sizeof(pg_local_to_utf), PG_EUC_TW, len);
+                 sizeof(LUmapEUC_TW) / sizeof(pg_local_to_utf), PG_EUC_TW, len);
 
        PG_RETURN_INT32(0);
 }
@@ -55,7 +55,7 @@ utf8_to_euc_tw(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_EUC_TW);
index 0346515..bc293a4 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,14 +38,14 @@ gb18030_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_GB18030);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
        Assert(len > 0);
 
        LocalToUtf(src, dest, LUmapGB18030,
-                          sizeof(LUmapGB18030) / sizeof(pg_local_to_utf), PG_GB18030, len);
+               sizeof(LUmapGB18030) / sizeof(pg_local_to_utf), PG_GB18030, len);
 
        PG_RETURN_INT32(0);
 }
@@ -55,7 +55,7 @@ utf8_to_gb18030(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_GB18030);
index a6ec76c..94392a4 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,7 +38,7 @@ gbk_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_GBK);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
@@ -55,7 +55,7 @@ utf8_to_gbk(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_GBK);
index 6c373bf..f8d331e 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,78 +58,79 @@ extern Datum utf8_to_iso8859(PG_FUNCTION_ARGS);
  * ----------
  */
 
-typedef struct {
-       pg_enc encoding;
-       pg_local_to_utf *map1;          /* to UTF-8 map name */
-       pg_utf_to_local *map2;          /* from UTF-8 map name */
-       int     size1;  /* size of map1 */
-       int     size2;  /* size of map2 */
-} pg_conv_map;
+typedef struct
+{
+       pg_enc          encoding;
+       pg_local_to_utf *map1;          /* to UTF-8 map name */
+       pg_utf_to_local *map2;          /* from UTF-8 map name */
+       int                     size1;                  /* size of map1 */
+       int                     size2;                  /* size of map2 */
+}      pg_conv_map;
 
 static pg_conv_map maps[] = {
-       {PG_SQL_ASCII},                 /* SQL/ASCII */
-       {PG_EUC_JP},                    /* EUC for Japanese */
-       {PG_EUC_CN},                    /* EUC for Chinese */
-       {PG_EUC_KR},                    /* EUC for Korean */
-       {PG_EUC_TW},                    /* EUC for Taiwan */
-       {PG_JOHAB},                             /* EUC for Korean JOHAB */
-       {PG_UTF8},                              /* Unicode UTF-8 */
-       {PG_MULE_INTERNAL},             /* Mule internal code */
-       {PG_LATIN1},                    /* ISO-8859-1 Latin 1 */
+       {PG_SQL_ASCII},                         /* SQL/ASCII */
+       {PG_EUC_JP},                            /* EUC for Japanese */
+       {PG_EUC_CN},                            /* EUC for Chinese */
+       {PG_EUC_KR},                            /* EUC for Korean */
+       {PG_EUC_TW},                            /* EUC for Taiwan */
+       {PG_JOHAB},                                     /* EUC for Korean JOHAB */
+       {PG_UTF8},                                      /* Unicode UTF-8 */
+       {PG_MULE_INTERNAL},                     /* Mule internal code */
+       {PG_LATIN1},                            /* ISO-8859-1 Latin 1 */
        {PG_LATIN2, LUmapISO8859_2, ULmapISO8859_2,
-        sizeof(LUmapISO8859_2)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_2)/sizeof(pg_utf_to_local)},       /* ISO-8859-2 Latin 2 */
+               sizeof(LUmapISO8859_2) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_2) / sizeof(pg_utf_to_local)},      /* ISO-8859-2 Latin 2 */
        {PG_LATIN3, LUmapISO8859_3, ULmapISO8859_3,
-        sizeof(LUmapISO8859_3)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_3)/sizeof(pg_utf_to_local)},       /* ISO-8859-3 Latin 3 */
+               sizeof(LUmapISO8859_3) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_3) / sizeof(pg_utf_to_local)},      /* ISO-8859-3 Latin 3 */
        {PG_LATIN4, LUmapISO8859_4, ULmapISO8859_4,
-        sizeof(LUmapISO8859_4)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_4)/sizeof(pg_utf_to_local)},       /* ISO-8859-4 Latin 4 */
+               sizeof(LUmapISO8859_4) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_4) / sizeof(pg_utf_to_local)},      /* ISO-8859-4 Latin 4 */
        {PG_LATIN5, LUmapISO8859_9, ULmapISO8859_9,
-        sizeof(LUmapISO8859_9)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_9)/sizeof(pg_utf_to_local)},       /* ISO-8859-9 Latin 5 */
+               sizeof(LUmapISO8859_9) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_9) / sizeof(pg_utf_to_local)},      /* ISO-8859-9 Latin 5 */
        {PG_LATIN6, LUmapISO8859_10, ULmapISO8859_10,
-        sizeof(LUmapISO8859_10)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_10)/sizeof(pg_utf_to_local)},      /* ISO-8859-10 Latin 6 */
+               sizeof(LUmapISO8859_10) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_10) / sizeof(pg_utf_to_local)}, /* ISO-8859-10 Latin 6 */
        {PG_LATIN7, LUmapISO8859_13, ULmapISO8859_13,
-        sizeof(LUmapISO8859_13)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_13)/sizeof(pg_utf_to_local)},      /* ISO-8859-13 Latin 7 */
+               sizeof(LUmapISO8859_13) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_13) / sizeof(pg_utf_to_local)}, /* ISO-8859-13 Latin 7 */
        {PG_LATIN8, LUmapISO8859_14, ULmapISO8859_14,
-        sizeof(LUmapISO8859_14)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_14)/sizeof(pg_utf_to_local)},      /* ISO-8859-14 Latin 8 */
+               sizeof(LUmapISO8859_14) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_14) / sizeof(pg_utf_to_local)}, /* ISO-8859-14 Latin 8 */
        {PG_LATIN9, LUmapISO8859_2, ULmapISO8859_2,
-        sizeof(LUmapISO8859_15)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_15)/sizeof(pg_utf_to_local)},      /* ISO-8859-15 Latin 9 */
+               sizeof(LUmapISO8859_15) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_15) / sizeof(pg_utf_to_local)}, /* ISO-8859-15 Latin 9 */
        {PG_LATIN10, LUmapISO8859_16, ULmapISO8859_16,
-        sizeof(LUmapISO8859_16)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_16)/sizeof(pg_utf_to_local)},      /* ISO-8859-16 Latin 10 */
-       {PG_WIN1256},                                   /* windows-1256 */
+               sizeof(LUmapISO8859_16) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_16) / sizeof(pg_utf_to_local)}, /* ISO-8859-16 Latin 10 */
+       {PG_WIN1256},                           /* windows-1256 */
        {PG_TCVN},                                      /* TCVN (Windows-1258) */
        {PG_WIN874},                            /* windows-874 */
        {PG_KOI8R},                                     /* KOI8-R */
        {PG_WIN1251},                           /* windows-1251 (was: WIN) */
        {PG_ALT},                                       /* (MS-DOS CP866) */
        {PG_ISO_8859_5, LUmapISO8859_5, ULmapISO8859_5,
-        sizeof(LUmapISO8859_5)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_5)/sizeof(pg_utf_to_local)},       /* ISO-8859-5 */
+               sizeof(LUmapISO8859_5) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_5) / sizeof(pg_utf_to_local)},      /* ISO-8859-5 */
        {PG_ISO_8859_6, LUmapISO8859_6, ULmapISO8859_6,
-        sizeof(LUmapISO8859_6)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_6)/sizeof(pg_utf_to_local)},       /* ISO-8859-6 */
+               sizeof(LUmapISO8859_6) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_6) / sizeof(pg_utf_to_local)},      /* ISO-8859-6 */
        {PG_ISO_8859_7, LUmapISO8859_7, ULmapISO8859_7,
-        sizeof(LUmapISO8859_7)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_7)/sizeof(pg_utf_to_local)},       /* ISO-8859-7 */
+               sizeof(LUmapISO8859_7) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_7) / sizeof(pg_utf_to_local)},      /* ISO-8859-7 */
        {PG_ISO_8859_8, LUmapISO8859_8, ULmapISO8859_8,
-        sizeof(LUmapISO8859_8)/sizeof(pg_local_to_utf),
-        sizeof(ULmapISO8859_8)/sizeof(pg_utf_to_local)},       /* ISO-8859-8 */
+               sizeof(LUmapISO8859_8) / sizeof(pg_local_to_utf),
+       sizeof(ULmapISO8859_8) / sizeof(pg_utf_to_local)},      /* ISO-8859-8 */
 };
-               
+
 Datum
 iso8859_to_utf8(PG_FUNCTION_ARGS)
 {
-       int encoding = PG_GETARG_INT32(0);
+       int                     encoding = PG_GETARG_INT32(0);
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
        Assert(len > 0);
@@ -142,10 +143,10 @@ iso8859_to_utf8(PG_FUNCTION_ARGS)
 Datum
 utf8_to_iso8859(PG_FUNCTION_ARGS)
 {
-       int encoding = PG_GETARG_INT32(1);
+       int                     encoding = PG_GETARG_INT32(1);
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(len > 0);
index e66de79..0330234 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,7 +37,7 @@ iso8859_1_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned short c;
 
        Assert(PG_GETARG_INT32(0) == PG_LATIN1);
@@ -64,7 +64,7 @@ utf8_to_iso8859_1(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
        unsigned short c,
                                c1,
                                c2;
index 4dbd33f..c385922 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,14 +38,14 @@ johab_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_JOHAB);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
        Assert(len > 0);
 
        LocalToUtf(src, dest, LUmapJOHAB,
-                          sizeof(LUmapJOHAB) / sizeof(pg_local_to_utf), PG_JOHAB, len);
+                       sizeof(LUmapJOHAB) / sizeof(pg_local_to_utf), PG_JOHAB, len);
 
        PG_RETURN_INT32(0);
 }
@@ -55,7 +55,7 @@ utf8_to_johab(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_JOHAB);
index a460768..e42822e 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,7 +38,7 @@ sjis_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_SJIS);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
@@ -55,7 +55,7 @@ utf8_to_sjis(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_SJIS);
index 6847458..a6b47d8 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/Attic/utf8_and_tcvn.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/Attic/utf8_and_tcvn.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,7 +38,7 @@ tcvn_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_TCVN);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
@@ -55,7 +55,7 @@ utf8_to_tcvn(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_TCVN);
index d30f3de..afd3c68 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,7 +38,7 @@ uhc_to_utf8(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UHC);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
@@ -55,7 +55,7 @@ utf8_to_uhc(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_UHC);
index 6b32fe7..eab60c2 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/Attic/utf8_and_win1250.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/Attic/utf8_and_win1250.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -39,14 +39,14 @@ utf_to_win1250(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_WIN1250);
        Assert(len > 0);
 
-       UtfToLocal(src, dest, ULmapWIN1250, 
-               sizeof(ULmapWIN1250) / sizeof(pg_utf_to_local), len);
+       UtfToLocal(src, dest, ULmapWIN1250,
+                          sizeof(ULmapWIN1250) / sizeof(pg_utf_to_local), len);
 
        PG_RETURN_INT32(0);
 }
@@ -56,7 +56,7 @@ win1250_to_utf(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_WIN1250);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
index 4014330..073e11e 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/Attic/utf8_and_win1256.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/Attic/utf8_and_win1256.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -39,14 +39,14 @@ utf_to_win1256(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_WIN1256);
        Assert(len > 0);
 
-       UtfToLocal(src, dest, ULmapWIN1256, 
-               sizeof(ULmapWIN1256) / sizeof(pg_utf_to_local), len);
+       UtfToLocal(src, dest, ULmapWIN1256,
+                          sizeof(ULmapWIN1256) / sizeof(pg_utf_to_local), len);
 
        PG_RETURN_INT32(0);
 }
@@ -56,7 +56,7 @@ win1256_to_utf(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_WIN1256);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
index 9192db3..38a3f2b 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/Attic/utf8_and_win874.c,v 1.2 2002/08/22 00:01:45 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/Attic/utf8_and_win874.c,v 1.3 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -39,14 +39,14 @@ utf_to_win874(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_UTF8);
        Assert(PG_GETARG_INT32(1) == PG_WIN874);
        Assert(len > 0);
 
-       UtfToLocal(src, dest, ULmapWIN874, 
-               sizeof(ULmapWIN874) / sizeof(pg_utf_to_local), len);
+       UtfToLocal(src, dest, ULmapWIN874,
+                          sizeof(ULmapWIN874) / sizeof(pg_utf_to_local), len);
 
        PG_RETURN_INT32(0);
 }
@@ -56,14 +56,14 @@ win874_to_utf(PG_FUNCTION_ARGS)
 {
        unsigned char *src = PG_GETARG_CSTRING(2);
        unsigned char *dest = PG_GETARG_CSTRING(3);
-       int len = PG_GETARG_INT32(4);
+       int                     len = PG_GETARG_INT32(4);
 
        Assert(PG_GETARG_INT32(0) == PG_WIN874);
        Assert(PG_GETARG_INT32(1) == PG_UTF8);
        Assert(len > 0);
 
        LocalToUtf(src, dest, LUmapWIN874,
-               sizeof(LUmapWIN874) / sizeof(pg_local_to_utf), PG_WIN874, len);
+                 sizeof(LUmapWIN874) / sizeof(pg_local_to_utf), PG_WIN874, len);
 
        PG_RETURN_INT32(0);
 }
index 8c00038..af86299 100644 (file)
@@ -2,7 +2,7 @@
  * Encoding names and routines for work with it. All
  * in this file is shared bedween FE and BE.
  *
- * $Id: encnames.c,v 1.9 2002/09/03 21:45:43 petere Exp $
+ * $Id: encnames.c,v 1.10 2002/09/04 20:31:31 momjian Exp $
  */
 #ifdef FRONTEND
 #include "postgres_fe.h"
@@ -55,12 +55,12 @@ pg_encname  pg_encname_tbl[] =
                                                                 * for Japanese, stdandard OSF */
        {
                "euckr", PG_EUC_KR
-       },                                                      /* EUC-KR; Extended Unix Code for
-                                                                 * Korean , KS X 1001 standard */
+       },                                                      /* EUC-KR; Extended Unix Code for Korean ,
+                                                                * KS X 1001 standard */
        {
                "euctw", PG_EUC_TW
        },                                                      /* EUC-TW; Extended Unix Code for
-
+                                                                *
                                                                 * traditional Chinese */
        {
                "gb18030", PG_GB18030
@@ -171,7 +171,7 @@ pg_encname  pg_encname_tbl[] =
                "tcvn", PG_TCVN
        },                                                      /* TCVN; Vietnamese TCVN-5712 */
        {
-               "tcvn5712",PG_TCVN
+               "tcvn5712", PG_TCVN
        },                                                      /* alias for TCVN */
        {
                "uhc", PG_UHC
index 24f3d44..dfcad8e 100644 (file)
@@ -3,7 +3,7 @@
  * client encoding and server internal encoding.
  * (currently mule internal code (mic) is used)
  * Tatsuo Ishii
- * $Id: mbutils.c,v 1.34 2002/09/03 21:45:43 petere Exp $
+ * $Id: mbutils.c,v 1.35 2002/09/04 20:31:31 momjian Exp $
  */
 #include "postgres.h"
 #include "access/xact.h"
@@ -27,15 +27,15 @@ static pg_enc2name *DatabaseEncoding = &pg_enc2name_tbl[PG_SQL_ASCII];
  * allocated in TopMemoryContext so that it survives outside
  * transactions. See SetClientEncoding() for more details.
  */
-static         FmgrInfo                *ToServerConvPorc = NULL;
-static         FmgrInfo                *ToClientConvPorc = NULL;
+static FmgrInfo *ToServerConvPorc = NULL;
+static FmgrInfo *ToClientConvPorc = NULL;
 
 /* Internal functions */
 static unsigned char *
-perform_default_encoding_conversion(unsigned char *src, int len, bool is_client_to_server);
+                       perform_default_encoding_conversion(unsigned char *src, int len, bool is_client_to_server);
 
 static int
-cliplen(const unsigned char *str, int len, int limit);
+                       cliplen(const unsigned char *str, int len, int limit);
 
 /*
  * Set the client encoding and save fmgrinfo for the converion
@@ -46,9 +46,10 @@ int
 SetClientEncoding(int encoding, bool doit)
 {
        int                     current_server_encoding;
-       Oid                     to_server_proc, to_client_proc;
-       FmgrInfo        *to_server = NULL;
-       FmgrInfo        *to_client = NULL;
+       Oid                     to_server_proc,
+                               to_client_proc;
+       FmgrInfo   *to_server = NULL;
+       FmgrInfo   *to_client = NULL;
        MemoryContext oldcontext;
 
        current_server_encoding = GetDatabaseEncoding();
@@ -57,15 +58,15 @@ SetClientEncoding(int encoding, bool doit)
                return (-1);
 
        if (current_server_encoding == encoding ||
-               (current_server_encoding == PG_SQL_ASCII || encoding == PG_SQL_ASCII))
+       (current_server_encoding == PG_SQL_ASCII || encoding == PG_SQL_ASCII))
        {
                ClientEncoding = &pg_enc2name_tbl[encoding];
                return 0;
        }
 
-       /* XXX We cannot use FindDefaultConversionProc() while in
-        * bootstrap or initprocessing mode since namespace functions will
-        * not work.
+       /*
+        * XXX We cannot use FindDefaultConversionProc() while in bootstrap or
+        * initprocessing mode since namespace functions will not work.
         */
        if (IsTransactionState())
        {
@@ -76,8 +77,8 @@ SetClientEncoding(int encoding, bool doit)
                        return -1;
 
                /*
-                * load the fmgr info into TopMemoryContext so that it
-                * survives outside transaction.
+                * load the fmgr info into TopMemoryContext so that it survives
+                * outside transaction.
                 */
                oldcontext = MemoryContextSwitchTo(TopMemoryContext);
                to_server = palloc(sizeof(FmgrInfo));
@@ -94,7 +95,7 @@ SetClientEncoding(int encoding, bool doit)
        {
                ClientEncoding = &pg_enc2name_tbl[encoding];
 
-               if(ToServerConvPorc != NULL)
+               if (ToServerConvPorc != NULL)
                {
                        if (ToServerConvPorc->fn_extra)
                                pfree(ToServerConvPorc->fn_extra);
@@ -102,7 +103,7 @@ SetClientEncoding(int encoding, bool doit)
                }
                ToServerConvPorc = to_server;
 
-               if(ToClientConvPorc != NULL)
+               if (ToClientConvPorc != NULL)
                {
                        if (ToClientConvPorc->fn_extra)
                                pfree(ToClientConvPorc->fn_extra);
@@ -152,11 +153,11 @@ pg_do_encoding_conversion(unsigned char *src, int len,
                                                  int src_encoding, int dest_encoding)
 {
        unsigned char *result;
-       Oid     proc;
+       Oid                     proc;
 
        if (!IsTransactionState())
                return src;
-       
+
        if (src_encoding == dest_encoding)
                return src;
 
@@ -171,13 +172,14 @@ pg_do_encoding_conversion(unsigned char *src, int len,
                return src;
        }
 
-       /* XXX we shoud avoid throwing errors in OidFuctionCall. Otherwise
-        * we are going into inifinite loop!  So we have to make sure that
-        * the function exists before calling OidFunctionCall.
+       /*
+        * XXX we shoud avoid throwing errors in OidFuctionCall. Otherwise we
+        * are going into inifinite loop!  So we have to make sure that the
+        * function exists before calling OidFunctionCall.
         */
        if (!SearchSysCacheExists(PROCOID,
-                                                        ObjectIdGetDatum(proc),
-                                                        0, 0, 0))
+                                                         ObjectIdGetDatum(proc),
+                                                         0, 0, 0))
        {
                elog(LOG, "default conversion proc %u for %s to %s not found in pg_proc",
                         proc,
@@ -204,17 +206,17 @@ pg_do_encoding_conversion(unsigned char *src, int len,
 Datum
 pg_convert(PG_FUNCTION_ARGS)
 {
-       Datum   string = PG_GETARG_DATUM(0);
-       Datum   dest_encoding_name = PG_GETARG_DATUM(1);
-       Datum   src_encoding_name = DirectFunctionCall1(
-           namein, CStringGetDatum(DatabaseEncoding->name));
-       Datum   result;
+       Datum           string = PG_GETARG_DATUM(0);
+       Datum           dest_encoding_name = PG_GETARG_DATUM(1);
+       Datum           src_encoding_name = DirectFunctionCall1(
+                                               namein, CStringGetDatum(DatabaseEncoding->name));
+       Datum           result;
 
        result = DirectFunctionCall3(
-           pg_convert2, string, src_encoding_name, dest_encoding_name);
+                        pg_convert2, string, src_encoding_name, dest_encoding_name);
 
        /* free memory allocated by namein */
-       pfree((void *)src_encoding_name);
+       pfree((void *) src_encoding_name);
 
        PG_RETURN_TEXT_P(result);
 }
@@ -235,7 +237,7 @@ pg_convert2(PG_FUNCTION_ARGS)
        unsigned char *result;
        text       *retval;
        unsigned char *str;
-       int len;
+       int                     len;
 
        if (src_encoding < 0)
                elog(ERROR, "Invalid source encoding name %s", src_encoding_name);
@@ -252,9 +254,11 @@ pg_convert2(PG_FUNCTION_ARGS)
        if (result == NULL)
                elog(ERROR, "Encoding conversion failed");
 
-       /* build text data type structre. we cannot use textin() here,
-          since textin assumes that input string encoding is same as
-          database encoding.  */
+       /*
+        * build text data type structre. we cannot use textin() here, since
+        * textin assumes that input string encoding is same as database
+        * encoding.
+        */
        len = strlen(result) + VARHDRSZ;
        retval = palloc(len);
        VARATT_SIZEP(retval) = len;
@@ -262,7 +266,7 @@ pg_convert2(PG_FUNCTION_ARGS)
 
        if (result != str)
                pfree(result);
-        pfree(str);
+       pfree(str);
 
        /* free memory if allocated by the toaster */
        PG_FREE_IF_COPY(string, 0);
@@ -301,18 +305,19 @@ pg_server_to_client(unsigned char *s, int len)
 }
 
 /*
- *  Perform default encoding conversion using cached FmgrInfo. Since
- *  this function does not access database at all, it is safe to call
- *  outside transactions. Explicit setting client encoding required
- *  before calling this function. Otherwise no conversion is
- *  performed.
+ *     Perform default encoding conversion using cached FmgrInfo. Since
+ *     this function does not access database at all, it is safe to call
+ *     outside transactions. Explicit setting client encoding required
+ *     before calling this function. Otherwise no conversion is
+ *     performed.
 */
 static unsigned char *
 perform_default_encoding_conversion(unsigned char *src, int len, bool is_client_to_server)
 {
        unsigned char *result;
-       int src_encoding, dest_encoding;
-       FmgrInfo *flinfo;
+       int                     src_encoding,
+                               dest_encoding;
+       FmgrInfo   *flinfo;
 
        if (is_client_to_server)
        {
@@ -376,7 +381,7 @@ pg_mbstrlen(const unsigned char *mbstr)
 
        /* optimization for single byte encoding */
        if (pg_database_encoding_max_length() == 1)
-               return strlen((char *)mbstr);
+               return strlen((char *) mbstr);
 
        while (*mbstr)
        {
@@ -506,9 +511,9 @@ pg_client_encoding(PG_FUNCTION_ARGS)
 }
 
 static int
-cliplen(const unsigned char *str, int len, int limit) 
+cliplen(const unsigned char *str, int len, int limit)
 {
-       int     l = 0;
+       int                     l = 0;
        const unsigned char *s;
 
        for (s = str; *s; s++, l++)
index 50d90f3..eeee9a6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * conversion functions between pg_wchar and multibyte streams.
  * Tatsuo Ishii
- * $Id: wchar.c,v 1.29 2002/09/03 21:45:43 petere Exp $
+ * $Id: wchar.c,v 1.30 2002/09/04 20:31:31 momjian Exp $
  *
  * WIN1250 client encoding updated by Pavel Behal
  *
@@ -511,30 +511,31 @@ pg_uhc_mblen(const unsigned char *s)
 }
 
 /*
- *  * GB18030
- *   * Added by Bill Huang <bhuang@redhat.com>,<bill_huanghb@ybb.ne.jp>
- *    */
+ *     * GB18030
+ *      * Added by Bill Huang <bhuang@redhat.com>,<bill_huanghb@ybb.ne.jp>
+ *       */
 static int
 pg_gb18030_mblen(const unsigned char *s)
 {
-        int                     len;
-        if (*s <= 0x7f)
-        {                                                       /* ASCII */
-                len = 1;
-        }
-        else
-        {                                                       
-                if((*(s+1) >= 0x40 && *(s+1) <= 0x7e)|| (*(s+1) >= 0x80 && *(s+1) <= 0xfe))
-                        len = 2;
-                else if(*(s+1) >= 0x30 && *(s+1) <= 0x39)
-                        len = 4;
-                else
-                        len = 2;
-        }
-        return (len);
+       int                     len;
+
+       if (*s <= 0x7f)
+       {                                                       /* ASCII */
+               len = 1;
+       }
+       else
+       {
+               if ((*(s + 1) >= 0x40 && *(s + 1) <= 0x7e) || (*(s + 1) >= 0x80 && *(s + 1) <= 0xfe))
+                       len = 2;
+               else if (*(s + 1) >= 0x30 && *(s + 1) <= 0x39)
+                       len = 4;
+               else
+                       len = 2;
+       }
+       return (len);
 }
 
-               
+
 pg_wchar_tbl pg_wchar_table[] = {
        {pg_ascii2wchar_with_len, pg_ascii_mblen, 1},           /* 0; PG_SQL_ASCII      */
        {pg_eucjp2wchar_with_len, pg_eucjp_mblen, 3},           /* 1; PG_EUC_JP */
@@ -543,7 +544,7 @@ pg_wchar_tbl pg_wchar_table[] = {
        {pg_euctw2wchar_with_len, pg_euctw_mblen, 3},           /* 4; PG_EUC_TW */
        {pg_johab2wchar_with_len, pg_johab_mblen, 3},           /* 5; PG_JOHAB */
        {pg_utf2wchar_with_len, pg_utf_mblen, 3},       /* 6; PG_UNICODE */
-       {pg_mule2wchar_with_len, pg_mule_mblen, 3},     /* 7; PG_MULE_INTERNAL */
+       {pg_mule2wchar_with_len, pg_mule_mblen, 3}, /* 7; PG_MULE_INTERNAL */
        {pg_latin12wchar_with_len, pg_latin1_mblen, 1},         /* 8; PG_LATIN1 */
        {pg_latin12wchar_with_len, pg_latin1_mblen, 1},         /* 9; PG_LATIN2 */
        {pg_latin12wchar_with_len, pg_latin1_mblen, 1},         /* 10; PG_LATIN3 */
@@ -569,7 +570,7 @@ pg_wchar_tbl pg_wchar_table[] = {
        {0, pg_gbk_mblen, 2},           /* 30; PG_GBK */
        {0, pg_uhc_mblen, 2},           /* 31; PG_UHC */
        {pg_latin12wchar_with_len, pg_latin1_mblen, 1},         /* 32; PG_WIN1250 */
-       {0, pg_gb18030_mblen, 2}       /* 33; PG_GB18030 */
+       {0, pg_gb18030_mblen, 2}        /* 33; PG_GB18030 */
 };
 
 /* returns the byte length of a word for mule internal code */
index fd80b23..3769f35 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.52 2002/07/20 05:16:59 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.53 2002/09/04 20:31:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -223,7 +223,7 @@ GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
                                *db_id = HeapTupleGetOid(&tup);
                                pathlen = VARSIZE(&(tup_db->datpath)) - VARHDRSZ;
                                if (pathlen < 0)
-                                       pathlen = 0;                            /* pure paranoia */
+                                       pathlen = 0;    /* pure paranoia */
                                if (pathlen >= MAXPGPATH)
                                        pathlen = MAXPGPATH - 1;        /* more paranoia */
                                strncpy(path, VARDATA(&(tup_db->datpath)), pathlen);
index a1c2f24..7df703e 100644 (file)
@@ -5,7 +5,7 @@
  * command, configuration file, and command line options.
  * See src/backend/utils/misc/README for more information.
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.92 2002/09/02 05:42:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.93 2002/09/04 20:31:33 momjian Exp $
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  * Written by Peter Eisentraut <peter_e@gmx.net>.
@@ -68,11 +68,11 @@ extern char *Syslog_facility;
 extern char *Syslog_ident;
 
 static const char *assign_facility(const char *facility,
-                                                                  bool doit, bool interactive);
+                               bool doit, bool interactive);
 #endif
 
 static const char *assign_msglvl(int *var, const char *newval,
-                                                                       bool doit, bool interactive);
+                         bool doit, bool interactive);
 
 /*
  * Debugging options
@@ -90,8 +90,8 @@ bool          Debug_pretty_print = false;
 bool           Show_parser_stats = false;
 bool           Show_planner_stats = false;
 bool           Show_executor_stats = false;
-bool           Show_statement_stats = false;   /* this is sort of all three above
-                                                                                * together */
+bool           Show_statement_stats = false;           /* this is sort of all
+                                                                                                * three above together */
 bool           Show_btree_build_stats = false;
 
 bool           Explain_pretty_print = true;
@@ -103,16 +103,16 @@ bool              Australian_timezones = false;
 bool           Password_encryption = true;
 
 int                    log_min_error_statement;
-char           *log_min_error_statement_str = NULL;
+char      *log_min_error_statement_str = NULL;
 const char     log_min_error_statement_str_default[] = "error";
 
-int         server_min_messages;
-char       *server_min_messages_str = NULL;
-const char  server_min_messages_str_default[] = "notice";
+int                    server_min_messages;
+char      *server_min_messages_str = NULL;
+const char     server_min_messages_str_default[] = "notice";
 
-int         client_min_messages;
-char       *client_min_messages_str = NULL;
-const char  client_min_messages_str_default[] = "notice";
+int                    client_min_messages;
+char      *client_min_messages_str = NULL;
+const char     client_min_messages_str_default[] = "notice";
 
 
 #ifndef PG_KRB_SRVTAB
@@ -134,7 +134,7 @@ static char *timezone_string;
 static char *XactIsoLevel_string;
 
 static const char *assign_defaultxactisolevel(const char *newval,
-                                                                                         bool doit, bool interactive);
+                                                  bool doit, bool interactive);
 
 
 /*
@@ -161,20 +161,20 @@ struct config_generic
        enum config_type vartype;       /* type of variable (set only at startup) */
        int                     status;                 /* status bits, see below */
        GucSource       reset_source;   /* source of the reset_value */
-       GucSource       session_source; /* source of the session_value */
-       GucSource       tentative_source; /* source of the tentative_value */
+       GucSource       session_source; /* source of the session_value */
+       GucSource       tentative_source;               /* source of the tentative_value */
        GucSource       source;                 /* source of the current actual value */
 };
 
 /* bit values in flags field */
-#define GUC_LIST_INPUT         0x0001  /* input can be list format */
-#define GUC_LIST_QUOTE         0x0002  /* double-quote list elements */
-#define GUC_NO_SHOW_ALL                0x0004  /* exclude from SHOW ALL */
-#define GUC_NO_RESET_ALL       0x0008  /* exclude from RESET ALL */
+#define GUC_LIST_INPUT         0x0001          /* input can be list format */
+#define GUC_LIST_QUOTE         0x0002          /* double-quote list elements */
+#define GUC_NO_SHOW_ALL                0x0004          /* exclude from SHOW ALL */
+#define GUC_NO_RESET_ALL       0x0008          /* exclude from RESET ALL */
 
 /* bit values in status field */
-#define GUC_HAVE_TENTATIVE     0x0001  /* tentative value is defined */
-#define GUC_HAVE_LOCAL         0x0002  /* a SET LOCAL has been executed */
+#define GUC_HAVE_TENTATIVE     0x0001          /* tentative value is defined */
+#define GUC_HAVE_LOCAL         0x0002          /* a SET LOCAL has been executed */
 
 
 /* GUC records for specific variable types */
@@ -309,213 +309,213 @@ static struct config_bool
                        ConfigureNamesBool[] =
 {
        {
-               { "enable_seqscan", PGC_USERSET }, &enable_seqscan,
+               {"enable_seqscan", PGC_USERSET}, &enable_seqscan,
                true, NULL, NULL
        },
        {
-               { "enable_indexscan", PGC_USERSET }, &enable_indexscan,
+               {"enable_indexscan", PGC_USERSET}, &enable_indexscan,
                true, NULL, NULL
        },
        {
-               { "enable_tidscan", PGC_USERSET }, &enable_tidscan,
+               {"enable_tidscan", PGC_USERSET}, &enable_tidscan,
                true, NULL, NULL
        },
        {
-               { "enable_sort", PGC_USERSET }, &enable_sort,
+               {"enable_sort", PGC_USERSET}, &enable_sort,
                true, NULL, NULL
        },
        {
-               { "enable_nestloop", PGC_USERSET }, &enable_nestloop,
+               {"enable_nestloop", PGC_USERSET}, &enable_nestloop,
                true, NULL, NULL
        },
        {
-               { "enable_mergejoin", PGC_USERSET }, &enable_mergejoin,
+               {"enable_mergejoin", PGC_USERSET}, &enable_mergejoin,
                true, NULL, NULL
        },
        {
-               { "enable_hashjoin", PGC_USERSET }, &enable_hashjoin,
+               {"enable_hashjoin", PGC_USERSET}, &enable_hashjoin,
                true, NULL, NULL
        },
        {
-               { "geqo", PGC_USERSET }, &enable_geqo,
+               {"geqo", PGC_USERSET}, &enable_geqo,
                true, NULL, NULL
        },
 
        {
-               { "tcpip_socket", PGC_POSTMASTER }, &NetServer,
+               {"tcpip_socket", PGC_POSTMASTER}, &NetServer,
                false, NULL, NULL
        },
        {
-               { "ssl", PGC_POSTMASTER }, &EnableSSL,
+               {"ssl", PGC_POSTMASTER}, &EnableSSL,
                false, NULL, NULL
        },
        {
-               { "fsync", PGC_SIGHUP }, &enableFsync,
+               {"fsync", PGC_SIGHUP}, &enableFsync,
                true, NULL, NULL
        },
        {
-               { "silent_mode", PGC_POSTMASTER }, &SilentMode,
+               {"silent_mode", PGC_POSTMASTER}, &SilentMode,
                false, NULL, NULL
        },
 
        {
-               { "log_connections", PGC_BACKEND }, &Log_connections,
+               {"log_connections", PGC_BACKEND}, &Log_connections,
                false, NULL, NULL
        },
        {
-               { "log_timestamp", PGC_SIGHUP }, &Log_timestamp,
+               {"log_timestamp", PGC_SIGHUP}, &Log_timestamp,
                false, NULL, NULL
        },
        {
-               { "log_pid", PGC_SIGHUP }, &Log_pid,
+               {"log_pid", PGC_SIGHUP}, &Log_pid,
                false, NULL, NULL
        },
 
 #ifdef USE_ASSERT_CHECKING
        {
-               { "debug_assertions", PGC_USERSET }, &assert_enabled,
+               {"debug_assertions", PGC_USERSET}, &assert_enabled,
                true, NULL, NULL
        },
 #endif
 
        {
-               { "log_statement", PGC_USERSET }, &Log_statement,
+               {"log_statement", PGC_USERSET}, &Log_statement,
                false, NULL, NULL
        },
        {
-               { "log_duration", PGC_USERSET }, &Log_duration,
+               {"log_duration", PGC_USERSET}, &Log_duration,
                false, NULL, NULL
        },
        {
-               { "debug_print_parse", PGC_USERSET }, &Debug_print_parse,
+               {"debug_print_parse", PGC_USERSET}, &Debug_print_parse,
                false, NULL, NULL
        },
        {
-               { "debug_print_rewritten", PGC_USERSET }, &Debug_print_rewritten,
+               {"debug_print_rewritten", PGC_USERSET}, &Debug_print_rewritten,
                false, NULL, NULL
        },
        {
-               { "debug_print_plan", PGC_USERSET }, &Debug_print_plan,
+               {"debug_print_plan", PGC_USERSET}, &Debug_print_plan,
                false, NULL, NULL
        },
        {
-               { "debug_pretty_print", PGC_USERSET }, &Debug_pretty_print,
+               {"debug_pretty_print", PGC_USERSET}, &Debug_pretty_print,
                false, NULL, NULL
        },
 
        {
-               { "show_parser_stats", PGC_USERSET }, &Show_parser_stats,
+               {"show_parser_stats", PGC_USERSET}, &Show_parser_stats,
                false, NULL, NULL
        },
        {
-               { "show_planner_stats", PGC_USERSET }, &Show_planner_stats,
+               {"show_planner_stats", PGC_USERSET}, &Show_planner_stats,
                false, NULL, NULL
        },
        {
-               { "show_executor_stats", PGC_USERSET }, &Show_executor_stats,
+               {"show_executor_stats", PGC_USERSET}, &Show_executor_stats,
                false, NULL, NULL
        },
        {
-               { "show_statement_stats", PGC_USERSET }, &Show_statement_stats,
+               {"show_statement_stats", PGC_USERSET}, &Show_statement_stats,
                false, NULL, NULL
        },
 #ifdef BTREE_BUILD_STATS
        {
-               { "show_btree_build_stats", PGC_SUSET }, &Show_btree_build_stats,
+               {"show_btree_build_stats", PGC_SUSET}, &Show_btree_build_stats,
                false, NULL, NULL
        },
 #endif
 
        {
-               { "explain_pretty_print", PGC_USERSET }, &Explain_pretty_print,
+               {"explain_pretty_print", PGC_USERSET}, &Explain_pretty_print,
                true, NULL, NULL
        },
 
        {
-               { "stats_start_collector", PGC_POSTMASTER }, &pgstat_collect_startcollector,
+               {"stats_start_collector", PGC_POSTMASTER}, &pgstat_collect_startcollector,
                true, NULL, NULL
        },
        {
-               { "stats_reset_on_server_start", PGC_POSTMASTER }, &pgstat_collect_resetonpmstart,
+               {"stats_reset_on_server_start", PGC_POSTMASTER}, &pgstat_collect_resetonpmstart,
                true, NULL, NULL
        },
        {
-               { "stats_command_string", PGC_SUSET }, &pgstat_collect_querystring,
+               {"stats_command_string", PGC_SUSET}, &pgstat_collect_querystring,
                false, NULL, NULL
        },
        {
-               { "stats_row_level", PGC_SUSET }, &pgstat_collect_tuplelevel,
+               {"stats_row_level", PGC_SUSET}, &pgstat_collect_tuplelevel,
                false, NULL, NULL
        },
        {
-               { "stats_block_level", PGC_SUSET }, &pgstat_collect_blocklevel,
+               {"stats_block_level", PGC_SUSET}, &pgstat_collect_blocklevel,
                false, NULL, NULL
        },
 
        {
-               { "trace_notify", PGC_USERSET }, &Trace_notify,
+               {"trace_notify", PGC_USERSET}, &Trace_notify,
                false, NULL, NULL
        },
 
 #ifdef LOCK_DEBUG
        {
-               { "trace_locks", PGC_SUSET }, &Trace_locks,
+               {"trace_locks", PGC_SUSET}, &Trace_locks,
                false, NULL, NULL
        },
        {
-               { "trace_userlocks", PGC_SUSET }, &Trace_userlocks,
+               {"trace_userlocks", PGC_SUSET}, &Trace_userlocks,
                false, NULL, NULL
        },
        {
-               { "trace_lwlocks", PGC_SUSET }, &Trace_lwlocks,
+               {"trace_lwlocks", PGC_SUSET}, &Trace_lwlocks,
                false, NULL, NULL
        },
        {
-               { "debug_deadlocks", PGC_SUSET }, &Debug_deadlocks,
+               {"debug_deadlocks", PGC_SUSET}, &Debug_deadlocks,
                false, NULL, NULL
        },
 #endif
 
        {
-               { "hostname_lookup", PGC_SIGHUP }, &HostnameLookup,
+               {"hostname_lookup", PGC_SIGHUP}, &HostnameLookup,
                false, NULL, NULL
        },
        {
-               { "show_source_port", PGC_SIGHUP }, &ShowPortNumber,
+               {"show_source_port", PGC_SIGHUP}, &ShowPortNumber,
                false, NULL, NULL
        },
 
        {
-               { "sql_inheritance", PGC_USERSET }, &SQL_inheritance,
+               {"sql_inheritance", PGC_USERSET}, &SQL_inheritance,
                true, NULL, NULL
        },
        {
-               { "australian_timezones", PGC_USERSET }, &Australian_timezones,
+               {"australian_timezones", PGC_USERSET}, &Australian_timezones,
                false, ClearDateCache, NULL
        },
        {
-               { "fixbtree", PGC_POSTMASTER }, &FixBTree,
+               {"fixbtree", PGC_POSTMASTER}, &FixBTree,
                true, NULL, NULL
        },
        {
-               { "password_encryption", PGC_USERSET }, &Password_encryption,
+               {"password_encryption", PGC_USERSET}, &Password_encryption,
                true, NULL, NULL
        },
        {
-               { "transform_null_equals", PGC_USERSET }, &Transform_null_equals,
+               {"transform_null_equals", PGC_USERSET}, &Transform_null_equals,
                false, NULL, NULL
        },
        {
-               { "db_user_namespace", PGC_SIGHUP }, &Db_user_namespace,
+               {"db_user_namespace", PGC_SIGHUP}, &Db_user_namespace,
                false, NULL, NULL
        },
        {
-               { "autocommit", PGC_USERSET }, &autocommit, 
+               {"autocommit", PGC_USERSET}, &autocommit,
                true, NULL, NULL
        },
 
        {
-               { NULL, 0 }, NULL, false, NULL, NULL
+               {NULL, 0}, NULL, false, NULL, NULL
        }
 };
 
@@ -524,38 +524,38 @@ static struct config_int
                        ConfigureNamesInt[] =
 {
        {
-               { "default_statistics_target", PGC_USERSET }, &default_statistics_target,
+               {"default_statistics_target", PGC_USERSET}, &default_statistics_target,
                10, 1, 1000, NULL, NULL
        },
        {
-               { "geqo_threshold", PGC_USERSET }, &geqo_rels,
+               {"geqo_threshold", PGC_USERSET}, &geqo_rels,
                DEFAULT_GEQO_RELS, 2, INT_MAX, NULL, NULL
        },
        {
-               { "geqo_pool_size", PGC_USERSET }, &Geqo_pool_size,
+               {"geqo_pool_size", PGC_USERSET}, &Geqo_pool_size,
                DEFAULT_GEQO_POOL_SIZE, 0, MAX_GEQO_POOL_SIZE, NULL, NULL
        },
        {
-               { "geqo_effort", PGC_USERSET }, &Geqo_effort,
+               {"geqo_effort", PGC_USERSET}, &Geqo_effort,
                1, 1, INT_MAX, NULL, NULL
        },
        {
-               { "geqo_generations", PGC_USERSET }, &Geqo_generations,
+               {"geqo_generations", PGC_USERSET}, &Geqo_generations,
                0, 0, INT_MAX, NULL, NULL
        },
        {
-               { "geqo_random_seed", PGC_USERSET }, &Geqo_random_seed,
+               {"geqo_random_seed", PGC_USERSET}, &Geqo_random_seed,
                -1, INT_MIN, INT_MAX, NULL, NULL
        },
 
        {
-               { "deadlock_timeout", PGC_POSTMASTER }, &DeadlockTimeout,
+               {"deadlock_timeout", PGC_POSTMASTER}, &DeadlockTimeout,
                1000, 0, INT_MAX, NULL, NULL
        },
 
 #ifdef HAVE_SYSLOG
        {
-               { "syslog", PGC_SIGHUP }, &Use_syslog,
+               {"syslog", PGC_SIGHUP}, &Use_syslog,
                0, 0, 2, NULL, NULL
        },
 #endif
@@ -568,121 +568,121 @@ static struct config_int
         * backends number.
         */
        {
-               { "max_connections", PGC_POSTMASTER }, &MaxBackends,
+               {"max_connections", PGC_POSTMASTER}, &MaxBackends,
                DEF_MAXBACKENDS, 1, INT_MAX, NULL, NULL
        },
 
        {
-               { "superuser_reserved_connections", PGC_POSTMASTER }, &ReservedBackends,
+               {"superuser_reserved_connections", PGC_POSTMASTER}, &ReservedBackends,
                2, 0, INT_MAX, NULL, NULL
        },
 
        {
-               { "shared_buffers", PGC_POSTMASTER }, &NBuffers,
+               {"shared_buffers", PGC_POSTMASTER}, &NBuffers,
                DEF_NBUFFERS, 16, INT_MAX, NULL, NULL
        },
 
        {
-               { "port", PGC_POSTMASTER }, &PostPortNumber,
+               {"port", PGC_POSTMASTER}, &PostPortNumber,
                DEF_PGPORT, 1, 65535, NULL, NULL
        },
 
        {
-               { "unix_socket_permissions", PGC_POSTMASTER }, &Unix_socket_permissions,
+               {"unix_socket_permissions", PGC_POSTMASTER}, &Unix_socket_permissions,
                0777, 0000, 0777, NULL, NULL
        },
 
        {
-               { "sort_mem", PGC_USERSET }, &SortMem,
+               {"sort_mem", PGC_USERSET}, &SortMem,
                1024, 8 * BLCKSZ / 1024, INT_MAX, NULL, NULL
        },
 
        {
-               { "vacuum_mem", PGC_USERSET }, &VacuumMem,
+               {"vacuum_mem", PGC_USERSET}, &VacuumMem,
                8192, 1024, INT_MAX, NULL, NULL
        },
 
        {
-               { "max_files_per_process", PGC_BACKEND }, &max_files_per_process,
+               {"max_files_per_process", PGC_BACKEND}, &max_files_per_process,
                1000, 25, INT_MAX, NULL, NULL
        },
 
 #ifdef LOCK_DEBUG
        {
-               { "trace_lock_oidmin", PGC_SUSET }, &Trace_lock_oidmin,
+               {"trace_lock_oidmin", PGC_SUSET}, &Trace_lock_oidmin,
                BootstrapObjectIdData, 1, INT_MAX, NULL, NULL
        },
        {
-               { "trace_lock_table", PGC_SUSET }, &Trace_lock_table,
+               {"trace_lock_table", PGC_SUSET}, &Trace_lock_table,
                0, 0, INT_MAX, NULL, NULL
        },
 #endif
        {
-               { "max_expr_depth", PGC_USERSET }, &max_expr_depth,
+               {"max_expr_depth", PGC_USERSET}, &max_expr_depth,
                DEFAULT_MAX_EXPR_DEPTH, 10, INT_MAX, NULL, NULL
        },
 
        {
-               { "statement_timeout", PGC_USERSET }, &StatementTimeout,
+               {"statement_timeout", PGC_USERSET}, &StatementTimeout,
                0, 0, INT_MAX, NULL, NULL
        },
 
        {
-               { "max_fsm_relations", PGC_POSTMASTER }, &MaxFSMRelations,
+               {"max_fsm_relations", PGC_POSTMASTER}, &MaxFSMRelations,
                100, 10, INT_MAX, NULL, NULL
        },
        {
-               { "max_fsm_pages", PGC_POSTMASTER }, &MaxFSMPages,
+               {"max_fsm_pages", PGC_POSTMASTER}, &MaxFSMPages,
                10000, 1000, INT_MAX, NULL, NULL
        },
 
        {
-               { "max_locks_per_transaction", PGC_POSTMASTER }, &max_locks_per_xact,
+               {"max_locks_per_transaction", PGC_POSTMASTER}, &max_locks_per_xact,
                64, 10, INT_MAX, NULL, NULL
        },
 
        {
-               { "authentication_timeout", PGC_SIGHUP }, &AuthenticationTimeout,
+               {"authentication_timeout", PGC_SIGHUP}, &AuthenticationTimeout,
                60, 1, 600, NULL, NULL
        },
 
        {
-               { "pre_auth_delay", PGC_SIGHUP }, &PreAuthDelay,
+               {"pre_auth_delay", PGC_SIGHUP}, &PreAuthDelay,
                0, 0, 60, NULL, NULL
        },
 
        {
-               { "checkpoint_segments", PGC_SIGHUP }, &CheckPointSegments,
+               {"checkpoint_segments", PGC_SIGHUP}, &CheckPointSegments,
                3, 1, INT_MAX, NULL, NULL
        },
 
        {
-               { "checkpoint_timeout", PGC_SIGHUP }, &CheckPointTimeout,
+               {"checkpoint_timeout", PGC_SIGHUP}, &CheckPointTimeout,
                300, 30, 3600, NULL, NULL
        },
 
        {
-               { "wal_buffers", PGC_POSTMASTER }, &XLOGbuffers,
+               {"wal_buffers", PGC_POSTMASTER}, &XLOGbuffers,
                8, 4, INT_MAX, NULL, NULL
        },
 
        {
-               { "wal_debug", PGC_SUSET }, &XLOG_DEBUG,
+               {"wal_debug", PGC_SUSET}, &XLOG_DEBUG,
                0, 0, 16, NULL, NULL
        },
 
        {
-               { "commit_delay", PGC_USERSET }, &CommitDelay,
+               {"commit_delay", PGC_USERSET}, &CommitDelay,
                0, 0, 100000, NULL, NULL
        },
 
        {
-               { "commit_siblings", PGC_USERSET }, &CommitSiblings,
+               {"commit_siblings", PGC_USERSET}, &CommitSiblings,
                5, 1, 1000, NULL, NULL
        },
 
        {
-               { NULL, 0 }, NULL, 0, 0, 0, NULL, NULL
+               {NULL, 0}, NULL, 0, 0, 0, NULL, NULL
        }
 };
 
@@ -691,40 +691,40 @@ static struct config_real
                        ConfigureNamesReal[] =
 {
        {
-               { "effective_cache_size", PGC_USERSET }, &effective_cache_size,
+               {"effective_cache_size", PGC_USERSET}, &effective_cache_size,
                DEFAULT_EFFECTIVE_CACHE_SIZE, 0, DBL_MAX, NULL, NULL
        },
        {
-               { "random_page_cost", PGC_USERSET }, &random_page_cost,
+               {"random_page_cost", PGC_USERSET}, &random_page_cost,
                DEFAULT_RANDOM_PAGE_COST, 0, DBL_MAX, NULL, NULL
        },
        {
-               { "cpu_tuple_cost", PGC_USERSET }, &cpu_tuple_cost,
+               {"cpu_tuple_cost", PGC_USERSET}, &cpu_tuple_cost,
                DEFAULT_CPU_TUPLE_COST, 0, DBL_MAX, NULL, NULL
        },
        {
-               { "cpu_index_tuple_cost", PGC_USERSET }, &cpu_index_tuple_cost,
+               {"cpu_index_tuple_cost", PGC_USERSET}, &cpu_index_tuple_cost,
                DEFAULT_CPU_INDEX_TUPLE_COST, 0, DBL_MAX, NULL, NULL
        },
        {
-               { "cpu_operator_cost", PGC_USERSET }, &cpu_operator_cost,
+               {"cpu_operator_cost", PGC_USERSET}, &cpu_operator_cost,
                DEFAULT_CPU_OPERATOR_COST, 0, DBL_MAX, NULL, NULL
        },
 
        {
-               { "geqo_selection_bias", PGC_USERSET }, &Geqo_selection_bias,
+               {"geqo_selection_bias", PGC_USERSET}, &Geqo_selection_bias,
                DEFAULT_GEQO_SELECTION_BIAS, MIN_GEQO_SELECTION_BIAS,
                MAX_GEQO_SELECTION_BIAS, NULL, NULL
        },
 
        {
-               { "seed", PGC_USERSET, GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL },
+               {"seed", PGC_USERSET, GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL},
                &phony_random_seed,
                0.5, 0.0, 1.0, assign_random_seed, show_random_seed
        },
 
        {
-               { NULL, 0 }, NULL, 0.0, 0.0, 0.0, NULL, NULL
+               {NULL, 0}, NULL, 0.0, 0.0, 0.0, NULL, NULL
        }
 };
 
@@ -733,126 +733,126 @@ static struct config_string
                        ConfigureNamesString[] =
 {
        {
-               { "client_encoding", PGC_USERSET }, &client_encoding_string,
+               {"client_encoding", PGC_USERSET}, &client_encoding_string,
                "SQL_ASCII", assign_client_encoding, NULL
        },
 
        {
-               { "client_min_messages", PGC_USERSET }, &client_min_messages_str,
+               {"client_min_messages", PGC_USERSET}, &client_min_messages_str,
                client_min_messages_str_default, assign_client_min_messages, NULL
        },
 
        {
-               { "log_min_error_statement", PGC_USERSET }, &log_min_error_statement_str,
+               {"log_min_error_statement", PGC_USERSET}, &log_min_error_statement_str,
                log_min_error_statement_str_default, assign_min_error_statement, NULL
        },
 
        {
-               { "DateStyle", PGC_USERSET, GUC_LIST_INPUT }, &datestyle_string,
+               {"DateStyle", PGC_USERSET, GUC_LIST_INPUT}, &datestyle_string,
                "ISO, US", assign_datestyle, show_datestyle
        },
 
        {
-               { "default_transaction_isolation", PGC_USERSET }, &default_iso_level_string,
+               {"default_transaction_isolation", PGC_USERSET}, &default_iso_level_string,
                "read committed", assign_defaultxactisolevel, NULL
        },
 
        {
-               { "dynamic_library_path", PGC_SUSET }, &Dynamic_library_path,
+               {"dynamic_library_path", PGC_SUSET}, &Dynamic_library_path,
                "$libdir", NULL, NULL
        },
 
        {
-               { "krb_server_keyfile", PGC_POSTMASTER }, &pg_krb_server_keyfile,
+               {"krb_server_keyfile", PGC_POSTMASTER}, &pg_krb_server_keyfile,
                PG_KRB_SRVTAB, NULL, NULL
        },
 
        {
-               { "lc_messages", PGC_SUSET }, &locale_messages,
+               {"lc_messages", PGC_SUSET}, &locale_messages,
                "", locale_messages_assign, NULL
        },
 
        {
-               { "lc_monetary", PGC_USERSET }, &locale_monetary,
+               {"lc_monetary", PGC_USERSET}, &locale_monetary,
                "", locale_monetary_assign, NULL
        },
 
        {
-               { "lc_numeric", PGC_USERSET }, &locale_numeric,
+               {"lc_numeric", PGC_USERSET}, &locale_numeric,
                "", locale_numeric_assign, NULL
        },
 
        {
-               { "lc_time", PGC_USERSET }, &locale_time,
+               {"lc_time", PGC_USERSET}, &locale_time,
                "", locale_time_assign, NULL
        },
 
        {
-               { "search_path", PGC_USERSET, GUC_LIST_INPUT | GUC_LIST_QUOTE },
+               {"search_path", PGC_USERSET, GUC_LIST_INPUT | GUC_LIST_QUOTE},
                &namespace_search_path,
                "$user,public", assign_search_path, NULL
        },
 
        {
-               { "server_encoding", PGC_USERSET }, &server_encoding_string,
+               {"server_encoding", PGC_USERSET}, &server_encoding_string,
                "SQL_ASCII", assign_server_encoding, show_server_encoding
        },
 
        {
-               { "server_min_messages", PGC_USERSET }, &server_min_messages_str,
+               {"server_min_messages", PGC_USERSET}, &server_min_messages_str,
                server_min_messages_str_default, assign_server_min_messages, NULL
        },
 
        {
-               { "session_authorization", PGC_USERSET, GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL },
+               {"session_authorization", PGC_USERSET, GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL},
                &session_authorization_string,
                NULL, assign_session_authorization, show_session_authorization
        },
 
 #ifdef HAVE_SYSLOG
        {
-               { "syslog_facility", PGC_POSTMASTER }, &Syslog_facility,
+               {"syslog_facility", PGC_POSTMASTER}, &Syslog_facility,
                "LOCAL0", assign_facility, NULL
        },
        {
-               { "syslog_ident", PGC_POSTMASTER }, &Syslog_ident,
+               {"syslog_ident", PGC_POSTMASTER}, &Syslog_ident,
                "postgres", NULL, NULL
        },
 #endif
 
        {
-               { "TimeZone", PGC_USERSET }, &timezone_string,
+               {"TimeZone", PGC_USERSET}, &timezone_string,
                "UNKNOWN", assign_timezone, show_timezone
        },
 
        {
-               { "TRANSACTION ISOLATION LEVEL", PGC_USERSET, GUC_NO_RESET_ALL },
+               {"TRANSACTION ISOLATION LEVEL", PGC_USERSET, GUC_NO_RESET_ALL},
                &XactIsoLevel_string,
                NULL, assign_XactIsoLevel, show_XactIsoLevel
        },
 
        {
-               { "unix_socket_group", PGC_POSTMASTER }, &Unix_socket_group,
+               {"unix_socket_group", PGC_POSTMASTER}, &Unix_socket_group,
                "", NULL, NULL
        },
 
        {
-               { "unix_socket_directory", PGC_POSTMASTER }, &UnixSocketDir,
+               {"unix_socket_directory", PGC_POSTMASTER}, &UnixSocketDir,
                "", NULL, NULL
        },
 
        {
-               { "virtual_host", PGC_POSTMASTER }, &VirtualHost,
+               {"virtual_host", PGC_POSTMASTER}, &VirtualHost,
                "", NULL, NULL
        },
 
        {
-               { "wal_sync_method", PGC_SIGHUP }, &XLOG_sync_method,
+               {"wal_sync_method", PGC_SIGHUP}, &XLOG_sync_method,
                XLOG_sync_method_default, assign_xlog_sync_method, NULL
        },
 
        {
-               { NULL, 0 }, NULL, NULL, NULL, NULL
+               {NULL, 0}, NULL, NULL, NULL, NULL
        }
 };
 
@@ -863,19 +863,19 @@ static struct config_string
  * Actual lookup of variables is done through this single, sorted array.
  */
 static struct config_generic **guc_variables;
-static int num_guc_variables;
+static int     num_guc_variables;
 
 static bool guc_dirty;                 /* TRUE if need to do commit/abort work */
 
-static char *guc_string_workspace; /* for avoiding memory leaks */
+static char *guc_string_workspace;             /* for avoiding memory leaks */
 
 
-static int guc_var_compare(const void *a, const void *b);
-static char *_ShowOption(struct config_generic *record);
+static int     guc_var_compare(const void *a, const void *b);
+static char *_ShowOption(struct config_generic * record);
 
 
 /*
- * Build the sorted array.  This is split out so that it could be
+ * Build the sorted array.     This is split out so that it could be
  * re-executed after startup (eg, we could allow loadable modules to
  * add vars, and then we'd need to re-sort).
  */
@@ -927,16 +927,16 @@ build_guc_variables(void)
        num_vars = 0;
 
        for (i = 0; ConfigureNamesBool[i].gen.name; i++)
-               guc_vars[num_vars++] = & ConfigureNamesBool[i].gen;
+               guc_vars[num_vars++] = &ConfigureNamesBool[i].gen;
 
        for (i = 0; ConfigureNamesInt[i].gen.name; i++)
-               guc_vars[num_vars++] = & ConfigureNamesInt[i].gen;
+               guc_vars[num_vars++] = &ConfigureNamesInt[i].gen;
 
        for (i = 0; ConfigureNamesReal[i].gen.name; i++)
-               guc_vars[num_vars++] = & ConfigureNamesReal[i].gen;
+               guc_vars[num_vars++] = &ConfigureNamesReal[i].gen;
 
        for (i = 0; ConfigureNamesString[i].gen.name; i++)
-               guc_vars[num_vars++] = & ConfigureNamesString[i].gen;
+               guc_vars[num_vars++] = &ConfigureNamesString[i].gen;
 
        qsort((void *) guc_vars, num_vars, sizeof(struct config_generic *),
                  guc_var_compare);
@@ -964,11 +964,11 @@ find_option(const char *name)
         * by equating const char ** with struct config_generic *, we are
         * assuming the name field is first in config_generic.
         */
-       res = (struct config_generic**) bsearch((void *) &key,
-                                                                                       (void *) guc_variables,
-                                                                                       num_guc_variables,
-                                                                                       sizeof(struct config_generic *),
-                                                                                       guc_var_compare);
+       res = (struct config_generic **) bsearch((void *) &key,
+                                                                                        (void *) guc_variables,
+                                                                                        num_guc_variables,
+                                                                                sizeof(struct config_generic *),
+                                                                                        guc_var_compare);
        if (res)
                return *res;
        return NULL;
@@ -1048,88 +1048,92 @@ InitializeGUCOptions(void)
                switch (gconf->vartype)
                {
                        case PGC_BOOL:
-                       {
-                               struct config_bool *conf = (struct config_bool *) gconf;
+                               {
+                                       struct config_bool *conf = (struct config_bool *) gconf;
 
-                               if (conf->assign_hook)
-                                       if (!(*conf->assign_hook) (conf->reset_val, true, false))
-                                               fprintf(stderr, "Failed to initialize %s to %d\n",
-                                                               conf->gen.name, (int) conf->reset_val);
-                               *conf->variable = conf->reset_val;
-                               conf->session_val = conf->reset_val;
-                               break;
-                       }
+                                       if (conf->assign_hook)
+                                               if (!(*conf->assign_hook) (conf->reset_val, true, false))
+                                                       fprintf(stderr, "Failed to initialize %s to %d\n",
+                                                                 conf->gen.name, (int) conf->reset_val);
+                                       *conf->variable = conf->reset_val;
+                                       conf->session_val = conf->reset_val;
+                                       break;
+                               }
                        case PGC_INT:
-                       {
-                               struct config_int *conf = (struct config_int *) gconf;
+                               {
+                                       struct config_int *conf = (struct config_int *) gconf;
 
-                               Assert(conf->reset_val >= conf->min);
-                               Assert(conf->reset_val <= conf->max);
-                               if (conf->assign_hook)
-                                       if (!(*conf->assign_hook) (conf->reset_val, true, false))
-                                               fprintf(stderr, "Failed to initialize %s to %d\n",
-                                                               conf->gen.name, conf->reset_val);
-                               *conf->variable = conf->reset_val;
-                               conf->session_val = conf->reset_val;
-                               break;
-                       }
+                                       Assert(conf->reset_val >= conf->min);
+                                       Assert(conf->reset_val <= conf->max);
+                                       if (conf->assign_hook)
+                                               if (!(*conf->assign_hook) (conf->reset_val, true, false))
+                                                       fprintf(stderr, "Failed to initialize %s to %d\n",
+                                                                       conf->gen.name, conf->reset_val);
+                                       *conf->variable = conf->reset_val;
+                                       conf->session_val = conf->reset_val;
+                                       break;
+                               }
                        case PGC_REAL:
-                       {
-                               struct config_real *conf = (struct config_real *) gconf;
-
-                               Assert(conf->reset_val >= conf->min);
-                               Assert(conf->reset_val <= conf->max);
-                               if (conf->assign_hook)
-                                       if (!(*conf->assign_hook) (conf->reset_val, true, false))
-                                               fprintf(stderr, "Failed to initialize %s to %g\n",
-                                                               conf->gen.name, conf->reset_val);
-                               *conf->variable = conf->reset_val;
-                               conf->session_val = conf->reset_val;
-                               break;
-                       }
-                       case PGC_STRING:
-                       {
-                               struct config_string *conf = (struct config_string *) gconf;
-                               char       *str;
-
-                               *conf->variable = NULL;
-                               conf->reset_val = NULL;
-                               conf->session_val = NULL;
-                               conf->tentative_val = NULL;
-
-                               if (conf->boot_val == NULL)
                                {
-                                       /* Cannot set value yet */
+                                       struct config_real *conf = (struct config_real *) gconf;
+
+                                       Assert(conf->reset_val >= conf->min);
+                                       Assert(conf->reset_val <= conf->max);
+                                       if (conf->assign_hook)
+                                               if (!(*conf->assign_hook) (conf->reset_val, true, false))
+                                                       fprintf(stderr, "Failed to initialize %s to %g\n",
+                                                                       conf->gen.name, conf->reset_val);
+                                       *conf->variable = conf->reset_val;
+                                       conf->session_val = conf->reset_val;
                                        break;
                                }
-
-                               str = strdup(conf->boot_val);
-                               if (str == NULL)
-                                       elog(PANIC, "out of memory");
-                               conf->reset_val = str;
-
-                               if (conf->assign_hook)
+                       case PGC_STRING:
                                {
-                                       const char   *newstr;
+                                       struct config_string *conf = (struct config_string *) gconf;
+                                       char       *str;
+
+                                       *conf->variable = NULL;
+                                       conf->reset_val = NULL;
+                                       conf->session_val = NULL;
+                                       conf->tentative_val = NULL;
 
-                                       newstr = (*conf->assign_hook) (str, true, false);
-                                       if (newstr == NULL)
+                                       if (conf->boot_val == NULL)
                                        {
-                                               fprintf(stderr, "Failed to initialize %s to '%s'\n",
-                                                               conf->gen.name, str);
+                                               /* Cannot set value yet */
+                                               break;
                                        }
-                                       else if (newstr != str)
+
+                                       str = strdup(conf->boot_val);
+                                       if (str == NULL)
+                                               elog(PANIC, "out of memory");
+                                       conf->reset_val = str;
+
+                                       if (conf->assign_hook)
                                        {
-                                               free(str);
-                                               /* See notes in set_config_option about casting */
-                                               str = (char *) newstr;
-                                               conf->reset_val = str;
+                                               const char *newstr;
+
+                                               newstr = (*conf->assign_hook) (str, true, false);
+                                               if (newstr == NULL)
+                                               {
+                                                       fprintf(stderr, "Failed to initialize %s to '%s'\n",
+                                                                       conf->gen.name, str);
+                                               }
+                                               else if (newstr != str)
+                                               {
+                                                       free(str);
+
+                                                       /*
+                                                        * See notes in set_config_option about
+                                                        * casting
+                                                        */
+                                                       str = (char *) newstr;
+                                                       conf->reset_val = str;
+                                               }
                                        }
+                                       *conf->variable = str;
+                                       conf->session_val = str;
+                                       break;
                                }
-                               *conf->variable = str;
-                               conf->session_val = str;
-                               break;
-                       }
                }
        }
 
@@ -1146,7 +1150,7 @@ InitializeGUCOptions(void)
 
        /*
         * For historical reasons, some GUC parameters can receive defaults
-        * from environment variables.  Process those settings.
+        * from environment variables.  Process those settings.
         */
 
        env = getenv("PGPORT");
@@ -1192,86 +1196,89 @@ ResetAllOptions(void)
                switch (gconf->vartype)
                {
                        case PGC_BOOL:
-                       {
-                               struct config_bool *conf = (struct config_bool *) gconf;
+                               {
+                                       struct config_bool *conf = (struct config_bool *) gconf;
 
-                               if (conf->assign_hook)
-                                       if (!(*conf->assign_hook) (conf->reset_val, true, true))
-                                               elog(ERROR, "Failed to reset %s", conf->gen.name);
-                               *conf->variable = conf->reset_val;
-                               conf->tentative_val = conf->reset_val;
-                               conf->gen.source = conf->gen.reset_source;
-                               conf->gen.tentative_source = conf->gen.reset_source;
-                               conf->gen.status |= GUC_HAVE_TENTATIVE;
-                               guc_dirty = true;
-                               break;
-                       }
+                                       if (conf->assign_hook)
+                                               if (!(*conf->assign_hook) (conf->reset_val, true, true))
+                                                       elog(ERROR, "Failed to reset %s", conf->gen.name);
+                                       *conf->variable = conf->reset_val;
+                                       conf->tentative_val = conf->reset_val;
+                                       conf->gen.source = conf->gen.reset_source;
+                                       conf->gen.tentative_source = conf->gen.reset_source;
+                                       conf->gen.status |= GUC_HAVE_TENTATIVE;
+                                       guc_dirty = true;
+                                       break;
+                               }
                        case PGC_INT:
-                       {
-                               struct config_int *conf = (struct config_int *) gconf;
+                               {
+                                       struct config_int *conf = (struct config_int *) gconf;
 
-                               if (conf->assign_hook)
-                                       if (!(*conf->assign_hook) (conf->reset_val, true, true))
-                                               elog(ERROR, "Failed to reset %s", conf->gen.name);
-                               *conf->variable = conf->reset_val;
-                               conf->tentative_val = conf->reset_val;
-                               conf->gen.source = conf->gen.reset_source;
-                               conf->gen.tentative_source = conf->gen.reset_source;
-                               conf->gen.status |= GUC_HAVE_TENTATIVE;
-                               guc_dirty = true;
-                               break;
-                       }
+                                       if (conf->assign_hook)
+                                               if (!(*conf->assign_hook) (conf->reset_val, true, true))
+                                                       elog(ERROR, "Failed to reset %s", conf->gen.name);
+                                       *conf->variable = conf->reset_val;
+                                       conf->tentative_val = conf->reset_val;
+                                       conf->gen.source = conf->gen.reset_source;
+                                       conf->gen.tentative_source = conf->gen.reset_source;
+                                       conf->gen.status |= GUC_HAVE_TENTATIVE;
+                                       guc_dirty = true;
+                                       break;
+                               }
                        case PGC_REAL:
-                       {
-                               struct config_real *conf = (struct config_real *) gconf;
-
-                               if (conf->assign_hook)
-                                       if (!(*conf->assign_hook) (conf->reset_val, true, true))
-                                               elog(ERROR, "Failed to reset %s", conf->gen.name);
-                               *conf->variable = conf->reset_val;
-                               conf->tentative_val = conf->reset_val;
-                               conf->gen.source = conf->gen.reset_source;
-                               conf->gen.tentative_source = conf->gen.reset_source;
-                               conf->gen.status |= GUC_HAVE_TENTATIVE;
-                               guc_dirty = true;
-                               break;
-                       }
-                       case PGC_STRING:
-                       {
-                               struct config_string *conf = (struct config_string *) gconf;
-                               char       *str;
-
-                               if (conf->reset_val == NULL)
                                {
-                                       /* Nothing to reset to, as yet; so do nothing */
+                                       struct config_real *conf = (struct config_real *) gconf;
+
+                                       if (conf->assign_hook)
+                                               if (!(*conf->assign_hook) (conf->reset_val, true, true))
+                                                       elog(ERROR, "Failed to reset %s", conf->gen.name);
+                                       *conf->variable = conf->reset_val;
+                                       conf->tentative_val = conf->reset_val;
+                                       conf->gen.source = conf->gen.reset_source;
+                                       conf->gen.tentative_source = conf->gen.reset_source;
+                                       conf->gen.status |= GUC_HAVE_TENTATIVE;
+                                       guc_dirty = true;
                                        break;
                                }
+                       case PGC_STRING:
+                               {
+                                       struct config_string *conf = (struct config_string *) gconf;
+                                       char       *str;
 
-                               /* We need not strdup here */
-                               str = conf->reset_val;
+                                       if (conf->reset_val == NULL)
+                                       {
+                                               /* Nothing to reset to, as yet; so do nothing */
+                                               break;
+                                       }
 
-                               if (conf->assign_hook)
-                               {
-                                       const char   *newstr;
+                                       /* We need not strdup here */
+                                       str = conf->reset_val;
 
-                                       newstr = (*conf->assign_hook) (str, true, true);
-                                       if (newstr == NULL)
-                                               elog(ERROR, "Failed to reset %s", conf->gen.name);
-                                       else if (newstr != str)
+                                       if (conf->assign_hook)
                                        {
-                                               /* See notes in set_config_option about casting */
-                                               str = (char *) newstr;
+                                               const char *newstr;
+
+                                               newstr = (*conf->assign_hook) (str, true, true);
+                                               if (newstr == NULL)
+                                                       elog(ERROR, "Failed to reset %s", conf->gen.name);
+                                               else if (newstr != str)
+                                               {
+                                                       /*
+                                                        * See notes in set_config_option about
+                                                        * casting
+                                                        */
+                                                       str = (char *) newstr;
+                                               }
                                        }
-                               }
 
-                               SET_STRING_VARIABLE(conf, str);
-                               SET_STRING_TENTATIVE_VAL(conf, str);
-                               conf->gen.source = conf->gen.reset_source;
-                               conf->gen.tentative_source = conf->gen.reset_source;
-                               conf->gen.status |= GUC_HAVE_TENTATIVE;
-                               guc_dirty = true;
-                               break;
-                       }
+                                       SET_STRING_VARIABLE(conf, str);
+                                       SET_STRING_TENTATIVE_VAL(conf, str);
+                                       conf->gen.source = conf->gen.reset_source;
+                                       conf->gen.tentative_source = conf->gen.reset_source;
+                                       conf->gen.status |= GUC_HAVE_TENTATIVE;
+                                       guc_dirty = true;
+                                       break;
+                               }
                }
        }
 }
@@ -1307,111 +1314,112 @@ AtEOXact_GUC(bool isCommit)
                switch (gconf->vartype)
                {
                        case PGC_BOOL:
-                       {
-                               struct config_bool *conf = (struct config_bool *) gconf;
-
-                               if (isCommit && (conf->gen.status & GUC_HAVE_TENTATIVE))
                                {
-                                       conf->session_val = conf->tentative_val;
-                                       conf->gen.session_source = conf->gen.tentative_source;
-                               }
+                                       struct config_bool *conf = (struct config_bool *) gconf;
 
-                               if (*conf->variable != conf->session_val)
-                               {
-                                       if (conf->assign_hook)
-                                               if (!(*conf->assign_hook) (conf->session_val,
-                                                                                                  true, false))
-                                                       elog(LOG, "Failed to commit %s", conf->gen.name);
-                                       *conf->variable = conf->session_val;
+                                       if (isCommit && (conf->gen.status & GUC_HAVE_TENTATIVE))
+                                       {
+                                               conf->session_val = conf->tentative_val;
+                                               conf->gen.session_source = conf->gen.tentative_source;
+                                       }
+
+                                       if (*conf->variable != conf->session_val)
+                                       {
+                                               if (conf->assign_hook)
+                                                       if (!(*conf->assign_hook) (conf->session_val,
+                                                                                                          true, false))
+                                                               elog(LOG, "Failed to commit %s", conf->gen.name);
+                                               *conf->variable = conf->session_val;
+                                       }
+                                       conf->gen.source = conf->gen.session_source;
+                                       conf->gen.status = 0;
+                                       break;
                                }
-                               conf->gen.source = conf->gen.session_source;
-                               conf->gen.status = 0;
-                               break;
-                       }
                        case PGC_INT:
-                       {
-                               struct config_int *conf = (struct config_int *) gconf;
-
-                               if (isCommit && (conf->gen.status & GUC_HAVE_TENTATIVE))
                                {
-                                       conf->session_val = conf->tentative_val;
-                                       conf->gen.session_source = conf->gen.tentative_source;
-                               }
+                                       struct config_int *conf = (struct config_int *) gconf;
 
-                               if (*conf->variable != conf->session_val)
-                               {
-                                       if (conf->assign_hook)
-                                               if (!(*conf->assign_hook) (conf->session_val,
-                                                                                                  true, false))
-                                                       elog(LOG, "Failed to commit %s", conf->gen.name);
-                                       *conf->variable = conf->session_val;
+                                       if (isCommit && (conf->gen.status & GUC_HAVE_TENTATIVE))
+                                       {
+                                               conf->session_val = conf->tentative_val;
+                                               conf->gen.session_source = conf->gen.tentative_source;
+                                       }
+
+                                       if (*conf->variable != conf->session_val)
+                                       {
+                                               if (conf->assign_hook)
+                                                       if (!(*conf->assign_hook) (conf->session_val,
+                                                                                                          true, false))
+                                                               elog(LOG, "Failed to commit %s", conf->gen.name);
+                                               *conf->variable = conf->session_val;
+                                       }
+                                       conf->gen.source = conf->gen.session_source;
+                                       conf->gen.status = 0;
+                                       break;
                                }
-                               conf->gen.source = conf->gen.session_source;
-                               conf->gen.status = 0;
-                               break;
-                       }
                        case PGC_REAL:
-                       {
-                               struct config_real *conf = (struct config_real *) gconf;
-
-                               if (isCommit && (conf->gen.status & GUC_HAVE_TENTATIVE))
                                {
-                                       conf->session_val = conf->tentative_val;
-                                       conf->gen.session_source = conf->gen.tentative_source;
-                               }
+                                       struct config_real *conf = (struct config_real *) gconf;
 
-                               if (*conf->variable != conf->session_val)
-                               {
-                                       if (conf->assign_hook)
-                                               if (!(*conf->assign_hook) (conf->session_val,
-                                                                                                  true, false))
-                                                       elog(LOG, "Failed to commit %s", conf->gen.name);
-                                       *conf->variable = conf->session_val;
-                               }
-                               conf->gen.source = conf->gen.session_source;
-                               conf->gen.status = 0;
-                               break;
-                       }
-                       case PGC_STRING:
-                       {
-                               struct config_string *conf = (struct config_string *) gconf;
+                                       if (isCommit && (conf->gen.status & GUC_HAVE_TENTATIVE))
+                                       {
+                                               conf->session_val = conf->tentative_val;
+                                               conf->gen.session_source = conf->gen.tentative_source;
+                                       }
 
-                               if (isCommit && (conf->gen.status & GUC_HAVE_TENTATIVE))
-                               {
-                                       SET_STRING_SESSION_VAL(conf, conf->tentative_val);
-                                       conf->gen.session_source = conf->gen.tentative_source;
-                                       conf->tentative_val = NULL;     /* transfer ownership */
+                                       if (*conf->variable != conf->session_val)
+                                       {
+                                               if (conf->assign_hook)
+                                                       if (!(*conf->assign_hook) (conf->session_val,
+                                                                                                          true, false))
+                                                               elog(LOG, "Failed to commit %s", conf->gen.name);
+                                               *conf->variable = conf->session_val;
+                                       }
+                                       conf->gen.source = conf->gen.session_source;
+                                       conf->gen.status = 0;
+                                       break;
                                }
-                               else
+                       case PGC_STRING:
                                {
-                                       SET_STRING_TENTATIVE_VAL(conf, NULL);
-                               }
+                                       struct config_string *conf = (struct config_string *) gconf;
 
-                               if (*conf->variable != conf->session_val)
-                               {
-                                       char       *str = conf->session_val;
+                                       if (isCommit && (conf->gen.status & GUC_HAVE_TENTATIVE))
+                                       {
+                                               SET_STRING_SESSION_VAL(conf, conf->tentative_val);
+                                               conf->gen.session_source = conf->gen.tentative_source;
+                                               conf->tentative_val = NULL;             /* transfer ownership */
+                                       }
+                                       else
+                                               SET_STRING_TENTATIVE_VAL(conf, NULL);
 
-                                       if (conf->assign_hook)
+                                       if (*conf->variable != conf->session_val)
                                        {
-                                               const char   *newstr;
+                                               char       *str = conf->session_val;
 
-                                               newstr = (*conf->assign_hook) (str, true, false);
-                                               if (newstr == NULL)
-                                                       elog(LOG, "Failed to commit %s", conf->gen.name);
-                                               else if (newstr != str)
+                                               if (conf->assign_hook)
                                                {
-                                                       /* See notes in set_config_option about casting */
-                                                       str = (char *) newstr;
-                                                       SET_STRING_SESSION_VAL(conf, str);
+                                                       const char *newstr;
+
+                                                       newstr = (*conf->assign_hook) (str, true, false);
+                                                       if (newstr == NULL)
+                                                               elog(LOG, "Failed to commit %s", conf->gen.name);
+                                                       else if (newstr != str)
+                                                       {
+                                                               /*
+                                                                * See notes in set_config_option about
+                                                                * casting
+                                                                */
+                                                               str = (char *) newstr;
+                                                               SET_STRING_SESSION_VAL(conf, str);
+                                                       }
                                                }
-                                       }
 
-                                       SET_STRING_VARIABLE(conf, str);
+                                               SET_STRING_VARIABLE(conf, str);
+                                       }
+                                       conf->gen.source = conf->gen.session_source;
+                                       conf->gen.status = 0;
+                                       break;
                                }
-                               conf->gen.source = conf->gen.session_source;
-                               conf->gen.status = 0;
-                               break;
-                       }
                }
        }
 
@@ -1644,18 +1652,20 @@ set_config_option(const char *name, const char *value,
 
        /* Should we report errors interactively? */
        interactive = (source >= PGC_S_SESSION);
+
        /*
-        * Should we set reset/session values?  (If so, the behavior is not
+        * Should we set reset/session values?  (If so, the behavior is not
         * transactional.)
         */
        makeDefault = DoIt && (source <= PGC_S_OVERRIDE) && (value != NULL);
 
        /*
         * Ignore attempted set if overridden by previously processed setting.
-        * However, if DoIt is false then plow ahead anyway since we are trying
-        * to find out if the value is potentially good, not actually use it.
-        * Also keep going if makeDefault is true, since we may want to set
-        * the reset/session values even if we can't set the variable itself.
+        * However, if DoIt is false then plow ahead anyway since we are
+        * trying to find out if the value is potentially good, not actually
+        * use it. Also keep going if makeDefault is true, since we may want
+        * to set the reset/session values even if we can't set the variable
+        * itself.
         */
        if (record->source > source)
        {
@@ -1897,8 +1907,8 @@ set_config_option(const char *name, const char *value,
                                {
                                        /*
                                         * We could possibly avoid strdup here, but easier to
-                                        * make this case work the same as the normal assignment
-                                        * case.
+                                        * make this case work the same as the normal
+                                        * assignment case.
                                         */
                                        newval = strdup(conf->reset_val);
                                        if (newval == NULL)
@@ -1924,7 +1934,7 @@ set_config_option(const char *name, const char *value,
 
                                if (conf->assign_hook)
                                {
-                                       const char   *hookresult;
+                                       const char *hookresult;
 
                                        hookresult = (*conf->assign_hook) (newval,
                                                                                                           DoIt, interactive);
@@ -1939,13 +1949,15 @@ set_config_option(const char *name, const char *value,
                                        else if (hookresult != newval)
                                        {
                                                free(newval);
+
                                                /*
-                                                * Having to cast away const here is annoying, but the
-                                                * alternative is to declare assign_hooks as returning
-                                                * char*, which would mean they'd have to cast away
-                                                * const, or as both taking and returning char*, which
-                                                * doesn't seem attractive either --- we don't want
-                                                * them to scribble on the passed str.
+                                                * Having to cast away const here is annoying, but
+                                                * the alternative is to declare assign_hooks as
+                                                * returning char*, which would mean they'd have
+                                                * to cast away const, or as both taking and
+                                                * returning char*, which doesn't seem attractive
+                                                * either --- we don't want them to scribble on
+                                                * the passed str.
                                                 */
                                                newval = (char *) hookresult;
                                        }
@@ -1992,9 +2004,7 @@ set_config_option(const char *name, const char *value,
                                        }
                                }
                                else
-                               {
                                        free(newval);
-                               }
                                break;
                        }
        }
@@ -2006,7 +2016,7 @@ set_config_option(const char *name, const char *value,
 
 /*
  * Set a config option to the given value. See also set_config_option,
- * this is just the wrapper to be called from outside GUC.  NB: this
+ * this is just the wrapper to be called from outside GUC.     NB: this
  * is used only for non-transactional operations.
  */
 void
@@ -2109,7 +2119,7 @@ flatten_set_variable_args(const char *name, List *args)
        struct config_generic *record;
        int                     flags;
        StringInfoData buf;
-       List            *l;
+       List       *l;
 
        /* Fast path if just DEFAULT */
        if (args == NIL)
@@ -2157,27 +2167,27 @@ flatten_set_variable_args(const char *name, List *args)
                                         * Coerce to interval and back to normalize the value
                                         * and account for any typmod.
                                         */
-                                       Datum   interval;
-                                       char   *intervalout;
+                                       Datum           interval;
+                                       char       *intervalout;
 
                                        interval =
                                                DirectFunctionCall3(interval_in,
                                                                                        CStringGetDatum(val),
                                                                                        ObjectIdGetDatum(InvalidOid),
-                                                                                       Int32GetDatum(arg->typename->typmod));
+                                                                  Int32GetDatum(arg->typename->typmod));
 
                                        intervalout =
                                                DatumGetCString(DirectFunctionCall3(interval_out,
                                                                                                                        interval,
-                                                                                                                       ObjectIdGetDatum(InvalidOid),
-                                                                                                                       Int32GetDatum(-1)));
+                                                                                       ObjectIdGetDatum(InvalidOid),
+                                                                                                        Int32GetDatum(-1)));
                                        appendStringInfo(&buf, "INTERVAL '%s'", intervalout);
                                }
                                else
                                {
                                        /*
-                                        * Plain string literal or identifier.  For quote mode,
-                                        * quote it if it's not a vanilla identifier.
+                                        * Plain string literal or identifier.  For quote
+                                        * mode, quote it if it's not a vanilla identifier.
                                         */
                                        if (flags & GUC_LIST_QUOTE)
                                                appendStringInfo(&buf, "%s", quote_identifier(val));
@@ -2218,11 +2228,11 @@ SetPGVariable(const char *name, List *args, bool is_local)
 Datum
 set_config_by_name(PG_FUNCTION_ARGS)
 {
-       char   *name;
-       char   *value;
-       char   *new_value;
-       bool    is_local;
-       text   *result_text;
+       char       *name;
+       char       *value;
+       char       *new_value;
+       bool            is_local;
+       text       *result_text;
 
        if (PG_ARGISNULL(0))
                elog(ERROR, "SET variable name is required");
@@ -2237,8 +2247,8 @@ set_config_by_name(PG_FUNCTION_ARGS)
                value = DatumGetCString(DirectFunctionCall1(textout, PG_GETARG_DATUM(1)));
 
        /*
-        * Get the desired state of is_local. Default to false
-        * if provided value is NULL
+        * Get the desired state of is_local. Default to false if provided
+        * value is NULL
         */
        if (PG_ARGISNULL(2))
                is_local = false;
@@ -2300,10 +2310,10 @@ void
 ShowGUCConfigOption(const char *name)
 {
        TupOutputState *tstate;
-       TupleDesc               tupdesc;
-       CommandDest             dest = whereToSendOutput;
-       const char         *varname;
-       char               *value;
+       TupleDesc       tupdesc;
+       CommandDest dest = whereToSendOutput;
+       const char *varname;
+       char       *value;
 
        /* Get the value and canonical spelling of name */
        value = GetConfigOptionByName(name, &varname);
@@ -2330,9 +2340,9 @@ ShowAllGUCConfig(void)
 {
        int                     i;
        TupOutputState *tstate;
-       TupleDesc               tupdesc;
-       CommandDest             dest = whereToSendOutput;
-       char              *values[2];
+       TupleDesc       tupdesc;
+       CommandDest dest = whereToSendOutput;
+       char       *values[2];
 
        /* need a tuple descriptor representing two TEXT columns */
        tupdesc = CreateTemplateTupleDesc(2, false);
@@ -2424,9 +2434,9 @@ GetNumConfigOptions(void)
 Datum
 show_config_by_name(PG_FUNCTION_ARGS)
 {
-       char   *varname;
-       char   *varval;
-       text   *result_text;
+       char       *varname;
+       char       *varval;
+       text       *result_text;
 
        /* Get the GUC variable name */
        varname = DatumGetCString(DirectFunctionCall1(textout, PG_GETARG_DATUM(0)));
@@ -2448,21 +2458,24 @@ show_config_by_name(PG_FUNCTION_ARGS)
 Datum
 show_all_settings(PG_FUNCTION_ARGS)
 {
-       FuncCallContext    *funcctx;
-       TupleDesc                       tupdesc;
-       int                                     call_cntr;
-       int                                     max_calls;
-       TupleTableSlot     *slot;
-       AttInMetadata      *attinmeta;
-       MemoryContext           oldcontext;
+       FuncCallContext *funcctx;
+       TupleDesc       tupdesc;
+       int                     call_cntr;
+       int                     max_calls;
+       TupleTableSlot *slot;
+       AttInMetadata *attinmeta;
+       MemoryContext oldcontext;
 
        /* stuff done only on the first call of the function */
-       if(SRF_IS_FIRSTCALL())
-       {
+       if (SRF_IS_FIRSTCALL())
+       {
                /* create a function context for cross-call persistence */
-               funcctx = SRF_FIRSTCALL_INIT();
+               funcctx = SRF_FIRSTCALL_INIT();
 
-               /* switch to memory context appropriate for multiple function calls */
+               /*
+                * switch to memory context appropriate for multiple function
+                * calls
+                */
                oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
 
                /* need a tuple descriptor representing two TEXT columns */
@@ -2479,8 +2492,8 @@ show_all_settings(PG_FUNCTION_ARGS)
                funcctx->slot = slot;
 
                /*
-                * Generate attribute metadata needed later to produce tuples from raw
-                * C strings
+                * Generate attribute metadata needed later to produce tuples from
+                * raw C strings
                 */
                attinmeta = TupleDescGetAttInMetadata(tupdesc);
                funcctx->attinmeta = attinmeta;
@@ -2489,18 +2502,18 @@ show_all_settings(PG_FUNCTION_ARGS)
                funcctx->max_calls = GetNumConfigOptions();
 
                MemoryContextSwitchTo(oldcontext);
-    }
+       }
 
        /* stuff done on every call of the function */
-       funcctx = SRF_PERCALL_SETUP();
+       funcctx = SRF_PERCALL_SETUP();
 
        call_cntr = funcctx->call_cntr;
        max_calls = funcctx->max_calls;
        slot = funcctx->slot;
        attinmeta = funcctx->attinmeta;
 
-       if (call_cntr < max_calls)      /* do when there is more left to send */
-       {
+       if (call_cntr < max_calls)      /* do when there is more left to send */
+       {
                char       *values[2];
                char       *varname;
                char       *varval;
@@ -2527,14 +2540,14 @@ show_all_settings(PG_FUNCTION_ARGS)
 
                                /* make sure we haven't gone too far now */
                                if (call_cntr >= max_calls)
-                                       SRF_RETURN_DONE(funcctx);
+                                       SRF_RETURN_DONE(funcctx);
                        }
                } while (noshow);
 
                /*
-                * Prepare a values array for storage in our slot.
-                * This should be an array of C strings which will
-                * be processed later by the appropriate "in" functions.
+                * Prepare a values array for storage in our slot. This should be
+                * an array of C strings which will be processed later by the
+                * appropriate "in" functions.
                 */
                values[0] = varname;
                values[1] = varval;
@@ -2549,16 +2562,15 @@ show_all_settings(PG_FUNCTION_ARGS)
                if (varval != NULL)
                        pfree(varval);
 
-               SRF_RETURN_NEXT(funcctx, result);
-       }
-       else    /* do when there is no more left */
-       {
-               SRF_RETURN_DONE(funcctx);
-       }
+               SRF_RETURN_NEXT(funcctx, result);
+       }
+       else
+/* do when there is no more left */
+               SRF_RETURN_DONE(funcctx);
 }
 
 static char *
-_ShowOption(struct config_generic *record)
+_ShowOption(struct config_generic * record)
 {
        char            buffer[256];
        const char *val;
@@ -2699,7 +2711,6 @@ assign_facility(const char *facility, bool doit, bool interactive)
                return facility;
        return NULL;
 }
-
 #endif
 
 
@@ -2707,9 +2718,15 @@ static const char *
 assign_defaultxactisolevel(const char *newval, bool doit, bool interactive)
 {
        if (strcasecmp(newval, "serializable") == 0)
-               { if (doit) DefaultXactIsoLevel = XACT_SERIALIZABLE; }
+       {
+               if (doit)
+                       DefaultXactIsoLevel = XACT_SERIALIZABLE;
+       }
        else if (strcasecmp(newval, "read committed") == 0)
-               { if (doit) DefaultXactIsoLevel = XACT_READ_COMMITTED; }
+       {
+               if (doit)
+                       DefaultXactIsoLevel = XACT_READ_COMMITTED;
+       }
        else
                return NULL;
        return newval;
@@ -2723,7 +2740,7 @@ assign_defaultxactisolevel(const char *newval, bool doit, bool interactive)
 void
 ProcessGUCArray(ArrayType *array, GucSource source)
 {
-       int             i;
+       int                     i;
 
        Assert(array != NULL);
        Assert(ARR_ELEMTYPE(array) == TEXTOID);
@@ -2740,10 +2757,10 @@ ProcessGUCArray(ArrayType *array, GucSource source)
                char       *value;
 
                d = array_ref(array, 1, &i,
-                                         -1 /*varlenarray*/,
-                                         -1 /*TEXT's typlen*/,
-                                         false /*TEXT's typbyval*/,
-                                         'i' /*TEXT's typalign*/,
+                                         -1 /* varlenarray */ ,
+                                         -1 /* TEXT's typlen */ ,
+                                         false /* TEXT's typbyval */ ,
+                                         'i' /* TEXT's typalign */ ,
                                          &isnull);
 
                if (isnull)
@@ -2760,8 +2777,8 @@ ProcessGUCArray(ArrayType *array, GucSource source)
                }
 
                /*
-                * We process all these options at SUSET level.  We assume that the
-                * right to insert an option into pg_database or pg_shadow was
+                * We process all these options at SUSET level.  We assume that
+                * the right to insert an option into pg_database or pg_shadow was
                 * checked when it was inserted.
                 */
                SetConfigOption(name, value, PGC_SUSET, source);
@@ -2795,15 +2812,15 @@ GUCArrayAdd(ArrayType *array, const char *name, const char *value)
 
        if (array)
        {
-               int             index;
-               bool    isnull;
-               int             i;
+               int                     index;
+               bool            isnull;
+               int                     i;
 
                Assert(ARR_ELEMTYPE(array) == TEXTOID);
                Assert(ARR_NDIM(array) == 1);
                Assert(ARR_LBOUND(array)[0] == 1);
 
-               index = ARR_DIMS(array)[0] + 1; /* add after end */
+               index = ARR_DIMS(array)[0] + 1; /* add after end */
 
                for (i = 1; i <= ARR_DIMS(array)[0]; i++)
                {
@@ -2811,15 +2828,15 @@ GUCArrayAdd(ArrayType *array, const char *name, const char *value)
                        char       *current;
 
                        d = array_ref(array, 1, &i,
-                                                 -1 /*varlenarray*/,
-                                                 -1 /*TEXT's typlen*/,
-                                                 false /*TEXT's typbyval*/,
-                                                 'i' /*TEXT's typalign*/,
+                                                 -1 /* varlenarray */ ,
+                                                 -1 /* TEXT's typlen */ ,
+                                                 false /* TEXT's typbyval */ ,
+                                                 'i' /* TEXT's typalign */ ,
                                                  &isnull);
                        if (isnull)
                                continue;
                        current = DatumGetCString(DirectFunctionCall1(textout, d));
-                       if (strncmp(current, newval, strlen(name) + 1)==0)
+                       if (strncmp(current, newval, strlen(name) + 1) == 0)
                        {
                                index = i;
                                break;
@@ -2829,10 +2846,10 @@ GUCArrayAdd(ArrayType *array, const char *name, const char *value)
                isnull = false;
                a = array_set(array, 1, &index,
                                          datum,
-                                         -1 /*varlenarray*/,
-                                         -1 /*TEXT's typlen*/,
-                                         false /*TEXT's typbyval*/,
-                                         'i' /*TEXT's typalign*/,
+                                         -1 /* varlenarray */ ,
+                                         -1 /* TEXT's typlen */ ,
+                                         false /* TEXT's typbyval */ ,
+                                         'i' /* TEXT's typalign */ ,
                                          &isnull);
        }
        else
@@ -2848,9 +2865,9 @@ GUCArrayAdd(ArrayType *array, const char *name, const char *value)
 ArrayType *
 GUCArrayDelete(ArrayType *array, const char *name)
 {
-       ArrayType *newarray;
-       int i;
-       int index;
+       ArrayType  *newarray;
+       int                     i;
+       int                     index;
 
        Assert(name);
        Assert(array);
@@ -2872,26 +2889,26 @@ GUCArrayDelete(ArrayType *array, const char *name)
                bool            isnull;
 
                d = array_ref(array, 1, &i,
-                                         -1 /*varlenarray*/,
-                                         -1 /*TEXT's typlen*/,
-                                         false /*TEXT's typbyval*/,
-                                         'i' /*TEXT's typalign*/,
+                                         -1 /* varlenarray */ ,
+                                         -1 /* TEXT's typlen */ ,
+                                         false /* TEXT's typbyval */ ,
+                                         'i' /* TEXT's typalign */ ,
                                          &isnull);
                if (isnull)
                        continue;
                val = DatumGetCString(DirectFunctionCall1(textout, d));
 
-               if (strncmp(val, name, strlen(name))==0
+               if (strncmp(val, name, strlen(name)) == 0
                        && val[strlen(name)] == '=')
                        continue;
 
                isnull = false;
                newarray = array_set(newarray, 1, &index,
                                                         d,
-                                                        -1 /*varlenarray*/,
-                                                        -1 /*TEXT's typlen*/,
-                                                        false /*TEXT's typbyval*/,
-                                                        'i' /*TEXT's typalign*/,
+                                                        -1 /* varlenarray */ ,
+                                                        -1 /* TEXT's typlen */ ,
+                                                        false /* TEXT's typbyval */ ,
+                                                        'i' /* TEXT's typalign */ ,
                                                         &isnull);
                index++;
        }
@@ -2903,49 +2920,81 @@ const char *
 assign_server_min_messages(const char *newval,
                                                   bool doit, bool interactive)
 {
-       return(assign_msglvl(&server_min_messages,newval,doit,interactive));
+       return (assign_msglvl(&server_min_messages, newval, doit, interactive));
 }
 
 const char *
 assign_client_min_messages(const char *newval,
                                                   bool doit, bool interactive)
 {
-       return(assign_msglvl(&client_min_messages,newval,doit,interactive));
+       return (assign_msglvl(&client_min_messages, newval, doit, interactive));
 }
 
 const char *
 assign_min_error_statement(const char *newval, bool doit, bool interactive)
 {
-       return(assign_msglvl(&log_min_error_statement,newval,doit,interactive));
+       return (assign_msglvl(&log_min_error_statement, newval, doit, interactive));
 }
 
 static const char *
 assign_msglvl(int *var, const char *newval, bool doit, bool interactive)
 {
        if (strcasecmp(newval, "debug") == 0)
-               { if (doit) (*var) = DEBUG1; }
+       {
+               if (doit)
+                       (*var) = DEBUG1;
+       }
        else if (strcasecmp(newval, "debug5") == 0)
-               { if (doit) (*var) = DEBUG5; }
+       {
+               if (doit)
+                       (*var) = DEBUG5;
+       }
        else if (strcasecmp(newval, "debug4") == 0)
-               { if (doit) (*var) = DEBUG4; }
+       {
+               if (doit)
+                       (*var) = DEBUG4;
+       }
        else if (strcasecmp(newval, "debug3") == 0)
-               { if (doit) (*var) = DEBUG3; }
+       {
+               if (doit)
+                       (*var) = DEBUG3;
+       }
        else if (strcasecmp(newval, "debug2") == 0)
-               { if (doit) (*var) = DEBUG2; }
+       {
+               if (doit)
+                       (*var) = DEBUG2;
+       }
        else if (strcasecmp(newval, "debug1") == 0)
-               { if (doit) (*var) = DEBUG1; }
+       {
+               if (doit)
+                       (*var) = DEBUG1;
+       }
        else if (strcasecmp(newval, "log") == 0)
-               { if (doit) (*var) = LOG; }
+       {
+               if (doit)
+                       (*var) = LOG;
+       }
        else if (strcasecmp(newval, "info") == 0)
-               { if (doit) (*var) = INFO; }
+       {
+               if (doit)
+                       (*var) = INFO;
+       }
        else if (strcasecmp(newval, "notice") == 0)
-               { if (doit) (*var) = NOTICE; }
+       {
+               if (doit)
+                       (*var) = NOTICE;
+       }
        else if (strcasecmp(newval, "warning") == 0)
-               { if (doit) (*var) = WARNING; }
+       {
+               if (doit)
+                       (*var) = WARNING;
+       }
        else if (strcasecmp(newval, "error") == 0)
-               { if (doit) (*var) = ERROR; }
+       {
+               if (doit)
+                       (*var) = ERROR;
+       }
        else
                return NULL;                    /* fail */
        return newval;                          /* OK */
 }
-
index c6e3355..a87d620 100644 (file)
@@ -5,7 +5,7 @@
  * to contain some useful information. Mechanism differs wildly across
  * platforms.
  *
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/ps_status.c,v 1.12 2001/12/21 15:22:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/ps_status.c,v 1.13 2002/09/04 20:31:33 momjian Exp $
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  * various details abducted from various places
@@ -265,7 +265,7 @@ set_ps_display(const char *activity)
 
 #ifdef PS_USE_CLOBBER_ARGV
        {
-               int             buflen;
+               int                     buflen;
 
                /* pad unused memory */
                buflen = strlen(ps_buffer);
index 9cfcabb..bafe915 100644 (file)
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.47 2002/08/12 00:36:12 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/mmgr/aset.c,v 1.48 2002/09/04 20:31:33 momjian Exp $
  *
  * NOTE:
  *     This is a new (Feb. 05, 1999) implementation of the allocation set
@@ -206,6 +206,7 @@ static void AllocSetReset(MemoryContext context);
 static void AllocSetDelete(MemoryContext context);
 static Size AllocSetGetChunkSpace(MemoryContext context, void *pointer);
 static void AllocSetStats(MemoryContext context);
+
 #ifdef MEMORY_CONTEXT_CHECKING
 static void AllocSetCheck(MemoryContext context);
 #endif
@@ -223,7 +224,7 @@ static MemoryContextMethods AllocSetMethods = {
        AllocSetGetChunkSpace,
        AllocSetStats
 #ifdef MEMORY_CONTEXT_CHECKING
-       , AllocSetCheck
+       ,AllocSetCheck
 #endif
 };
 
index 53ea0fa..6dfbd95 100644 (file)
@@ -78,7 +78,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.26 2002/08/24 15:00:46 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.27 2002/09/04 20:31:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1854,8 +1854,8 @@ comparetup_index(Tuplesortstate *state, const void *a, const void *b)
         * otherwise the sort algorithm wouldn't have checked whether one must
         * appear before the other.
         *
-        * Some rather brain-dead implementations of qsort will sometimes
-        * call the comparison routine to compare a value to itself.  (At this
+        * Some rather brain-dead implementations of qsort will sometimes call
+        * the comparison routine to compare a value to itself.  (At this
         * writing only QNX 4 is known to do such silly things.)  Don't raise
         * a bogus error in that case.
         */
index 0cc8816..f531452 100644 (file)
@@ -6,7 +6,7 @@
  * NOTE: all the HeapTupleSatisfies routines will update the tuple's
  * "hint" status bits if we see that the inserting or deleting transaction
  * has now committed or aborted.  The caller is responsible for noticing any
- * change in t_infomask and scheduling a disk write if so.  Note that the
+ * change in t_infomask and scheduling a disk write if so.     Note that the
  * caller must hold at least a shared buffer context lock on the buffer
  * containing the tuple.  (VACUUM FULL assumes it's sufficient to have
  * exclusive lock on the containing relation, instead.)
@@ -16,7 +16,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.59 2002/09/02 01:05:06 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.60 2002/09/04 20:31:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -309,7 +309,7 @@ HeapTupleSatisfiesNow(HeapTupleHeader tuple)
  * This is a simplified version that only checks for VACUUM moving conditions.
  * It's appropriate for TOAST usage because TOAST really doesn't want to do
  * its own time qual checks; if you can see the main table row that contains
- * a TOAST reference, you should be able to see the TOASTed value.  However,
+ * a TOAST reference, you should be able to see the TOASTed value.     However,
  * vacuuming a TOAST table is independent of the main table, and in case such
  * a vacuum fails partway through, we'd better do this much checking.
  *
@@ -412,7 +412,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htuple, CommandId curcid)
                                return HeapTupleInvisible;              /* inserted after scan
                                                                                                 * started */
 
-                       if (tuple->t_infomask & HEAP_XMAX_INVALID)              /* xid invalid */
+                       if (tuple->t_infomask & HEAP_XMAX_INVALID)      /* xid invalid */
                                return HeapTupleMayBeUpdated;
 
                        Assert(TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(tuple)));
@@ -430,7 +430,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htuple, CommandId curcid)
                else if (!TransactionIdDidCommit(HeapTupleHeaderGetXmin(tuple)))
                {
                        if (TransactionIdDidAbort(HeapTupleHeaderGetXmin(tuple)))
-                               tuple->t_infomask |= HEAP_XMIN_INVALID; /* aborted */
+                               tuple->t_infomask |= HEAP_XMIN_INVALID; /* aborted */
                        return HeapTupleInvisible;
                }
                else
@@ -439,7 +439,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htuple, CommandId curcid)
 
        /* by here, the inserting transaction has committed */
 
-       if (tuple->t_infomask & HEAP_XMAX_INVALID)              /* xid invalid or aborted */
+       if (tuple->t_infomask & HEAP_XMAX_INVALID)      /* xid invalid or aborted */
                return HeapTupleMayBeUpdated;
 
        if (tuple->t_infomask & HEAP_XMAX_COMMITTED)
@@ -701,7 +701,7 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot)
         * when...
         */
        if (TransactionIdFollowsOrEquals(HeapTupleHeaderGetXmin(tuple),
-                                        snapshot->xmin))
+                                                                        snapshot->xmin))
        {
                uint32          i;
 
@@ -712,7 +712,7 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot)
                for (i = 0; i < snapshot->xcnt; i++)
                {
                        if (TransactionIdEquals(HeapTupleHeaderGetXmin(tuple),
-                                               snapshot->xip[i]))
+                                                                       snapshot->xip[i]))
                                return false;
                }
        }
@@ -752,7 +752,7 @@ HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot)
                uint32          i;
 
                if (TransactionIdFollowsOrEquals(HeapTupleHeaderGetXmax(tuple),
-                                                snapshot->xmax))
+                                                                                snapshot->xmax))
                        return true;
                for (i = 0; i < snapshot->xcnt; i++)
                {
@@ -867,7 +867,8 @@ HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin)
                                return HEAPTUPLE_LIVE;
                        if (TransactionIdDidCommit(HeapTupleHeaderGetXmax(tuple)))
                                tuple->t_infomask |= HEAP_XMAX_COMMITTED;
-                       else                            /* it's either aborted or crashed */
+                       else
+/* it's either aborted or crashed */
                                tuple->t_infomask |= HEAP_XMAX_INVALID;
                }
                return HEAPTUPLE_LIVE;
@@ -902,7 +903,7 @@ HeapTupleSatisfiesVacuum(HeapTupleHeader tuple, TransactionId OldestXmin)
         */
 
        if (TransactionIdEquals(HeapTupleHeaderGetXmin(tuple),
-                               HeapTupleHeaderGetXmax(tuple)))
+                                                       HeapTupleHeaderGetXmax(tuple)))
        {
                /*
                 * inserter also deleted it, so it was never visible to anyone
index 64ece82..d126bef 100644 (file)
@@ -6,7 +6,7 @@
  * copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
  * licence: BSD
  *
- * $Header: /cvsroot/pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.5 2002/09/02 22:18:26 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.6 2002/09/04 20:31:34 momjian Exp $
  */
 #include "postgres.h"
 
@@ -127,11 +127,11 @@ main(int argc, char *argv[])
        if (!EQ_CRC64(crc, ControlFile.crc))
                printf(_("WARNING: Calculated CRC checksum does not match value stored in file.\n"
                                 "Either the file is corrupt, or it has a different layout than this program\n"
-                                "is expecting.  The results below are untrustworthy.\n\n"));
+                        "is expecting.  The results below are untrustworthy.\n\n"));
 
        /*
-        * Use variable for format to suppress overly-anal-retentive gcc warning
-        * about %c
+        * Use variable for format to suppress overly-anal-retentive gcc
+        * warning about %c
         */
        strftime(pgctime_str, sizeof(pgctime_str), strftime_fmt,
                         localtime(&(ControlFile.time)));
index ddcb617..bd7b1a0 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.69 2002/08/29 00:17:05 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/bin/pg_dump/common.c,v 1.70 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #endif
 
 static void findParentsByOid(TableInfo *tblinfo, int numTables,
-                                                        InhInfo *inhinfo, int numInherits,
-                                                        const char *oid,
-                                                        int *numParentsPtr, int **parentIndexes);
+                                InhInfo *inhinfo, int numInherits,
+                                const char *oid,
+                                int *numParentsPtr, int **parentIndexes);
 static void flagInhTables(TableInfo *tbinfo, int numTables,
-                        InhInfo *inhinfo, int numInherits);
+                         InhInfo *inhinfo, int numInherits);
 static void flagInhAttrs(TableInfo *tbinfo, int numTables,
                         InhInfo *inhinfo, int numInherits);
 static int     strInArray(const char *pattern, char **arr, int arr_size);
index 314cf88..ef71182 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/dumputils.c,v 1.1 2002/08/27 18:57:26 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/dumputils.c,v 1.2 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,15 +31,17 @@ fmtId(const char *rawid)
 {
        static PQExpBuffer id_return = NULL;
        const char *cp;
-       bool need_quotes = false;
+       bool            need_quotes = false;
 
        if (id_return)                          /* first time through? */
                resetPQExpBuffer(id_return);
        else
                id_return = createPQExpBuffer();
 
-       /* These checks need to match the identifier production in scan.l.
-        * Don't use islower() etc. */
+       /*
+        * These checks need to match the identifier production in scan.l.
+        * Don't use islower() etc.
+        */
 
        if (ScanKeywordLookup(rawid))
                need_quotes = true;
index b4e39a1..a34d937 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/dumputils.h,v 1.2 2002/08/27 21:50:23 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/dumputils.h,v 1.3 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -23,4 +23,4 @@ extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
 extern const char *fmtId(const char *identifier);
 extern void appendStringLiteral(PQExpBuffer buf, const char *str, bool escapeAll);
 
-#endif /* DUMPUTILS_H */
+#endif   /* DUMPUTILS_H */
index de840e1..5226255 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.23 2002/08/27 18:57:26 petere Exp $
+ *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.24 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -68,7 +68,8 @@ typedef struct _restoreOptions
                                                                 * cirsumstances */
        int                     use_setsessauth;/* use SET SESSSION AUTHORIZATION instead
                                                                 * of \connect */
-       int                     disable_triggers;/* disable triggers during data-only restore */
+       int                     disable_triggers;               /* disable triggers during
+                                                                                * data-only restore */
        char       *superuser;          /* Username to use as superuser */
        int                     dataOnly;
        int                     dropSchema;
@@ -132,14 +133,14 @@ PGconn *ConnectDatabase(Archive *AH,
 
 /* Called to add a TOC entry */
 extern void ArchiveEntry(Archive *AHX, const char *oid, const char *tag,
-                                                const char *namespace, const char *owner,
-                                                const char *desc, const char *((*deps)[]),
-                                                const char *defn, const char *dropStmt,
-                                                const char *copyStmt,
-                                                DataDumperPtr dumpFn, void *dumpArg);
+                        const char *namespace, const char *owner,
+                        const char *desc, const char *((*deps)[]),
+                        const char *defn, const char *dropStmt,
+                        const char *copyStmt,
+                        DataDumperPtr dumpFn, void *dumpArg);
 
 /* Called to write *data* to the archive */
-extern size_t  WriteData(Archive *AH, const void *data, size_t dLen);
+extern size_t WriteData(Archive *AH, const void *data, size_t dLen);
 
 /*
 extern int     StartBlobs(Archive* AH);
index aefd094..0885cfe 100644 (file)
@@ -15,7 +15,7 @@
  *
  *
  * IDENTIFICATION
- *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.56 2002/08/27 18:57:26 petere Exp $
+ *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.57 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -170,8 +170,8 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
        }
 
        /*
-        * Work out if we have an implied data-only restore. This can happen if
-        * the dump was data only or if the user has used a toc list to
+        * Work out if we have an implied data-only restore. This can happen
+        * if the dump was data only or if the user has used a toc list to
         * exclude all of the schema data. All we do is look for schema
         * entries - if none are found then we set the dataOnly flag.
         *
@@ -453,10 +453,10 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *rop
        oldSchema = strdup(AH->currSchema);
 
        /*
-        * Become superuser if possible, since they are the only ones
-        * who can update pg_class.  If -S was not given, but we are allowed
-        * to use SET SESSION AUTHORIZATION, assume the initial user identity
-        * is a superuser.  Otherwise we just have to bull ahead anyway.
+        * Become superuser if possible, since they are the only ones who can
+        * update pg_class.  If -S was not given, but we are allowed to use
+        * SET SESSION AUTHORIZATION, assume the initial user identity is a
+        * superuser.  Otherwise we just have to bull ahead anyway.
         */
        if (ropt->superuser)
        {
@@ -465,9 +465,7 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *rop
                _selectOutputSchema(AH, oldSchema);
        }
        else if (AH->ropt->use_setsessauth)
-       {
                _doSetSessionAuth(AH, NULL);
-       }
 
        ahlog(AH, 1, "disabling triggers\n");
 
@@ -499,9 +497,7 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *rop
                _selectOutputSchema(AH, oldSchema);
        }
        else if (AH->ropt->use_setsessauth)
-       {
                _doSetSessionAuth(AH, oldUser);
-       }
        free(oldUser);
        free(oldSchema);
 }
@@ -520,10 +516,10 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt
        oldSchema = strdup(AH->currSchema);
 
        /*
-        * Become superuser if possible, since they are the only ones
-        * who can update pg_class.  If -S was not given, but we are allowed
-        * to use SET SESSION AUTHORIZATION, assume the initial user identity
-        * is a superuser.  Otherwise we just have to bull ahead anyway.
+        * Become superuser if possible, since they are the only ones who can
+        * update pg_class.  If -S was not given, but we are allowed to use
+        * SET SESSION AUTHORIZATION, assume the initial user identity is a
+        * superuser.  Otherwise we just have to bull ahead anyway.
         */
        if (ropt->superuser)
        {
@@ -532,9 +528,7 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt
                _selectOutputSchema(AH, oldSchema);
        }
        else if (AH->ropt->use_setsessauth)
-       {
                _doSetSessionAuth(AH, NULL);
-       }
 
        ahlog(AH, 1, "enabling triggers\n");
 
@@ -569,9 +563,7 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt
                _selectOutputSchema(AH, oldSchema);
        }
        else if (AH->ropt->use_setsessauth)
-       {
                _doSetSessionAuth(AH, oldUser);
-       }
        free(oldUser);
        free(oldSchema);
 }
@@ -814,7 +806,7 @@ EndRestoreBlob(ArchiveHandle *AH, Oid oid)
        if (AH->lo_buf_used > 0)
        {
                /* Write remaining bytes from the LO buffer */
-               size_t res;
+               size_t          res;
 
                res = lo_write(AH->connection, AH->loFd, (void *) AH->lo_buf, AH->lo_buf_used);
 
@@ -822,7 +814,7 @@ EndRestoreBlob(ArchiveHandle *AH, Oid oid)
                          (unsigned long) AH->lo_buf_used, (unsigned long) res);
                if (res != AH->lo_buf_used)
                        die_horribly(AH, modulename, "could not write to large object (result: %lu, expected: %lu)\n",
-                                                (unsigned long) res, (unsigned long) AH->lo_buf_used);
+                                  (unsigned long) res, (unsigned long) AH->lo_buf_used);
                AH->lo_buf_used = 0;
        }
 
@@ -1209,24 +1201,24 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
                if (AH->lo_buf_used + size * nmemb > AH->lo_buf_size)
                {
                        /* Split LO buffer */
-                       size_t remaining = AH->lo_buf_size - AH->lo_buf_used;
-                       size_t slack = nmemb * size - remaining;
+                       size_t          remaining = AH->lo_buf_size - AH->lo_buf_used;
+                       size_t          slack = nmemb * size - remaining;
 
-                       memcpy((char *)AH->lo_buf + AH->lo_buf_used, ptr, remaining);
+                       memcpy((char *) AH->lo_buf + AH->lo_buf_used, ptr, remaining);
                        res = lo_write(AH->connection, AH->loFd, AH->lo_buf, AH->lo_buf_size);
                        ahlog(AH, 5, "wrote %lu bytes of large object data (result = %lu)\n",
                                  (unsigned long) AH->lo_buf_size, (unsigned long) res);
                        if (res != AH->lo_buf_size)
                                die_horribly(AH, modulename,
                                                         "could not write to large object (result: %lu, expected: %lu)\n",
-                                                        (unsigned long) res, (unsigned long) AH->lo_buf_size);
-                       memcpy(AH->lo_buf, (char *)ptr + remaining, slack);
+                                  (unsigned long) res, (unsigned long) AH->lo_buf_size);
+                       memcpy(AH->lo_buf, (char *) ptr + remaining, slack);
                        AH->lo_buf_used = slack;
                }
                else
                {
                        /* LO Buffer is still large enough, buffer it */
-                       memcpy((char *)AH->lo_buf + AH->lo_buf_used, ptr, size * nmemb);
+                       memcpy((char *) AH->lo_buf + AH->lo_buf_used, ptr, size * nmemb);
                        AH->lo_buf_used += size * nmemb;
                }
 
@@ -1635,7 +1627,7 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt,
 
        AH->currUser = strdup("");      /* So it's valid, but we can free() it
                                                                 * later if necessary */
-       AH->currSchema = strdup(""); /* ditto */
+       AH->currSchema = strdup("");    /* ditto */
 
        AH->toc = (TocEntry *) calloc(1, sizeof(TocEntry));
        if (!AH->toc)
@@ -1957,10 +1949,13 @@ static void
 _doSetSessionAuth(ArchiveHandle *AH, const char *user)
 {
        PQExpBuffer cmd = createPQExpBuffer();
+
        appendPQExpBuffer(cmd, "SET SESSION AUTHORIZATION ");
        if (user)
-               /* SQL requires a string literal here.  Might as well be
-                * correct. */
+
+               /*
+                * SQL requires a string literal here.  Might as well be correct.
+                */
                appendStringLiteral(cmd, user, false);
        else
                appendPQExpBuffer(cmd, "DEFAULT");
@@ -1992,7 +1987,7 @@ _doSetSessionAuth(ArchiveHandle *AH, const char *user)
  * user, this won't do anything.
  *
  * If we're currently restoring right into a database, this will
- * actually establish a connection.    Otherwise it puts a \connect into
+ * actually establish a connection. Otherwise it puts a \connect into
  * the script output.
  */
 static void
@@ -2007,9 +2002,7 @@ _reconnectAsUser(ArchiveHandle *AH, const char *dbname, const char *user)
         * needed
         */
        if (!dbname && AH->ropt->use_setsessauth)
-       {
                _doSetSessionAuth(AH, user);
-       }
        else if (AH->ropt && AH->ropt->noReconnect)
        {
                /* When -R was given, don't do anything. */
index e22320d..3572dd1 100644 (file)
@@ -17,7 +17,7 @@
  *
  *
  * IDENTIFICATION
- *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.46 2002/08/20 17:54:44 petere Exp $
+ *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.47 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -229,7 +229,7 @@ typedef struct _archiveHandle
 
        RestoreOptions *ropt;           /* Used to check restore options in
                                                                 * ahwrite etc */
-       void                    *lo_buf;
+       void       *lo_buf;
        size_t          lo_buf_used;
        size_t          lo_buf_size;
 } ArchiveHandle;
@@ -241,7 +241,7 @@ typedef struct _tocEntry
        int                     id;
        int                     hadDumper;              /* Archiver was passed a dumper routine
                                                                 * (used in restore) */
-       char       *tag;                                /* index tag */
+       char       *tag;                        /* index tag */
        char       *namespace;          /* null or empty string if not in a schema */
        char       *owner;
        char       *desc;
@@ -282,10 +282,10 @@ extern int        TocIDRequired(ArchiveHandle *AH, int id, RestoreOptions *ropt);
  * Mandatory routines for each supported format
  */
 
-extern size_t  WriteInt(ArchiveHandle *AH, int i);
+extern size_t WriteInt(ArchiveHandle *AH, int i);
 extern int     ReadInt(ArchiveHandle *AH);
 extern char *ReadStr(ArchiveHandle *AH);
-extern size_t  WriteStr(ArchiveHandle *AH, const char *s);
+extern size_t WriteStr(ArchiveHandle *AH, const char *s);
 
 extern void StartRestoreBlobs(ArchiveHandle *AH);
 extern void StartRestoreBlob(ArchiveHandle *AH, Oid oid);
index 3b220ef..37597f7 100644 (file)
@@ -19,7 +19,7 @@
  *
  *
  * IDENTIFICATION
- *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.20 2002/08/20 17:54:44 petere Exp $
+ *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.21 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 static void _ArchiveEntry(ArchiveHandle *AH, TocEntry *te);
 static void _StartData(ArchiveHandle *AH, TocEntry *te);
-static size_t  _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
+static size_t _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
 static void _EndData(ArchiveHandle *AH, TocEntry *te);
 static int     _WriteByte(ArchiveHandle *AH, const int i);
 static int     _ReadByte(ArchiveHandle *);
-static size_t  _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
-static size_t  _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
+static size_t _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
+static size_t _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
 static void _CloseArchive(ArchiveHandle *AH);
 static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
 static void _WriteExtraToc(ArchiveHandle *AH, TocEntry *te);
@@ -147,7 +147,7 @@ InitArchiveFmt_Custom(ArchiveHandle *AH)
 
        /* Initialize LO buffering */
        AH->lo_buf_size = LOBBUFSIZE;
-       AH->lo_buf = (void *)malloc(LOBBUFSIZE);
+       AH->lo_buf = (void *) malloc(LOBBUFSIZE);
        if (AH->lo_buf == NULL)
                die_horribly(AH, modulename, "out of memory\n");
 
@@ -567,7 +567,7 @@ _PrintData(ArchiveHandle *AH)
                cnt = fread(in, 1, blkLen, AH->FH);
                if (cnt != blkLen)
                        die_horribly(AH, modulename,
-                                                "could not read data block - expected %lu, got %lu\n",
+                                  "could not read data block - expected %lu, got %lu\n",
                                                 (unsigned long) blkLen, (unsigned long) cnt);
 
                ctx->filePos += blkLen;
@@ -695,7 +695,7 @@ _skipData(ArchiveHandle *AH)
                cnt = fread(in, 1, blkLen, AH->FH);
                if (cnt != blkLen)
                        die_horribly(AH, modulename,
-                                                "could not read data block - expected %lu, got %lu\n",
+                                  "could not read data block - expected %lu, got %lu\n",
                                                 (unsigned long) blkLen, (unsigned long) cnt);
 
                ctx->filePos += blkLen;
@@ -956,8 +956,8 @@ _DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush)
                        if (zp->avail_out < zlibOutSize)
                        {
                                /*
-                                * printf("Wrote %lu byte deflated chunk\n", (unsigned long) (zlibOutSize -
-                                * zp->avail_out));
+                                * printf("Wrote %lu byte deflated chunk\n", (unsigned
+                                * long) (zlibOutSize - zp->avail_out));
                                 */
                                WriteInt(AH, zlibOutSize - zp->avail_out);
                                if (fwrite(out, 1, zlibOutSize - zp->avail_out, AH->FH) != (zlibOutSize - zp->avail_out))
index f54153d..c3bb6b0 100644 (file)
@@ -5,7 +5,7 @@
  *     Implements the basic DB functions used by the archiver.
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.39 2002/08/27 18:57:26 petere Exp $
+ *       $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.40 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -279,7 +279,7 @@ ConnectDatabase(Archive *AHX,
        /* check to see that the backend connection was successfully made */
        if (PQstatus(AH->connection) == CONNECTION_BAD)
                die_horribly(AH, modulename, "connection to database \"%s\" failed: %s",
-                                        PQdb(AH->connection), PQerrorMessage(AH->connection));
+                                  PQdb(AH->connection), PQerrorMessage(AH->connection));
 
        /* check for version mismatch */
        _check_database_version(AH, ignoreVersion);
@@ -598,8 +598,8 @@ FixupBlobRefs(ArchiveHandle *AH, TocEntry *te)
        appendPQExpBuffer(tblQry,
                                          "SELECT a.attname FROM "
                                          "pg_catalog.pg_attribute a, pg_catalog.pg_type t "
-                                         "WHERE a.attnum > 0 AND a.attrelid = '%s'::pg_catalog.regclass "
-                                         "AND a.atttypid = t.oid AND t.typname in ('oid', 'lo')",
+                "WHERE a.attnum > 0 AND a.attrelid = '%s'::pg_catalog.regclass "
+                                "AND a.atttypid = t.oid AND t.typname in ('oid', 'lo')",
                                          tblName->data);
 
        res = PQexec(AH->blobConnection, tblQry->data);
@@ -639,12 +639,12 @@ FixupBlobRefs(ArchiveHandle *AH, TocEntry *te)
                if (!uRes)
                        die_horribly(AH, modulename,
                                        "could not update column \"%s\" of table \"%s\": %s",
-                                       attr, te->tag, PQerrorMessage(AH->blobConnection));
+                                         attr, te->tag, PQerrorMessage(AH->blobConnection));
 
                if (PQresultStatus(uRes) != PGRES_COMMAND_OK)
                        die_horribly(AH, modulename,
                                "error while updating column \"%s\" of table \"%s\": %s",
-                                       attr, te->tag, PQerrorMessage(AH->blobConnection));
+                                         attr, te->tag, PQerrorMessage(AH->blobConnection));
 
                PQclear(uRes);
        }
@@ -686,7 +686,7 @@ InsertBlobXref(ArchiveHandle *AH, Oid old, Oid new)
        PQExpBuffer qry = createPQExpBuffer();
 
        appendPQExpBuffer(qry,
-                                         "Insert Into %s(oldOid, newOid) Values ('%u', '%u');",
+                                  "Insert Into %s(oldOid, newOid) Values ('%u', '%u');",
                                          BLOB_XREF_TABLE, old, new);
 
        ExecuteSqlCommand(AH, qry, "could not create large object cross-reference entry", true);
index 0183be6..b471da6 100644 (file)
@@ -20,7 +20,7 @@
  *
  *
  * IDENTIFICATION
- *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.17 2002/08/20 17:54:44 petere Exp $
+ *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.18 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 static void _ArchiveEntry(ArchiveHandle *AH, TocEntry *te);
 static void _StartData(ArchiveHandle *AH, TocEntry *te);
-static size_t  _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
+static size_t _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
 static void _EndData(ArchiveHandle *AH, TocEntry *te);
 static int     _WriteByte(ArchiveHandle *AH, const int i);
 static int     _ReadByte(ArchiveHandle *);
-static size_t  _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
-static size_t  _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
+static size_t _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
+static size_t _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
 static void _CloseArchive(ArchiveHandle *AH);
 static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
 static void _WriteExtraToc(ArchiveHandle *AH, TocEntry *te);
@@ -107,7 +107,7 @@ InitArchiveFmt_Files(ArchiveHandle *AH)
 
        /* Initialize LO buffering */
        AH->lo_buf_size = LOBBUFSIZE;
-       AH->lo_buf = (void *)malloc(LOBBUFSIZE);
+       AH->lo_buf = (void *) malloc(LOBBUFSIZE);
        if (AH->lo_buf == NULL)
                die_horribly(AH, modulename, "out of memory\n");
 
index c5a01e3..2925dd1 100644 (file)
@@ -17,7 +17,7 @@
  *
  *
  * IDENTIFICATION
- *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_null.c,v 1.10 2002/08/20 17:54:44 petere Exp $
+ *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_null.c,v 1.11 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include <string.h>
 #include <unistd.h>                            /* for dup */
 
-static size_t  _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
+static size_t _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
 static void _EndData(ArchiveHandle *AH, TocEntry *te);
 static int     _WriteByte(ArchiveHandle *AH, const int i);
-static size_t  _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
+static size_t _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
 static void _CloseArchive(ArchiveHandle *AH);
 static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
 
index 35c85c2..eb6e9fc 100644 (file)
@@ -16,7 +16,7 @@
  *
  *
  * IDENTIFICATION
- *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.27 2002/09/03 18:50:54 petere Exp $
+ *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.28 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 static void _ArchiveEntry(ArchiveHandle *AH, TocEntry *te);
 static void _StartData(ArchiveHandle *AH, TocEntry *te);
-static size_t  _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
+static size_t _WriteData(ArchiveHandle *AH, const void *data, size_t dLen);
 static void _EndData(ArchiveHandle *AH, TocEntry *te);
 static int     _WriteByte(ArchiveHandle *AH, const int i);
 static int     _ReadByte(ArchiveHandle *);
-static size_t  _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
-static size_t  _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
+static size_t _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
+static size_t _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
 static void _CloseArchive(ArchiveHandle *AH);
 static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
 static void _WriteExtraToc(ArchiveHandle *AH, TocEntry *te);
@@ -107,13 +107,13 @@ static int        tarPrintf(ArchiveHandle *AH, TAR_MEMBER *th, const char *fmt,...);
 static void _tarAddFile(ArchiveHandle *AH, TAR_MEMBER *th);
 static int     _tarChecksum(char *th);
 static TAR_MEMBER *_tarPositionTo(ArchiveHandle *AH, const char *filename);
-static size_t  tarRead(void *buf, size_t len, TAR_MEMBER *th);
-static size_t  tarWrite(const void *buf, size_t len, TAR_MEMBER *th);
+static size_t tarRead(void *buf, size_t len, TAR_MEMBER *th);
+static size_t tarWrite(const void *buf, size_t len, TAR_MEMBER *th);
 static void _tarWriteHeader(TAR_MEMBER *th);
 static int     _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th);
-static size_t  _tarReadRaw(ArchiveHandle *AH, void *buf, size_t len, TAR_MEMBER *th, FILE *fh);
+static size_t _tarReadRaw(ArchiveHandle *AH, void *buf, size_t len, TAR_MEMBER *th, FILE *fh);
 
-static size_t  _scriptOut(ArchiveHandle *AH, const void *buf, size_t len);
+static size_t _scriptOut(ArchiveHandle *AH, const void *buf, size_t len);
 
 /*
  *     Initializer
@@ -152,7 +152,7 @@ InitArchiveFmt_Tar(ArchiveHandle *AH)
 
        /* Initialize LO buffering */
        AH->lo_buf_size = LOBBUFSIZE;
-       AH->lo_buf = (void *)malloc(LOBBUFSIZE);
+       AH->lo_buf = (void *) malloc(LOBBUFSIZE);
        if (AH->lo_buf == NULL)
                die_horribly(AH, modulename, "out of memory\n");
 
@@ -537,7 +537,7 @@ tarWrite(const void *buf, size_t len, TAR_MEMBER *th)
 
        if (res != len)
                die_horribly(th->AH, modulename,
-                                        "could not write to tar member (wrote %lu, attempted %lu)\n",
+                       "could not write to tar member (wrote %lu, attempted %lu)\n",
                                         (unsigned long) res, (unsigned long) len);
 
        th->pos += res;
@@ -1025,7 +1025,9 @@ _tarAddFile(ArchiveHandle *AH, TAR_MEMBER *th)
 
        if (len != th->fileLen)
        {
-               char buf1[100], buf2[100];
+               char            buf1[100],
+                                       buf2[100];
+
                snprintf(buf1, 100, INT64_FORMAT, (int64) len);
                snprintf(buf2, 100, INT64_FORMAT, (int64) th->pos);
                die_horribly(AH, modulename, "actual file length (%s) does not match expected (%s)\n",
@@ -1060,7 +1062,9 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
        /* Go to end of current file, if any */
        if (ctx->tarFHpos != 0)
        {
-               char buf1[100], buf2[100];
+               char            buf1[100],
+                                       buf2[100];
+
                snprintf(buf1, 100, INT64_FORMAT, (int64) ctx->tarFHpos);
                snprintf(buf2, 100, INT64_FORMAT, (int64) ctx->tarNextMember);
                ahlog(AH, 4, "moving from position %s to next member at file position %s\n",
@@ -1071,7 +1075,8 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
        }
 
        {
-               char buf[100];
+               char            buf[100];
+
                snprintf(buf, 100, INT64_FORMAT, (int64) ctx->tarFHpos);
                ahlog(AH, 4, "now at file position %s\n", buf);
        }
@@ -1138,7 +1143,9 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
 #if 0
                if (ftello(ctx->tarFH) != ctx->tarFHpos)
                {
-                       char buf1[100], buf2[100];
+                       char            buf1[100],
+                                               buf2[100];
+
                        snprintf(buf1, 100, INT64_FORMAT, (int64) ftello(ctx->tarFH));
                        snprintf(buf2, 100, INT64_FORMAT, (int64) ftello(ctx->tarFHpos));
                        die_horribly(AH, modulename,
@@ -1188,7 +1195,8 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
        sscanf(&h[148], "%8o", &sum);
 
        {
-               char buf[100];
+               char            buf[100];
+
                snprintf(buf, 100, INT64_FORMAT, (int64) hPos);
                ahlog(AH, 3, "TOC Entry %s at %s (length %lu, checksum %d)\n",
                          &tag[0], buf, (unsigned long) len, sum);
@@ -1196,7 +1204,8 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th)
 
        if (chk != sum)
        {
-               char buf[100];
+               char            buf[100];
+
                snprintf(buf, 100, INT64_FORMAT, (int64) ftello(ctx->tarFH));
                die_horribly(AH, modulename,
                                         "corrupt tar header found in %s "
index 0e6500a..6e37343 100644 (file)
@@ -22,7 +22,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.296 2002/09/02 06:11:42 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.297 2002/09/04 20:31:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -78,27 +78,27 @@ static void help(const char *progname);
 static int     parse_version(const char *versionString);
 static NamespaceInfo *findNamespace(const char *nsoid, const char *objoid);
 static void dumpClasses(const TableInfo *tblinfo, const int numTables,
-                                               Archive *fout, const bool oids);
+                       Archive *fout, const bool oids);
 static void dumpComment(Archive *fout, const char *target,
-                                               const char *namespace, const char *owner,
-                                               const char *oid, const char *classname, int subid,
-                                               const char *((*deps)[]));
+                       const char *namespace, const char *owner,
+                       const char *oid, const char *classname, int subid,
+                       const char *((*deps)[]));
 static void dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
-                                                       FuncInfo *g_finfo, int numFuncs,
-                                                       TypeInfo *g_tinfo, int numTypes);
+                               FuncInfo *g_finfo, int numFuncs,
+                               TypeInfo *g_tinfo, int numTypes);
 static void dumpOneDomain(Archive *fout, TypeInfo *tinfo);
 static void dumpOneCompositeType(Archive *fout, TypeInfo *tinfo);
 static void dumpOneTable(Archive *fout, TableInfo *tbinfo,
-                                                TableInfo *g_tblinfo);
+                        TableInfo *g_tblinfo);
 static void dumpOneSequence(Archive *fout, TableInfo *tbinfo,
-                                                       const bool schemaOnly, const bool dataOnly);
+                               const bool schemaOnly, const bool dataOnly);
 
 static void dumpTableACL(Archive *fout, TableInfo *tbinfo);
 static void dumpFuncACL(Archive *fout, FuncInfo *finfo);
 static void dumpAggACL(Archive *fout, AggInfo *finfo);
 static void dumpACL(Archive *fout, const char *type, const char *name,
-                                       const char *tag, const char *nspname,
-                                       const char *usename, const char *acl, const char *objoid);
+               const char *tag, const char *nspname,
+               const char *usename, const char *acl, const char *objoid);
 
 static void dumpConstraints(Archive *fout, TableInfo *tblinfo, int numTables);
 static void dumpTriggers(Archive *fout, TableInfo *tblinfo, int numTables);
@@ -106,10 +106,10 @@ static void dumpRules(Archive *fout, TableInfo *tblinfo, int numTables);
 static char *format_function_signature(FuncInfo *finfo, bool honor_quotes);
 static void dumpOneFunc(Archive *fout, FuncInfo *finfo);
 static void dumpOneOpr(Archive *fout, OprInfo *oprinfo,
-                                          OprInfo *g_oprinfo, int numOperators);
+                  OprInfo *g_oprinfo, int numOperators);
 static const char *convertRegProcReference(const char *proc);
 static const char *convertOperatorReference(const char *opr,
-                                               OprInfo *g_oprinfo, int numOperators);
+                                                OprInfo *g_oprinfo, int numOperators);
 static void dumpOneOpclass(Archive *fout, OpclassInfo *opcinfo);
 static void dumpOneAgg(Archive *fout, AggInfo *agginfo);
 static Oid     findLastBuiltinOid_V71(const char *);
@@ -361,7 +361,7 @@ main(int argc, char **argv)
                                         */
                                        if (selectTablename[0] == '"')
                                        {
-                                               char    *endptr;
+                                               char       *endptr;
 
                                                endptr = selectTablename + strlen(selectTablename) - 1;
                                                if (*endptr == '"')
@@ -434,8 +434,8 @@ main(int argc, char **argv)
 #ifndef HAVE_GETOPT_LONG
                        case '-':
                                fprintf(stderr,
-                                               _("%s was compiled without support for long options.\n"
-                                                "Use --help for help on invocation options.\n"),
+                                 _("%s was compiled without support for long options.\n"
+                                       "Use --help for help on invocation options.\n"),
                                                progname);
                                exit(1);
                                break;
@@ -453,8 +453,8 @@ main(int argc, char **argv)
        if (optind < (argc - 1))
        {
                fprintf(stderr,
-                       _("%s: too many command line options (first is '%s')\n"
-                                       "Try '%s --help' for more information.\n"),
+                               _("%s: too many command line options (first is '%s')\n"
+                                 "Try '%s --help' for more information.\n"),
                                progname, argv[optind + 1], progname);
                exit(1);
        }
@@ -656,69 +656,69 @@ help(const char *progname)
        printf(_("Options:\n"));
 
 #ifdef HAVE_GETOPT_LONG
-       printf(_(       "  -a, --data-only          dump only the data, not the schema\n"));
-       printf(_(       "  -b, --blobs              include large objects in dump\n"));
-       printf(_(       "  -c, --clean              clean (drop) schema prior to create\n"));
-       printf(_(       "  -C, --create             include commands to create database in dump\n"));
-       printf(_(       "  -d, --inserts            dump data as INSERT, rather than COPY, commands\n"));
-       printf(_(       "  -D, --column-inserts     dump data as INSERT commands with column names\n"));
-       printf(_(       "  -f, --file=FILENAME      output file name\n"));
-       printf(_(       "  -F, --format {c|t|p}     output file format (custom, tar, plain text)\n"));
-       printf(_(       "  -h, --host=HOSTNAME      database server host name\n"));
-       printf(_(       "  -i, --ignore-version     proceed even when server version mismatches\n"
-                               "                           pg_dump version\n"));
-       printf(_(       "  -o, --oids               include OIDs in dump\n"));
-       printf(_(       "  -O, --no-owner           do not output \\connect commands in plain\n"
-                               "                           text format\n"));
-       printf(_(       "  -p, --port=PORT          database server port number\n"));
-       printf(_(       "  -R, --no-reconnect       disable ALL reconnections to the database in\n"
-                               "                           plain text format\n"));
-       printf(_(       "  -s, --schema-only        dump only the schema, no data\n"));
-       printf(_(       "  -S, --superuser=NAME     specify the superuser user name to use in\n"
-                               "                           plain text format\n"));
-       printf(_(       "  -t, --table=TABLE        dump this table only (* for all)\n"));
-       printf(_(       "  -U, --username=NAME      connect as specified database user\n"));
-       printf(_(       "  -v, --verbose            verbose mode\n"));
-       printf(_(       "  -W, --password           force password prompt (should happen automatically)\n"));
-       printf(_(       "  -x, --no-privileges      do not dump privileges (grant/revoke)\n"));
-       printf(_(       "  -X use-set-session-authorization, --use-set-session-authorization\n"
-                               "                           output SET SESSION AUTHORIZATION commands rather\n"
-                               "                           than \\connect commands\n"));
-       printf(_(       "  -X disable-triggers, --disable-triggers\n"
-                               "                           disable triggers during data-only restore\n"));
-       printf(_(       "  -Z, --compress {0-9}     compression level for compressed formats\n"));
-
-#else /* not HAVE_GETOPT_LONG */
-       printf(_(       "  -a                       dump only the data, not the schema\n"));
-       printf(_(       "  -b                       include large objects in dump\n"));
-       printf(_(       "  -c                       clean (drop) schema prior to create\n"));
-       printf(_(       "  -C                       include commands to create database in dump\n"));
-       printf(_(       "  -d                       dump data as INSERT, rather than COPY, commands\n"));
-       printf(_(       "  -D                       dump data as INSERT commands with column names\n"));
-       printf(_(       "  -f FILENAME              output file name\n"));
-       printf(_(       "  -F {c|t|p}               output file format (custom, tar, plain text)\n"));
-       printf(_(       "  -h HOSTNAME              database server host name\n"));
-       printf(_(       "  -i                       proceed even when server version mismatches\n"
-                               "                           pg_dump version\n"));
-       printf(_(       "  -o                       include OIDs in dump\n"));
-       printf(_(       "  -O                       do not output \\connect commands in plain\n"
-                               "                           text format\n"));
-       printf(_(       "  -p PORT                  database server port number\n"));
-       printf(_(       "  -R                       disable ALL reconnections to the database in\n"
-                               "                           plain text format\n"));
-       printf(_(       "  -s                       dump only the schema, no data\n"));
-       printf(_(       "  -S NAME                  specify the superuser user name to use in\n"
-                               "                           plain text format\n"));
-       printf(_(       "  -t TABLE                 dump this table only (* for all)\n"));
-       printf(_(       "  -U NAME                  connect as specified database user\n"));
-       printf(_(       "  -v                       verbose mode\n"));
-       printf(_(       "  -W                       force password prompt (should happen automatically)\n"));
-       printf(_(       "  -x                       do not dump privileges (grant/revoke)\n"));
-       printf(_(       "  -X use-set-session-authorization\n"
-                               "                           output SET SESSION AUTHORIZATION commands rather\n"
-                               "                           than \\connect commands\n"));
-       printf(_(       "  -X disable-triggers      disable triggers during data-only restore\n"));
-       printf(_(       "  -Z {0-9}                 compression level for compressed formats\n"));
+       printf(_("  -a, --data-only          dump only the data, not the schema\n"));
+       printf(_("  -b, --blobs              include large objects in dump\n"));
+       printf(_("  -c, --clean              clean (drop) schema prior to create\n"));
+       printf(_("  -C, --create             include commands to create database in dump\n"));
+       printf(_("  -d, --inserts            dump data as INSERT, rather than COPY, commands\n"));
+       printf(_("  -D, --column-inserts     dump data as INSERT commands with column names\n"));
+       printf(_("  -f, --file=FILENAME      output file name\n"));
+       printf(_("  -F, --format {c|t|p}     output file format (custom, tar, plain text)\n"));
+       printf(_("  -h, --host=HOSTNAME      database server host name\n"));
+       printf(_("  -i, --ignore-version     proceed even when server version mismatches\n"
+                        "                           pg_dump version\n"));
+       printf(_("  -o, --oids               include OIDs in dump\n"));
+       printf(_("  -O, --no-owner           do not output \\connect commands in plain\n"
+                        "                           text format\n"));
+       printf(_("  -p, --port=PORT          database server port number\n"));
+       printf(_("  -R, --no-reconnect       disable ALL reconnections to the database in\n"
+                        "                           plain text format\n"));
+       printf(_("  -s, --schema-only        dump only the schema, no data\n"));
+       printf(_("  -S, --superuser=NAME     specify the superuser user name to use in\n"
+                        "                           plain text format\n"));
+       printf(_("  -t, --table=TABLE        dump this table only (* for all)\n"));
+       printf(_("  -U, --username=NAME      connect as specified database user\n"));
+       printf(_("  -v, --verbose            verbose mode\n"));
+       printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
+       printf(_("  -x, --no-privileges      do not dump privileges (grant/revoke)\n"));
+       printf(_("  -X use-set-session-authorization, --use-set-session-authorization\n"
+                        "                           output SET SESSION AUTHORIZATION commands rather\n"
+                        "                           than \\connect commands\n"));
+       printf(_("  -X disable-triggers, --disable-triggers\n"
+                        "                           disable triggers during data-only restore\n"));
+       printf(_("  -Z, --compress {0-9}     compression level for compressed formats\n"));
+
+#else                                                  /* not HAVE_GETOPT_LONG */
+       printf(_("  -a                       dump only the data, not the schema\n"));
+       printf(_("  -b                       include large objects in dump\n"));
+       printf(_("  -c                       clean (drop) schema prior to create\n"));
+       printf(_("  -C                       include commands to create database in dump\n"));
+       printf(_("  -d                       dump data as INSERT, rather than COPY, commands\n"));
+       printf(_("  -D                       dump data as INSERT commands with column names\n"));
+       printf(_("  -f FILENAME              output file name\n"));
+       printf(_("  -F {c|t|p}               output file format (custom, tar, plain text)\n"));
+       printf(_("  -h HOSTNAME              database server host name\n"));
+       printf(_("  -i                       proceed even when server version mismatches\n"
+                        "                           pg_dump version\n"));
+       printf(_("  -o                       include OIDs in dump\n"));
+       printf(_("  -O                       do not output \\connect commands in plain\n"
+                        "                           text format\n"));
+       printf(_("  -p PORT                  database server port number\n"));
+       printf(_("  -R                       disable ALL reconnections to the database in\n"
+                        "                           plain text format\n"));
+       printf(_("  -s                       dump only the schema, no data\n"));
+       printf(_("  -S NAME                  specify the superuser user name to use in\n"
+                        "                           plain text format\n"));
+       printf(_("  -t TABLE                 dump this table only (* for all)\n"));
+       printf(_("  -U NAME                  connect as specified database user\n"));
+       printf(_("  -v                       verbose mode\n"));
+       printf(_("  -W                       force password prompt (should happen automatically)\n"));
+       printf(_("  -x                       do not dump privileges (grant/revoke)\n"));
+       printf(_("  -X use-set-session-authorization\n"
+                        "                           output SET SESSION AUTHORIZATION commands rather\n"
+                        "                           than \\connect commands\n"));
+       printf(_("  -X disable-triggers      disable triggers during data-only restore\n"));
+       printf(_("  -Z {0-9}                 compression level for compressed formats\n"));
 #endif
 
        printf(_("\nIf no database name is not supplied, then the PGDATABASE environment\n"
@@ -766,7 +766,7 @@ selectDumpableNamespace(NamespaceInfo *nsinfo)
 {
        /*
         * If a specific table is being dumped, do not dump any complete
-        * namespaces.  Otherwise, dump all non-system namespaces.
+        * namespaces.  Otherwise, dump all non-system namespaces.
         */
        if (selectTablename != NULL)
                nsinfo->dump = false;
@@ -785,8 +785,8 @@ selectDumpableTable(TableInfo *tbinfo)
 {
        /*
         * Always dump if dumping parent namespace; else, if a particular
-        * tablename has been specified, dump matching table name; else,
-        * do not dump.
+        * tablename has been specified, dump matching table name; else, do
+        * not dump.
         */
        if (tbinfo->relnamespace->dump)
                tbinfo->dump = true;
@@ -817,7 +817,7 @@ dumpClasses_nodumpData(Archive *fout, char *oid, void *dctxv)
        int                     ret;
        bool            copydone;
        char            copybuf[COPYBUFSIZ];
-  const char*   column_list;
+       const char *column_list;
 
        if (g_verbose)
                write_msg(NULL, "dumping out the contents of table %s\n", classname);
@@ -906,46 +906,42 @@ dumpClasses_nodumpData(Archive *fout, char *oid, void *dctxv)
                /*
                 * THROTTLE:
                 *
-                * There was considerable discussion in late July, 2000
-                * regarding slowing down pg_dump when backing up large
-                * tables. Users with both slow & fast (muti-processor)
-                * machines experienced performance degradation when doing
-                * a backup.
+                * There was considerable discussion in late July, 2000 regarding
+                * slowing down pg_dump when backing up large tables. Users with
+                * both slow & fast (muti-processor) machines experienced
+                * performance degradation when doing a backup.
                 *
-                * Initial attempts based on sleeping for a number of ms for
-                * each ms of work were deemed too complex, then a simple
-                * 'sleep in each loop' implementation was suggested. The
-                * latter failed because the loop was too tight. Finally,
-                * the following was implemented:
+                * Initial attempts based on sleeping for a number of ms for each ms
+                * of work were deemed too complex, then a simple 'sleep in each
+                * loop' implementation was suggested. The latter failed because
+                * the loop was too tight. Finally, the following was implemented:
                 *
-                * If throttle is non-zero, then See how long since the last
-                * sleep. Work out how long to sleep (based on ratio). If
-                * sleep is more than 100ms, then sleep reset timer EndIf
-                * EndIf
+                * If throttle is non-zero, then See how long since the last sleep.
+                * Work out how long to sleep (based on ratio). If sleep is more
+                * than 100ms, then sleep reset timer EndIf EndIf
                 *
-                * where the throttle value was the number of ms to sleep per
-                * ms of work. The calculation was done in each loop.
+                * where the throttle value was the number of ms to sleep per ms of
+                * work. The calculation was done in each loop.
                 *
-                * Most of the hard work is done in the backend, and this
-                * solution still did not work particularly well: on slow
-                * machines, the ratio was 50:1, and on medium paced
-                * machines, 1:1, and on fast multi-processor machines, it
-                * had little or no effect, for reasons that were unclear.
+                * Most of the hard work is done in the backend, and this solution
+                * still did not work particularly well: on slow machines, the
+                * ratio was 50:1, and on medium paced machines, 1:1, and on fast
+                * multi-processor machines, it had little or no effect, for
+                * reasons that were unclear.
                 *
                 * Further discussion ensued, and the proposal was dropped.
                 *
-                * For those people who want this feature, it can be
-                * implemented using gettimeofday in each loop,
-                * calculating the time since last sleep, multiplying that
-                * by the sleep ratio, then if the result is more than a
-                * preset 'minimum sleep time' (say 100ms), call the
-                * 'select' function to sleep for a subsecond period ie.
+                * For those people who want this feature, it can be implemented
+                * using gettimeofday in each loop, calculating the time since
+                * last sleep, multiplying that by the sleep ratio, then if the
+                * result is more than a preset 'minimum sleep time' (say 100ms),
+                * call the 'select' function to sleep for a subsecond period ie.
                 *
                 * select(0, NULL, NULL, NULL, &tvi);
                 *
-                * This will return after the interval specified in the
-                * structure tvi. Fianally, call gettimeofday again to
-                * save the 'last sleep time'.
+                * This will return after the interval specified in the structure
+                * tvi. Fianally, call gettimeofday again to save the 'last sleep
+                * time'.
                 */
        }
        archprintf(fout, "\\.\n\n\n");
@@ -1059,27 +1055,27 @@ dumpClasses_dumpData(Archive *fout, char *oid, void *dctxv)
                                        case FLOAT4OID:
                                        case FLOAT8OID:
                                        case NUMERICOID:
-                                       {
-                                               /*
-                                                * These types are printed without quotes
-                                                * unless they contain values that aren't
-                                                * accepted by the scanner unquoted (e.g.,
-                                                * 'NaN').  Note that strtod() and friends
-                                                * might accept NaN, so we can't use that to
-                                                * test.
-                                                *
-                                                * In reality we only need to defend against
-                                                * infinity and NaN, so we need not get too
-                                                * crazy about pattern matching here.
-                                                */
-                                               const char *s = PQgetvalue(res, tuple, field);
-
-                                               if (strspn(s, "0123456789 +-eE.") == strlen(s))
-                                                       archprintf(fout, "%s", s);
-                                               else
-                                                       archprintf(fout, "'%s'", s);
-                                       }
-                                       break;
+                                               {
+                                                       /*
+                                                        * These types are printed without quotes
+                                                        * unless they contain values that aren't
+                                                        * accepted by the scanner unquoted (e.g.,
+                                                        * 'NaN').      Note that strtod() and friends
+                                                        * might accept NaN, so we can't use that to
+                                                        * test.
+                                                        *
+                                                        * In reality we only need to defend against
+                                                        * infinity and NaN, so we need not get too
+                                                        * crazy about pattern matching here.
+                                                        */
+                                                       const char *s = PQgetvalue(res, tuple, field);
+
+                                                       if (strspn(s, "0123456789 +-eE.") == strlen(s))
+                                                               archprintf(fout, "%s", s);
+                                                       else
+                                                               archprintf(fout, "'%s'", s);
+                                               }
+                                               break;
 
                                        case BITOID:
                                        case VARBITOID:
@@ -1088,7 +1084,7 @@ dumpClasses_dumpData(Archive *fout, char *oid, void *dctxv)
                                                break;
 
                                        case BOOLOID:
-                                               if (strcmp(PQgetvalue(res, tuple, field), "t")==0)
+                                               if (strcmp(PQgetvalue(res, tuple, field), "t") == 0)
                                                        archprintf(fout, "true");
                                                else
                                                        archprintf(fout, "false");
@@ -1134,7 +1130,7 @@ static void
 dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
                        const bool oids)
 {
-       PQExpBuffer     copyBuf = createPQExpBuffer();
+       PQExpBuffer copyBuf = createPQExpBuffer();
        DataDumperPtr dumpFn;
        DumpContext *dumpCtx;
        char       *copyStmt;
@@ -1173,7 +1169,7 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
                                appendPQExpBuffer(copyBuf, "COPY %s %s %sFROM stdin;\n",
                                                                  fmtId(tblinfo[i].relname),
                                                                  column_list,
-                                                                 (oids && tblinfo[i].hasoids) ? "WITH OIDS " : "");
+                                          (oids && tblinfo[i].hasoids) ? "WITH OIDS " : "");
                                copyStmt = copyBuf->data;
                        }
                        else
@@ -1184,7 +1180,7 @@ dumpClasses(const TableInfo *tblinfo, const int numTables, Archive *fout,
                        }
 
                        ArchiveEntry(fout, tblinfo[i].oid, tblinfo[i].relname,
-                                                tblinfo[i].relnamespace->nspname, tblinfo[i].usename,
+                                       tblinfo[i].relnamespace->nspname, tblinfo[i].usename,
                                                 "TABLE DATA", NULL, "", "", copyStmt,
                                                 dumpFn, dumpCtx);
                }
@@ -1278,7 +1274,7 @@ dumpDatabase(Archive *AH)
                                 dba,                   /* Owner */
                                 "DATABASE",    /* Desc */
                                 NULL,                  /* Deps */
-                                creaQry->data, /* Create */
+                                creaQry->data, /* Create */
                                 delQry->data,  /* Del */
                                 NULL,                  /* Copy */
                                 NULL,                  /* Dumper */
@@ -1451,9 +1447,9 @@ getNamespaces(int *numNamespaces)
         * we read in can be linked to a containing namespace.
         */
        appendPQExpBuffer(query, "SELECT oid, nspname, "
-                                                 "(select usename from pg_user where nspowner = usesysid) as usename, "
-                                                 "nspacl "
-                                                 "FROM pg_namespace");
+       "(select usename from pg_user where nspowner = usesysid) as usename, "
+                                         "nspacl "
+                                         "FROM pg_namespace");
 
        res = PQexec(g_conn, query->data);
        if (!res ||
@@ -1502,7 +1498,7 @@ getNamespaces(int *numNamespaces)
  *             getNamespaces
  *
  * NB: for pre-7.3 source database, we use object OID to guess whether it's
- * a system object or not.  In 7.3 and later there is no guessing.
+ * a system object or not.     In 7.3 and later there is no guessing.
  */
 static NamespaceInfo *
 findNamespace(const char *nsoid, const char *objoid)
@@ -1513,7 +1509,7 @@ findNamespace(const char *nsoid, const char *objoid)
        {
                for (i = 0; i < g_numNamespaces; i++)
                {
-                       NamespaceInfo  *nsinfo = &g_namespaces[i];
+                       NamespaceInfo *nsinfo = &g_namespaces[i];
 
                        if (strcmp(nsoid, nsinfo->oid) == 0)
                                return nsinfo;
@@ -1678,8 +1674,8 @@ getOperators(int *numOprs)
        int                     i_oprcode;
 
        /*
-        * find all operators, including builtin operators;
-        * we filter out system-defined operators at dump-out time.
+        * find all operators, including builtin operators; we filter out
+        * system-defined operators at dump-out time.
         */
 
        /* Make sure we are in proper schema */
@@ -1756,15 +1752,15 @@ getOpclasses(int *numOpclasses)
        int                     ntups;
        int                     i;
        PQExpBuffer query = createPQExpBuffer();
-       OpclassInfo    *opcinfo;
+       OpclassInfo *opcinfo;
        int                     i_oid;
        int                     i_opcname;
        int                     i_opcnamespace;
        int                     i_usename;
 
        /*
-        * find all opclasses, including builtin opclasses;
-        * we filter out system-defined opclasses at dump-out time.
+        * find all opclasses, including builtin opclasses; we filter out
+        * system-defined opclasses at dump-out time.
         */
 
        /* Make sure we are in proper schema */
@@ -1864,7 +1860,7 @@ getAggregates(int *numAggs)
                                                  "FROM pg_proc "
                                                  "WHERE proisagg "
                                                  "AND pronamespace != "
-                                                 "(select oid from pg_namespace where nspname = 'pg_catalog')");
+                 "(select oid from pg_namespace where nspname = 'pg_catalog')");
        }
        else
        {
@@ -1912,7 +1908,7 @@ getAggregates(int *numAggs)
                                          agginfo[i].aggname);
                agginfo[i].aggacl = strdup(PQgetvalue(res, i, i_aggacl));
                agginfo[i].anybasetype = false; /* computed when it's dumped */
-               agginfo[i].fmtbasetype = NULL; /* computed when it's dumped */
+               agginfo[i].fmtbasetype = NULL;  /* computed when it's dumped */
        }
 
        PQclear(res);
@@ -1963,7 +1959,7 @@ getFuncs(int *numFuncs)
                                                  "FROM pg_proc "
                                                  "WHERE NOT proisagg "
                                                  "AND pronamespace != "
-                                                 "(select oid from pg_namespace where nspname = 'pg_catalog')");
+                 "(select oid from pg_namespace where nspname = 'pg_catalog')");
        }
        else
        {
@@ -2078,15 +2074,15 @@ getTables(int *numTables)
        /*
         * Find all the tables (including views and sequences).
         *
-        * We include system catalogs, so that we can work if a user table
-        * is defined to inherit from a system catalog (pretty weird, but...)
+        * We include system catalogs, so that we can work if a user table is
+        * defined to inherit from a system catalog (pretty weird, but...)
         *
         * We ignore tables that are not type 'r' (ordinary relation) or 'S'
         * (sequence) or 'v' (view).
         *
         * Note: in this phase we should collect only a minimal amount of
-        * information about each table, basically just enough to decide if
-        * it is interesting.  We must fetch all tables in this phase because
+        * information about each table, basically just enough to decide if it
+        * is interesting.      We must fetch all tables in this phase because
         * otherwise we cannot correctly identify inherited columns, serial
         * columns, etc.
         */
@@ -2108,18 +2104,18 @@ getTables(int *numTables)
                                                  "from pg_class c "
                                                  "left join pg_depend d on "
                                                  "(c.relkind = '%c' and "
-                                                 "d.classid = c.tableoid and d.objid = c.oid and "
+                                               "d.classid = c.tableoid and d.objid = c.oid and "
                                                  "d.objsubid = 0 and "
-                                                 "d.refclassid = c.tableoid and d.deptype = 'i') "
+                                               "d.refclassid = c.tableoid and d.deptype = 'i') "
                                                  "where relkind in ('%c', '%c', '%c') "
                                                  "order by c.oid",
                                                  RELKIND_SEQUENCE,
-                                                 RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW);
+                                          RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW);
        }
        else if (g_fout->remoteVersion >= 70200)
        {
                appendPQExpBuffer(query,
-                                                 "SELECT pg_class.oid, relname, relacl, relkind, "
+                                               "SELECT pg_class.oid, relname, relacl, relkind, "
                                                  "0::oid as relnamespace, "
                                                  "(select usename from pg_user where relowner = usesysid) as usename, "
                                                  "relchecks, reltriggers, "
@@ -2242,8 +2238,8 @@ getTables(int *numTables)
                /* other fields were zeroed above */
 
                /*
-                * Decide whether we want to dump this table.  Sequences owned
-                * by serial columns are never dumpable on their own; we will
+                * Decide whether we want to dump this table.  Sequences owned by
+                * serial columns are never dumpable on their own; we will
                 * transpose their owning table's dump flag to them below.
                 */
                if (tblinfo[i].owning_tab == NULL)
@@ -2270,8 +2266,8 @@ getTables(int *numTables)
                        resetPQExpBuffer(lockquery);
                        appendPQExpBuffer(lockquery,
                                                          "LOCK TABLE %s IN ACCESS SHARE MODE",
-                                                         fmtQualifiedId(tblinfo[i].relnamespace->nspname,
-                                                                                        tblinfo[i].relname));
+                                                fmtQualifiedId(tblinfo[i].relnamespace->nspname,
+                                                                               tblinfo[i].relname));
                        lres = PQexec(g_conn, lockquery->data);
                        if (!lres || PQresultStatus(lres) != PGRES_COMMAND_OK)
                        {
@@ -2383,7 +2379,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
 
        for (i = 0; i < numTables; i++)
        {
-               TableInfo *tbinfo = &tblinfo[i];
+               TableInfo  *tbinfo = &tblinfo[i];
 
                /* Don't bother to collect info for sequences */
                if (tbinfo->relkind == RELKIND_SEQUENCE)
@@ -2419,7 +2415,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
                {
                        appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, attstattarget, "
                                                          "attnotnull, atthasdef, attisdropped, "
-                                                         "pg_catalog.format_type(atttypid,atttypmod) as atttypname "
+                         "pg_catalog.format_type(atttypid,atttypmod) as atttypname "
                                                          "from pg_catalog.pg_attribute a "
                                                          "where attrelid = '%s'::pg_catalog.oid "
                                                          "and attnum > 0::pg_catalog.int2 "
@@ -2430,12 +2426,12 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
                {
                        /*
                         * attstattarget doesn't exist in 7.1.  It does exist in 7.2,
-                        * but we don't dump it because we can't tell whether it's been
-                        * explicitly set or was just a default.
+                        * but we don't dump it because we can't tell whether it's
+                        * been explicitly set or was just a default.
                         */
                        appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, -1 as attstattarget, "
-                                                         "attnotnull, atthasdef, false as attisdropped, "
-                                                         "format_type(atttypid,atttypmod) as atttypname "
+                                                "attnotnull, atthasdef, false as attisdropped, "
+                                                "format_type(atttypid,atttypmod) as atttypname "
                                                          "from pg_attribute a "
                                                          "where attrelid = '%s'::oid "
                                                          "and attnum > 0::int2 "
@@ -2446,7 +2442,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
                {
                        /* format_type not available before 7.1 */
                        appendPQExpBuffer(q, "SELECT attnum, attname, atttypmod, -1 as attstattarget, "
-                                                         "attnotnull, atthasdef, false as attisdropped, "
+                                                "attnotnull, atthasdef, false as attisdropped, "
                                                          "(select typname from pg_type where oid = atttypid) as atttypname "
                                                          "from pg_attribute a "
                                                          "where attrelid = '%s'::oid "
@@ -2494,9 +2490,9 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
                        tbinfo->atttypmod[j] = atoi(PQgetvalue(res, j, i_atttypmod));
                        tbinfo->attstattarget[j] = atoi(PQgetvalue(res, j, i_attstattarget));
                        tbinfo->attisdropped[j] = (PQgetvalue(res, j, i_attisdropped)[0] == 't');
-                       tbinfo->attisserial[j] = false; /* fix below */
+                       tbinfo->attisserial[j] = false;         /* fix below */
                        tbinfo->notnull[j] = (PQgetvalue(res, j, i_attnotnull)[0] == 't');
-                       tbinfo->adef_expr[j] = NULL;    /* fix below */
+                       tbinfo->adef_expr[j] = NULL;            /* fix below */
                        if (PQgetvalue(res, j, i_atthasdef)[0] == 't')
                                hasdefaults = true;
                        /* these flags will be set in flagInhAttrs() */
@@ -2519,7 +2515,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
                        if (g_fout->remoteVersion >= 70300)
                        {
                                appendPQExpBuffer(q, "SELECT adnum, "
-                                                                 "pg_catalog.pg_get_expr(adbin, adrelid) AS adsrc "
+                                          "pg_catalog.pg_get_expr(adbin, adrelid) AS adsrc "
                                                                  "FROM pg_catalog.pg_attrdef "
                                                                  "WHERE adrelid = '%s'::pg_catalog.oid",
                                                                  tbinfo->oid);
@@ -2551,7 +2547,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
                        numDefaults = PQntuples(res);
                        for (j = 0; j < numDefaults; j++)
                        {
-                               int             adnum = atoi(PQgetvalue(res, j, 0));
+                               int                     adnum = atoi(PQgetvalue(res, j, 0));
 
                                if (adnum <= 0 || adnum > ntups)
                                {
@@ -2559,16 +2555,17 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
                                                          adnum, tbinfo->relname);
                                        exit_nicely();
                                }
-                               tbinfo->adef_expr[adnum-1] = strdup(PQgetvalue(res, j, 1));
+                               tbinfo->adef_expr[adnum - 1] = strdup(PQgetvalue(res, j, 1));
                        }
                        PQclear(res);
                }
 
                /*
-                * Check to see if any columns are serial columns.  Our first quick
-                * filter is that it must be integer or bigint with a default.  If
-                * so, we scan to see if we found a sequence linked to this column.
-                * If we did, mark the column and sequence appropriately.
+                * Check to see if any columns are serial columns.      Our first
+                * quick filter is that it must be integer or bigint with a
+                * default.  If so, we scan to see if we found a sequence linked
+                * to this column. If we did, mark the column and sequence
+                * appropriately.
                 */
                for (j = 0; j < ntups; j++)
                {
@@ -2584,11 +2581,11 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
                                continue;
                        for (k = 0; k < numTables; k++)
                        {
-                               TableInfo *seqinfo = &tblinfo[k];
+                               TableInfo  *seqinfo = &tblinfo[k];
 
                                if (seqinfo->owning_tab != NULL &&
                                        strcmp(seqinfo->owning_tab, tbinfo->oid) == 0 &&
-                                       seqinfo->owning_col == j+1)
+                                       seqinfo->owning_col == j + 1)
                                {
                                        /*
                                         * Found a match.  Copy the table's interesting and
@@ -2647,7 +2644,7 @@ dumpComment(Archive *fout, const char *target,
        if (fout->remoteVersion >= 70300)
        {
                appendPQExpBuffer(query, "SELECT description FROM pg_catalog.pg_description "
-                                                 "WHERE objoid = '%s'::pg_catalog.oid and classoid = "
+                                       "WHERE objoid = '%s'::pg_catalog.oid and classoid = "
                                                  "'pg_catalog.%s'::pg_catalog.regclass "
                                                  "and objsubid = %d",
                                                  oid, classname, subid);
@@ -2731,7 +2728,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo,
        if (fout->remoteVersion >= 70300)
        {
                appendPQExpBuffer(query, "SELECT description, objsubid FROM pg_catalog.pg_description "
-                                                 "WHERE objoid = '%s'::pg_catalog.oid and classoid = "
+                                       "WHERE objoid = '%s'::pg_catalog.oid and classoid = "
                                                  "'pg_catalog.pg_class'::pg_catalog.regclass "
                                                  "ORDER BY objoid, classoid, objsubid",
                                                  tbinfo->oid);
@@ -2740,7 +2737,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo,
        {
                appendPQExpBuffer(query, "SELECT description, objsubid FROM pg_description "
                                                  "WHERE objoid = '%s'::oid and classoid = "
-                                          "(SELECT oid FROM pg_class where relname = 'pg_class') "
+                                "(SELECT oid FROM pg_class where relname = 'pg_class') "
                                                  "ORDER BY objoid, classoid, objsubid",
                                                  tbinfo->oid);
        }
@@ -2768,7 +2765,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo,
        for (i = 0; i < ntups; i++)
        {
                const char *descr = PQgetvalue(res, i, i_description);
-               int objsubid = atoi(PQgetvalue(res, i, i_objsubid));
+               int                     objsubid = atoi(PQgetvalue(res, i, i_objsubid));
 
                if (objsubid == 0)
                {
@@ -2792,7 +2789,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo,
                        appendPQExpBuffer(target, "COLUMN %s.",
                                                          fmtId(tbinfo->relname));
                        appendPQExpBuffer(target, "%s",
-                                                         fmtId(tbinfo->attnames[objsubid-1]));
+                                                         fmtId(tbinfo->attnames[objsubid - 1]));
 
                        resetPQExpBuffer(query);
                        appendPQExpBuffer(query, "COMMENT ON %s IS ", target->data);
@@ -2860,7 +2857,7 @@ dumpDBComment(Archive *fout)
 
 /*
  * dumpNamespaces
- *    writes out to fout the queries to recreate user-defined namespaces
+ *       writes out to fout the queries to recreate user-defined namespaces
  */
 void
 dumpNamespaces(Archive *fout, NamespaceInfo *nsinfo, int numNamespaces)
@@ -2885,10 +2882,10 @@ dumpNamespaces(Archive *fout, NamespaceInfo *nsinfo, int numNamespaces)
                qnspname = strdup(fmtId(nspinfo->nspname));
 
                /*
-                * If it's the PUBLIC namespace, don't emit a CREATE SCHEMA
-                * record for it, since we expect PUBLIC to exist already in
-                * the destination database.  And emit ACL info only if the ACL
-                * isn't the standard value for PUBLIC.
+                * If it's the PUBLIC namespace, don't emit a CREATE SCHEMA record
+                * for it, since we expect PUBLIC to exist already in the
+                * destination database.  And emit ACL info only if the ACL isn't
+                * the standard value for PUBLIC.
                 */
                if (strcmp(nspinfo->nspname, "public") == 0)
                {
@@ -2933,8 +2930,8 @@ dumpNamespaces(Archive *fout, NamespaceInfo *nsinfo, int numNamespaces)
 
 /*
  * dumpOneBaseType
- *    writes out to fout the queries to recreate a user-defined base type
- *    as requested by dumpTypes
+ *       writes out to fout the queries to recreate a user-defined base type
+ *       as requested by dumpTypes
  */
 static void
 dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
@@ -3038,7 +3035,7 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
        /*
         * Before we create a type, we need to create the input and output
         * functions for it, if they haven't been created already.  So make
-        * sure there are dependency entries for this.  But don't include
+        * sure there are dependency entries for this.  But don't include
         * dependencies if the functions aren't going to be dumped.
         */
        funcInd = findFuncByOid(g_finfo, numFuncs, typinputoid);
@@ -3049,7 +3046,10 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
        if (funcInd >= 0 && g_finfo[funcInd].pronamespace->dump)
                (*deps)[depIdx++] = strdup(typoutputoid);
 
-       /* DROP must be fully qualified in case same name appears in pg_catalog */
+       /*
+        * DROP must be fully qualified in case same name appears in
+        * pg_catalog
+        */
        appendPQExpBuffer(delq, "DROP TYPE %s.",
                                          fmtId(tinfo->typnamespace->nspname));
        appendPQExpBuffer(delq, "%s CASCADE;\n",
@@ -3120,7 +3120,7 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
 
        appendPQExpBuffer(q, "\n);\n");
 
-       (*deps)[depIdx++] = NULL;               /* End of List */
+       (*deps)[depIdx++] = NULL;       /* End of List */
 
        ArchiveEntry(fout, tinfo->oid, tinfo->typname,
                                 tinfo->typnamespace->nspname,
@@ -3143,8 +3143,8 @@ dumpOneBaseType(Archive *fout, TypeInfo *tinfo,
 
 /*
  * dumpOneDomain
- *    writes out to fout the queries to recreate a user-defined domain
- *    as requested by dumpTypes
+ *       writes out to fout the queries to recreate a user-defined domain
+ *       as requested by dumpTypes
  */
 static void
 dumpOneDomain(Archive *fout, TypeInfo *tinfo)
@@ -3169,7 +3169,7 @@ dumpOneDomain(Archive *fout, TypeInfo *tinfo)
        /* Fetch domain specific details */
        /* We assume here that remoteVersion must be at least 70300 */
        appendPQExpBuffer(query, "SELECT typnotnull, "
-                                         "pg_catalog.format_type(typbasetype, typtypmod) as typdefn, "
+                       "pg_catalog.format_type(typbasetype, typtypmod) as typdefn, "
                                          "typdefault, typbasetype "
                                          "FROM pg_catalog.pg_type "
                                          "WHERE oid = '%s'::pg_catalog.oid",
@@ -3200,7 +3200,10 @@ dumpOneDomain(Archive *fout, TypeInfo *tinfo)
                typdefault = PQgetvalue(res, 0, PQfnumber(res, "typdefault"));
        typbasetype = PQgetvalue(res, 0, PQfnumber(res, "typbasetype"));
 
-       /* DROP must be fully qualified in case same name appears in pg_catalog */
+       /*
+        * DROP must be fully qualified in case same name appears in
+        * pg_catalog
+        */
        appendPQExpBuffer(delq, "DROP DOMAIN %s.",
                                          fmtId(tinfo->typnamespace->nspname));
        appendPQExpBuffer(delq, "%s;\n",
@@ -3222,7 +3225,7 @@ dumpOneDomain(Archive *fout, TypeInfo *tinfo)
 
        appendPQExpBuffer(q, ";\n");
 
-       (*deps)[depIdx++] = NULL;               /* End of List */
+       (*deps)[depIdx++] = NULL;       /* End of List */
 
        ArchiveEntry(fout, tinfo->oid, tinfo->typname,
                                 tinfo->typnamespace->nspname,
@@ -3245,8 +3248,8 @@ dumpOneDomain(Archive *fout, TypeInfo *tinfo)
 
 /*
  * dumpOneCompositeType
- *    writes out to fout the queries to recreate a user-defined stand-alone
- *    composite type as requested by dumpTypes
+ *       writes out to fout the queries to recreate a user-defined stand-alone
+ *       composite type as requested by dumpTypes
  */
 static void
 dumpOneCompositeType(Archive *fout, TypeInfo *tinfo)
@@ -3256,8 +3259,8 @@ dumpOneCompositeType(Archive *fout, TypeInfo *tinfo)
        PQExpBuffer query = createPQExpBuffer();
        PGresult   *res;
        int                     ntups;
-       int             i_attname;
-       int             i_atttypdefn;
+       int                     i_attname;
+       int                     i_atttypdefn;
        int                     i;
 
        /* Set proper schema search path so type references list correctly */
@@ -3267,8 +3270,8 @@ dumpOneCompositeType(Archive *fout, TypeInfo *tinfo)
        /* We assume here that remoteVersion must be at least 70300 */
 
        appendPQExpBuffer(query, "SELECT a.attname, "
-                                         "pg_catalog.format_type(a.atttypid, a.atttypmod) as atttypdefn "
-                                         "FROM pg_catalog.pg_type t, pg_catalog.pg_attribute a "
+                "pg_catalog.format_type(a.atttypid, a.atttypmod) as atttypdefn "
+                                 "FROM pg_catalog.pg_type t, pg_catalog.pg_attribute a "
                                          "WHERE t.oid = '%s'::pg_catalog.oid "
                                          "AND a.attrelid = t.typrelid "
                                          "AND NOT a.attisdropped "
@@ -3311,7 +3314,10 @@ dumpOneCompositeType(Archive *fout, TypeInfo *tinfo)
        }
        appendPQExpBuffer(q, ");\n");
 
-       /* DROP must be fully qualified in case same name appears in pg_catalog */
+       /*
+        * DROP must be fully qualified in case same name appears in
+        * pg_catalog
+        */
        appendPQExpBuffer(delq, "DROP TYPE %s.",
                                          fmtId(tinfo->typnamespace->nspname));
        appendPQExpBuffer(delq, "%s;\n",
@@ -3468,11 +3474,11 @@ dumpProcLangs(Archive *fout, FuncInfo finfo[], int numFuncs)
 
                /*
                 * Current theory is to dump PLs iff their underlying functions
-                * will be dumped (are in a dumpable namespace, or have a non-system
-                * OID in pre-7.3 databases).  Actually, we treat the PL itself
-                * as being in the underlying function's namespace, though it
-                * isn't really.  This avoids searchpath problems for the HANDLER
-                * clause.
+                * will be dumped (are in a dumpable namespace, or have a
+                * non-system OID in pre-7.3 databases).  Actually, we treat the
+                * PL itself as being in the underlying function's namespace,
+                * though it isn't really.  This avoids searchpath problems for
+                * the HANDLER clause.
                 */
                if (!finfo[fidx].pronamespace->dump)
                        continue;
@@ -3481,7 +3487,7 @@ dumpProcLangs(Archive *fout, FuncInfo finfo[], int numFuncs)
                resetPQExpBuffer(delqry);
 
                /* Make a dependency to ensure function is dumped first */
-               deps = malloc(sizeof(char *) * (2 + (strcmp(lanvalidator, "0")!=0) ? 1 : 0));
+               deps = malloc(sizeof(char *) * (2 + (strcmp(lanvalidator, "0") != 0) ? 1 : 0));
                depIdx = 0;
 
                (*deps)[depIdx++] = strdup(lanplcallfoid);
@@ -3495,13 +3501,13 @@ dumpProcLangs(Archive *fout, FuncInfo finfo[], int numFuncs)
                                                  fmtId(lanname));
                appendPQExpBuffer(defqry, " HANDLER %s",
                                                  fmtId(finfo[fidx].proname));
-               if (strcmp(lanvalidator, "0")!=0)
+               if (strcmp(lanvalidator, "0") != 0)
                {
                        appendPQExpBuffer(defqry, " VALIDATOR ");
                        /* Cope with possibility that validator is in different schema */
                        if (finfo[vidx].pronamespace != finfo[fidx].pronamespace)
                                appendPQExpBuffer(defqry, "%s.",
-                                                                 fmtId(finfo[vidx].pronamespace->nspname));
+                                                          fmtId(finfo[vidx].pronamespace->nspname));
                        appendPQExpBuffer(defqry, "%s",
                                                          fmtId(finfo[vidx].proname));
                        (*deps)[depIdx++] = strdup(lanvalidator);
@@ -3517,7 +3523,8 @@ dumpProcLangs(Archive *fout, FuncInfo finfo[], int numFuncs)
 
                if (!aclsSkip)
                {
-                       char *tmp = strdup(fmtId(lanname));
+                       char       *tmp = strdup(fmtId(lanname));
+
                        dumpACL(fout, "LANGUAGE", tmp, lanname,
                                        finfo[fidx].pronamespace->nspname,
                                        NULL, lanacl, lanoid);
@@ -3588,7 +3595,8 @@ format_function_signature(FuncInfo *finfo, bool honor_quotes)
 static void
 dumpFuncACL(Archive *fout, FuncInfo *finfo)
 {
-       char *funcsig, *funcsig_tag;
+       char       *funcsig,
+                          *funcsig_tag;
 
        funcsig = format_function_signature(finfo, true);
        funcsig_tag = format_function_signature(finfo, false);
@@ -3647,7 +3655,7 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
        {
                appendPQExpBuffer(query,
                                                  "SELECT proretset, prosrc, probin, "
-                                                 "case when proiscachable then 'i' else 'v' end as provolatile, "
+                "case when proiscachable then 'i' else 'v' end as provolatile, "
                                                  "proisstrict, "
                                                  "'f'::boolean as prosecdef, "
                                                  "(SELECT lanname FROM pg_language WHERE oid = prolang) as lanname "
@@ -3659,7 +3667,7 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
        {
                appendPQExpBuffer(query,
                                                  "SELECT proretset, prosrc, probin, "
-                                                 "case when proiscachable then 'i' else 'v' end as provolatile, "
+                "case when proiscachable then 'i' else 'v' end as provolatile, "
                                                  "'f'::boolean as proisstrict, "
                                                  "'f'::boolean as prosecdef, "
                                                  "(SELECT lanname FROM pg_language WHERE oid = prolang) as lanname "
@@ -3720,7 +3728,10 @@ dumpOneFunc(Archive *fout, FuncInfo *finfo)
        funcsig = format_function_signature(finfo, true);
        funcsig_tag = format_function_signature(finfo, false);
 
-       /* DROP must be fully qualified in case same name appears in pg_catalog */
+       /*
+        * DROP must be fully qualified in case same name appears in
+        * pg_catalog
+        */
        appendPQExpBuffer(delqry, "DROP FUNCTION %s.%s;\n",
                                          fmtId(finfo->pronamespace->nspname),
                                          funcsig);
@@ -3818,21 +3829,21 @@ dumpCasts(Archive *fout,
 
        for (i = 0; i < ntups; i++)
        {
-               char castoid = PQgetvalue(res, i, 0);
-               char castsource = PQgetvalue(res, i, 1);
-               char casttarget = PQgetvalue(res, i, 2);
-               char castfunc = PQgetvalue(res, i, 3);
-               char castimplicit = PQgetvalue(res, i, 4);
-               int fidx = -1;
+               char       *castoid = PQgetvalue(res, i, 0);
+               char       *castsource = PQgetvalue(res, i, 1);
+               char       *casttarget = PQgetvalue(res, i, 2);
+               char       *castfunc = PQgetvalue(res, i, 3);
+               char       *castimplicit = PQgetvalue(res, i, 4);
+               int                     fidx = -1;
                const char *((*deps)[]);
 
                if (strcmp(castfunc, "0") != 0)
                        fidx = findFuncByOid(finfo, numFuncs, castfunc);
 
                /*
-                * We treat the cast as being in the namespace of the
-                * underlying function.  This doesn't handle binary compatible
-                * casts.  Where should those go?
+                * We treat the cast as being in the namespace of the underlying
+                * function.  This doesn't handle binary compatible casts.  Where
+                * should those go?
                 */
                if (fidx < 0 || !finfo[fidx].pronamespace->dump)
                        continue;
@@ -3859,13 +3870,13 @@ dumpCasts(Archive *fout,
                                                  getFormattedTypeName(castsource, zeroAsNone),
                                                  getFormattedTypeName(casttarget, zeroAsNone));
 
-               if (strcmp(castfunc, "0")==0)
+               if (strcmp(castfunc, "0") == 0)
                        appendPQExpBuffer(defqry, "WITHOUT FUNCTION");
                else
                        appendPQExpBuffer(defqry, "WITH FUNCTION %s",
-                                                         format_function_signature(&finfo[fidx], true));
+                                                 format_function_signature(&finfo[fidx], true));
 
-               if (strcmp(castimplicit, "t")==0)
+               if (strcmp(castimplicit, "t") == 0)
                        appendPQExpBuffer(defqry, " AS ASSIGNMENT");
                appendPQExpBuffer(defqry, ";\n");
 
@@ -3982,9 +3993,9 @@ dumpOneOpr(Archive *fout, OprInfo *oprinfo,
        {
                appendPQExpBuffer(query, "SELECT oprkind, oprcode, "
                                                  "CASE WHEN oprleft = 0 THEN '-' "
-                                                 "ELSE format_type(oprleft, NULL) END as oprleft, "
+                                          "ELSE format_type(oprleft, NULL) END as oprleft, "
                                                  "CASE WHEN oprright = 0 THEN '-' "
-                                                 "ELSE format_type(oprright, NULL) END as oprright, "
+                                        "ELSE format_type(oprright, NULL) END as oprright, "
                                                  "oprcom, oprnegate, oprrest, oprjoin, "
                                                  "oprcanhash, oprlsortop, oprrsortop, "
                                                  "0 as oprltcmpop, 0 as oprgtcmpop "
@@ -4059,8 +4070,8 @@ dumpOneOpr(Archive *fout, OprInfo *oprinfo,
                                          oprinfo->oprname);
 
        /*
-        * right unary means there's a left arg and left unary means
-        * there's a right arg
+        * right unary means there's a left arg and left unary means there's a
+        * right arg
         */
        if (strcmp(oprkind, "r") == 0 ||
                strcmp(oprkind, "b") == 0)
@@ -4123,7 +4134,10 @@ dumpOneOpr(Archive *fout, OprInfo *oprinfo,
        if (name)
                appendPQExpBuffer(details, ",\n    GTCMP = %s", name);
 
-       /* DROP must be fully qualified in case same name appears in pg_catalog */
+       /*
+        * DROP must be fully qualified in case same name appears in
+        * pg_catalog
+        */
        appendPQExpBuffer(delq, "DROP OPERATOR %s.%s;\n",
                                          fmtId(oprinfo->oprnamespace->nspname),
                                          oprid->data);
@@ -4171,9 +4185,9 @@ convertRegProcReference(const char *proc)
 
        if (g_fout->remoteVersion >= 70300)
        {
-               char   *name;
-               char   *paren;
-               bool    inquote;
+               char       *name;
+               char       *paren;
+               bool            inquote;
 
                name = strdup(proc);
                /* find non-double-quoted left paren */
@@ -4208,7 +4222,7 @@ static const char *
 convertOperatorReference(const char *opr,
                                                 OprInfo *g_oprinfo, int numOperators)
 {
-       char   *name;
+       char       *name;
 
        /* In all cases "0" means a null reference */
        if (strcmp(opr, "0") == 0)
@@ -4216,8 +4230,8 @@ convertOperatorReference(const char *opr,
 
        if (g_fout->remoteVersion >= 70300)
        {
-               char   *paren;
-               bool    inquote;
+               char       *paren;
+               bool            inquote;
 
                name = strdup(opr);
                /* find non-double-quoted left paren */
@@ -4312,7 +4326,7 @@ dumpOneOpclass(Archive *fout, OpclassInfo *opcinfo)
        appendPQExpBuffer(query, "SELECT opcintype::pg_catalog.regtype, "
                                          "opckeytype::pg_catalog.regtype, "
                                          "opcdefault, "
-                                         "(SELECT amname FROM pg_catalog.pg_am WHERE oid = opcamid) AS amname "
+       "(SELECT amname FROM pg_catalog.pg_am WHERE oid = opcamid) AS amname "
                                          "FROM pg_catalog.pg_opclass "
                                          "WHERE oid = '%s'::pg_catalog.oid",
                                          opcinfo->oid);
@@ -4344,7 +4358,10 @@ dumpOneOpclass(Archive *fout, OpclassInfo *opcinfo)
        opcdefault = PQgetvalue(res, 0, i_opcdefault);
        amname = PQgetvalue(res, 0, i_amname);
 
-       /* DROP must be fully qualified in case same name appears in pg_catalog */
+       /*
+        * DROP must be fully qualified in case same name appears in
+        * pg_catalog
+        */
        appendPQExpBuffer(delq, "DROP OPERATOR CLASS %s",
                                          fmtId(opcinfo->opcnamespace->nspname));
        appendPQExpBuffer(delq, ".%s",
@@ -4508,7 +4525,7 @@ format_aggregate_signature(AggInfo *agginfo, Archive *fout, bool honor_quotes)
        initPQExpBuffer(&buf);
        if (honor_quotes)
                appendPQExpBuffer(&buf, "%s",
-                                         fmtId(agginfo->aggname));
+                                                 fmtId(agginfo->aggname));
        else
                appendPQExpBuffer(&buf, "%s", agginfo->aggname);
 
@@ -4536,7 +4553,8 @@ format_aggregate_signature(AggInfo *agginfo, Archive *fout, bool honor_quotes)
 static void
 dumpAggACL(Archive *fout, AggInfo *finfo)
 {
-       char *aggsig, *aggsig_tag;
+       char       *aggsig,
+                          *aggsig_tag;
 
        aggsig = format_aggregate_signature(finfo, fout, true);
        aggsig_tag = format_aggregate_signature(finfo, fout, false);
@@ -4586,9 +4604,9 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo)
                                                  "aggfinalfn, aggtranstype::pg_catalog.regtype, "
                                                  "agginitval, "
                                                  "proargtypes[0] = 'pg_catalog.\"any\"'::pg_catalog.regtype as anybasetype, "
-                                                 "proargtypes[0]::pg_catalog.regtype as fmtbasetype, "
+                                       "proargtypes[0]::pg_catalog.regtype as fmtbasetype, "
                                                  "'t'::boolean as convertok "
-                                                 "from pg_catalog.pg_aggregate a, pg_catalog.pg_proc p "
+                                 "from pg_catalog.pg_aggregate a, pg_catalog.pg_proc p "
                                                  "where a.aggfnoid = p.oid "
                                                  "and p.oid = '%s'::pg_catalog.oid",
                                                  agginfo->oid);
@@ -4596,11 +4614,11 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo)
        else if (g_fout->remoteVersion >= 70100)
        {
                appendPQExpBuffer(query, "SELECT aggtransfn, aggfinalfn, "
-                                                 "format_type(aggtranstype, NULL) as aggtranstype, "
+                                         "format_type(aggtranstype, NULL) as aggtranstype, "
                                                  "agginitval, "
                                                  "aggbasetype = 0 as anybasetype, "
                                                  "CASE WHEN aggbasetype = 0 THEN '-' "
-                                                 "ELSE format_type(aggbasetype, NULL) END as fmtbasetype, "
+                          "ELSE format_type(aggbasetype, NULL) END as fmtbasetype, "
                                                  "'t'::boolean as convertok "
                                                  "from pg_aggregate "
                                                  "where oid = '%s'::oid",
@@ -4657,7 +4675,7 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo)
        convertok = (PQgetvalue(res, 0, i_convertok)[0] == 't');
 
        aggsig = format_aggregate_signature(agginfo, g_fout, true);
-       aggsig_tag = format_aggregate_signature(agginfo, g_fout, false);
+       aggsig_tag = format_aggregate_signature(agginfo, g_fout, false);
 
        if (!convertok)
        {
@@ -4716,7 +4734,10 @@ dumpOneAgg(Archive *fout, AggInfo *agginfo)
                                                  aggfinalfn);
        }
 
-       /* DROP must be fully qualified in case same name appears in pg_catalog */
+       /*
+        * DROP must be fully qualified in case same name appears in
+        * pg_catalog
+        */
        appendPQExpBuffer(delq, "DROP AGGREGATE %s.%s;\n",
                                          fmtId(agginfo->aggnamespace->nspname),
                                          aggsig);
@@ -4793,7 +4814,7 @@ GetPrivileges(Archive *AH, const char *s, const char *type)
        else \
                all = false
 
-       if (strcmp(type, "TABLE")==0)
+       if (strcmp(type, "TABLE") == 0)
        {
                CONVERT_PRIV('a', "INSERT");
                CONVERT_PRIV('r', "SELECT");
@@ -4812,15 +4833,11 @@ GetPrivileges(Archive *AH, const char *s, const char *type)
                        CONVERT_PRIV('w', "UPDATE,DELETE");
                }
        }
-       else if (strcmp(type, "FUNCTION")==0)
-       {
+       else if (strcmp(type, "FUNCTION") == 0)
                CONVERT_PRIV('X', "EXECUTE");
-       }
-       else if (strcmp(type, "LANGUAGE")==0)
-       {
+       else if (strcmp(type, "LANGUAGE") == 0)
                CONVERT_PRIV('U', "USAGE");
-       }
-       else if (strcmp(type, "SCHEMA")==0)
+       else if (strcmp(type, "SCHEMA") == 0)
        {
                CONVERT_PRIV('C', "CREATE");
                CONVERT_PRIV('U', "USAGE");
@@ -4953,7 +4970,8 @@ dumpACL(Archive *fout, const char *type, const char *name,
        }
 
        /*
-        * If we didn't find any owner privs, the owner must have revoked 'em all
+        * If we didn't find any owner privs, the owner must have revoked 'em
+        * all
         */
        if (!found_owner_privs && usename)
        {
@@ -4973,8 +4991,8 @@ dumpACL(Archive *fout, const char *type, const char *name,
 static void
 dumpTableACL(Archive *fout, TableInfo *tbinfo)
 {
-       char *namecopy = strdup(fmtId(tbinfo->relname));
-       char *dumpoid;
+       char       *namecopy = strdup(fmtId(tbinfo->relname));
+       char       *dumpoid;
 
        /*
         * Choose OID to use for sorting ACL into position.  For a view, sort
@@ -4989,7 +5007,7 @@ dumpTableACL(Archive *fout, TableInfo *tbinfo)
                dumpoid = tbinfo->oid;
 
        dumpACL(fout, "TABLE", namecopy, tbinfo->relname,
-                       tbinfo->relnamespace->nspname, tbinfo->usename, tbinfo->relacl,
+                 tbinfo->relnamespace->nspname, tbinfo->usename, tbinfo->relacl,
                        dumpoid);
 
        free(namecopy);
@@ -5002,7 +5020,7 @@ dumpTableACL(Archive *fout, TableInfo *tbinfo)
  */
 void
 dumpTables(Archive *fout, TableInfo tblinfo[], int numTables,
-                  const bool aclsSkip, const bool schemaOnly, const bool dataOnly)
+                const bool aclsSkip, const bool schemaOnly, const bool dataOnly)
 {
        int                     i;
 
@@ -5012,7 +5030,7 @@ dumpTables(Archive *fout, TableInfo tblinfo[], int numTables,
         */
        for (i = 0; i < numTables; i++)
        {
-               TableInfo          *tbinfo = &tblinfo[i];
+               TableInfo  *tbinfo = &tblinfo[i];
 
                if (tbinfo->relkind != RELKIND_SEQUENCE)
                        continue;
@@ -5029,9 +5047,9 @@ dumpTables(Archive *fout, TableInfo tblinfo[], int numTables,
        {
                for (i = 0; i < numTables; i++)
                {
-                       TableInfo          *tbinfo = &tblinfo[i];
+                       TableInfo  *tbinfo = &tblinfo[i];
 
-                       if (tbinfo->relkind == RELKIND_SEQUENCE) /* already dumped */
+                       if (tbinfo->relkind == RELKIND_SEQUENCE)        /* already dumped */
                                continue;
 
                        if (tbinfo->dump)
@@ -5049,7 +5067,7 @@ dumpTables(Archive *fout, TableInfo tblinfo[], int numTables,
         */
        for (i = 0; i < numTables; i++)
        {
-               TableInfo          *tbinfo = &tblinfo[i];
+               TableInfo  *tbinfo = &tblinfo[i];
 
                if (tbinfo->relkind != RELKIND_SEQUENCE)
                        continue;
@@ -5108,7 +5126,7 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
                {
                        appendPQExpBuffer(query, "SELECT definition as viewdef, "
                                                          "(select oid from pg_rewrite where "
-                                                         " rulename=('_RET' || viewname)::name) as view_oid"
+                                         " rulename=('_RET' || viewname)::name) as view_oid"
                                                          " from pg_views where viewname = ");
                        appendStringLiteral(query, tbinfo->relname, true);
                        appendPQExpBuffer(query, ";");
@@ -5154,7 +5172,10 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
                /* Save it for use by dumpACL, too */
                tbinfo->viewoid = objoid;
 
-               /* DROP must be fully qualified in case same name appears in pg_catalog */
+               /*
+                * DROP must be fully qualified in case same name appears in
+                * pg_catalog
+                */
                appendPQExpBuffer(delq, "DROP VIEW %s.",
                                                  fmtId(tbinfo->relnamespace->nspname));
                appendPQExpBuffer(delq, "%s;\n",
@@ -5167,8 +5188,8 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
 
                /*
                 * Views can have default values -- however, they must be
-                * specified in an ALTER TABLE command after the view has
-                * been created, not in the view definition itself.
+                * specified in an ALTER TABLE command after the view has been
+                * created, not in the view definition itself.
                 */
                for (j = 0; j < tbinfo->numatts; j++)
                {
@@ -5194,7 +5215,10 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
                numParents = tbinfo->numParents;
                parentIndexes = tbinfo->parentIndexes;
 
-               /* DROP must be fully qualified in case same name appears in pg_catalog */
+               /*
+                * DROP must be fully qualified in case same name appears in
+                * pg_catalog
+                */
                appendPQExpBuffer(delq, "DROP TABLE %s.",
                                                  fmtId(tbinfo->relnamespace->nspname));
                appendPQExpBuffer(delq, "%s;\n",
@@ -5220,7 +5244,7 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
                                /* Attribute type */
                                if (g_fout->remoteVersion >= 70100)
                                {
-                                       char    *typname = tbinfo->atttypnames[j];
+                                       char       *typname = tbinfo->atttypnames[j];
 
                                        if (tbinfo->attisserial[j])
                                        {
@@ -5263,10 +5287,10 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
                }
 
                /*
-                * Add non-inherited CHECK constraints, if any. If a
-                * constraint matches by name and condition with a constraint
-                * belonging to a parent class (OR conditions match and both names
-                * start with '$'), we assume it was inherited.
+                * Add non-inherited CHECK constraints, if any. If a constraint
+                * matches by name and condition with a constraint belonging to a
+                * parent class (OR conditions match and both names start with
+                * '$'), we assume it was inherited.
                 */
                if (tbinfo->ncheck > 0)
                {
@@ -5283,7 +5307,7 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
                        if (g_fout->remoteVersion >= 70300)
                                appendPQExpBuffer(query, "SELECT conname, consrc"
                                                                  " from pg_catalog.pg_constraint c1"
-                                                                 " where conrelid = '%s'::pg_catalog.oid "
+                                                               " where conrelid = '%s'::pg_catalog.oid "
                                                                  "   and contype = 'c' "
                                                                  "   and not exists "
                                                                  "  (select 1 from "
@@ -5350,13 +5374,13 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
                }
 
                /*
-                * Primary Key: In versions of PostgreSQL prior to 7.2, we
-                * needed to include the primary key in the table definition.
-                * However, this is not ideal because it creates an index
-                * on the table, which makes COPY slower. As of release 7.2,
-                * we can add primary keys to a table after it has been created,
-                * using ALTER TABLE; see dumpIndexes() for more information.
-                * Therefore, we ignore primary keys in this function.
+                * Primary Key: In versions of PostgreSQL prior to 7.2, we needed
+                * to include the primary key in the table definition. However,
+                * this is not ideal because it creates an index on the table,
+                * which makes COPY slower. As of release 7.2, we can add primary
+                * keys to a table after it has been created, using ALTER TABLE;
+                * see dumpIndexes() for more information. Therefore, we ignore
+                * primary keys in this function.
                 */
 
                appendPQExpBuffer(q, "\n)");
@@ -5372,7 +5396,7 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
                                        appendPQExpBuffer(q, ", ");
                                if (parentRel->relnamespace != tbinfo->relnamespace)
                                        appendPQExpBuffer(q, "%s.",
-                                                                         fmtId(parentRel->relnamespace->nspname));
+                                                               fmtId(parentRel->relnamespace->nspname));
                                appendPQExpBuffer(q, "%s",
                                                                  fmtId(parentRel->relname));
                        }
@@ -5385,11 +5409,11 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
                appendPQExpBuffer(q, ";\n");
 
                /*
-                * Dump per-column statistics information. We only issue an ALTER TABLE
-                * statement if the attstattarget entry for this column is non-negative
-                * (i.e. it's not the default value)
+                * Dump per-column statistics information. We only issue an ALTER
+                * TABLE statement if the attstattarget entry for this column is
+                * non-negative (i.e. it's not the default value)
                 */
-               for (j = 0; j  < tbinfo->numatts; j++)
+               for (j = 0; j < tbinfo->numatts; j++)
                {
                        if (tbinfo->attstattarget[j] >= 0 &&
                                !tbinfo->attisdropped[j])
@@ -5415,9 +5439,7 @@ dumpOneTable(Archive *fout, TableInfo *tbinfo, TableInfo *g_tblinfo)
        if (commentDeps)
        {
                for (j = 0; (*commentDeps)[j] != NULL; j++)
-               {
                        free((void *) (*commentDeps)[j]);
-               }
                free(commentDeps);
        }
 
@@ -5497,23 +5519,23 @@ dumpIndexes(Archive *fout, TableInfo *tblinfo, int numTables)
                selectSourceSchema(tbinfo->relnamespace->nspname);
 
                /*
-                * The point of the messy-looking outer join is to find a constraint
-                * that is related by an internal dependency link to the index.
-                * If we find one, we emit an ADD CONSTRAINT command instead of
-                * a CREATE INDEX command.  We assume an index won't have more than
-                * one internal dependency.
+                * The point of the messy-looking outer join is to find a
+                * constraint that is related by an internal dependency link to
+                * the index. If we find one, we emit an ADD CONSTRAINT command
+                * instead of a CREATE INDEX command.  We assume an index won't
+                * have more than one internal dependency.
                 */
                resetPQExpBuffer(query);
                if (g_fout->remoteVersion >= 70300)
                        appendPQExpBuffer(query,
                                                          "SELECT i.indexrelid as indexreloid, "
-                                                         "coalesce(c.conname, t.relname) as indexrelname, "
-                                                         "pg_catalog.pg_get_indexdef(i.indexrelid) as indexdef, "
+                                          "coalesce(c.conname, t.relname) as indexrelname, "
+                                "pg_catalog.pg_get_indexdef(i.indexrelid) as indexdef, "
                                                          "i.indkey, "
                                                          "t.relnatts as indnkeys, "
-                                                         "coalesce(c.contype, '0') as contype " 
+                                                         "coalesce(c.contype, '0') as contype "
                                                          "FROM pg_catalog.pg_index i "
-                                                         "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) "
+                                 "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) "
                                                          "LEFT JOIN pg_catalog.pg_depend d "
                                                          "ON (d.classid = t.tableoid "
                                                          "AND d.objid = t.oid "
@@ -5528,7 +5550,7 @@ dumpIndexes(Archive *fout, TableInfo *tblinfo, int numTables)
                        appendPQExpBuffer(query,
                                                          "SELECT i.indexrelid as indexreloid, "
                                                          "t.relname as indexrelname, "
-                                                         "pg_get_indexdef(i.indexrelid) as indexdef, "
+                                                       "pg_get_indexdef(i.indexrelid) as indexdef, "
                                                          "i.indkey, "
                                                          "t.relnatts as indnkeys, "
                                                          "CASE WHEN i.indisprimary THEN 'p'::char "
@@ -5561,7 +5583,7 @@ dumpIndexes(Archive *fout, TableInfo *tblinfo, int numTables)
                        const char *indexreloid = PQgetvalue(res, j, i_indexreloid);
                        const char *indexrelname = PQgetvalue(res, j, i_indexrelname);
                        const char *indexdef = PQgetvalue(res, j, i_indexdef);
-                       char contype = *(PQgetvalue(res, j, i_contype));
+                       char            contype = *(PQgetvalue(res, j, i_contype));
 
                        resetPQExpBuffer(q);
                        resetPQExpBuffer(delq);
@@ -5569,14 +5591,14 @@ dumpIndexes(Archive *fout, TableInfo *tblinfo, int numTables)
                        if (contype == 'p' || contype == 'u')
                        {
                                /*
-                                * If we found a constraint matching the index, emit
-                                * ADD CONSTRAINT not CREATE INDEX.
+                                * If we found a constraint matching the index, emit ADD
+                                * CONSTRAINT not CREATE INDEX.
                                 *
-                                * In a pre-7.3 database, we take this path iff the index
-                                * was marked indisprimary.
+                                * In a pre-7.3 database, we take this path iff the index was
+                                * marked indisprimary.
                                 */
-                               int indnkeys = atoi(PQgetvalue(res, j, i_indnkeys));
-                               char **indkeys = (char **) malloc(indnkeys * sizeof(char *));
+                               int                     indnkeys = atoi(PQgetvalue(res, j, i_indnkeys));
+                               char      **indkeys = (char **) malloc(indnkeys * sizeof(char *));
                                int                     k;
 
                                parseNumericArray(PQgetvalue(res, j, i_indkey),
@@ -5586,7 +5608,7 @@ dumpIndexes(Archive *fout, TableInfo *tblinfo, int numTables)
                                                                  fmtId(tbinfo->relname));
                                appendPQExpBuffer(q, "    ADD CONSTRAINT %s %s (",
                                                                  fmtId(indexrelname),
-                                                                 contype == 'p' ? "PRIMARY KEY" : "UNIQUE");
+                                                         contype == 'p' ? "PRIMARY KEY" : "UNIQUE");
 
                                for (k = 0; k < indnkeys; k++)
                                {
@@ -5604,7 +5626,10 @@ dumpIndexes(Archive *fout, TableInfo *tblinfo, int numTables)
 
                                appendPQExpBuffer(q, ");\n");
 
-                               /* DROP must be fully qualified in case same name appears in pg_catalog */
+                               /*
+                                * DROP must be fully qualified in case same name appears
+                                * in pg_catalog
+                                */
                                appendPQExpBuffer(delq, "ALTER TABLE ONLY %s.",
                                                                  fmtId(tbinfo->relnamespace->nspname));
                                appendPQExpBuffer(delq, "%s ",
@@ -5629,7 +5654,10 @@ dumpIndexes(Archive *fout, TableInfo *tblinfo, int numTables)
                                /* Plain secondary index */
                                appendPQExpBuffer(q, "%s;\n", indexdef);
 
-                               /* DROP must be fully qualified in case same name appears in pg_catalog */
+                               /*
+                                * DROP must be fully qualified in case same name appears
+                                * in pg_catalog
+                                */
                                appendPQExpBuffer(delq, "DROP INDEX %s.",
                                                                  fmtId(tbinfo->relnamespace->nspname));
                                appendPQExpBuffer(delq, "%s;\n",
@@ -5870,7 +5898,10 @@ dumpOneSequence(Archive *fout, TableInfo *tbinfo,
        {
                resetPQExpBuffer(delqry);
 
-               /* DROP must be fully qualified in case same name appears in pg_catalog */
+               /*
+                * DROP must be fully qualified in case same name appears in
+                * pg_catalog
+                */
                appendPQExpBuffer(delqry, "DROP SEQUENCE %s.",
                                                  fmtId(tbinfo->relnamespace->nspname));
                appendPQExpBuffer(delqry, "%s;\n",
@@ -5878,8 +5909,8 @@ dumpOneSequence(Archive *fout, TableInfo *tbinfo,
 
                resetPQExpBuffer(query);
                appendPQExpBuffer(query,
-                                                 "CREATE SEQUENCE %s\n    START %s\n    INCREMENT %s\n"
-                                                 "    MAXVALUE %s\n    MINVALUE %s\n    CACHE %s%s;\n",
+                                  "CREATE SEQUENCE %s\n    START %s\n    INCREMENT %s\n"
+                                  "    MAXVALUE %s\n    MINVALUE %s\n    CACHE %s%s;\n",
                                                  fmtId(tbinfo->relname),
                                                  (called ? minv : last),
                                                  incby, maxv, minv, cache,
@@ -5955,7 +5986,7 @@ dumpConstraints(Archive *fout, TableInfo *tblinfo, int numTables)
 
        for (i = 0; i < numTables; i++)
        {
-               TableInfo          *tbinfo = &tblinfo[i];
+               TableInfo  *tbinfo = &tblinfo[i];
 
                if (tbinfo->ntrig == 0 || !tbinfo->dump)
                        continue;
@@ -5964,13 +5995,16 @@ dumpConstraints(Archive *fout, TableInfo *tblinfo, int numTables)
                        write_msg(NULL, "dumping foreign key constraints for table %s\n",
                                          tbinfo->relname);
 
-               /* select table schema to ensure regproc name is qualified if needed */
+               /*
+                * select table schema to ensure regproc name is qualified if
+                * needed
+                */
                selectSourceSchema(tbinfo->relnamespace->nspname);
 
                resetPQExpBuffer(query);
                appendPQExpBuffer(query,
                                                  "SELECT oid, conname, "
-                                                 "pg_catalog.pg_get_constraintdef(oid) as condef "
+                                               "pg_catalog.pg_get_constraintdef(oid) as condef "
                                                  "FROM pg_catalog.pg_constraint "
                                                  "WHERE conrelid = '%s'::pg_catalog.oid "
                                                  "AND contype = 'f'",
@@ -5987,7 +6021,7 @@ dumpConstraints(Archive *fout, TableInfo *tblinfo, int numTables)
                i_conoid = PQfnumber(res, "oid");
                i_conname = PQfnumber(res, "conname");
                i_condef = PQfnumber(res, "condef");
-       
+
                for (j = 0; j < ntups; j++)
                {
                        const char *conOid = PQgetvalue(res, j, i_conoid);
@@ -6001,7 +6035,10 @@ dumpConstraints(Archive *fout, TableInfo *tblinfo, int numTables)
                                                          fmtId(conName),
                                                          conDef);
 
-                       /* DROP must be fully qualified in case same name appears in pg_catalog */
+                       /*
+                        * DROP must be fully qualified in case same name appears in
+                        * pg_catalog
+                        */
                        resetPQExpBuffer(delqry);
                        appendPQExpBuffer(delqry, "ALTER TABLE ONLY %s.",
                                                          fmtId(tbinfo->relnamespace->nspname));
@@ -6060,7 +6097,7 @@ dumpTriggers(Archive *fout, TableInfo *tblinfo, int numTables)
 
        for (i = 0; i < numTables; i++)
        {
-               TableInfo          *tbinfo = &tblinfo[i];
+               TableInfo  *tbinfo = &tblinfo[i];
 
                if (tbinfo->ntrig == 0 || !tbinfo->dump)
                        continue;
@@ -6069,20 +6106,26 @@ dumpTriggers(Archive *fout, TableInfo *tblinfo, int numTables)
                        write_msg(NULL, "dumping triggers for table %s\n",
                                          tbinfo->relname);
 
-               /* select table schema to ensure regproc name is qualified if needed */
+               /*
+                * select table schema to ensure regproc name is qualified if
+                * needed
+                */
                selectSourceSchema(tbinfo->relnamespace->nspname);
 
                resetPQExpBuffer(query);
                if (g_fout->remoteVersion >= 70300)
                {
-                       /* We ignore triggers that are tied to a foreign-key constraint */
+                       /*
+                        * We ignore triggers that are tied to a foreign-key
+                        * constraint
+                        */
                        appendPQExpBuffer(query,
                                                          "SELECT tgname, "
                                                          "tgfoid::pg_catalog.regproc as tgfname, "
                                                          "tgtype, tgnargs, tgargs, "
-                                                         "tgisconstraint, tgconstrname, tgdeferrable, "
+                                                  "tgisconstraint, tgconstrname, tgdeferrable, "
                                                          "tgconstrrelid, tginitdeferred, oid, "
-                                                         "tgconstrrelid::pg_catalog.regclass as tgconstrrelname "
+                                "tgconstrrelid::pg_catalog.regclass as tgconstrrelname "
                                                          "from pg_catalog.pg_trigger t "
                                                          "where tgrelid = '%s'::pg_catalog.oid "
                                                          "and (not tgisconstraint "
@@ -6095,11 +6138,11 @@ dumpTriggers(Archive *fout, TableInfo *tblinfo, int numTables)
                else
                {
                        appendPQExpBuffer(query,
-                                                         "SELECT tgname, tgfoid::regproc as tgfname, "
+                                                       "SELECT tgname, tgfoid::regproc as tgfname, "
                                                          "tgtype, tgnargs, tgargs, "
-                                                         "tgisconstraint, tgconstrname, tgdeferrable, "
+                                                  "tgisconstraint, tgconstrname, tgdeferrable, "
                                                          "tgconstrrelid, tginitdeferred, oid, "
-                                                         "(select relname from pg_class where oid = tgconstrrelid) "
+                         "(select relname from pg_class where oid = tgconstrrelid) "
                                                          "             as tgconstrrelname "
                                                          "from pg_trigger "
                                                          "where tgrelid = '%s'::oid",
@@ -6113,9 +6156,10 @@ dumpTriggers(Archive *fout, TableInfo *tblinfo, int numTables)
                        exit_nicely();
                }
                ntups = PQntuples(res);
+
                /*
-                * We may have less triggers than recorded due to constraint triggers
-                * which are dumped by dumpConstraints
+                * We may have less triggers than recorded due to constraint
+                * triggers which are dumped by dumpConstraints
                 */
                if (ntups > tbinfo->ntrig)
                {
@@ -6167,7 +6211,11 @@ dumpTriggers(Archive *fout, TableInfo *tblinfo, int numTables)
                                tginitdeferred = 1;
 
                        resetPQExpBuffer(delqry);
-                       /* DROP must be fully qualified in case same name appears in pg_catalog */
+
+                       /*
+                        * DROP must be fully qualified in case same name appears in
+                        * pg_catalog
+                        */
                        appendPQExpBuffer(delqry, "DROP TRIGGER %s ",
                                                          fmtId(tgname));
                        appendPQExpBuffer(delqry, "ON %s.",
@@ -6233,10 +6281,10 @@ dumpTriggers(Archive *fout, TableInfo *tblinfo, int numTables)
                                        /* If we are using regclass, name is already quoted */
                                        if (g_fout->remoteVersion >= 70300)
                                                appendPQExpBuffer(query, "    FROM %s\n    ",
-                                                                                 PQgetvalue(res, j, i_tgconstrrelname));
+                                                                 PQgetvalue(res, j, i_tgconstrrelname));
                                        else
                                                appendPQExpBuffer(query, "    FROM %s\n    ",
-                                                                                 fmtId(PQgetvalue(res, j, i_tgconstrrelname)));
+                                                  fmtId(PQgetvalue(res, j, i_tgconstrrelname)));
                                }
                                if (!tgdeferrable)
                                        appendPQExpBuffer(query, "NOT ");
@@ -6342,7 +6390,7 @@ dumpRules(Archive *fout, TableInfo *tblinfo, int numTables)
         */
        for (t = 0; t < numTables; t++)
        {
-               TableInfo          *tbinfo = &tblinfo[t];
+               TableInfo  *tbinfo = &tblinfo[t];
 
                if (!tbinfo->hasrules || !tbinfo->dump)
                        continue;
@@ -6358,7 +6406,7 @@ dumpRules(Archive *fout, TableInfo *tblinfo, int numTables)
                if (g_fout->remoteVersion >= 70300)
                {
                        appendPQExpBuffer(query,
-                                                         "SELECT pg_catalog.pg_get_ruledef(oid) AS definition,"
+                                  "SELECT pg_catalog.pg_get_ruledef(oid) AS definition,"
                                                          " oid, rulename "
                                                          "FROM pg_catalog.pg_rewrite "
                                                          "WHERE ev_class = '%s'::pg_catalog.oid "
@@ -6369,8 +6417,8 @@ dumpRules(Archive *fout, TableInfo *tblinfo, int numTables)
                else
                {
                        /*
-                        * We include pg_rules in the cross since it filters out all view
-                        * rules (pjw 15-Sep-2000).
+                        * We include pg_rules in the cross since it filters out all
+                        * view rules (pjw 15-Sep-2000).
                         */
                        appendPQExpBuffer(query, "SELECT definition,"
                                                          "   pg_rewrite.oid, pg_rewrite.rulename "
@@ -6378,9 +6426,9 @@ dumpRules(Archive *fout, TableInfo *tblinfo, int numTables)
                                                          "WHERE pg_class.relname = ");
                        appendStringLiteral(query, tbinfo->relname, true);
                        appendPQExpBuffer(query,
-                                                         "    AND pg_rewrite.ev_class = pg_class.oid "
-                                                         "    AND pg_rules.tablename = pg_class.relname "
-                                                         "    AND pg_rules.rulename = pg_rewrite.rulename "
+                                                       "    AND pg_rewrite.ev_class = pg_class.oid "
+                                                "    AND pg_rules.tablename = pg_class.relname "
+                                          "    AND pg_rules.rulename = pg_rewrite.rulename "
                                                          "ORDER BY pg_rewrite.oid");
                }
 
@@ -6448,7 +6496,7 @@ dumpRules(Archive *fout, TableInfo *tblinfo, int numTables)
 static void
 selectSourceSchema(const char *schemaName)
 {
-       static char        *curSchemaName = NULL;
+       static char *curSchemaName = NULL;
        PQExpBuffer query;
        PGresult   *res;
 
@@ -6606,11 +6654,12 @@ myFormatType(const char *typname, int32 typmod)
                                                          precision, scale);
                }
        }
+
        /*
         * char is an internal single-byte data type; Let's make sure we force
         * it through with quotes. - thomas 1998-12-13
         */
-       else if (strcmp(typname, "char")==0)
+       else if (strcmp(typname, "char") == 0)
                appendPQExpBuffer(buf, "\"char\"");
        else
                appendPQExpBuffer(buf, "%s", fmtId(typname));
@@ -6657,12 +6706,12 @@ fmtCopyColumnList(const TableInfo *ti)
 {
        static PQExpBuffer q = NULL;
        int                     numatts = ti->numatts;
-       char**  attnames = ti->attnames;
-       bool*   attisdropped = ti->attisdropped;
-       bool    needComma;
-       int i;
+       char      **attnames = ti->attnames;
+       bool       *attisdropped = ti->attisdropped;
+       bool            needComma;
+       int                     i;
 
-       if (q)                          /* first time through? */
+       if (q)                                          /* first time through? */
                resetPQExpBuffer(q);
        else
                q = createPQExpBuffer();
index d89a06c..d7e214c 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_dump.h,v 1.98 2002/08/22 00:01:46 tgl Exp $
+ * $Id: pg_dump.h,v 1.99 2002/09/04 20:31:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
  *
  * NOTE: the structures described here live for the entire pg_dump run;
  * and in most cases we make a struct for every object we can find in the
- * catalogs, not only those we are actually going to dump.  Hence, it's
+ * catalogs, not only those we are actually going to dump.     Hence, it's
  * best to store a minimal amount of per-object info in these structs,
  * and retrieve additional per-object info when and if we dump a specific
- * object.  In particular, try to avoid retrieving expensive-to-compute
+ * object.     In particular, try to avoid retrieving expensive-to-compute
  * information until it's known to be needed.
  */
 
@@ -60,7 +60,7 @@ typedef struct _funcInfo
        char       *usename;            /* name of owner, or empty string */
        Oid                     lang;
        int                     nargs;
-       char       **argtypes;          /* OIDs */
+       char      **argtypes;           /* OIDs */
        char       *prorettype;         /* OID */
        char       *proacl;
        bool            dumped;                 /* true if already dumped */
@@ -119,8 +119,9 @@ typedef struct _tableInfo
        bool            dump;                   /* true if we want to dump it */
 
        /*
-        * These fields are computed only if we decide the table is interesting
-        * (it's either a table to dump, or a direct parent of a dumpable table).
+        * These fields are computed only if we decide the table is
+        * interesting (it's either a table to dump, or a direct parent of a
+        * dumpable table).
         */
        int                     numatts;                /* number of attributes */
        char      **attnames;           /* the attribute names */
@@ -129,6 +130,7 @@ typedef struct _tableInfo
        int                *attstattarget;      /* attribute statistics targets */
        bool       *attisdropped;       /* true if attr is dropped; don't dump it */
        bool       *attisserial;        /* true if attr is serial or bigserial */
+
        /*
         * Note: we need to store per-attribute notnull and default stuff for
         * all interesting tables so that we can tell which constraints were
@@ -214,20 +216,20 @@ extern InhInfo *getInherits(int *numInherits);
 extern void getTableAttrs(TableInfo *tbinfo, int numTables);
 extern void dumpDBComment(Archive *outfile);
 extern void dumpNamespaces(Archive *fout,
-                                                  NamespaceInfo *nsinfo, int numNamespaces);
+                          NamespaceInfo *nsinfo, int numNamespaces);
 extern void dumpTypes(Archive *fout, FuncInfo *finfo, int numFuncs,
                  TypeInfo *tinfo, int numTypes);
 extern void dumpProcLangs(Archive *fout, FuncInfo finfo[], int numFuncs);
 extern void dumpFuncs(Archive *fout, FuncInfo finfo[], int numFuncs);
 extern void dumpCasts(Archive *fout, FuncInfo *finfo, int numFuncs,
-                                         TypeInfo *tinfo, int numTypes);
+                 TypeInfo *tinfo, int numTypes);
 extern void dumpAggs(Archive *fout, AggInfo agginfo[], int numAggregates);
 extern void dumpOprs(Archive *fout, OprInfo *oprinfo, int numOperators);
 extern void dumpOpclasses(Archive *fout,
-                                                 OpclassInfo *opcinfo, int numOpclasses);
+                         OpclassInfo *opcinfo, int numOpclasses);
 extern void dumpTables(Archive *fout, TableInfo tblinfo[], int numTables,
-                                          const bool aclsSkip,
-                                          const bool schemaOnly, const bool dataOnly);
+                  const bool aclsSkip,
+                  const bool schemaOnly, const bool dataOnly);
 extern void dumpIndexes(Archive *fout, TableInfo *tbinfo, int numTables);
 
 /* sprompt.h */
index 3103561..1ff698e 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.5 2002/09/02 22:18:56 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.6 2002/09/04 20:31:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -45,17 +45,17 @@ static void dumpUserConfig(PGconn *conn, const char *username);
 static void makeAlterConfigCommand(const char *arrayitem, const char *type, const char *name);
 static void dumpDatabases(PGconn *conn);
 
-static int runPgDump(const char *dbname);
+static int     runPgDump(const char *dbname);
 static PGconn *connectDatabase(const char *dbname, const char *pghost, const char *pgport,
-                                                          const char *pguser, bool require_password);
+                               const char *pguser, bool require_password);
 static PGresult *executeQuery(PGconn *conn, const char *query);
 static char *findPgDump(const char *argv0);
 
 
-char *pgdumploc;
+char      *pgdumploc;
 PQExpBuffer pgdumpopts;
-bool output_clean = false;
-bool verbose = false;
+bool           output_clean = false;
+bool           verbose = false;
 
 
 
@@ -169,20 +169,20 @@ main(int argc, char *argv[])
                                appendPQExpBuffer(pgdumpopts, " -W");
                                break;
 
-            default:
-                fprintf(stderr, _("Try '%s --help' for more information.\n"), progname);
-                exit(1);
+                       default:
+                               fprintf(stderr, _("Try '%s --help' for more information.\n"), progname);
+                               exit(1);
                }
        }
 
-    if (optind < argc)
-    {
-        fprintf(stderr,
+       if (optind < argc)
+       {
+               fprintf(stderr,
                                _("%s: too many command line options (first is '%s')\n"
                                  "Try '%s --help' for more information.\n"),
-                progname, argv[optind], progname);
-        exit(1);
-    }
+                               progname, argv[optind], progname);
+               exit(1);
+       }
 
 
        conn = connectDatabase("template1", pghost, pgport, pguser, force_password);
@@ -217,32 +217,32 @@ help(void)
 
        printf(_("Options:\n"));
 #ifdef HAVE_GETOPT_LONG
-    printf(_("  -c, --clean              clean (drop) schema prior to create\n"));
+       printf(_("  -c, --clean              clean (drop) schema prior to create\n"));
        printf(_("  -d, --inserts            dump data as INSERT, rather than COPY, commands\n"));
        printf(_("  -D, --column-inserts     dump data as INSERT commands with column names\n"));
        printf(_("  -g, --globals-only       only dump global objects, no databases\n"));
-    printf(_("  -h, --host=HOSTNAME      database server host name\n"));
+       printf(_("  -h, --host=HOSTNAME      database server host name\n"));
        printf(_("  -i, --ignore-version     proceed even when server version mismatches\n"
                         "                           pg_dumpall version\n"));
        printf(_("  -o, --oids               include OIDs in dump\n"));
-    printf(_("  -p, --port=PORT          database server port number\n"));
-    printf(_("  -U, --username=NAME      connect as specified database user\n"));
+       printf(_("  -p, --port=PORT          database server port number\n"));
+       printf(_("  -U, --username=NAME      connect as specified database user\n"));
        printf(_("  -v, --verbose            verbose mode\n"));
-    printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
-#else /* not HAVE_GETOPT_LONG */
-    printf(_("  -c                       clean (drop) schema prior to create\n"));
+       printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
+#else                                                  /* not HAVE_GETOPT_LONG */
+       printf(_("  -c                       clean (drop) schema prior to create\n"));
        printf(_("  -d                       dump data as INSERT, rather than COPY, commands\n"));
        printf(_("  -D                       dump data as INSERT commands with column names\n"));
        printf(_("  -g                       only dump global objects, no databases\n"));
-    printf(_("  -h HOSTNAME              database server host name\n"));
+       printf(_("  -h HOSTNAME              database server host name\n"));
        printf(_("  -i                       proceed even when server version mismatches\n"
                         "                           pg_dumpall version\n"));
        printf(_("  -o                       include OIDs in dump\n"));
-    printf(_("  -p PORT                  database server port number\n"));
-    printf(_("  -U NAME                  connect as specified database user\n"));
+       printf(_("  -p PORT                  database server port number\n"));
+       printf(_("  -U NAME                  connect as specified database user\n"));
        printf(_("  -v                       verbose mode\n"));
-    printf(_("  -W                       force password prompt (should happen automatically)\n"));
-#endif /* not HAVE_GETOPT_LONG */
+       printf(_("  -W                       force password prompt (should happen automatically)\n"));
+#endif   /* not HAVE_GETOPT_LONG */
 
        printf(_("\nThe SQL script will be written to the standard output.\n\n"));
        printf(_("Report bugs to <pgsql-bugs@postgresql.org>.\n"));
@@ -256,8 +256,8 @@ help(void)
 static void
 dumpUsers(PGconn *conn)
 {
-       PGresult *res;
-       int i;
+       PGresult   *res;
+       int                     i;
 
        printf("--\n-- Users\n--\n\n");
        printf("DELETE FROM pg_shadow WHERE usesysid <> (SELECT datdba FROM pg_database WHERE datname = 'template0');\n\n");
@@ -283,12 +283,12 @@ dumpUsers(PGconn *conn)
                        appendStringLiteral(buf, PQgetvalue(res, i, 2), true);
                }
 
-               if (strcmp(PQgetvalue(res, i, 3), "t")==0)
+               if (strcmp(PQgetvalue(res, i, 3), "t") == 0)
                        appendPQExpBuffer(buf, " CREATEDB");
                else
                        appendPQExpBuffer(buf, " NOCREATEDB");
 
-               if (strcmp(PQgetvalue(res, i, 4), "t")==0)
+               if (strcmp(PQgetvalue(res, i, 4), "t") == 0)
                        appendPQExpBuffer(buf, " CREATEUSER");
                else
                        appendPQExpBuffer(buf, " NOCREATEUSER");
@@ -316,8 +316,8 @@ dumpUsers(PGconn *conn)
 static void
 dumpGroups(PGconn *conn)
 {
-       PGresult *res;
-       int i;
+       PGresult   *res;
+       int                     i;
 
        printf("--\n-- Groups\n--\n\n");
        printf("DELETE FROM pg_group;\n\n");
@@ -327,8 +327,8 @@ dumpGroups(PGconn *conn)
        for (i = 0; i < PQntuples(res); i++)
        {
                PQExpBuffer buf = createPQExpBuffer();
-               char *val;
-               char *tok;
+               char       *val;
+               char       *tok;
 
                appendPQExpBuffer(buf, "CREATE GROUP %s WITH SYSID %s;\n",
                                                  fmtId(PQgetvalue(res, i, 0)),
@@ -338,9 +338,9 @@ dumpGroups(PGconn *conn)
                tok = strtok(val, ",{}");
                do
                {
-                       PGresult *res2;
+                       PGresult   *res2;
                        PQExpBuffer buf2 = createPQExpBuffer();
-                       int j;
+                       int                     j;
 
                        appendPQExpBuffer(buf2, "SELECT usename FROM pg_shadow WHERE usesysid = %s;", tok);
                        res2 = executeQuery(conn, buf2->data);
@@ -382,24 +382,27 @@ dumpGroups(PGconn *conn)
 static void
 dumpCreateDB(PGconn *conn)
 {
-       PGresult *res;
-       int i;
+       PGresult   *res;
+       int                     i;
 
        printf("--\n-- Database creation\n--\n\n");
 
-       /* Basically this query returns: dbname, dbowner, encoding, istemplate, dbpath */
+       /*
+        * Basically this query returns: dbname, dbowner, encoding,
+        * istemplate, dbpath
+        */
        res = executeQuery(conn, "SELECT datname, coalesce(usename, (select usename from pg_shadow where usesysid=(select datdba from pg_database where datname='template0'))), pg_encoding_to_char(d.encoding), datistemplate, datpath FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) WHERE datallowconn ORDER BY 1;");
 
        for (i = 0; i < PQntuples(res); i++)
        {
                PQExpBuffer buf = createPQExpBuffer();
-               char *dbname = PQgetvalue(res, i, 0);
-               char *dbowner = PQgetvalue(res, i, 1);
-               char *dbencoding = PQgetvalue(res, i, 2);
-               char *dbistemplate = PQgetvalue(res, i, 3);
-               char *dbpath = PQgetvalue(res, i, 4);
+               char       *dbname = PQgetvalue(res, i, 0);
+               char       *dbowner = PQgetvalue(res, i, 1);
+               char       *dbencoding = PQgetvalue(res, i, 2);
+               char       *dbistemplate = PQgetvalue(res, i, 3);
+               char       *dbpath = PQgetvalue(res, i, 4);
 
-               if (strcmp(dbname, "template1")==0)
+               if (strcmp(dbname, "template1") == 0)
                        continue;
 
                if (output_clean)
@@ -408,7 +411,7 @@ dumpCreateDB(PGconn *conn)
                appendPQExpBuffer(buf, "CREATE DATABASE %s", fmtId(dbname));
                appendPQExpBuffer(buf, " WITH OWNER = %s TEMPLATE = template0", fmtId(dbowner));
 
-               if (strcmp(dbpath, "")!=0)
+               if (strcmp(dbpath, "") != 0)
                {
                        appendPQExpBuffer(buf, " LOCATION = ");
                        appendStringLiteral(buf, dbpath, true);
@@ -419,7 +422,7 @@ dumpCreateDB(PGconn *conn)
 
                appendPQExpBuffer(buf, ";\n");
 
-               if (strcmp(dbistemplate, "t")==0)
+               if (strcmp(dbistemplate, "t") == 0)
                {
                        appendPQExpBuffer(buf, "UPDATE pg_database SET datistemplate = 't' WHERE datname = ");
                        appendStringLiteral(buf, dbname, true);
@@ -444,9 +447,9 @@ static void
 dumpDatabaseConfig(PGconn *conn, const char *dbname)
 {
        PQExpBuffer buf = createPQExpBuffer();
-       int count = 1;
+       int                     count = 1;
 
-       for(;;)
+       for (;;)
        {
                PGresult   *res;
 
@@ -480,9 +483,9 @@ static void
 dumpUserConfig(PGconn *conn, const char *username)
 {
        PQExpBuffer buf = createPQExpBuffer();
-       int count = 1;
+       int                     count = 1;
 
-       for(;;)
+       for (;;)
        {
                PGresult   *res;
 
@@ -515,8 +518,8 @@ dumpUserConfig(PGconn *conn, const char *username)
 static void
 makeAlterConfigCommand(const char *arrayitem, const char *type, const char *name)
 {
-       char *pos;
-       char *mine;
+       char       *pos;
+       char       *mine;
        PQExpBuffer buf = createPQExpBuffer();
 
        mine = strdup(arrayitem);
@@ -543,15 +546,16 @@ makeAlterConfigCommand(const char *arrayitem, const char *type, const char *name
 static void
 dumpDatabases(PGconn *conn)
 {
-       PGresult *res;
-       int i;
+       PGresult   *res;
+       int                     i;
 
        res = executeQuery(conn, "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;");
        for (i = 0; i < PQntuples(res); i++)
        {
-               int ret;
+               int                     ret;
+
+               char       *dbname = PQgetvalue(res, i, 0);
 
-               char *dbname = PQgetvalue(res, i, 0);
                if (verbose)
                        fprintf(stderr, _("%s: dumping database \"%s\"...\n"), progname, dbname);
 
@@ -576,7 +580,7 @@ static int
 runPgDump(const char *dbname)
 {
        PQExpBuffer cmd = createPQExpBuffer();
-       int ret;
+       int                     ret;
 
        appendPQExpBuffer(cmd, "%s %s -X use-set-session-authorization -Fp %s",
                                          pgdumploc, pgdumpopts->data, dbname);
@@ -644,7 +648,7 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport,
        if (PQstatus(conn) == CONNECTION_BAD)
        {
                fprintf(stderr, _("%s: could not connect to database %s: %s\n"),
-                                       progname, dbname, PQerrorMessage(conn));
+                               progname, dbname, PQerrorMessage(conn));
                exit(0);
        }
 
@@ -659,7 +663,7 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport,
 static PGresult *
 executeQuery(PGconn *conn, const char *query)
 {
-       PGresult *res;
+       PGresult   *res;
 
        res = PQexec(conn, query);
        if (!res ||
@@ -696,7 +700,8 @@ findPgDump(const char *argv0)
                appendPQExpBuffer(cmd, "pg_dump");
        else
        {
-               char *dir = strdup(argv0);
+               char       *dir = strdup(argv0);
+
                *(dir + (last - argv0)) = '\0';
                appendPQExpBuffer(cmd, "%s/pg_dump", dir);
        }
@@ -704,15 +709,15 @@ findPgDump(const char *argv0)
        result = strdup(cmd->data);
 
        appendPQExpBuffer(cmd, " -V >/dev/null 2>&1");
-       if (system(cmd->data)==0)
+       if (system(cmd->data) == 0)
                goto end;
 
        result = BINDIR "/pg_dump";
-       if (system(BINDIR "/pg_dump -V >/dev/null 2>&1")==0)
+       if (system(BINDIR "/pg_dump -V >/dev/null 2>&1") == 0)
                goto end;
 
        fprintf(stderr, _("%s: could not find pg_dump\n"
-                                         "Make sure it is in the path or in the same directory as %s.\n"),
+               "Make sure it is in the path or in the same directory as %s.\n"),
                        progname, progname);
        exit(1);
 
index 4aa9270..382b0db 100644 (file)
@@ -34,7 +34,7 @@
  *
  *
  * IDENTIFICATION
- *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.40 2002/08/28 20:57:22 petere Exp $
+ *             $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.41 2002/09/04 20:31:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -379,75 +379,75 @@ usage(const char *progname)
        printf(_("Options:\n"));
 
 #ifdef HAVE_GETOPT_LONG
-       printf(_(       "  -a, --data-only          restore only the data, no schema\n"));
-       printf(_(       "  -c, --clean              clean (drop) schema prior to create\n"));
-       printf(_(       "  -C, --create             issue commands to create the database\n"));
-       printf(_(       "  -d, --dbname=NAME        output database name\n"));
-       printf(_(       "  -f, --file=FILENAME      output file name\n"));
-       printf(_(       "  -F, --format={c|t}       specify backup file format\n"));
-       printf(_(       "  -h, --host=HOSTNAME      database server host name\n"));
-       printf(_(       "  -i, --ignore-version     proceed even when server version mismatches\n"));
-       printf(_(       "  -I, --index=NAME         restore named index\n"));
-       printf(_(       "  -l, --list               print summarized TOC of the archive\n"));
-       printf(_(       "  -L, --use-list=FILENAME  use specified table of contents for ordering\n"
-                               "                           output from this file\n"));
-       printf(_(       "  -N, --orig-order         restore in original dump order\n"));
-       printf(_(       "  -o, --oid-order          restore in OID order\n"));
-       printf(_(       "  -O, --no-owner           do not reconnect to database to match\n"
-                               "                           object owner\n"));
-       printf(_(       "  -p, --port=PORT          database server port number\n"));
-       printf(_(       "  -P, --function=NAME(args)restore named function\n"));
-       printf(_(       "  -r, --rearrange          rearrange output to put indexes etc. at end\n"));
-       printf(_(       "  -R, --no-reconnect       disallow ALL reconnections to the database\n"));
-       printf(_(       "  -s, --schema-only        restore only the schema, no data\n"));
-       printf(_(       "  -S, --superuser=NAME     specify the superuser user name to use for\n"
-                               "                           disabling triggers\n"));
-       printf(_(       "  -t, --table=NAME         restore named table\n"));
-       printf(_(       "  -T, --trigger=NAME       restore named trigger\n"));
-       printf(_(       "  -U, --username=NAME      connect as specified database user\n"));
-       printf(_(       "  -v, --verbose            verbose mode\n"));
-       printf(_(       "  -W, --password           force password prompt (should happen automatically)\n"));
-       printf(_(       "  -x, --no-privileges      skip restoration of access privileges (grant/revoke)\n"));
-       printf(_(       "  -X use-set-session-authorization, --use-set-session-authorization\n"
-                               "                           use SET SESSION AUTHORIZATION commands instead\n"
-                               "                           of reconnecting, if possible\n"));
-       printf(_(       "  -X disable-triggers, --disable-triggers\n"
-                               "                           disable triggers during data-only restore\n"));
+       printf(_("  -a, --data-only          restore only the data, no schema\n"));
+       printf(_("  -c, --clean              clean (drop) schema prior to create\n"));
+       printf(_("  -C, --create             issue commands to create the database\n"));
+       printf(_("  -d, --dbname=NAME        output database name\n"));
+       printf(_("  -f, --file=FILENAME      output file name\n"));
+       printf(_("  -F, --format={c|t}       specify backup file format\n"));
+       printf(_("  -h, --host=HOSTNAME      database server host name\n"));
+       printf(_("  -i, --ignore-version     proceed even when server version mismatches\n"));
+       printf(_("  -I, --index=NAME         restore named index\n"));
+       printf(_("  -l, --list               print summarized TOC of the archive\n"));
+       printf(_("  -L, --use-list=FILENAME  use specified table of contents for ordering\n"
+                        "                           output from this file\n"));
+       printf(_("  -N, --orig-order         restore in original dump order\n"));
+       printf(_("  -o, --oid-order          restore in OID order\n"));
+       printf(_("  -O, --no-owner           do not reconnect to database to match\n"
+                        "                           object owner\n"));
+       printf(_("  -p, --port=PORT          database server port number\n"));
+       printf(_("  -P, --function=NAME(args)restore named function\n"));
+       printf(_("  -r, --rearrange          rearrange output to put indexes etc. at end\n"));
+       printf(_("  -R, --no-reconnect       disallow ALL reconnections to the database\n"));
+       printf(_("  -s, --schema-only        restore only the schema, no data\n"));
+       printf(_("  -S, --superuser=NAME     specify the superuser user name to use for\n"
+                        "                           disabling triggers\n"));
+       printf(_("  -t, --table=NAME         restore named table\n"));
+       printf(_("  -T, --trigger=NAME       restore named trigger\n"));
+       printf(_("  -U, --username=NAME      connect as specified database user\n"));
+       printf(_("  -v, --verbose            verbose mode\n"));
+       printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
+       printf(_("  -x, --no-privileges      skip restoration of access privileges (grant/revoke)\n"));
+       printf(_("  -X use-set-session-authorization, --use-set-session-authorization\n"
+                        "                           use SET SESSION AUTHORIZATION commands instead\n"
+                  "                           of reconnecting, if possible\n"));
+       printf(_("  -X disable-triggers, --disable-triggers\n"
+                        "                           disable triggers during data-only restore\n"));
 
 #else                                                  /* not HAVE_GETOPT_LONG */
-       printf(_(       "  -a                       restore only the data, no schema\n"));
-       printf(_(       "  -c                       clean (drop) schema prior to create\n"));
-       printf(_(       "  -C                       issue commands to create the database\n"));
-       printf(_(       "  -d NAME                  output database name\n"));
-       printf(_(       "  -f FILENAME              output file name\n"));
-       printf(_(       "  -F {c|t}                 specify backup file format\n"));
-       printf(_(       "  -h HOSTNAME              database server host name\n"));
-       printf(_(       "  -i                       proceed even when server version mismatches\n"));
-       printf(_(       "  -I NAME                  restore named index\n"));
-       printf(_(       "  -l                       print summarized TOC of the archive\n"));
-       printf(_(       "  -L FILENAME              use specified table of contents for ordering\n"
-                               "                           output from this file\n"));
-       printf(_(       "  -N                       restore in original dump order\n"));
-       printf(_(       "  -o                       restore in OID order\n"));
-       printf(_(       "  -O                       do not reconnect to database to match\n"
-                               "                           object owner\n"));
-       printf(_(       "  -p PORT                  database server port number\n"));
-       printf(_(       "  -P NAME(args)            restore named function\n"));
-       printf(_(       "  -r                       rearrange output to put indexes etc. at end\n"));
-       printf(_(       "  -R                       disallow ALL reconnections to the database\n"));
-       printf(_(       "  -s                       restore only the schema, no data\n"));
-       printf(_(       "  -S NAME                  specify the superuser user name to use for\n"
-                               "                           disabling triggers\n"));
-       printf(_(       "  -t NAME                  restore named table\n"));
-       printf(_(       "  -T NAME                  restore named trigger\n"));
-       printf(_(       "  -U NAME                  connect as specified database user\n"));
-       printf(_(       "  -v                       verbose mode\n"));
-       printf(_(       "  -W                       force password prompt (should happen automatically)\n"));
-       printf(_(       "  -x                       skip restoration of access privileges (grant/revoke)\n"));
-       printf(_(       "  -X use-set-session-authorization\n"
-                               "                           use SET SESSION AUTHORIZATION commands instead\n"
-                               "                           of reconnecting, if possible\n"));
-       printf(_(       "  -X disable-triggers      disable triggers during data-only restore\n"));
+       printf(_("  -a                       restore only the data, no schema\n"));
+       printf(_("  -c                       clean (drop) schema prior to create\n"));
+       printf(_("  -C                       issue commands to create the database\n"));
+       printf(_("  -d NAME                  output database name\n"));
+       printf(_("  -f FILENAME              output file name\n"));
+       printf(_("  -F {c|t}                 specify backup file format\n"));
+       printf(_("  -h HOSTNAME              database server host name\n"));
+       printf(_("  -i                       proceed even when server version mismatches\n"));
+       printf(_("  -I NAME                  restore named index\n"));
+       printf(_("  -l                       print summarized TOC of the archive\n"));
+       printf(_("  -L FILENAME              use specified table of contents for ordering\n"
+                        "                           output from this file\n"));
+       printf(_("  -N                       restore in original dump order\n"));
+       printf(_("  -o                       restore in OID order\n"));
+       printf(_("  -O                       do not reconnect to database to match\n"
+                        "                           object owner\n"));
+       printf(_("  -p PORT                  database server port number\n"));
+       printf(_("  -P NAME(args)            restore named function\n"));
+       printf(_("  -r                       rearrange output to put indexes etc. at end\n"));
+       printf(_("  -R                       disallow ALL reconnections to the database\n"));
+       printf(_("  -s                       restore only the schema, no data\n"));
+       printf(_("  -S NAME                  specify the superuser user name to use for\n"
+                        "                           disabling triggers\n"));
+       printf(_("  -t NAME                  restore named table\n"));
+       printf(_("  -T NAME                  restore named trigger\n"));
+       printf(_("  -U NAME                  connect as specified database user\n"));
+       printf(_("  -v                       verbose mode\n"));
+       printf(_("  -W                       force password prompt (should happen automatically)\n"));
+       printf(_("  -x                       skip restoration of access privileges (grant/revoke)\n"));
+       printf(_("  -X use-set-session-authorization\n"
+                        "                           use SET SESSION AUTHORIZATION commands instead\n"
+                  "                           of reconnecting, if possible\n"));
+       printf(_("  -X disable-triggers      disable triggers during data-only restore\n"));
 #endif
 
        printf(_("\nIf no input file name is supplied, then standard input is used.\n\n"));
@@ -486,8 +486,8 @@ static char *
 _cleanupFuncName(char *name)
 {
        int                     i;
-       char            *ch;
-       
+       char       *ch;
+
        if (!name || !name[0])
                return NULL;
 
@@ -497,7 +497,7 @@ _cleanupFuncName(char *name)
        {
                strcpy(name, &name[1]);
                if (strchr(name, '"') != NULL)
-                       strcpy(strchr(name, '"'), strchr(name, '"')+1);
+                       strcpy(strchr(name, '"'), strchr(name, '"') + 1);
        }
        /* otherwise, convert function name to lowercase... */
        else
@@ -508,21 +508,20 @@ _cleanupFuncName(char *name)
        }
 
        /* strip out any space before paren */
-       ch = strchr(name,'(');
-       while (ch && ch > name && *(ch-1) == ' ')
+       ch = strchr(name, '(');
+       while (ch && ch > name && *(ch - 1) == ' ')
        {
                strcpy(ch - 1, ch);
                ch--;
        }
 
        /*
-        *      Strip out spaces after commas in parameter list.
-        *      We can't remove all spaces because some types, like
-        *      'double precision' have spaces.
+        * Strip out spaces after commas in parameter list. We can't remove
+        * all spaces because some types, like 'double precision' have spaces.
         */
-       if ((ch = strchr(name,'(')) != NULL)
+       if ((ch = strchr(name, '(')) != NULL)
        {
-               while ((ch = strstr(ch,", ")) != NULL)
+               while ((ch = strstr(ch, ", ")) != NULL)
                        strcpy(ch + 1, ch + 2);
        }
 
index 6bc0d98..9c15b3f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/sprompt.c,v 1.1 2002/07/06 20:12:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/sprompt.c,v 1.2 2002/09/04 20:31:35 momjian Exp $
  */
 
 /*
@@ -24,7 +24,7 @@
 #include <termios.h>
 #endif
 
-bool prompt_state = false;
+bool           prompt_state = false;
 extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
 
 char *
index 11986cd..0d23007 100644 (file)
@@ -23,7 +23,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Header: /cvsroot/pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.4 2002/09/02 02:47:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.5 2002/09/04 20:31:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -220,8 +220,8 @@ main(int argc, char *argv[])
        if (ControlFile.state != DB_SHUTDOWNED && !force)
        {
                printf(_("The database server was not shut down cleanly.\n"
-                                "Resetting the transaction log may cause data to be lost.\n"
-                                "If you want to proceed anyway, use -f to force reset.\n"));
+                        "Resetting the transaction log may cause data to be lost.\n"
+                        "If you want to proceed anyway, use -f to force reset.\n"));
                exit(1);
        }
 
@@ -234,7 +234,7 @@ main(int argc, char *argv[])
                ControlFile.checkPointCopy.nextXid = set_xid;
 
        if (minXlogId > ControlFile.logId ||
-               (minXlogId == ControlFile.logId && minXlogSeg > ControlFile.logSeg))
+        (minXlogId == ControlFile.logId && minXlogSeg > ControlFile.logSeg))
        {
                ControlFile.logId = minXlogId;
                ControlFile.logSeg = minXlogSeg;
@@ -640,7 +640,7 @@ static void
 usage(void)
 {
        printf(_("%s resets the PostgreSQL transaction log.\n\n"), progname);
-    printf(_("Usage:\n  %s [OPTIONS] DATADIR\n\n"), progname);
+       printf(_("Usage:\n  %s [OPTIONS] DATADIR\n\n"), progname);
        printf(_("Options:\n"));
        printf(_("  -f                force update to be done\n"));
        printf(_("  -l FILEID,SEG     force minimum WAL starting location for new transaction log\n"));
index 0004022..b1e451c 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000-2002 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.79 2002/09/02 06:11:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.80 2002/09/04 20:31:35 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "command.h"
@@ -58,7 +58,7 @@ enum option_type
 };
 
 static char *scan_option(char **string, enum option_type type,
-                                                char *quote, bool semicolon);
+                       char *quote, bool semicolon);
 static char *unescape(const unsigned char *source, size_t len);
 
 static bool do_edit(const char *filename_arg, PQExpBuffer query_buf);
@@ -246,13 +246,13 @@ exec_command(const char *cmd,
                                        opt2q;
 
                /*
-                * Ideally we should treat the arguments as SQL identifiers.  But for
-                * backwards compatibility with 7.2 and older pg_dump files, we have
-                * to take unquoted arguments verbatim (don't downcase them).
-                * For now, double-quoted arguments may be stripped of double quotes
-                * (as if SQL identifiers).  By 7.4 or so, pg_dump files can be
-                * expected to double-quote all mixed-case \connect arguments,
-                * and then we can get rid of OT_SQLIDHACK.
+                * Ideally we should treat the arguments as SQL identifiers.  But
+                * for backwards compatibility with 7.2 and older pg_dump files,
+                * we have to take unquoted arguments verbatim (don't downcase
+                * them). For now, double-quoted arguments may be stripped of
+                * double quotes (as if SQL identifiers).  By 7.4 or so, pg_dump
+                * files can be expected to double-quote all mixed-case \connect
+                * arguments, and then we can get rid of OT_SQLIDHACK.
                 */
                opt1 = scan_option(&string, OT_SQLIDHACK, &opt1q, true);
                opt2 = scan_option(&string, OT_SQLIDHACK, &opt2q, true);
@@ -723,9 +723,7 @@ exec_command(const char *cmd,
                if (!quiet)
                {
                        if (pset.timing)
-                       {
                                puts(gettext(("Timing is on.")));
-                       }
                        else
                        {
                                puts(gettext(("Timing is off.")));
@@ -733,7 +731,7 @@ exec_command(const char *cmd,
                        }
                }
        }
-  
+
        /* \unset */
        else if (strcmp(cmd, "unset") == 0)
        {
@@ -931,8 +929,8 @@ scan_option(char **string, enum option_type type, char *quote, bool semicolon)
                        /*
                         * Next command: treat like end of line
                         *
-                        * XXX this means we can't conveniently accept options that
-                        * start with a backslash; therefore, option processing that
+                        * XXX this means we can't conveniently accept options that start
+                        * with a backslash; therefore, option processing that
                         * encourages use of backslashes is rather broken.
                         */
                case '\\':
@@ -1088,7 +1086,8 @@ scan_option(char **string, enum option_type type, char *quote, bool semicolon)
                         *
                         * If we are processing the option as a SQL identifier, then
                         * downcase unquoted letters and remove double-quotes --- but
-                        * doubled double-quotes become output double-quotes, per spec.
+                        * doubled double-quotes become output double-quotes, per
+                        * spec.
                         *
                         * Note that a string like FOO"BAR"BAZ will be converted to
                         * fooBARbaz; this is somewhat inconsistent with the SQL spec,
@@ -1124,7 +1123,7 @@ scan_option(char **string, enum option_type type, char *quote, bool semicolon)
                                        else
                                        {
                                                if (*cp != '"')
-                                                       break; /* whitespace or end of string */
+                                                       break;          /* whitespace or end of string */
                                                if (quote)
                                                        *quote = '"';
                                                inquotes = true;
@@ -1150,12 +1149,12 @@ scan_option(char **string, enum option_type type, char *quote, bool semicolon)
                                /* Strip any trailing semi-colons if requested */
                                if (semicolon)
                                {
-                                       int             i;
+                                       int                     i;
 
                                        for (i = token_len - 1;
                                                 i >= 0 && return_val[i] == ';';
                                                 i--)
-                                               /* skip */;
+                                                /* skip */ ;
 
                                        if (i < 0)
                                        {
@@ -1169,9 +1168,9 @@ scan_option(char **string, enum option_type type, char *quote, bool semicolon)
                                }
 
                                /*
-                                * If SQL identifier processing was requested,
-                                * then we strip out excess double quotes and downcase
-                                * unquoted letters.
+                                * If SQL identifier processing was requested, then we
+                                * strip out excess double quotes and downcase unquoted
+                                * letters.
                                 */
                                if (type == OT_SQLID || type == OT_SQLIDHACK)
                                {
@@ -1189,7 +1188,7 @@ scan_option(char **string, enum option_type type, char *quote, bool semicolon)
                                                        }
                                                        inquotes = !inquotes;
                                                        /* Collapse out quote at *cp */
-                                                       memmove(cp, cp+1, strlen(cp));
+                                                       memmove(cp, cp + 1, strlen(cp));
                                                        /* do not advance cp */
                                                }
                                                else
@@ -1550,8 +1549,8 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
                const char *tmpdirenv = getenv("TMPDIR");
 
                snprintf(fnametmp, sizeof(fnametmp), "%s/psql.edit.%ld.%ld",
-                               tmpdirenv ? tmpdirenv : "/tmp",
-                               (long) geteuid(), (long) getpid());
+                                tmpdirenv ? tmpdirenv : "/tmp",
+                                (long) geteuid(), (long) getpid());
 #else
                GetTempFileName(".", "psql", 0, fnametmp);
 #endif
index f8bf9c9..0277301 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.43 2002/08/27 20:16:48 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.44 2002/09/04 20:31:35 momjian Exp $
  */
 #include "postgres_fe.h"
 
@@ -295,7 +295,8 @@ SendQuery(const char *query)
        bool            success = false;
        PGresult   *results;
        PGnotify   *notify;
-       struct timeval before,after;
+       struct timeval before,
+                               after;
        struct timezone tz;
 
        if (!pset.db)
@@ -327,14 +328,10 @@ SendQuery(const char *query)
 
        cancelConn = pset.db;
        if (pset.timing)
-       {
                gettimeofday(&before, &tz);
-       }
        results = PQexec(pset.db, query);
        if (pset.timing)
-       {
                gettimeofday(&after, &tz);
-       }
        if (PQresultStatus(results) == PGRES_COPY_IN)
                copy_in_state = true;
        /* keep cancel connection for copy out state */
@@ -467,7 +464,7 @@ SendQuery(const char *query)
        /* Possible microtiming output */
        if (pset.timing && success)
                printf(gettext("Time: %.2f ms\n"),
-                          ((after.tv_sec-before.tv_sec)*1000000 + after.tv_usec - before.tv_usec) / 1000.0);
+                          ((after.tv_sec - before.tv_sec) * 1000000 + after.tv_usec - before.tv_usec) / 1000.0);
 
        return success;
 }
index 32f875d..90a9006 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.23 2002/06/20 16:00:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/copy.c,v 1.24 2002/09/04 20:31:35 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "copy.h"
@@ -123,7 +123,10 @@ parse_slash_copy(const char *args)
                        error = true;
                else
                {
-                       /* Allows old COPY syntax for backward compatibility 2002-06-19 */
+                       /*
+                        * Allows old COPY syntax for backward compatibility
+                        * 2002-06-19
+                        */
                        if (strcasecmp(token, "with") == 0)
                        {
                                token = strtokx(NULL, " \t\n\r", NULL, '\\', NULL, NULL, pset.encoding);
@@ -165,7 +168,10 @@ parse_slash_copy(const char *args)
                token = strtokx(NULL, " \t\n\r", NULL, '\\', NULL, NULL, pset.encoding);
                if (token)
                {
-                       /* Allows old COPY syntax for backward compatibility 2002-06-19 */
+                       /*
+                        * Allows old COPY syntax for backward compatibility
+                        * 2002-06-19
+                        */
                        if (strcasecmp(token, "using") == 0)
                        {
                                token = strtokx(NULL, " \t\n\r", NULL, '\\', NULL, NULL, pset.encoding);
@@ -212,10 +218,12 @@ parse_slash_copy(const char *args)
                                        else
                                                error = true;
                                }
-                               else error = true;
+                               else
+                                       error = true;
                        }
                }
-               else error = true;
+               else
+                       error = true;
        }
 
        free(line);
@@ -305,7 +313,7 @@ do_copy(const char *args)
 
        /* make sure the specified file is not a directory */
        fstat(fileno(copystream), &st);
-       if( S_ISDIR(st.st_mode) )
+       if (S_ISDIR(st.st_mode))
        {
                fclose(copystream);
                psql_error("%s: cannot COPY TO/FROM a directory\n",
index 4bf3b6c..239d984 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000-2002 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.67 2002/08/29 00:17:05 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.68 2002/09/04 20:31:35 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "describe.h"
 #define _(x) gettext((x))
 
 static bool describeOneTableDetails(const char *schemaname,
-                                                                       const char *relationname,
-                                                                       const char *oid,
-                                                                       bool verbose);
+                                               const char *relationname,
+                                               const char *oid,
+                                               bool verbose);
 static void processNamePattern(PQExpBuffer buf, const char *pattern,
-                                                          bool have_where, bool force_escape,
-                                                          const char *schemavar, const char *namevar,
-                                                          const char *altnamevar, const char *visibilityrule);
+                                  bool have_where, bool force_escape,
+                                  const char *schemavar, const char *namevar,
+                                  const char *altnamevar, const char *visibilityrule);
 
 
 static void *
@@ -71,19 +71,19 @@ describeAggregates(const char *pattern, bool verbose)
         * types and ones that work on all (denoted by input type = "any")
         */
        printfPQExpBuffer(&buf,
-                        "SELECT n.nspname as \"%s\",\n"
-                        "  p.proname AS \"%s\",\n"
-                        "  CASE p.proargtypes[0]\n"
-                        "    WHEN 'pg_catalog.\"any\"'::pg_catalog.regtype\n"
-                        "    THEN CAST('%s' AS pg_catalog.text)\n"
-                        "    ELSE pg_catalog.format_type(p.proargtypes[0], NULL)\n"
-                        "  END AS \"%s\",\n"
+                                         "SELECT n.nspname as \"%s\",\n"
+                                         "  p.proname AS \"%s\",\n"
+                                         "  CASE p.proargtypes[0]\n"
+                                       "    WHEN 'pg_catalog.\"any\"'::pg_catalog.regtype\n"
+                                         "    THEN CAST('%s' AS pg_catalog.text)\n"
+                         "    ELSE pg_catalog.format_type(p.proargtypes[0], NULL)\n"
+                                         "  END AS \"%s\",\n"
                         "  pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
-                        "FROM pg_catalog.pg_proc p\n"
-                        "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
-                        "WHERE p.proisagg\n",
-                        _("Schema"), _("Name"), _("(all types)"),
-                        _("Data type"), _("Description"));
+                                         "FROM pg_catalog.pg_proc p\n"
+       "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
+                                         "WHERE p.proisagg\n",
+                                         _("Schema"), _("Name"), _("(all types)"),
+                                         _("Data type"), _("Description"));
 
        processNamePattern(&buf, pattern, true, false,
                                           "n.nspname", "p.proname", NULL,
@@ -119,38 +119,39 @@ describeFunctions(const char *pattern, bool verbose)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                        "SELECT pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n"
-                        "  n.nspname as \"%s\",\n"
-                        "  p.proname as \"%s\",\n"
-                        "  pg_catalog.oidvectortypes(p.proargtypes) as \"%s\"",
-                        _("Result data type"), _("Schema"), _("Name"),
-                        _("Argument data types"));
+                "SELECT pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n"
+                                         "  n.nspname as \"%s\",\n"
+                                         "  p.proname as \"%s\",\n"
+                                 "  pg_catalog.oidvectortypes(p.proargtypes) as \"%s\"",
+                                         _("Result data type"), _("Schema"), _("Name"),
+                                         _("Argument data types"));
 
        if (verbose)
                appendPQExpBuffer(&buf,
-                                ",\n  u.usename as \"%s\",\n"
-                                "  l.lanname as \"%s\",\n"
-                                "  p.prosrc as \"%s\",\n"
-                                "  pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"",
-                                _("Owner"), _("Language"),
-                                _("Source code"), _("Description"));
+                                                 ",\n  u.usename as \"%s\",\n"
+                                                 "  l.lanname as \"%s\",\n"
+                                                 "  p.prosrc as \"%s\",\n"
+                         "  pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"",
+                                                 _("Owner"), _("Language"),
+                                                 _("Source code"), _("Description"));
 
        if (!verbose)
                appendPQExpBuffer(&buf,
-                          "\nFROM pg_catalog.pg_proc p"
-                          "\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n");
+                                                 "\nFROM pg_catalog.pg_proc p"
+                                                 "\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n");
        else
                appendPQExpBuffer(&buf,
-                          "\nFROM pg_catalog.pg_proc p"
-                          "\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace"
-                          "\n     LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang"
-                          "\n     LEFT JOIN pg_catalog.pg_user u ON u.usesysid = p.proowner\n");
+                                                 "\nFROM pg_catalog.pg_proc p"
+                                                 "\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace"
+                "\n     LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang"
+                                                 "\n     LEFT JOIN pg_catalog.pg_user u ON u.usesysid = p.proowner\n");
 
        /*
-        * we skip in/out funcs by excluding functions that take or return cstring
+        * we skip in/out funcs by excluding functions that take or return
+        * cstring
         */
        appendPQExpBuffer(&buf,
-                                         "WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype\n"
+          "WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype\n"
                                          "      AND p.proargtypes[0] <> 'pg_catalog.cstring'::pg_catalog.regtype\n"
                                          "      AND NOT p.proisagg\n");
 
@@ -190,33 +191,34 @@ describeTypes(const char *pattern, bool verbose)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                        "SELECT n.nspname as \"%s\",\n"
-                        "  pg_catalog.format_type(t.oid, NULL) AS \"%s\",\n",
-                        _("Schema"), _("Name"));
+                                         "SELECT n.nspname as \"%s\",\n"
+                                       "  pg_catalog.format_type(t.oid, NULL) AS \"%s\",\n",
+                                         _("Schema"), _("Name"));
        if (verbose)
                appendPQExpBuffer(&buf,
-                                "  t.typname AS \"%s\",\n"
-                                "  CASE WHEN t.typrelid != 0\n"
-                                "      THEN CAST('tuple' AS pg_catalog.text)\n"
-                                "    WHEN t.typlen < 0\n"
-                                "      THEN CAST('var' AS pg_catalog.text)\n"
-                                "    ELSE CAST(t.typlen AS pg_catalog.text)\n"
-                                "  END AS \"%s\",\n",
-                                _("Internal name"), _("Size"));
+                                                 "  t.typname AS \"%s\",\n"
+                                                 "  CASE WHEN t.typrelid != 0\n"
+                                                 "      THEN CAST('tuple' AS pg_catalog.text)\n"
+                                                 "    WHEN t.typlen < 0\n"
+                                                 "      THEN CAST('var' AS pg_catalog.text)\n"
+                                                 "    ELSE CAST(t.typlen AS pg_catalog.text)\n"
+                                                 "  END AS \"%s\",\n",
+                                                 _("Internal name"), _("Size"));
        appendPQExpBuffer(&buf,
-                        "  pg_catalog.obj_description(t.oid, 'pg_type') as \"%s\"\n",
-                        _("Description"));
+                       "  pg_catalog.obj_description(t.oid, 'pg_type') as \"%s\"\n",
+                                         _("Description"));
 
        appendPQExpBuffer(&buf, "FROM pg_catalog.pg_type t\n"
-                        "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n");
+                                         "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n");
 
        /*
         * do not include array types (start with underscore); do not include
-        * complex types (typrelid!=0) unless they are standalone composite types
+        * complex types (typrelid!=0) unless they are standalone composite
+        * types
         */
        appendPQExpBuffer(&buf, "WHERE (t.typrelid = 0 ");
        appendPQExpBuffer(&buf, "OR (SELECT c.relkind = 'c' FROM pg_catalog.pg_class c "
-                                                         "WHERE c.oid = t.typrelid)) ");
+                                         "WHERE c.oid = t.typrelid)) ");
        appendPQExpBuffer(&buf, "AND t.typname !~ '^_'\n");
 
        /* Match name pattern against either internal or external name */
@@ -255,18 +257,18 @@ describeOperators(const char *pattern)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                        "SELECT n.nspname as \"%s\",\n"
-                        "  o.oprname AS \"%s\",\n"
-                        "  CASE WHEN o.oprkind='l' THEN NULL ELSE pg_catalog.format_type(o.oprleft, NULL) END AS \"%s\",\n"
-                        "  CASE WHEN o.oprkind='r' THEN NULL ELSE pg_catalog.format_type(o.oprright, NULL) END AS \"%s\",\n"
-                        "  pg_catalog.format_type(o.oprresult, NULL) AS \"%s\",\n"
-                        "  coalesce(pg_catalog.obj_description(o.oid, 'pg_operator'),\n"
-                        "           pg_catalog.obj_description(o.oprcode, 'pg_proc')) AS \"%s\"\n"
-                        "FROM pg_catalog.pg_operator o\n"
-                        "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace\n",
-                        _("Schema"), _("Name"),
-                        _("Left arg type"), _("Right arg type"),
-                        _("Result type"), _("Description"));
+                                         "SELECT n.nspname as \"%s\",\n"
+                                         "  o.oprname AS \"%s\",\n"
+                                         "  CASE WHEN o.oprkind='l' THEN NULL ELSE pg_catalog.format_type(o.oprleft, NULL) END AS \"%s\",\n"
+                                         "  CASE WHEN o.oprkind='r' THEN NULL ELSE pg_catalog.format_type(o.oprright, NULL) END AS \"%s\",\n"
+                          "  pg_catalog.format_type(o.oprresult, NULL) AS \"%s\",\n"
+                "  coalesce(pg_catalog.obj_description(o.oid, 'pg_operator'),\n"
+                                         "           pg_catalog.obj_description(o.oprcode, 'pg_proc')) AS \"%s\"\n"
+                                         "FROM pg_catalog.pg_operator o\n"
+                                         "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace\n",
+                                         _("Schema"), _("Name"),
+                                         _("Left arg type"), _("Right arg type"),
+                                         _("Result type"), _("Description"));
 
        processNamePattern(&buf, pattern, false, true,
                                           "n.nspname", "o.oprname", NULL,
@@ -304,20 +306,20 @@ listAllDbs(bool verbose)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                        "SELECT d.datname as \"%s\",\n"
-                        "       u.usename as \"%s\"",
-                        _("Name"), _("Owner"));
+                                         "SELECT d.datname as \"%s\",\n"
+                                         "       u.usename as \"%s\"",
+                                         _("Name"), _("Owner"));
        appendPQExpBuffer(&buf,
-                        ",\n       pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\"",
-                        _("Encoding"));
+               ",\n       pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\"",
+                                         _("Encoding"));
        if (verbose)
                appendPQExpBuffer(&buf,
-                        ",\n       pg_catalog.obj_description(d.oid, 'pg_database') as \"%s\"",
-                                _("Description"));
+                                                 ",\n       pg_catalog.obj_description(d.oid, 'pg_database') as \"%s\"",
+                                                 _("Description"));
        appendPQExpBuffer(&buf,
                                          "\nFROM pg_catalog.pg_database d"
-                                         "\n  LEFT JOIN pg_catalog.pg_user u ON d.datdba = u.usesysid\n"
-                  "ORDER BY 1;");
+                 "\n  LEFT JOIN pg_catalog.pg_user u ON d.datdba = u.usesysid\n"
+                                         "ORDER BY 1;");
 
        res = PSQLexec(buf.data);
        termPQExpBuffer(&buf);
@@ -348,26 +350,27 @@ permissionsList(const char *pattern)
        initPQExpBuffer(&buf);
 
        /*
-        * we ignore indexes and toast tables since they have no meaningful rights
+        * we ignore indexes and toast tables since they have no meaningful
+        * rights
         */
        printfPQExpBuffer(&buf,
-                        "SELECT n.nspname as \"%s\",\n"
-                        "  c.relname as \"%s\",\n"
-                        "  c.relacl as \"%s\"\n"
-                        "FROM pg_catalog.pg_class c\n"
-                        "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
-                        "WHERE c.relkind IN ('r', 'v', 'S')\n",
-                        _("Schema"), _("Table"), _("Access privileges"));
+                                         "SELECT n.nspname as \"%s\",\n"
+                                         "  c.relname as \"%s\",\n"
+                                         "  c.relacl as \"%s\"\n"
+                                         "FROM pg_catalog.pg_class c\n"
+       "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
+                                         "WHERE c.relkind IN ('r', 'v', 'S')\n",
+                                         _("Schema"), _("Table"), _("Access privileges"));
 
        /*
         * Unless a schema pattern is specified, we suppress system and temp
-        * tables, since they normally aren't very interesting from a permissions
-        * point of view.  You can see 'em by explicit request though,
-        * eg with \z pg_catalog.*
+        * tables, since they normally aren't very interesting from a
+        * permissions point of view.  You can see 'em by explicit request
+        * though, eg with \z pg_catalog.*
         */
        processNamePattern(&buf, pattern, true, false,
                                           "n.nspname", "c.relname", NULL,
-                                          "pg_catalog.pg_table_is_visible(c.oid) AND n.nspname !~ '^pg_'");
+               "pg_catalog.pg_table_is_visible(c.oid) AND n.nspname !~ '^pg_'");
 
        appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
 
@@ -409,99 +412,99 @@ objectDescription(const char *pattern)
        initPQExpBuffer(&buf);
 
        appendPQExpBuffer(&buf,
-                        "SELECT DISTINCT tt.nspname AS \"%s\", tt.name AS \"%s\", tt.object AS \"%s\", d.description AS \"%s\"\n"
-                        "FROM (\n",
-                         _("Schema"), _("Name"), _("Object"), _("Description"));
+                                         "SELECT DISTINCT tt.nspname AS \"%s\", tt.name AS \"%s\", tt.object AS \"%s\", d.description AS \"%s\"\n"
+                                         "FROM (\n",
+                                 _("Schema"), _("Name"), _("Object"), _("Description"));
 
        /* Aggregate descriptions */
        appendPQExpBuffer(&buf,
-                        "  SELECT p.oid as oid, p.tableoid as tableoid,\n"
-                        "  n.nspname as nspname,\n"
-                        "  CAST(p.proname AS pg_catalog.text) as name,"
-                        "  CAST('%s' AS pg_catalog.text) as object\n"
-                        "  FROM pg_catalog.pg_proc p\n"
-                        "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
-                        "  WHERE p.proisagg\n",
-                        _("aggregate"));
+                                         "  SELECT p.oid as oid, p.tableoid as tableoid,\n"
+                                         "  n.nspname as nspname,\n"
+                                         "  CAST(p.proname AS pg_catalog.text) as name,"
+                                         "  CAST('%s' AS pg_catalog.text) as object\n"
+                                         "  FROM pg_catalog.pg_proc p\n"
+                                         "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
+                                         "  WHERE p.proisagg\n",
+                                         _("aggregate"));
        processNamePattern(&buf, pattern, true, false,
                                           "n.nspname", "p.proname", NULL,
                                           "pg_catalog.pg_function_is_visible(p.oid)");
 
        /* Function descriptions (except in/outs for datatypes) */
        appendPQExpBuffer(&buf,
-                        "UNION ALL\n"
-                        "  SELECT p.oid as oid, p.tableoid as tableoid,\n"
-                        "  n.nspname as nspname,\n"
-                        "  CAST(p.proname AS pg_catalog.text) as name,"
-                        "  CAST('%s' AS pg_catalog.text) as object\n"
-                        "  FROM pg_catalog.pg_proc p\n"
-                        "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
-
-                        "  WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype\n"
-                        "      AND p.proargtypes[0] <> 'pg_catalog.cstring'::pg_catalog.regtype\n"
-                        "      AND NOT p.proisagg\n",
-                        _("function"));
+                                         "UNION ALL\n"
+                                         "  SELECT p.oid as oid, p.tableoid as tableoid,\n"
+                                         "  n.nspname as nspname,\n"
+                                         "  CAST(p.proname AS pg_catalog.text) as name,"
+                                         "  CAST('%s' AS pg_catalog.text) as object\n"
+                                         "  FROM pg_catalog.pg_proc p\n"
+                                         "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
+
+        "  WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype\n"
+                                         "      AND p.proargtypes[0] <> 'pg_catalog.cstring'::pg_catalog.regtype\n"
+                                         "      AND NOT p.proisagg\n",
+                                         _("function"));
        processNamePattern(&buf, pattern, true, false,
                                           "n.nspname", "p.proname", NULL,
                                           "pg_catalog.pg_function_is_visible(p.oid)");
 
        /* Operator descriptions (only if operator has its own comment) */
        appendPQExpBuffer(&buf,
-                        "UNION ALL\n"
-                        "  SELECT o.oid as oid, o.tableoid as tableoid,\n"
-                        "  n.nspname as nspname,\n"
-                        "  CAST(o.oprname AS pg_catalog.text) as name,"
-                        "  CAST('%s' AS pg_catalog.text) as object\n"
-                        "  FROM pg_catalog.pg_operator o\n"
-                        "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace\n",
-                        _("operator"));
+                                         "UNION ALL\n"
+                                         "  SELECT o.oid as oid, o.tableoid as tableoid,\n"
+                                         "  n.nspname as nspname,\n"
+                                         "  CAST(o.oprname AS pg_catalog.text) as name,"
+                                         "  CAST('%s' AS pg_catalog.text) as object\n"
+                                         "  FROM pg_catalog.pg_operator o\n"
+                                         "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace\n",
+                                         _("operator"));
        processNamePattern(&buf, pattern, false, false,
                                           "n.nspname", "o.oprname", NULL,
                                           "pg_catalog.pg_operator_is_visible(o.oid)");
 
        /* Type description */
        appendPQExpBuffer(&buf,
-                        "UNION ALL\n"
-                        "  SELECT t.oid as oid, t.tableoid as tableoid,\n"
-                        "  n.nspname as nspname,\n"
-                        "  pg_catalog.format_type(t.oid, NULL) as name,"
-                        "  CAST('%s' AS pg_catalog.text) as object\n"
-                        "  FROM pg_catalog.pg_type t\n"
-                        "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n",
-                        _("data type"));
+                                         "UNION ALL\n"
+                                         "  SELECT t.oid as oid, t.tableoid as tableoid,\n"
+                                         "  n.nspname as nspname,\n"
+                                         "  pg_catalog.format_type(t.oid, NULL) as name,"
+                                         "  CAST('%s' AS pg_catalog.text) as object\n"
+                                         "  FROM pg_catalog.pg_type t\n"
+                                         "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n",
+                                         _("data type"));
        processNamePattern(&buf, pattern, false, false,
-                                          "n.nspname", "pg_catalog.format_type(t.oid, NULL)", NULL,
+                               "n.nspname", "pg_catalog.format_type(t.oid, NULL)", NULL,
                                           "pg_catalog.pg_type_is_visible(t.oid)");
 
        /* Relation (tables, views, indexes, sequences) descriptions */
        appendPQExpBuffer(&buf,
-                        "UNION ALL\n"
-                        "  SELECT c.oid as oid, c.tableoid as tableoid,\n"
-                        "  n.nspname as nspname,\n"
-                        "  CAST(c.relname AS pg_catalog.text) as name,\n"
-                        "  CAST(\n"
-                        "    CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'i' THEN '%s' WHEN 'S' THEN '%s' END"
-                        "  AS pg_catalog.text) as object\n"
-                        "  FROM pg_catalog.pg_class c\n"
-                        "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
-                        "  WHERE c.relkind IN ('r', 'v', 'i', 'S')\n",
-                        _("table"), _("view"), _("index"), _("sequence"));
+                                         "UNION ALL\n"
+                                         "  SELECT c.oid as oid, c.tableoid as tableoid,\n"
+                                         "  n.nspname as nspname,\n"
+                                         "  CAST(c.relname AS pg_catalog.text) as name,\n"
+                                         "  CAST(\n"
+                                         "    CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'i' THEN '%s' WHEN 'S' THEN '%s' END"
+                                         "  AS pg_catalog.text) as object\n"
+                                         "  FROM pg_catalog.pg_class c\n"
+                                         "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
+                                         "  WHERE c.relkind IN ('r', 'v', 'i', 'S')\n",
+                                         _("table"), _("view"), _("index"), _("sequence"));
        processNamePattern(&buf, pattern, true, false,
                                           "n.nspname", "c.relname", NULL,
                                           "pg_catalog.pg_table_is_visible(c.oid)");
 
        /* Rule description (ignore rules for views) */
        appendPQExpBuffer(&buf,
-                        "UNION ALL\n"
-                        "  SELECT r.oid as oid, r.tableoid as tableoid,\n"
-                        "  n.nspname as nspname,\n"
-                        "  CAST(r.rulename AS pg_catalog.text) as name,"
-                        "  CAST('%s' AS pg_catalog.text) as object\n"
-                        "  FROM pg_catalog.pg_rewrite r\n"
-                        "       JOIN pg_catalog.pg_class c ON c.oid = r.ev_class\n"
-                        "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
-                        "  WHERE r.rulename != '_RETURN'\n",
-                        _("rule"));
+                                         "UNION ALL\n"
+                                         "  SELECT r.oid as oid, r.tableoid as tableoid,\n"
+                                         "  n.nspname as nspname,\n"
+                                         "  CAST(r.rulename AS pg_catalog.text) as name,"
+                                         "  CAST('%s' AS pg_catalog.text) as object\n"
+                                         "  FROM pg_catalog.pg_rewrite r\n"
+                         "       JOIN pg_catalog.pg_class c ON c.oid = r.ev_class\n"
+                                         "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
+                                         "  WHERE r.rulename != '_RETURN'\n",
+                                         _("rule"));
        /* XXX not sure what to do about visibility rule here? */
        processNamePattern(&buf, pattern, true, false,
                                           "n.nspname", "r.rulename", NULL,
@@ -509,23 +512,23 @@ objectDescription(const char *pattern)
 
        /* Trigger description */
        appendPQExpBuffer(&buf,
-                        "UNION ALL\n"
-                        "  SELECT t.oid as oid, t.tableoid as tableoid,\n"
-                        "  n.nspname as nspname,\n"
-                        "  CAST(t.tgname AS pg_catalog.text) as name,"
-                        "  CAST('%s' AS pg_catalog.text) as object\n"
-                        "  FROM pg_catalog.pg_trigger t\n"
-                        "       JOIN pg_catalog.pg_class c ON c.oid = t.tgrelid\n"
-                        "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n",
-                        _("trigger"));
+                                         "UNION ALL\n"
+                                         "  SELECT t.oid as oid, t.tableoid as tableoid,\n"
+                                         "  n.nspname as nspname,\n"
+                                         "  CAST(t.tgname AS pg_catalog.text) as name,"
+                                         "  CAST('%s' AS pg_catalog.text) as object\n"
+                                         "  FROM pg_catalog.pg_trigger t\n"
+                          "       JOIN pg_catalog.pg_class c ON c.oid = t.tgrelid\n"
+                                         "       LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n",
+                                         _("trigger"));
        /* XXX not sure what to do about visibility rule here? */
        processNamePattern(&buf, pattern, false, false,
                                           "n.nspname", "t.tgname", NULL,
                                           "pg_catalog.pg_table_is_visible(c.oid)");
 
        appendPQExpBuffer(&buf,
-                        ") AS tt\n"
-                        "  JOIN pg_catalog.pg_description d ON (tt.oid = d.objoid and tt.tableoid = d.classoid and d.objsubid = 0)\n");
+                                         ") AS tt\n"
+                                         "  JOIN pg_catalog.pg_description d ON (tt.oid = d.objoid and tt.tableoid = d.classoid and d.objsubid = 0)\n");
 
        appendPQExpBuffer(&buf, "ORDER BY 1, 2, 3;");
 
@@ -561,11 +564,11 @@ describeTableDetails(const char *pattern, bool verbose)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                        "SELECT c.oid,\n"
-                        "  n.nspname,\n"
-                        "  c.relname\n"
-                        "FROM pg_catalog.pg_class c\n"
-                        "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n");
+                                         "SELECT c.oid,\n"
+                                         "  n.nspname,\n"
+                                         "  c.relname\n"
+                                         "FROM pg_catalog.pg_class c\n"
+                                         "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n");
 
        processNamePattern(&buf, pattern, false, false,
                                           "n.nspname", "c.relname", NULL,
@@ -625,7 +628,7 @@ describeOneTableDetails(const char *schemaname,
        PGresult   *res = NULL;
        printTableOpt myopt = pset.popt.topt;
        int                     i;
-       char *view_def = NULL;
+       char       *view_def = NULL;
        const char *headers[5];
        char      **cells = NULL;
        char      **footers = NULL;
@@ -649,7 +652,7 @@ describeOneTableDetails(const char *schemaname,
 
        /* Get general table info */
        printfPQExpBuffer(&buf,
-                                         "SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules\n"
+        "SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules\n"
                                          "FROM pg_catalog.pg_class WHERE oid = '%s'",
                                          oid);
        res = PSQLexec(buf.data);
@@ -757,7 +760,7 @@ describeOneTableDetails(const char *schemaname,
 
                                printfPQExpBuffer(&buf,
                                                                  "SELECT substring(d.adsrc for 128) FROM pg_catalog.pg_attrdef d\n"
-                                                                 "WHERE d.adrelid = '%s' AND d.adnum = %s",
+                                                          "WHERE d.adrelid = '%s' AND d.adnum = %s",
                                                                  oid, PQgetvalue(res, i, 4));
 
                                result = PSQLexec(buf.data);
@@ -809,7 +812,7 @@ describeOneTableDetails(const char *schemaname,
                        break;
                default:
                        printfPQExpBuffer(&title, _("?%c? \"%s.%s\""),
-                                                         tableinfo.relkind, schemaname, relationname);
+                                                       tableinfo.relkind, schemaname, relationname);
                        break;
        }
 
@@ -818,9 +821,10 @@ describeOneTableDetails(const char *schemaname,
        {
                /* Footer information about an index */
                PGresult   *result;
+
                printfPQExpBuffer(&buf,
-                                                 "SELECT i.indisunique, i.indisprimary, a.amname, c2.relname,\n"
-                                                 "  pg_catalog.pg_get_expr(i.indpred, i.indrelid)\n"
+                 "SELECT i.indisunique, i.indisprimary, a.amname, c2.relname,\n"
+                                         "  pg_catalog.pg_get_expr(i.indpred, i.indrelid)\n"
                                                  "FROM pg_catalog.pg_index i, pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_am a\n"
                                                  "WHERE i.indexrelid = c.oid AND c.oid = '%s' AND c.relam = a.oid\n"
                                                  "AND i.indrelid = c2.oid",
@@ -878,10 +882,10 @@ describeOneTableDetails(const char *schemaname,
                if (tableinfo.hasrules)
                {
                        printfPQExpBuffer(&buf,
-                                       "SELECT r.rulename\n"
-                                       "FROM pg_catalog.pg_rewrite r\n"
-                                       "WHERE r.ev_class = '%s' AND r.rulename != '_RETURN'",
-                                        oid);
+                                                         "SELECT r.rulename\n"
+                                                         "FROM pg_catalog.pg_rewrite r\n"
+                                  "WHERE r.ev_class = '%s' AND r.rulename != '_RETURN'",
+                                                         oid);
                        result = PSQLexec(buf.data);
                        if (!result)
                                goto error_return;
@@ -934,12 +938,12 @@ describeOneTableDetails(const char *schemaname,
                if (tableinfo.hasindex)
                {
                        printfPQExpBuffer(&buf,
-                                       "SELECT c2.relname, i.indisprimary, i.indisunique, "
-                                       "pg_catalog.pg_get_indexdef(i.indexrelid)\n"
-                                       "FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i\n"
-                                       "WHERE c.oid = '%s' AND c.oid = i.indrelid AND i.indexrelid = c2.oid\n"
-                                       "ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname",
-                                       oid);
+                                        "SELECT c2.relname, i.indisprimary, i.indisunique, "
+                                                         "pg_catalog.pg_get_indexdef(i.indexrelid)\n"
+                                                         "FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i\n"
+                                                         "WHERE c.oid = '%s' AND c.oid = i.indrelid AND i.indexrelid = c2.oid\n"
+                                                         "ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname",
+                                                         oid);
                        result1 = PSQLexec(buf.data);
                        if (!result1)
                                goto error_return;
@@ -951,10 +955,10 @@ describeOneTableDetails(const char *schemaname,
                if (tableinfo.checks)
                {
                        printfPQExpBuffer(&buf,
-                                       "SELECT consrc, conname\n"
-                                       "FROM pg_catalog.pg_constraint r\n"
-                                       "WHERE r.conrelid = '%s' AND r.contype = 'c'",
-                                       oid);
+                                                         "SELECT consrc, conname\n"
+                                                         "FROM pg_catalog.pg_constraint r\n"
+                                                  "WHERE r.conrelid = '%s' AND r.contype = 'c'",
+                                                         oid);
                        result2 = PSQLexec(buf.data);
                        if (!result2)
                                goto error_return;
@@ -966,10 +970,10 @@ describeOneTableDetails(const char *schemaname,
                if (tableinfo.hasrules)
                {
                        printfPQExpBuffer(&buf,
-                                       "SELECT r.rulename\n"
-                                       "FROM pg_catalog.pg_rewrite r\n"
-                                       "WHERE r.ev_class = '%s'",
-                                       oid);
+                                                         "SELECT r.rulename\n"
+                                                         "FROM pg_catalog.pg_rewrite r\n"
+                                                         "WHERE r.ev_class = '%s'",
+                                                         oid);
                        result3 = PSQLexec(buf.data);
                        if (!result3)
                                goto error_return;
@@ -981,15 +985,15 @@ describeOneTableDetails(const char *schemaname,
                if (tableinfo.triggers)
                {
                        printfPQExpBuffer(&buf,
-                                       "SELECT t.tgname\n"
-                                       "FROM pg_catalog.pg_trigger t\n"
-                                       "WHERE t.tgrelid = '%s' "
-                                       "and (not tgisconstraint "
-                                       " OR NOT EXISTS"
-                                       "  (SELECT 1 FROM pg_catalog.pg_depend d "
-                                       "   JOIN pg_catalog.pg_constraint c ON (d.refclassid = c.tableoid AND d.refobjid = c.oid) "
-                                       "   WHERE d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i' AND c.contype = 'f'))",
-                                       oid);
+                                                         "SELECT t.tgname\n"
+                                                         "FROM pg_catalog.pg_trigger t\n"
+                                                         "WHERE t.tgrelid = '%s' "
+                                                         "and (not tgisconstraint "
+                                                         " OR NOT EXISTS"
+                                                         "  (SELECT 1 FROM pg_catalog.pg_depend d "
+                                                         "   JOIN pg_catalog.pg_constraint c ON (d.refclassid = c.tableoid AND d.refobjid = c.oid) "
+                                                         "   WHERE d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i' AND c.contype = 'f'))",
+                                                         oid);
                        result4 = PSQLexec(buf.data);
                        if (!result4)
                                goto error_return;
@@ -997,15 +1001,15 @@ describeOneTableDetails(const char *schemaname,
                                trigger_count = PQntuples(result4);
                }
 
-               /* count foreign-key constraints (there are none if no triggers) */
+               /* count foreign-key constraints (there are none if no triggers) */
                if (tableinfo.triggers)
                {
                        printfPQExpBuffer(&buf,
-                                       "SELECT conname,\n"
-                                       "  pg_catalog.pg_get_constraintdef(oid) as condef\n"
-                                       "FROM pg_catalog.pg_constraint r\n"
-                                       "WHERE r.conrelid = '%s' AND r.contype = 'f'",
-                                       oid);
+                                                         "SELECT conname,\n"
+                                        "  pg_catalog.pg_get_constraintdef(oid) as condef\n"
+                                                         "FROM pg_catalog.pg_constraint r\n"
+                                                  "WHERE r.conrelid = '%s' AND r.contype = 'f'",
+                                                         oid);
                        result5 = PSQLexec(buf.data);
                        if (!result5)
                                goto error_return;
@@ -1022,7 +1026,7 @@ describeOneTableDetails(const char *schemaname,
                        char       *s = _("Indexes");
                        const char *indexdef;
                        const char *usingpos;
-       
+
                        if (i == 0)
                                printfPQExpBuffer(&buf, "%s: %s", s,
                                                                  PQgetvalue(result1, i, 0));
@@ -1032,9 +1036,9 @@ describeOneTableDetails(const char *schemaname,
 
                        /* Label as primary key or unique (but not both) */
                        appendPQExpBuffer(&buf,
-                                                         strcmp(PQgetvalue(result1,i,1),"t") == 0
+                                                         strcmp(PQgetvalue(result1, i, 1), "t") == 0
                                                          ? _(" primary key") :
-                                                         (strcmp(PQgetvalue(result1,i,2),"t") == 0
+                                                         (strcmp(PQgetvalue(result1, i, 2), "t") == 0
                                                           ? _(" unique")
                                                           : ""));
 
@@ -1184,18 +1188,18 @@ describeUsers(const char *pattern)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                        "SELECT u.usename AS \"%s\",\n"
-                        "  u.usesysid AS \"%s\",\n"
-                        "  CASE WHEN u.usesuper AND u.usecreatedb THEN CAST('%s' AS pg_catalog.text)\n"
-                        "       WHEN u.usesuper THEN CAST('%s' AS pg_catalog.text)\n"
-                        "       WHEN u.usecreatedb THEN CAST('%s' AS pg_catalog.text)\n"
-                        "       ELSE CAST('' AS pg_catalog.text)\n"
-                        "  END AS \"%s\"\n"
-                        "FROM pg_catalog.pg_user u\n",
-                        _("User name"), _("User ID"),
-                        _("superuser, create database"),
-                        _("superuser"), _("create database"),
-                        _("Attributes"));
+                                         "SELECT u.usename AS \"%s\",\n"
+                                         "  u.usesysid AS \"%s\",\n"
+                                         "  CASE WHEN u.usesuper AND u.usecreatedb THEN CAST('%s' AS pg_catalog.text)\n"
+                       "       WHEN u.usesuper THEN CAST('%s' AS pg_catalog.text)\n"
+                "       WHEN u.usecreatedb THEN CAST('%s' AS pg_catalog.text)\n"
+                                         "       ELSE CAST('' AS pg_catalog.text)\n"
+                                         "  END AS \"%s\"\n"
+                                         "FROM pg_catalog.pg_user u\n",
+                                         _("User name"), _("User ID"),
+                                         _("superuser, create database"),
+                                         _("superuser"), _("create database"),
+                                         _("Attributes"));
 
        processNamePattern(&buf, pattern, false, false,
                                           NULL, "u.usename", NULL, NULL);
@@ -1249,32 +1253,32 @@ listTables(const char *tabtypes, const char *pattern, bool verbose)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                        "SELECT n.nspname as \"%s\",\n"
-                        "  c.relname as \"%s\",\n"
-                        "  CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'i' THEN '%s' WHEN 'S' THEN '%s' WHEN 's' THEN '%s' END as \"%s\",\n"
-                        "  u.usename as \"%s\"",
-                        _("Schema"), _("Name"),
-                        _("table"), _("view"), _("index"), _("sequence"),
-                        _("special"), _("Type"), _("Owner"));
+                                         "SELECT n.nspname as \"%s\",\n"
+                                         "  c.relname as \"%s\",\n"
+                                         "  CASE c.relkind WHEN 'r' THEN '%s' WHEN 'v' THEN '%s' WHEN 'i' THEN '%s' WHEN 'S' THEN '%s' WHEN 's' THEN '%s' END as \"%s\",\n"
+                                         "  u.usename as \"%s\"",
+                                         _("Schema"), _("Name"),
+                                         _("table"), _("view"), _("index"), _("sequence"),
+                                         _("special"), _("Type"), _("Owner"));
 
        if (verbose)
                appendPQExpBuffer(&buf,
-                                ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
-                                _("Description"));
+                 ",\n  pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"",
+                                                 _("Description"));
 
-    if (showIndexes)
+       if (showIndexes)
                appendPQExpBuffer(&buf,
                                                  ",\n c2.relname as \"%s\""
                                                  "\nFROM pg_catalog.pg_class c"
-                                                 "\n     JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid"
-                                                 "\n     JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid"
-                                                 "\n     LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner"
+                         "\n     JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid"
+                         "\n     JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid"
+               "\n     LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner"
                                                  "\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n",
                                                  _("Table"));
        else
                appendPQExpBuffer(&buf,
                                                  "\nFROM pg_catalog.pg_class c"
-                                                 "\n     LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner"
+               "\n     LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner"
                                                  "\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n");
 
        appendPQExpBuffer(&buf, "WHERE c.relkind IN (");
@@ -1288,12 +1292,13 @@ listTables(const char *tabtypes, const char *pattern, bool verbose)
                appendPQExpBuffer(&buf, "'S',");
        if (showSystem && showTables)
                appendPQExpBuffer(&buf, "'s',");
-       appendPQExpBuffer(&buf, "''");                  /* dummy */
+       appendPQExpBuffer(&buf, "''");          /* dummy */
        appendPQExpBuffer(&buf, ")\n");
 
        /*
-        * Unless showSystem is specified, we suppress system tables, ie, those
-        * in pg_catalog and pg_toast.  (We don't want to hide temp tables though.)
+        * Unless showSystem is specified, we suppress system tables, ie,
+        * those in pg_catalog and pg_toast.  (We don't want to hide temp
+        * tables though.)
         */
        if (showSystem)
                processNamePattern(&buf, pattern, true, false,
@@ -1346,21 +1351,21 @@ listDomains(const char *pattern)
        initPQExpBuffer(&buf);
 
        printfPQExpBuffer(&buf,
-                "SELECT n.nspname as \"%s\",\n"
-                "       t.typname as \"%s\",\n"
-                "       pg_catalog.format_type(t.typbasetype, t.typtypmod) as \"%s\",\n"
-                "       CASE WHEN t.typnotnull AND t.typdefault IS NOT NULL THEN 'not null default '||t.typdefault\n"
-                "            WHEN t.typnotnull AND t.typdefault IS NULL THEN 'not null'\n"
-                "            WHEN NOT t.typnotnull AND t.typdefault IS NOT NULL THEN 'default '||t.typdefault\n"
-                "            ELSE ''\n"
-                "       END as \"%s\"\n"
-                "FROM pg_catalog.pg_type t\n"
-                "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n"
-                "WHERE t.typtype = 'd'\n",
-                _("Schema"),
-                _("Name"),
-                _("Type"),
-                _("Modifier"));
+                                         "SELECT n.nspname as \"%s\",\n"
+                                         "       t.typname as \"%s\",\n"
+                                         "       pg_catalog.format_type(t.typbasetype, t.typtypmod) as \"%s\",\n"
+                                         "       CASE WHEN t.typnotnull AND t.typdefault IS NOT NULL THEN 'not null default '||t.typdefault\n"
+                                         "            WHEN t.typnotnull AND t.typdefault IS NULL THEN 'not null'\n"
+                                         "            WHEN NOT t.typnotnull AND t.typdefault IS NOT NULL THEN 'default '||t.typdefault\n"
+                                         "            ELSE ''\n"
+                                         "       END as \"%s\"\n"
+                                         "FROM pg_catalog.pg_type t\n"
+       "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n"
+                                         "WHERE t.typtype = 'd'\n",
+                                         _("Schema"),
+                                         _("Name"),
+                                         _("Type"),
+                                         _("Modifier"));
 
        processNamePattern(&buf, pattern, true, false,
                                           "n.nspname", "t.typname", NULL,
@@ -1397,7 +1402,7 @@ listDomains(const char *pattern)
  * namevar: name of WHERE variable to match against an object-name pattern.
  * altnamevar: NULL, or name of an alternate variable to match against name.
  * visibilityrule: clause to use if we want to restrict to visible objects
- * (for example, "pg_catalog.pg_table_is_visible(p.oid)").  Can be NULL.
+ * (for example, "pg_catalog.pg_table_is_visible(p.oid)").     Can be NULL.
  */
 static void
 processNamePattern(PQExpBuffer buf, const char *pattern,
@@ -1479,10 +1484,11 @@ processNamePattern(PQExpBuffer buf, const char *pattern,
                         * Ordinary data character, transfer to pattern
                         *
                         * Inside double quotes, or at all times if parsing an operator
-                        * name, quote regexp special characters with a backslash to avoid
-                        * regexp errors.  Outside quotes, however, let them pass through
-                        * as-is; this lets knowledgeable users build regexp expressions
-                        * that are more powerful than shell-style patterns.
+                        * name, quote regexp special characters with a backslash to
+                        * avoid regexp errors.  Outside quotes, however, let them
+                        * pass through as-is; this lets knowledgeable users build
+                        * regexp expressions that are more powerful than shell-style
+                        * patterns.
                         */
                        if ((inquotes || force_escape) &&
                                strchr("|*+?()[]{}.^$\\", *cp))
@@ -1511,8 +1517,8 @@ processNamePattern(PQExpBuffer buf, const char *pattern,
                appendPQExpBufferChar(&schemabuf, '$');
                /* Optimize away ".*$", and possibly the whole pattern */
                if (schemabuf.len >= 3 &&
-                       strcmp(schemabuf.data + (schemabuf.len-3), ".*$") == 0)
-                       schemabuf.data[schemabuf.len-3] = '\0';
+                       strcmp(schemabuf.data + (schemabuf.len - 3), ".*$") == 0)
+                       schemabuf.data[schemabuf.len - 3] = '\0';
 
                if (schemabuf.data[0] && schemavar)
                {
@@ -1538,8 +1544,8 @@ processNamePattern(PQExpBuffer buf, const char *pattern,
                appendPQExpBufferChar(&namebuf, '$');
                /* Optimize away ".*$", and possibly the whole pattern */
                if (namebuf.len >= 3 &&
-                       strcmp(namebuf.data + (namebuf.len-3), ".*$") == 0)
-                       namebuf.data[namebuf.len-3] = '\0';
+                       strcmp(namebuf.data + (namebuf.len - 3), ".*$") == 0)
+                       namebuf.data[namebuf.len - 3] = '\0';
 
                if (namebuf.data[0])
                {
index a224898..45d9c1e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.55 2002/08/27 18:28:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.56 2002/09/04 20:31:35 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "print.h"
@@ -70,13 +70,13 @@ usage(void)
                        psql_error("could not get current user name: %s\n", strerror(errno));
                        exit(EXIT_FAILURE);
                }
-#else /* WIN32 */
+#else                                                  /* WIN32 */
                char            buf[128];
                DWORD           bufsize = sizeof(buf) - 1;
 
                if (GetUserName(buf, &bufsize))
                        user = buf;
-#endif /* WIN32 */
+#endif   /* WIN32 */
        }
 
 /* If this " is the start of the string then it ought to end there to fit in 80 columns >> " */
@@ -161,7 +161,8 @@ struct winsize
 void
 slashUsage(bool pager)
 {
-       FILE       *output, *pagerfd = NULL;
+       FILE       *output,
+                          *pagerfd = NULL;
 
        /* check whether we need / can / are supposed to use pager */
        if (pager
@@ -202,10 +203,14 @@ slashUsage(bool pager)
                output = stdout;
 
        /* if you add/remove a line here, change the row test above */
-    /*      if this " is the start of the string then it ought to end there to fit in 80 columns >> " */
+
+       /*
+        * if this " is the start of the string then it ought to end there to
+        * fit in 80 columns >> "
+        */
        fprintf(output, _(" \\a             toggle between unaligned and aligned output mode\n"));
        fprintf(output, _(" \\c[onnect] [DBNAME|- [USER]]\n"
-                                       "                connect to new database (currently \"%s\")\n"),
+                "                connect to new database (currently \"%s\")\n"),
                        PQdb(pset.db));
        fprintf(output, _(" \\C [STRING]    set table title, or unset if none\n"));
        fprintf(output, _(" \\cd [DIR]      change the current working directory\n"));
@@ -234,11 +239,11 @@ slashUsage(bool pager)
        fprintf(output, _(" \\i FILE        execute commands from file\n"));
        fprintf(output, _(" \\l             list all databases\n"));
        fprintf(output, _(" \\lo_export, \\lo_import, \\lo_list, \\lo_unlink\n"
-                                       "                large object operations\n"));
+                                         "                large object operations\n"));
        fprintf(output, _(" \\o FILE        send all query results to file or |pipe\n"));
        fprintf(output, _(" \\p             show the contents of the query buffer\n"));
        fprintf(output, _(" \\pset NAME [VALUE]  set table output option (NAME := {format|border|expanded|\n"
-                                       "                fieldsep|null|recordsep|tuples_only|title|tableattr|pager})\n"));
+                                         "                fieldsep|null|recordsep|tuples_only|title|tableattr|pager})\n"));
        fprintf(output, _(" \\q             quit psql\n"));
        fprintf(output, _(" \\qecho [STRING]  write string to query output stream (see \\o)\n"));
        fprintf(output, _(" \\r             reset (clear) the query buffer\n"));
index e893b8c..fbb52f2 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/input.h,v 1.16 2002/04/10 22:47:03 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/input.h,v 1.17 2002/09/04 20:31:36 momjian Exp $
  */
 #ifndef INPUT_H
 #define INPUT_H
  * USE_READLINE is the definite pointers regarding existence or not.
  */
 #ifdef HAVE_LIBREADLINE
-# define USE_READLINE 1
-# if defined(HAVE_READLINE_READLINE_H)
-#  include <readline/readline.h>
-# elif defined(HAVE_READLINE_H)
-#  include <readline.h>
-# endif
-# if defined(HAVE_READLINE_HISTORY_H)
-#  include <readline/history.h>
-# elif defined(HAVE_HISTORY_H)
-#  include <history.h>
-# endif
+#define USE_READLINE 1
+#if defined(HAVE_READLINE_READLINE_H)
+#include <readline/readline.h>
+#elif defined(HAVE_READLINE_H)
+#include <readline.h>
+#endif
+#if defined(HAVE_READLINE_HISTORY_H)
+#include <readline/history.h>
+#elif defined(HAVE_HISTORY_H)
+#include <history.h>
+#endif
 #endif
 
 char      *gets_interactive(char *prompt);
index 0e90fce..2bca9da 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000-2002 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.20 2002/08/10 03:56:24 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/large_obj.c,v 1.21 2002/09/04 20:31:36 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "large_obj.h"
@@ -358,7 +358,7 @@ do_lo_list(void)
 
        snprintf(buf, sizeof(buf),
                         "SELECT loid as \"ID\", pg_catalog.obj_description(loid, 'pg_largeobject') as \"%s\"\n"
-                        "FROM (SELECT DISTINCT loid FROM pg_catalog.pg_largeobject) x\n"
+                "FROM (SELECT DISTINCT loid FROM pg_catalog.pg_largeobject) x\n"
                         "ORDER BY \"ID\"",
                         gettext("Description"));
 
index d3fe265..6d9367f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.49 2002/07/03 16:47:46 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.50 2002/09/04 20:31:36 momjian Exp $
  */
 #include "postgres_fe.h"
 #include "mainloop.h"
@@ -396,15 +396,15 @@ MainLoop(FILE *source)
 
                                        if (i < len)
                                        {
-                                               thislen = PQmblen(line+i, pset.encoding);
+                                               thislen = PQmblen(line + i, pset.encoding);
                                                goto rescan;    /* reparse the just substituted */
                                        }
                                }
                                else
                                {
                                        /*
-                                        * if the variable doesn't exist we'll leave the string as
-                                        * is ... move on ...
+                                        * if the variable doesn't exist we'll leave the
+                                        * string as is ... move on ...
                                         */
                                }
                        }
index bcb3495..09ec685 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/print.h,v 1.13 2002/07/15 01:56:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/print.h,v 1.14 2002/09/04 20:31:36 momjian Exp $
  */
 #ifndef PRINT_H
 #define PRINT_H
@@ -72,7 +72,7 @@ typedef struct _printQueryOpt
  *
  * It calls the printTable above with all the things set straight.
  */
-void printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout);
+void           printQuery(const PGresult *result, const printQueryOpt *opt, FILE *fout);
 
 #ifndef __CYGWIN__
 #define DEFAULT_PAGER "more"
index 183b8e9..d05b294 100644 (file)
@@ -3,13 +3,13 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/Attic/sprompt.c,v 1.2 2002/07/06 20:14:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/Attic/sprompt.c,v 1.3 2002/09/04 20:31:36 momjian Exp $
  */
 
 
 /* This file is shared by psql and pg_dump. */
 
+
 /*
  * simple_prompt
  *
@@ -28,7 +28,7 @@
 #include <termios.h>
 #endif
 
-bool prompt_state = false;
+bool           prompt_state = false;
 extern char *simple_prompt(const char *prompt, int maxlen, bool echo);
 
 char *
index a93219d..ef84d94 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.63 2002/08/27 20:16:48 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.64 2002/09/04 20:31:36 momjian Exp $
  */
 #include "postgres_fe.h"
 
@@ -11,7 +11,7 @@
 
 #ifndef WIN32
 #include <unistd.h>
-#else /* WIN32 */
+#else                                                  /* WIN32 */
 #include <io.h>
 #include <windows.h>
 #include <win32.h>
@@ -541,7 +541,11 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options)
                                }
                                break;
 #ifndef HAVE_GETOPT_LONG
-                       /* FreeBSD has a broken getopt that causes this test to fail. */
+
+                               /*
+                                * FreeBSD has a broken getopt that causes this test to
+                                * fail.
+                                */
                        case '-':
                                fprintf(stderr,
                                                gettext("%s was compiled without support for long options.\n"
index cc95a60..ce4a2b5 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright 2000-2002 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.63 2002/09/02 06:19:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.64 2002/09/04 20:31:36 momjian Exp $
  */
 
 /*----------------------------------------------------------------------
@@ -145,7 +145,8 @@ pgsql_thing_t words_after_create[] = {
        {"FUNCTION", "SELECT DISTINCT proname FROM pg_catalog.pg_proc WHERE substr(proname,1,%d)='%s'"},
        {"GROUP", "SELECT groname FROM pg_catalog.pg_group WHERE substr(groname,1,%d)='%s'"},
        {"INDEX", Query_for_list_of_indexes},
-       {"OPERATOR", NULL},                     /* Querying for this is probably not such a good idea. */
+       {"OPERATOR", NULL},                     /* Querying for this is probably not such
+                                                                * a good idea. */
        {"RULE", "SELECT rulename FROM pg_catalog.pg_rules WHERE substr(rulename,1,%d)='%s'"},
        {"SCHEMA", "SELECT nspname FROM pg_catalog.pg_namespace WHERE substr(nspname,1,%d)='%s'"},
        {"SEQUENCE", "SELECT relname FROM pg_catalog.pg_class WHERE relkind='S' and substr(relname,1,%d)='%s'"},
@@ -330,7 +331,8 @@ psql_completion(char *text, int start, int end)
        }
 
        /*
-        * If we detect ALTER TABLE <name>, suggest either ADD, ALTER, or RENAME
+        * If we detect ALTER TABLE <name>, suggest either ADD, ALTER, or
+        * RENAME
         */
        else if (strcasecmp(prev3_wd, "ALTER") == 0 && strcasecmp(prev2_wd, "TABLE") == 0)
        {
@@ -400,8 +402,8 @@ psql_completion(char *text, int start, int end)
        {
                char       *list_COMMENT[] =
                {"DATABASE", "INDEX", "RULE", "SCHEMA", "SEQUENCE", "TABLE", "TYPE", "VIEW",
-                "COLUMN", "AGGREGATE", "FUNCTION", "OPERATOR", "TRIGGER", "CONSTRAINT",
-                "DOMAIN", NULL};
+                       "COLUMN", "AGGREGATE", "FUNCTION", "OPERATOR", "TRIGGER", "CONSTRAINT",
+               "DOMAIN", NULL};
 
                COMPLETE_WITH_LIST(list_COMMENT);
        }
@@ -604,7 +606,7 @@ psql_completion(char *text, int start, int end)
        else if (strcasecmp(prev2_wd, "INSERT") == 0 && strcasecmp(prev_wd, "INTO") == 0)
                COMPLETE_WITH_QUERY(Query_for_list_of_tables);
        /* Complete "INSERT INTO <table> (" with attribute names */
-       else if (rl_line_buffer[start-1]=='(' && strcasecmp(prev3_wd, "INSERT") == 0 && strcasecmp(prev2_wd, "INTO") == 0)
+       else if (rl_line_buffer[start - 1] == '(' && strcasecmp(prev3_wd, "INSERT") == 0 && strcasecmp(prev2_wd, "INTO") == 0)
                COMPLETE_WITH_ATTR(prev_wd);
 
        /*
@@ -614,13 +616,15 @@ psql_completion(char *text, int start, int end)
        else if (strcasecmp(prev3_wd, "INSERT") == 0 && strcasecmp(prev2_wd, "INTO") == 0)
        {
                char       *list_INSERT[] = {"DEFAULT VALUES", "SELECT", "VALUES", NULL};
+
                COMPLETE_WITH_LIST(list_INSERT);
        }
        /* Complete INSERT INTO <table> (attribs) with "VALUES" or "SELECT" */
        else if (strcasecmp(prev4_wd, "INSERT") == 0 && strcasecmp(prev3_wd, "INTO") == 0 &&
-                        prev_wd[strlen(prev_wd)-1]==')')
+                        prev_wd[strlen(prev_wd) - 1] == ')')
        {
                char       *list_INSERT[] = {"SELECT", "VALUES", NULL};
+
                COMPLETE_WITH_LIST(list_INSERT);
        }
 
@@ -631,25 +635,26 @@ psql_completion(char *text, int start, int end)
 /* LOCK */
        /* Complete LOCK [TABLE] with a list of tables */
        else if ((strcasecmp(prev_wd, "LOCK") == 0) ||
-                        (strcasecmp(prev_wd, "TABLE") == 0 && strcasecmp(prev2_wd, "LOCK")))
+        (strcasecmp(prev_wd, "TABLE") == 0 && strcasecmp(prev2_wd, "LOCK")))
                COMPLETE_WITH_QUERY(Query_for_list_of_tables);
 
        /* For the following, handle the case of a single table only for now */
 
        /* Complete LOCK [TABLE] <table> with "IN" */
-       else if ((strcasecmp(prev2_wd, "LOCK") == 0 && strcasecmp(prev_wd, "TABLE")) || 
+       else if ((strcasecmp(prev2_wd, "LOCK") == 0 && strcasecmp(prev_wd, "TABLE")) ||
                         (strcasecmp(prev2_wd, "TABLE") == 0 && strcasecmp(prev3_wd, "LOCK") == 0))
-                       COMPLETE_WITH_CONST("IN");
+               COMPLETE_WITH_CONST("IN");
 
        /* Complete LOCK [TABLE] <table> IN with a lock mode */
        else if (strcasecmp(prev_wd, "IN") == 0 &&
                         (strcasecmp(prev3_wd, "LOCK") == 0 ||
-                         (strcasecmp(prev3_wd, "TABLE") == 0 && strcasecmp(prev3_wd, "LOCK"))))
+       (strcasecmp(prev3_wd, "TABLE") == 0 && strcasecmp(prev3_wd, "LOCK"))))
        {
-                       char       *lock_modes[] = {"ACCESS SHARE MODE", "ROW SHARE MODE", "ROW EXCLUSIVE MODE", 
-                                                                               "SHARE UPDATE EXCLUSIVE MODE", "SHARE MODE", "SHARE ROW EXCLUSIVE MODE",
-                                                                               "EXCLUSIVE MODE", "ACCESS EXCLUSIVE MODE", NULL};
-                       COMPLETE_WITH_LIST(lock_modes);
+               char       *lock_modes[] = {"ACCESS SHARE MODE", "ROW SHARE MODE", "ROW EXCLUSIVE MODE",
+                       "SHARE UPDATE EXCLUSIVE MODE", "SHARE MODE", "SHARE ROW EXCLUSIVE MODE",
+               "EXCLUSIVE MODE", "ACCESS EXCLUSIVE MODE", NULL};
+
+               COMPLETE_WITH_LIST(lock_modes);
        }
 
 /* NOTIFY */
@@ -784,7 +789,7 @@ psql_completion(char *text, int start, int end)
 
 /* WHERE */
        /* Simple case of the word before the where being the table name */
-       else if (strcasecmp(prev_wd, "WHERE") == 0) 
+       else if (strcasecmp(prev_wd, "WHERE") == 0)
                COMPLETE_WITH_ATTR(prev2_wd);
 
 /* ... FROM ... */
@@ -1063,7 +1068,7 @@ previous_word(int point, int skip)
        int                     i,
                                start = 0,
                                end = -1,
-                               inquotes=0;
+                               inquotes = 0;
        char       *s;
 
        while (skip-- >= 0)
@@ -1093,11 +1098,12 @@ previous_word(int point, int skip)
                 * last character before any space going backwards from the end,
                 * or it's simply character 0
                 */
-               for (start = end; start > 0; start--) {
-                               if (rl_line_buffer[start] == '"')
-                                               inquotes = !inquotes;
-                               if ((rl_line_buffer[start - 1] == ' ') && inquotes==0)
-                                               break;
+               for (start = end; start > 0; start--)
+               {
+                       if (rl_line_buffer[start] == '"')
+                               inquotes = !inquotes;
+                       if ((rl_line_buffer[start - 1] == ' ') && inquotes == 0)
+                               break;
                }
 
                point = start;
index c82e720..6266da4 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: genam.h,v 1.36 2002/06/20 20:29:42 momjian Exp $
+ * $Id: genam.h,v 1.37 2002/09/04 20:31:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,16 +58,16 @@ extern InsertIndexResult index_insert(Relation indexRelation,
                         bool check_uniqueness);
 
 extern IndexScanDesc index_beginscan(Relation heapRelation,
-                                                                        Relation indexRelation,
-                                                                        Snapshot snapshot,
-                                                                        int nkeys, ScanKey key);
+                               Relation indexRelation,
+                               Snapshot snapshot,
+                               int nkeys, ScanKey key);
 extern void index_rescan(IndexScanDesc scan, ScanKey key);
 extern void index_endscan(IndexScanDesc scan);
 extern void index_markpos(IndexScanDesc scan);
 extern void index_restrpos(IndexScanDesc scan);
 extern HeapTuple index_getnext(IndexScanDesc scan, ScanDirection direction);
 extern bool index_getnext_indexitem(IndexScanDesc scan,
-                                                                       ScanDirection direction);
+                                               ScanDirection direction);
 
 extern IndexBulkDeleteResult *index_bulk_delete(Relation indexRelation,
                                  IndexBulkDeleteCallback callback,
@@ -82,17 +82,17 @@ extern struct FmgrInfo *index_getprocinfo(Relation irel, AttrNumber attnum,
  * index access method support routines (in genam.c)
  */
 extern IndexScanDesc RelationGetIndexScan(Relation indexRelation,
-                                                                                 int nkeys, ScanKey key);
+                                        int nkeys, ScanKey key);
 extern void IndexScanEnd(IndexScanDesc scan);
 
 /*
  * heap-or-index access to system catalogs (in genam.c)
  */
 extern SysScanDesc systable_beginscan(Relation heapRelation,
-                                                                         const char *indexRelname,
-                                                                         bool indexOK,
-                                                                         Snapshot snapshot,
-                                                                         int nkeys, ScanKey key);
+                                  const char *indexRelname,
+                                  bool indexOK,
+                                  Snapshot snapshot,
+                                  int nkeys, ScanKey key);
 extern HeapTuple systable_getnext(SysScanDesc sysscan);
 extern void systable_endscan(SysScanDesc sysscan);
 
index b0e3221..61c9526 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: heapam.h,v 1.78 2002/07/20 05:16:59 momjian Exp $
+ * $Id: heapam.h,v 1.79 2002/09/04 20:31:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -147,26 +147,26 @@ extern Relation heap_openr(const char *sysRelationName, LOCKMODE lockmode);
 #define heap_close(r,l)  relation_close(r,l)
 
 extern HeapScanDesc heap_beginscan(Relation relation, Snapshot snapshot,
-                                                                  int nkeys, ScanKey key);
+                          int nkeys, ScanKey key);
 extern void heap_rescan(HeapScanDesc scan, ScanKey key);
 extern void heap_endscan(HeapScanDesc scan);
 extern HeapTuple heap_getnext(HeapScanDesc scan, ScanDirection direction);
 
 extern bool heap_fetch(Relation relation, Snapshot snapshot,
-                                          HeapTuple tuple, Buffer *userbuf, bool keep_buf,
-                                          PgStat_Info *pgstat_info);
+                  HeapTuple tuple, Buffer *userbuf, bool keep_buf,
+                  PgStat_Info *pgstat_info);
 
 extern ItemPointer heap_get_latest_tid(Relation relation, Snapshot snapshot,
-                                                                          ItemPointer tid);
+                                       ItemPointer tid);
 extern void setLastTid(const ItemPointer tid);
 
 extern Oid     heap_insert(Relation relation, HeapTuple tup, CommandId cid);
-extern int     heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid,
-                                               CommandId cid);
+extern int heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid,
+                       CommandId cid);
 extern int heap_update(Relation relation, ItemPointer otid, HeapTuple tup,
-                                          ItemPointer ctid, CommandId cid);
-extern int     heap_mark4update(Relation relation, HeapTuple tup,
-                                                        Buffer *userbuf, CommandId cid);
+                       ItemPointer ctid, CommandId cid);
+extern int heap_mark4update(Relation relation, HeapTuple tup,
+                                Buffer *userbuf, CommandId cid);
 
 extern Oid     simple_heap_insert(Relation relation, HeapTuple tup);
 extern void simple_heap_delete(Relation relation, ItemPointer tid);
index 3bede1b..6da127e 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: htup.h,v 1.59 2002/09/02 01:05:06 tgl Exp $
+ * $Id: htup.h,v 1.60 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -29,7 +29,7 @@
  * so that alterations in HeapTupleHeaderData layout won't change the
  * supported max number of columns.
  */
-#define MaxTupleAttributeNumber        1664    /* 8 * 208 */
+#define MaxTupleAttributeNumber 1664   /* 8 * 208 */
 
 /*----------
  * MaxHeapAttributeNumber limits the number of (user) columns in a table.
@@ -79,7 +79,7 @@
  *             valid           unneeded        valid           valid           invalid
  *
  * MOVED BY VACUUM FULL:
- *             valid           unneeded        maybe-valid     unneeded        valid
+ *             valid           unneeded        maybe-valid unneeded    valid
  *
  * This assumes that VACUUM FULL never tries to move a tuple whose Cmin or
  * Cmax is still interesting (ie, insert-in-progress or delete-in-progress).
  * time.  Nor do we need to store Cmax and Xvac at the same time.
  *
  * Following the fixed header fields, the nulls bitmap is stored (beginning
- * at t_bits).  The bitmap is *not* stored if t_infomask shows that there
+ * at t_bits). The bitmap is *not* stored if t_infomask shows that there
  * are no nulls in the tuple.  If an OID field is present (as indicated by
  * t_infomask), then it is stored just before the user data, which begins at
- * the offset shown by t_hoff.  Note that t_hoff must be a multiple of
+ * the offset shown by t_hoff. Note that t_hoff must be a multiple of
  * MAXALIGN.
  *----------
  */
 typedef struct HeapTupleHeaderData
 {
-       TransactionId   t_xmin;         /* inserting xact ID */
+       TransactionId t_xmin;           /* inserting xact ID */
 
-       union {
+       union
+       {
                CommandId       t_cmin;         /* inserting command ID */
                TransactionId t_xmax;   /* deleting xact ID */
-       } t_field2;
+       }                       t_field2;
 
-       union {
+       union
+       {
                CommandId       t_cmax;         /* deleting command ID */
                TransactionId t_xvac;   /* VACUUM FULL xact ID */
-       } t_field3;
+       }                       t_field3;
 
        ItemPointerData t_ctid;         /* current TID of this or newer tuple */
 
@@ -139,8 +141,8 @@ typedef HeapTupleHeaderData *HeapTupleHeader;
 #define HEAP_HASEXTENDED               0x000C  /* the two above combined */
 #define HEAP_HASOID                            0x0010  /* has an object-id field */
 /* bit 0x0020 is presently unused */
-#define HEAP_XMAX_IS_XMIN              0x0040  /* created and deleted in the
-                                                                                * same transaction */
+#define HEAP_XMAX_IS_XMIN              0x0040  /* created and deleted in the same
+                                                                                * transaction */
 #define HEAP_XMAX_UNLOGGED             0x0080  /* to lock tuple for update
                                                                                 * without logging */
 #define HEAP_XMIN_COMMITTED            0x0100  /* t_xmin committed */
@@ -161,7 +163,7 @@ typedef HeapTupleHeaderData *HeapTupleHeader;
 /*
  * HeapTupleHeader accessor macros
  *
- * Note: beware of multiple evaluations of "tup" argument.  But the Set
+ * Note: beware of multiple evaluations of "tup" argument.     But the Set
  * macros evaluate their other argument only once.
  */
 
index 3af684b..a3236e6 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: istrat.h,v 1.25 2002/06/20 20:29:43 momjian Exp $
+ * $Id: istrat.h,v 1.26 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -48,7 +48,7 @@
 #define IndexStrategyIsValid(s) PointerIsValid(s)
 
 extern ScanKey StrategyMapGetScanKeyEntry(StrategyMap map,
-                                                                                 StrategyNumber strategyNumber);
+                                                  StrategyNumber strategyNumber);
 extern StrategyMap IndexStrategyGetStrategyMap(IndexStrategy indexStrategy,
                                          StrategyNumber maxStrategyNum, AttrNumber attrNum);
 
index 8eed08b..e8c4fa3 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: printtup.h,v 1.21 2002/08/22 00:01:47 tgl Exp $
+ * $Id: printtup.h,v 1.22 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,9 +19,9 @@
 extern DestReceiver *printtup_create_DR(bool isBinary);
 
 extern void debugSetup(DestReceiver *self, int operation,
-                                          const char *portalName, TupleDesc typeinfo);
+                  const char *portalName, TupleDesc typeinfo);
 extern void debugtup(HeapTuple tuple, TupleDesc typeinfo,
-                                        DestReceiver *self);
+                DestReceiver *self);
 
 /* XXX this one is really in executor/spi.c */
 extern void spi_printtup(HeapTuple tuple, TupleDesc tupdesc,
index 231d341..06b5701 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: relscan.h,v 1.28 2002/06/20 20:29:43 momjian Exp $
+ * $Id: relscan.h,v 1.29 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,11 +58,11 @@ typedef struct IndexScanDescData
        void       *opaque;                     /* access-method-specific info */
        ItemPointerData currentItemData;        /* current index pointer */
        ItemPointerData currentMarkData;        /* marked position, if any */
+
        /*
-        * xs_ctup/xs_cbuf are valid after a successful index_getnext.
-        * After index_getnext_indexitem, xs_ctup.t_self contains the
-        * heap tuple TID from the index entry, but its other fields are
-        * not valid.
+        * xs_ctup/xs_cbuf are valid after a successful index_getnext. After
+        * index_getnext_indexitem, xs_ctup.t_self contains the heap tuple TID
+        * from the index entry, but its other fields are not valid.
         */
        HeapTupleData xs_ctup;          /* current heap tuple, if any */
        Buffer          xs_cbuf;                /* current heap buffer in scan, if any */
index 09512a3..00ac016 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tupdesc.h,v 1.38 2002/09/02 01:05:06 tgl Exp $
+ * $Id: tupdesc.h,v 1.39 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,7 +58,7 @@ typedef struct tupleDesc
 extern TupleDesc CreateTemplateTupleDesc(int natts, bool hasoid);
 
 extern TupleDesc CreateTupleDesc(int natts, bool hasoid,
-                                                                Form_pg_attribute *attrs);
+                               Form_pg_attribute *attrs);
 
 extern TupleDesc CreateTupleDescCopy(TupleDesc tupdesc);
 
index 95a1fe8..a99c47a 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 2000, PostgreSQL Development Team
  *
- * $Id: tuptoaster.h,v 1.14 2002/03/05 05:33:25 momjian Exp $
+ * $Id: tuptoaster.h,v 1.15 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -102,13 +102,13 @@ extern varattrib *heap_tuple_untoast_attr(varattrib *attr);
 /* ----------
  * heap_tuple_untoast_attr_slice() -
  *
- *      Fetches only the specified portion of an attribute.
- *      (Handles all cases for attribute storage)
+ *             Fetches only the specified portion of an attribute.
+ *             (Handles all cases for attribute storage)
  * ----------
  */
-extern varattrib *heap_tuple_untoast_attr_slice(varattrib *attr, 
-                                                                                               int32 sliceoffset,
-                                                                                               int32 slicelength);
+extern varattrib *heap_tuple_untoast_attr_slice(varattrib *attr,
+                                                         int32 sliceoffset,
+                                                         int32 slicelength);
 
 /* ----------
  * toast_compress_datum -
index 6fd6e7e..7764421 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: valid.h,v 1.28 2002/06/20 20:29:43 momjian Exp $
+ * $Id: valid.h,v 1.29 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -78,7 +78,7 @@ do \
  *             HeapTupleSatisfies
  *
  *     res is set TRUE if the HeapTuple satisfies the timequal and keytest,
- *     otherwise it is set FALSE.  Note that the hint bits in the HeapTuple's
+ *     otherwise it is set FALSE.      Note that the hint bits in the HeapTuple's
  *     t_infomask may be updated as a side effect.
  *
  *     on 8/21/92 mao says:  i rearranged the tests here to do keytest before
index bc7d82f..bf2ce61 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: xlog.h,v 1.36 2002/08/30 16:50:50 momjian Exp $
+ * $Id: xlog.h,v 1.37 2002/09/04 20:31:37 momjian Exp $
  */
 #ifndef XLOG_H
 #define XLOG_H
@@ -217,6 +217,6 @@ extern XLogRecPtr GetRedoRecPtr(void);
 extern XLogRecPtr GetUndoRecPtr(void);
 
 extern const char *assign_xlog_sync_method(const char *method,
-                                                                                  bool doit, bool interactive);
+                                               bool doit, bool interactive);
 
 #endif   /* XLOG_H */
index 1ad03d4..39dbc5d 100644 (file)
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: c.h,v 1.124 2002/09/01 23:41:47 momjian Exp $
+ * $Id: c.h,v 1.125 2002/09/04 20:31:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -211,7 +211,7 @@ typedef char *Pointer;
 typedef signed char int8;              /* == 8 bits */
 typedef signed short int16;            /* == 16 bits */
 typedef signed int int32;              /* == 32 bits */
-#endif /* not HAVE_INT8 */
+#endif   /* not HAVE_INT8 */
 
 /*
  * uintN
@@ -224,7 +224,7 @@ typedef signed int int32;           /* == 32 bits */
 typedef unsigned char uint8;   /* == 8 bits */
 typedef unsigned short uint16; /* == 16 bits */
 typedef unsigned int uint32;   /* == 32 bits */
-#endif /* not HAVE_UINT8 */
+#endif   /* not HAVE_UINT8 */
 
 /*
  * boolN
@@ -290,7 +290,8 @@ typedef long long int int64;
 typedef unsigned long long int uint64;
 #endif
 
-#else /* not HAVE_LONG_INT_64 and not HAVE_LONG_LONG_INT_64 */
+#else                                                  /* not HAVE_LONG_INT_64 and not
+                                                                * HAVE_LONG_LONG_INT_64 */
 
 /* Won't actually work, but fall back to long int so that code compiles */
 #ifndef HAVE_INT64
@@ -301,8 +302,8 @@ typedef unsigned long int uint64;
 #endif
 
 #define INT64_IS_BUSTED
-
-#endif /* not HAVE_LONG_INT_64 and not HAVE_LONG_LONG_INT_64 */
+#endif   /* not HAVE_LONG_INT_64 and not
+                                                                * HAVE_LONG_LONG_INT_64 */
 
 /* Decide if we need to decorate 64-bit constants */
 #ifdef HAVE_LL_CONSTANTS
@@ -389,7 +390,7 @@ typedef struct
  *             Variable-length datatypes all share the 'struct varlena' header.
  *
  * NOTE: for TOASTable types, this is an oversimplification, since the value
- * may be compressed or moved out-of-line.  However datatype-specific routines
+ * may be compressed or moved out-of-line.     However datatype-specific routines
  * are mostly content to deal with de-TOASTed values only, and of course
  * client-side routines should never see a TOASTed value.  See postgres.h for
  * details of the TOASTed form.
index 86d621b..d0c18b1 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: dependency.h,v 1.4 2002/08/11 21:17:35 tgl Exp $
+ * $Id: dependency.h,v 1.5 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,7 +52,7 @@
  * DEPENDENCY_PIN ('p'): there is no dependent object; this type of entry
  * is a signal that the system itself depends on the referenced object,
  * and so that object must never be deleted.  Entries of this type are
- * created only during initdb.  The fields for the dependent object
+ * created only during initdb. The fields for the dependent object
  * contain zeroes.
  *
  * Other dependency flavors may be needed in future.
 
 typedef enum DependencyType
 {
-       DEPENDENCY_NORMAL       = 'n',
-       DEPENDENCY_AUTO         = 'a',
-       DEPENDENCY_INTERNAL     = 'i',
-       DEPENDENCY_PIN          = 'p'
+       DEPENDENCY_NORMAL = 'n',
+       DEPENDENCY_AUTO = 'a',
+       DEPENDENCY_INTERNAL = 'i',
+       DEPENDENCY_PIN = 'p'
 } DependencyType;
 
 
@@ -72,31 +72,32 @@ typedef enum DependencyType
  */
 typedef struct ObjectAddress
 {
-       Oid             classId;                /* Class Id from pg_class */
-       Oid             objectId;               /* OID of the object */
-       int32   objectSubId;    /* Subitem within the object (column of table) */
+       Oid                     classId;                /* Class Id from pg_class */
+       Oid                     objectId;               /* OID of the object */
+       int32           objectSubId;    /* Subitem within the object (column of
+                                                                * table) */
 } ObjectAddress;
 
 
 /* in dependency.c */
 
 extern void performDeletion(const ObjectAddress *object,
-                                                       DropBehavior behavior);
+                               DropBehavior behavior);
 
 extern void recordDependencyOnExpr(const ObjectAddress *depender,
-                                                                  Node *expr, List *rtable,
-                                                                  DependencyType behavior);
+                                          Node *expr, List *rtable,
+                                          DependencyType behavior);
 
 /* in pg_depend.c */
 
 extern void recordDependencyOn(const ObjectAddress *depender,
-                                                          const ObjectAddress *referenced,
-                                                          DependencyType behavior);
+                                  const ObjectAddress *referenced,
+                                  DependencyType behavior);
 
 extern void recordMultipleDependencies(const ObjectAddress *depender,
-                                                                          const ObjectAddress *referenced,
-                                                                          int nreferenced,
-                                                                          DependencyType behavior);
+                                                  const ObjectAddress *referenced,
+                                                  int nreferenced,
+                                                  DependencyType behavior);
 
 extern long deleteDependencyRecordsFor(Oid classId, Oid objectId);
 
index b1f5dc8..7ff705b 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: heap.h,v 1.56 2002/09/02 01:05:06 tgl Exp $
+ * $Id: heap.h,v 1.57 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -52,19 +52,19 @@ extern void AddRelationRawConstraints(Relation rel,
                                                  List *rawConstraints);
 
 extern Node *cookDefault(ParseState *pstate,
-                                                Node *raw_default,
-                                                Oid atttypid,
-                                                int32 atttypmod,
-                                                char *attname);
+                       Node *raw_default,
+                       Oid atttypid,
+                       int32 atttypmod,
+                       char *attname);
 
-extern int     RemoveRelConstraints(Relation rel, const char *constrName,
-                                                                DropBehavior behavior);
+extern int RemoveRelConstraints(Relation rel, const char *constrName,
+                                        DropBehavior behavior);
 
 extern void DeleteRelationTuple(Oid relid);
 extern void DeleteAttributeTuples(Oid relid);
 extern void RemoveAttributeById(Oid relid, AttrNumber attnum);
 extern void RemoveAttrDefault(Oid relid, AttrNumber attnum,
-                                                         DropBehavior behavior, bool complain);
+                                 DropBehavior behavior, bool complain);
 extern void RemoveAttrDefaultById(Oid attrdefId);
 
 extern Form_pg_attribute SystemAttributeDefinition(AttrNumber attno,
index da512da..95deaeb 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: indexing.h,v 1.74 2002/08/05 03:29:17 tgl Exp $
+ * $Id: indexing.h,v 1.75 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -90,7 +90,7 @@ typedef struct ResultRelInfo *CatalogIndexState;
 extern CatalogIndexState CatalogOpenIndexes(Relation heapRel);
 extern void CatalogCloseIndexes(CatalogIndexState indstate);
 extern void CatalogIndexInsert(CatalogIndexState indstate,
-                                                          HeapTuple heapTuple);
+                                  HeapTuple heapTuple);
 extern void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple);
 
 
index dd6c786..3369f67 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: namespace.h,v 1.19 2002/08/08 01:44:31 tgl Exp $
+ * $Id: namespace.h,v 1.20 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,7 +19,7 @@
 
 /*
  *     This structure holds a list of possible functions or operators
- *     found by namespace lookup.  Each function/operator is identified
+ *     found by namespace lookup.      Each function/operator is identified
  *     by OID and by argument types; the list must be pruned by type
  *     resolution rules that are embodied in the parser, not here.
  */
@@ -30,7 +30,7 @@ typedef struct _FuncCandidateList
        Oid                     oid;                    /* the function or operator's OID */
        int                     nargs;                  /* number of arg types returned */
        Oid                     args[1];                /* arg types --- VARIABLE LENGTH ARRAY */
-} *FuncCandidateList;                  /* VARIABLE LENGTH STRUCT */
+}      *FuncCandidateList;     /* VARIABLE LENGTH STRUCT */
 
 /*
  *     This structure holds a list of opclass candidates found by namespace
@@ -45,7 +45,7 @@ typedef struct _OpclassCandidateList
        Oid                     opcintype;              /* type of input data for opclass */
        bool            opcdefault;             /* T if opclass is default for opcintype */
        Oid                     opckeytype;             /* type of index data, or InvalidOid */
-} *OpclassCandidateList;
+}      *OpclassCandidateList;
 
 
 extern Oid     RangeVarGetRelid(const RangeVar *relation, bool failOK);
@@ -67,8 +67,8 @@ extern Oid    OpclassnameGetOpcid(Oid amid, const char *opcname);
 extern bool OpclassIsVisible(Oid opcid);
 
 extern void DeconstructQualifiedName(List *names,
-                                                                        char **nspname_p,
-                                                                        char **objname_p);
+                                                char **nspname_p,
+                                                char **objname_p);
 extern Oid     LookupExplicitNamespace(const char *nspname);
 
 extern Oid     QualifiedNameGetCreationNamespace(List *names, char **objname_p);
@@ -80,8 +80,8 @@ extern bool isTempNamespace(Oid namespaceId);
 extern void PushSpecialNamespace(Oid namespaceId);
 extern void PopSpecialNamespace(Oid namespaceId);
 
-extern Oid FindConversionByName(List *conname);
-extern Oid FindDefaultConversionProc(int4 for_encoding, int4 to_encoding);
+extern Oid     FindConversionByName(List *conname);
+extern Oid     FindDefaultConversionProc(int4 for_encoding, int4 to_encoding);
 
 /* initialization & transaction cleanup code */
 extern void InitializeSearchPath(void);
@@ -91,7 +91,7 @@ extern void AtEOXact_Namespace(bool isCommit);
 extern char *namespace_search_path;
 
 extern const char *assign_search_path(const char *newval,
-                                                                         bool doit, bool interactive);
+                                  bool doit, bool interactive);
 
 extern List *fetch_search_path(bool includeImplicit);
 
index cd46ac1..11d6e1f 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_aggregate.h,v 1.39 2002/06/20 20:29:43 momjian Exp $
+ * $Id: pg_aggregate.h,v 1.40 2002/09/04 20:31:37 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -105,7 +105,7 @@ DATA(insert ( 2124  timetz_larger   -                               1266    _null_ ));
 DATA(insert ( 2125     cashlarger              -                               790             _null_ ));
 DATA(insert ( 2126     timestamp_larger        -                       1114    _null_ ));
 DATA(insert ( 2127     timestamptz_larger      -                       1184    _null_ ));
-DATA(insert ( 2128     interval_larger -                               1186    _null_ ));
+DATA(insert ( 2128     interval_larger -                               1186    _null_ ));
 DATA(insert ( 2129     text_larger             -                               25              _null_ ));
 DATA(insert ( 2130     numeric_larger  -                               1700    _null_ ));
 
@@ -122,10 +122,10 @@ DATA(insert ( 2139        time_smaller    -                               1083    _null_ ));
 DATA(insert ( 2140     timetz_smaller  -                               1266    _null_ ));
 DATA(insert ( 2141     cashsmaller             -                               790             _null_ ));
 DATA(insert ( 2142     timestamp_smaller       -                       1114    _null_ ));
-DATA(insert ( 2143     timestamptz_smaller     -                       1184    _null_ ));
+DATA(insert ( 2143     timestamptz_smaller -                   1184    _null_ ));
 DATA(insert ( 2144     interval_smaller        -                       1186    _null_ ));
 DATA(insert ( 2145     text_smaller    -                               25              _null_ ));
-DATA(insert ( 2146     numeric_smaller -                               1700    _null_ ));
+DATA(insert ( 2146     numeric_smaller -                               1700    _null_ ));
 
 /*
  * Using int8inc for count() is cheating a little, since it really only
@@ -137,8 +137,8 @@ DATA(insert ( 2147  int8inc         -                                        20             0 ));
 DATA(insert ( 2148     int8_accum      numeric_variance        1231    "{0,0,0}" ));
 DATA(insert ( 2149     int4_accum      numeric_variance        1231    "{0,0,0}" ));
 DATA(insert ( 2150     int2_accum      numeric_variance        1231    "{0,0,0}" ));
-DATA(insert ( 2151     float4_accum    float8_variance 1022    "{0,0,0}" ));
-DATA(insert ( 2152     float8_accum    float8_variance 1022    "{0,0,0}" ));
+DATA(insert ( 2151     float4_accum    float8_variance 1022    "{0,0,0}" ));
+DATA(insert ( 2152     float8_accum    float8_variance 1022    "{0,0,0}" ));
 DATA(insert ( 2153     numeric_accum   numeric_variance        1231    "{0,0,0}" ));
 
 /* stddev */
@@ -153,11 +153,11 @@ DATA(insert ( 2159        numeric_accum   numeric_stddev  1231    "{0,0,0}" ));
  * prototypes for functions in pg_aggregate.c
  */
 extern void AggregateCreate(const char *aggName,
-                                                       Oid aggNamespace,
-                                                       List *aggtransfnName,
-                                                       List *aggfinalfnName,
-                                                       Oid aggBaseType,
-                                                       Oid aggTransType,
-                                                       const char *agginitval);
+                               Oid aggNamespace,
+                               List *aggtransfnName,
+                               List *aggfinalfnName,
+                               Oid aggBaseType,
+                               Oid aggTransType,
+                               const char *agginitval);
 
 #endif   /* PG_AGGREGATE_H */
index 6549622..918b17b 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_attribute.h,v 1.98 2002/08/30 19:23:20 tgl Exp $
+ * $Id: pg_attribute.h,v 1.99 2002/09/04 20:31:37 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -58,8 +58,8 @@ CATALOG(pg_attribute) BOOTSTRAP BKI_WITHOUT_OIDS
         * attstattarget is the target number of statistics datapoints to
         * collect during VACUUM ANALYZE of this column.  A zero here
         * indicates that we do not wish to collect any stats about this
-        * column. A "-1" here indicates that no value has been explicitly
-        * set for this column, so ANALYZE should use the default setting.
+        * column. A "-1" here indicates that no value has been explicitly set
+        * for this column, so ANALYZE should use the default setting.
         */
        int4            attstattarget;
 
@@ -219,7 +219,7 @@ typedef FormData_pg_attribute *Form_pg_attribute;
  * ----------------
  */
 #define Schema_pg_type \
-{ 1247, {"typname"},      19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typname"},      19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
 { 1247, {"typnamespace"},  26, -1,     4,      2, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
 { 1247, {"typowner"},     23, 0,       4,      3, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
 { 1247, {"typlen"},               21, 0,       2,      4, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
@@ -233,15 +233,15 @@ typedef FormData_pg_attribute *Form_pg_attribute;
 { 1247, {"typoutput"},    24, 0,       4, 12, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
 { 1247, {"typalign"},     18, 0,       1, 13, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
 { 1247, {"typstorage"},    18, 0,      1, 14, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
-{ 1247, {"typnotnull"},    16, 0,   1, 15, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1247, {"typnotnull"},    16, 0,      1, 15, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
 { 1247, {"typbasetype"},   26, 0,      4, 16, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
-{ 1247, {"typtypmod"},     23, 0,      4, 17, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
-{ 1247, {"typndims"},      23, 0,      4, 18, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typtypmod"},    23, 0,       4, 17, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1247, {"typndims"},     23, 0,       4, 18, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
 { 1247, {"typdefaultbin"}, 25, 0,  -1, 19, 0, -1, -1, false, 'x', false, 'i', false, false, false, false }, \
 { 1247, {"typdefault"},    25, 0,  -1, 20, 0, -1, -1, false, 'x', false, 'i', false, false, false, false }
 
 
-DATA(insert ( 1247 typname                     19 -1 NAMEDATALEN   1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1247 typname                     19 -1 NAMEDATALEN       1 0 -1 -1 f p f i t f f f));
 DATA(insert ( 1247 typnamespace                26 -1 4   2 0 -1 -1 t p f i t f f f));
 DATA(insert ( 1247 typowner                    23 0  4   3 0 -1 -1 t p f i t f f f));
 DATA(insert ( 1247 typlen                      21 0  2   4 0 -1 -1 t p f s t f f f));
@@ -299,14 +299,14 @@ DATA(insert ( 1262 tableoid                       26 0  4  -7 0 -1 -1 t p f i t f f f));
  */
 #define Schema_pg_proc \
 { 1255, {"proname"},                   19, -1, NAMEDATALEN,  1, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
-{ 1255, {"pronamespace"},              26, -1, 4,      2, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
+{ 1255, {"pronamespace"},              26, -1, 4,      2, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
 { 1255, {"proowner"},                  23, 0,  4,      3, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
 { 1255, {"prolang"},                   26, 0,  4,      4, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
-{ 1255, {"proisagg"},                  16, -1, 1,      5, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1255, {"proisagg"},                  16, -1, 1,      5, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
 { 1255, {"prosecdef"},                 16, 0,  1,      6, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
 { 1255, {"proisstrict"},               16, 0,  1,      7, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
-{ 1255, {"proretset"},                 16, 0,  1,  8, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
-{ 1255, {"provolatile"},               18, 0,  1,  9, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1255, {"proretset"},                 16, 0,  1,      8, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1255, {"provolatile"},               18, 0,  1,      9, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
 { 1255, {"pronargs"},                  21, 0,  2, 10, 0, -1, -1, true, 'p', false, 's', true, false, false, false }, \
 { 1255, {"prorettype"},                        26, 0,  4, 11, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
 { 1255, {"proargtypes"},               30, 0, INDEX_MAX_KEYS*4, 12, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
@@ -314,7 +314,7 @@ DATA(insert ( 1262 tableoid                 26 0  4  -7 0 -1 -1 t p f i t f f f));
 { 1255, {"probin"},                            17, 0, -1, 14, 0, -1, -1, false, 'x', false, 'i', false, false, false, false }, \
 { 1255, {"proacl"},                      1034, 0, -1, 15, 0, -1, -1, false, 'x', false, 'i', false, false, false, false }
 
-DATA(insert ( 1255 proname                     19 -1 NAMEDATALEN   1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1255 proname                     19 -1 NAMEDATALEN       1 0 -1 -1 f p f i t f f f));
 DATA(insert ( 1255 pronamespace                26 -1 4   2 0 -1 -1 t p f i t f f f));
 DATA(insert ( 1255 proowner                    23 0  4   3 0 -1 -1 t p f i t f f f));
 DATA(insert ( 1255 prolang                     26 0  4   4 0 -1 -1 t p f i t f f f));
@@ -348,7 +348,7 @@ DATA(insert ( 1260 usesuper                 16      0       1       4 0 -1 -1 t p f c t f f f));
 DATA(insert ( 1260 usecatupd           16      0       1       5 0 -1 -1 t p f c t f f f));
 DATA(insert ( 1260 passwd                      25      0  -1   6 0 -1 -1 f x f i f f f f));
 DATA(insert ( 1260 valuntil                    702 0   4       7 0 -1 -1 t p f i f f f f));
-DATA(insert ( 1260 useconfig     1009  0  -1   8 0 -1 -1 f x f i f f f f));
+DATA(insert ( 1260 useconfig     1009  0  -1   8 0 -1 -1 f x f i f f f f));
 DATA(insert ( 1260 ctid                                27 0  6  -1 0 -1 -1 f p f i t f f f));
 /* no OIDs in pg_shadow */
 DATA(insert ( 1260 xmin                                28 0  4  -3 0 -1 -1 t p f i t f f f));
@@ -390,7 +390,7 @@ DATA(insert ( 1261 tableoid                 26 0  4  -7 0 -1 -1 t p f i t f f f));
 { 1249, {"attstorage"},   18, 0,       1, 11, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
 { 1249, {"attisset"},    16, 0,        1, 12, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
 { 1249, {"attalign"},    18, 0,        1, 13, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
-{ 1249, {"attnotnull"},          16, 0, 1, 14, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
+{ 1249, {"attnotnull"},   16, 0, 1, 14, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
 { 1249, {"atthasdef"},   16, 0, 1, 15, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
 { 1249, {"attisdropped"}, 16, 0, 1, 16, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
 { 1249, {"attisinherited"},16,0, 1, 17, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }
@@ -425,7 +425,7 @@ DATA(insert ( 1249 tableoid                 26 0  4  -7 0 -1 -1 t p f i t f f f));
  * ----------------
  */
 #define Schema_pg_class \
-{ 1259, {"relname"},      19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
+{ 1259, {"relname"},      19, -1, NAMEDATALEN, 1, 0, -1, -1, false, 'p', false, 'i', true, false, false, false }, \
 { 1259, {"relnamespace"},  26, -1,     4,      2, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
 { 1259, {"reltype"},      26, 0,       4,      3, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
 { 1259, {"relowner"},     23, 0,       4,      4, 0, -1, -1, true, 'p', false, 'i', true, false, false, false }, \
@@ -450,7 +450,7 @@ DATA(insert ( 1249 tableoid                 26 0  4  -7 0 -1 -1 t p f i t f f f));
 { 1259, {"relhassubclass"},16, 0,      1, 23, 0, -1, -1, true, 'p', false, 'c', true, false, false, false }, \
 { 1259, {"relacl"},             1034, 0,  -1, 24, 0, -1, -1, false, 'x', false, 'i', false, false, false, false }
 
-DATA(insert ( 1259 relname                     19 -1 NAMEDATALEN   1 0 -1 -1 f p f i t f f f));
+DATA(insert ( 1259 relname                     19 -1 NAMEDATALEN       1 0 -1 -1 f p f i t f f f));
 DATA(insert ( 1259 relnamespace                26 -1 4   2 0 -1 -1 t p f i t f f f));
 DATA(insert ( 1259 reltype                     26 0  4   3 0 -1 -1 t p f i t f f f));
 DATA(insert ( 1259 relowner                    23 0  4   4 0 -1 -1 t p f i t f f f));
index 3866f7c..3176335 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 2002, PostgreSQL Global Development Group
  *
- * $Id: pg_cast.h,v 1.2 2002/09/01 00:58:06 tgl Exp $
+ * $Id: pg_cast.h,v 1.3 2002/09/04 20:31:37 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -42,78 +42,78 @@ typedef FormData_pg_cast *Form_pg_cast;
 /*
  * binary compatible casts
  */
-DATA(insert (   25 1042    0 t ));
-DATA(insert (   25 1043    0 t ));
-DATA(insert ( 1042   25    0 t ));
+DATA(insert (  25 1042    0 t ));
+DATA(insert (  25 1043    0 t ));
+DATA(insert ( 1042      25    0 t ));
 DATA(insert ( 1042 1043    0 t ));
-DATA(insert ( 1043   25    0 t ));
+DATA(insert ( 1043      25    0 t ));
 DATA(insert ( 1043 1042    0 t ));
 
-DATA(insert (   23   24    0 t ));
-DATA(insert (   23   26    0 t ));
-DATA(insert (   23 2202    0 t ));
-DATA(insert (   23 2203    0 t ));
-DATA(insert (   23 2204    0 t ));
-DATA(insert (   23 2205    0 t ));
-DATA(insert (   23 2206    0 t ));
-DATA(insert (   24   23    0 t ));
-DATA(insert (   24   26    0 t ));
-DATA(insert (   24 2202    0 t ));
-DATA(insert (   24 2203    0 t ));
-DATA(insert (   24 2204    0 t ));
-DATA(insert (   24 2205    0 t ));
-DATA(insert (   24 2206    0 t ));
-DATA(insert (   26   23    0 t ));
-DATA(insert (   26   24    0 t ));
-DATA(insert (   26 2202    0 t ));
-DATA(insert (   26 2203    0 t ));
-DATA(insert (   26 2204    0 t ));
-DATA(insert (   26 2205    0 t ));
-DATA(insert (   26 2206    0 t ));
-DATA(insert ( 2202   23    0 t ));
-DATA(insert ( 2202   24    0 t ));
-DATA(insert ( 2202   26    0 t ));
+DATA(insert (  23       24    0 t ));
+DATA(insert (  23       26    0 t ));
+DATA(insert (  23 2202    0 t ));
+DATA(insert (  23 2203    0 t ));
+DATA(insert (  23 2204    0 t ));
+DATA(insert (  23 2205    0 t ));
+DATA(insert (  23 2206    0 t ));
+DATA(insert (  24       23    0 t ));
+DATA(insert (  24       26    0 t ));
+DATA(insert (  24 2202    0 t ));
+DATA(insert (  24 2203    0 t ));
+DATA(insert (  24 2204    0 t ));
+DATA(insert (  24 2205    0 t ));
+DATA(insert (  24 2206    0 t ));
+DATA(insert (  26       23    0 t ));
+DATA(insert (  26       24    0 t ));
+DATA(insert (  26 2202    0 t ));
+DATA(insert (  26 2203    0 t ));
+DATA(insert (  26 2204    0 t ));
+DATA(insert (  26 2205    0 t ));
+DATA(insert (  26 2206    0 t ));
+DATA(insert ( 2202      23    0 t ));
+DATA(insert ( 2202      24    0 t ));
+DATA(insert ( 2202      26    0 t ));
 DATA(insert ( 2202 2203    0 t ));
 DATA(insert ( 2202 2204    0 t ));
 DATA(insert ( 2202 2205    0 t ));
 DATA(insert ( 2202 2206    0 t ));
-DATA(insert ( 2203   23    0 t ));
-DATA(insert ( 2203   24    0 t ));
-DATA(insert ( 2203   26    0 t ));
+DATA(insert ( 2203      23    0 t ));
+DATA(insert ( 2203      24    0 t ));
+DATA(insert ( 2203      26    0 t ));
 DATA(insert ( 2203 2202    0 t ));
 DATA(insert ( 2203 2204    0 t ));
 DATA(insert ( 2203 2205    0 t ));
 DATA(insert ( 2203 2206    0 t ));
-DATA(insert ( 2204   23    0 t ));
-DATA(insert ( 2204   24    0 t ));
-DATA(insert ( 2204   26    0 t ));
+DATA(insert ( 2204      23    0 t ));
+DATA(insert ( 2204      24    0 t ));
+DATA(insert ( 2204      26    0 t ));
 DATA(insert ( 2204 2202    0 t ));
 DATA(insert ( 2204 2203    0 t ));
 DATA(insert ( 2204 2205    0 t ));
 DATA(insert ( 2204 2206    0 t ));
-DATA(insert ( 2205   23    0 t ));
-DATA(insert ( 2205   24    0 t ));
-DATA(insert ( 2205   26    0 t ));
+DATA(insert ( 2205      23    0 t ));
+DATA(insert ( 2205      24    0 t ));
+DATA(insert ( 2205      26    0 t ));
 DATA(insert ( 2205 2202    0 t ));
 DATA(insert ( 2205 2203    0 t ));
 DATA(insert ( 2205 2204    0 t ));
 DATA(insert ( 2205 2206    0 t ));
-DATA(insert ( 2206   23    0 t ));
-DATA(insert ( 2206   24    0 t ));
-DATA(insert ( 2206   26    0 t ));
+DATA(insert ( 2206      23    0 t ));
+DATA(insert ( 2206      24    0 t ));
+DATA(insert ( 2206      26    0 t ));
 DATA(insert ( 2206 2202    0 t ));
 DATA(insert ( 2206 2203    0 t ));
 DATA(insert ( 2206 2204    0 t ));
 DATA(insert ( 2206 2205    0 t ));
 
-DATA(insert (   23  702    0 t ));
-DATA(insert (  702   23    0 t ));
+DATA(insert (  23      702    0 t ));
+DATA(insert (  702      23    0 t ));
 
-DATA(insert (   23  703    0 t ));
-DATA(insert (  703   23    0 t ));
+DATA(insert (  23      703    0 t ));
+DATA(insert (  703      23    0 t ));
 
-DATA(insert (  650  869    0 t ));
-DATA(insert (  869  650    0 t ));
+DATA(insert (  650     869    0 t ));
+DATA(insert (  869     650    0 t ));
 
 DATA(insert ( 1560 1562    0 t ));
 DATA(insert ( 1562 1560    0 t ));
@@ -129,108 +129,108 @@ DATA(insert ( 1562 1560    0 t ));
  * from pg_proc p, pg_type t where p.pronargs=1 and p.proname = t.typname
  * and p.prorettype = t.oid order by 1, 2;
  */
-DATA(insert (   18   25  946 t ));
-DATA(insert (   18 1042  860 t ));
-DATA(insert (   19   25  406 t ));
-DATA(insert (   19 1042  408 t ));
-DATA(insert (   19 1043 1401 t ));
-DATA(insert (   20   21  714 t ));
-DATA(insert (   20   23  480 t ));
-DATA(insert (   20   25 1288 t ));
-DATA(insert (   20  701  482 t ));
-DATA(insert (   20 1043 1623 f ));
-DATA(insert (   20 1700 1781 t ));
-DATA(insert (   21   20  754 t ));
-DATA(insert (   21   23  313 t ));
-DATA(insert (   21   25  113 t ));
-DATA(insert (   21  700  236 t ));
-DATA(insert (   21  701  235 t ));
-DATA(insert (   21 1700 1782 t ));
-DATA(insert (   23   20  481 t ));
-DATA(insert (   23   21  314 t ));
-DATA(insert (   23   25  112 t ));
-DATA(insert (   23  700  318 t ));
-DATA(insert (   23  701  316 t ));
-DATA(insert (   23 1043 1619 f ));
-DATA(insert (   23 1700 1740 t ));
-DATA(insert (   25   18  944 t ));
-DATA(insert (   25   19  407 t ));
-DATA(insert (   25   20 1289 f ));
-DATA(insert (   25   21  818 f ));
-DATA(insert (   25   23  819 f ));
-DATA(insert (   25   26  817 f ));
-DATA(insert (   25  650 1714 f ));
-DATA(insert (   25  700  839 f ));
-DATA(insert (   25  701  838 f ));
-DATA(insert (   25  829  767 f ));
-DATA(insert (   25  869 1713 f ));
-DATA(insert (   25 1082  748 f ));
-DATA(insert (   25 1083  837 f ));
-DATA(insert (   25 1114 2022 f ));
-DATA(insert (   25 1184 1191 f ));
-DATA(insert (   25 1186 1263 f ));
-DATA(insert (   25 1266  938 f ));
-DATA(insert (   26   25  114 t ));
-DATA(insert (  601  600 1532 f ));
-DATA(insert (  602  600 1533 f ));
-DATA(insert (  602  604 1449 f ));
-DATA(insert (  603  600 1534 f ));
-DATA(insert (  603  601 1541 f ));
-DATA(insert (  603  604 1448 f ));
-DATA(insert (  603  718 1479 f ));
-DATA(insert (  604  600 1540 f ));
-DATA(insert (  604  602 1447 f ));
-DATA(insert (  604  603 1446 f ));
-DATA(insert (  604  718 1474 f ));
-DATA(insert (  700   21  238 f ));
-DATA(insert (  700   23  319 f ));
-DATA(insert (  700   25  841 t ));
-DATA(insert (  700  701  311 t ));
+DATA(insert (  18       25  946 t ));
+DATA(insert (  18 1042  860 t ));
+DATA(insert (  19       25  406 t ));
+DATA(insert (  19 1042  408 t ));
+DATA(insert (  19 1043 1401 t ));
+DATA(insert (  20       21  714 t ));
+DATA(insert (  20       23  480 t ));
+DATA(insert (  20       25 1288 t ));
+DATA(insert (  20      701  482 t ));
+DATA(insert (  20 1043 1623 f ));
+DATA(insert (  20 1700 1781 t ));
+DATA(insert (  21       20  754 t ));
+DATA(insert (  21       23  313 t ));
+DATA(insert (  21       25  113 t ));
+DATA(insert (  21      700  236 t ));
+DATA(insert (  21      701  235 t ));
+DATA(insert (  21 1700 1782 t ));
+DATA(insert (  23       20  481 t ));
+DATA(insert (  23       21  314 t ));
+DATA(insert (  23       25  112 t ));
+DATA(insert (  23      700  318 t ));
+DATA(insert (  23      701  316 t ));
+DATA(insert (  23 1043 1619 f ));
+DATA(insert (  23 1700 1740 t ));
+DATA(insert (  25       18  944 t ));
+DATA(insert (  25       19  407 t ));
+DATA(insert (  25       20 1289 f ));
+DATA(insert (  25       21  818 f ));
+DATA(insert (  25       23  819 f ));
+DATA(insert (  25       26  817 f ));
+DATA(insert (  25      650 1714 f ));
+DATA(insert (  25      700  839 f ));
+DATA(insert (  25      701  838 f ));
+DATA(insert (  25      829  767 f ));
+DATA(insert (  25      869 1713 f ));
+DATA(insert (  25 1082  748 f ));
+DATA(insert (  25 1083  837 f ));
+DATA(insert (  25 1114 2022 f ));
+DATA(insert (  25 1184 1191 f ));
+DATA(insert (  25 1186 1263 f ));
+DATA(insert (  25 1266  938 f ));
+DATA(insert (  26       25  114 t ));
+DATA(insert (  601     600 1532 f ));
+DATA(insert (  602     600 1533 f ));
+DATA(insert (  602     604 1449 f ));
+DATA(insert (  603     600 1534 f ));
+DATA(insert (  603     601 1541 f ));
+DATA(insert (  603     604 1448 f ));
+DATA(insert (  603     718 1479 f ));
+DATA(insert (  604     600 1540 f ));
+DATA(insert (  604     602 1447 f ));
+DATA(insert (  604     603 1446 f ));
+DATA(insert (  604     718 1474 f ));
+DATA(insert (  700      21  238 f ));
+DATA(insert (  700      23  319 f ));
+DATA(insert (  700      25  841 t ));
+DATA(insert (  700     701  311 t ));
 DATA(insert (  700 1700 1742 t ));
-DATA(insert (  701   20  483 t ));
-DATA(insert (  701   21  237 f ));
-DATA(insert (  701   23  317 f ));
-DATA(insert (  701   25  840 t ));
-DATA(insert (  701  700  312 t ));
+DATA(insert (  701      20  483 t ));
+DATA(insert (  701      21  237 f ));
+DATA(insert (  701      23  317 f ));
+DATA(insert (  701      25  840 t ));
+DATA(insert (  701     700  312 t ));
 DATA(insert (  701 1700 1743 t ));
 DATA(insert (  702 1082 1179 f ));
 DATA(insert (  702 1083 1364 f ));
 DATA(insert (  702 1114 2023 t ));
 DATA(insert (  702 1184 1173 t ));
 DATA(insert (  703 1186 1177 t ));
-DATA(insert (  718  600 1416 f ));
-DATA(insert (  718  603 1480 f ));
-DATA(insert (  718  604 1544 f ));
-DATA(insert (  829   25  752 f ));
-DATA(insert (  869   25  730 f ));
-DATA(insert ( 1042   19  409 t ));
-DATA(insert ( 1043   19 1400 t ));
-DATA(insert ( 1082   25  749 t ));
+DATA(insert (  718     600 1416 f ));
+DATA(insert (  718     603 1480 f ));
+DATA(insert (  718     604 1544 f ));
+DATA(insert (  829      25  752 f ));
+DATA(insert (  869      25  730 f ));
+DATA(insert ( 1042      19  409 t ));
+DATA(insert ( 1043      19 1400 t ));
+DATA(insert ( 1082      25  749 t ));
 DATA(insert ( 1082 1114 2024 t ));
 DATA(insert ( 1082 1184 1174 t ));
-DATA(insert ( 1083   25  948 t ));
+DATA(insert ( 1083      25  948 t ));
 DATA(insert ( 1083 1186 1370 t ));
 DATA(insert ( 1083 1266 2047 t ));
-DATA(insert ( 1114   25 2034 t ));
-DATA(insert ( 1114  702 2030 f ));
+DATA(insert ( 1114      25 2034 t ));
+DATA(insert ( 1114     702 2030 f ));
 DATA(insert ( 1114 1082 2029 f ));
 DATA(insert ( 1114 1083 1316 f ));
 DATA(insert ( 1114 1184 2028 t ));
-DATA(insert ( 1184   25 1192 t ));
-DATA(insert ( 1184  702 1180 f ));
+DATA(insert ( 1184      25 1192 t ));
+DATA(insert ( 1184     702 1180 f ));
 DATA(insert ( 1184 1082 1178 f ));
 DATA(insert ( 1184 1083 2019 f ));
 DATA(insert ( 1184 1114 2027 t ));
 DATA(insert ( 1184 1266 1388 f ));
-DATA(insert ( 1186   25 1193 t ));
-DATA(insert ( 1186  703 1194 f ));
+DATA(insert ( 1186      25 1193 t ));
+DATA(insert ( 1186     703 1194 f ));
 DATA(insert ( 1186 1083 1419 f ));
-DATA(insert ( 1266   25  939 t ));
+DATA(insert ( 1266      25  939 t ));
 DATA(insert ( 1266 1083 2046 t ));
-DATA(insert ( 1700   20 1779 f ));
-DATA(insert ( 1700   21 1783 f ));
-DATA(insert ( 1700   23 1744 f ));
-DATA(insert ( 1700  700 1745 f ));
-DATA(insert ( 1700  701 1746 f ));
+DATA(insert ( 1700      20 1779 f ));
+DATA(insert ( 1700      21 1783 f ));
+DATA(insert ( 1700      23 1744 f ));
+DATA(insert ( 1700     700 1745 f ));
+DATA(insert ( 1700     701 1746 f ));
 
 #endif   /* PG_CAST_H */
index 466177f..59e4e92 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_class.h,v 1.72 2002/08/30 19:23:20 tgl Exp $
+ * $Id: pg_class.h,v 1.73 2002/09/04 20:31:37 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -146,9 +146,9 @@ DATA(insert OID = 1260 (  pg_shadow         PGNSP 86 PGUID 0 1260 0 0 0 0 f t r 8  0 0
 DESCR("");
 DATA(insert OID = 1261 (  pg_group             PGNSP 87 PGUID 0 1261 0 0 0 0 f t r 3  0 0 0 0 0 f f f f _null_ ));
 DESCR("");
-DATA(insert OID = 1262 (  pg_database  PGNSP 88 PGUID 0 1262 0 0 0 0 f t r 11  0 0 0 0 0 t f f f _null_ ));
+DATA(insert OID = 1262 (  pg_database  PGNSP 88 PGUID 0 1262 0 0 0 0 f t r 11  0 0 0 0 0 t f f f _null_ ));
 DESCR("");
-DATA(insert OID = 376  (  pg_xactlock  PGNSP  0 PGUID 0    0 0 0 0 0 f t s 1  0 0 0 0 0 f f f f _null_ ));
+DATA(insert OID = 376  (  pg_xactlock  PGNSP  0 PGUID 0        0 0 0 0 0 f t s 1  0 0 0 0 0 f f f f _null_ ));
 DESCR("");
 
 #define RelOid_pg_type                 1247
index e4a7dc8..ac7679b 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_constraint.h,v 1.2 2002/07/16 05:53:34 tgl Exp $
+ * $Id: pg_constraint.h,v 1.3 2002/09/04 20:31:37 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -37,10 +37,10 @@ CATALOG(pg_constraint)
         * conname + connamespace is deliberately not unique; we allow, for
         * example, the same name to be used for constraints of different
         * relations.  This is partly for backwards compatibility with past
-        * Postgres practice, and partly because we don't want to have to obtain
-        * a global lock to generate a globally unique name for a nameless
-        * constraint.  We associate a namespace with constraint names only
-        * for SQL92 compatibility.
+        * Postgres practice, and partly because we don't want to have to
+        * obtain a global lock to generate a globally unique name for a
+        * nameless constraint.  We associate a namespace with constraint
+        * names only for SQL92 compatibility.
         */
        NameData        conname;                /* name of this constraint */
        Oid                     connamespace;   /* OID of namespace containing constraint */
@@ -57,16 +57,17 @@ CATALOG(pg_constraint)
 
        /*
         * contypid links to the pg_type row for a domain if this is a domain
-        * constraint.  Otherwise it's 0.
+        * constraint.  Otherwise it's 0.
         *
-        * For SQL-style global ASSERTIONs, both conrelid and contypid would
-        * be zero.  This is not presently supported, however.
+        * For SQL-style global ASSERTIONs, both conrelid and contypid would be
+        * zero.  This is not presently supported, however.
         */
        Oid                     contypid;               /* domain this constraint constrains */
 
        /*
         * These fields, plus confkey, are only meaningful for a foreign-key
-        * constraint.  Otherwise confrelid is 0 and the char fields are spaces.
+        * constraint.  Otherwise confrelid is 0 and the char fields are
+        * spaces.
         */
        Oid                     confrelid;              /* relation referenced by foreign key */
        char            confupdtype;    /* foreign key's ON UPDATE action */
@@ -143,31 +144,31 @@ typedef FormData_pg_constraint *Form_pg_constraint;
 /*
  * prototypes for functions in pg_constraint.c
  */
-extern Oid     CreateConstraintEntry(const char *constraintName,
-                                                                 Oid constraintNamespace,
-                                                                 char constraintType,
-                                                                 bool isDeferrable,
-                                                                 bool isDeferred,
-                                                                 Oid relId,
-                                                                 const int16 *constraintKey,
-                                                                 int constraintNKeys,
-                                                                 Oid domainId,
-                                                                 Oid foreignRelId,
-                                                                 const int16 *foreignKey,
-                                                                 int foreignNKeys,
-                                                                 char foreignUpdateType,
-                                                                 char foreignDeleteType,
-                                                                 char foreignMatchType,
-                                                                 Node *conExpr,
-                                                                 const char *conBin,
-                                                                 const char *conSrc);
+extern Oid CreateConstraintEntry(const char *constraintName,
+                                         Oid constraintNamespace,
+                                         char constraintType,
+                                         bool isDeferrable,
+                                         bool isDeferred,
+                                         Oid relId,
+                                         const int16 *constraintKey,
+                                         int constraintNKeys,
+                                         Oid domainId,
+                                         Oid foreignRelId,
+                                         const int16 *foreignKey,
+                                         int foreignNKeys,
+                                         char foreignUpdateType,
+                                         char foreignDeleteType,
+                                         char foreignMatchType,
+                                         Node *conExpr,
+                                         const char *conBin,
+                                         const char *conSrc);
 
 extern void RemoveConstraintById(Oid conId);
 
 extern bool ConstraintNameIsUsed(Oid relId, Oid relNamespace,
-                                                                const char *cname);
+                                        const char *cname);
 extern char *GenerateConstraintName(Oid relId, Oid relNamespace,
-                                                                       int *counter);
+                                          int *counter);
 extern bool ConstraintNameIsGenerated(const char *cname);
 
 #endif   /* PG_CONSTRAINT_H */
index 77d8bcc..42179b2 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_control.h,v 1.9 2002/09/03 21:45:43 petere Exp $
+ * $Id: pg_control.h,v 1.10 2002/09/04 20:31:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -111,7 +111,7 @@ typedef struct ControlFileData
        uint32          funcMaxArgs;    /* maximum number of function arguments */
 
        /* flag indicating internal format of timestamp, interval, time */
-       uint32          enableIntTimes; /* int64 storage enabled? */
+       uint32          enableIntTimes; /* int64 storage enabled? */
 
        /* active locales */
        uint32          localeBuflen;
index 4b90c78..5c70e81 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_conversion.h,v 1.5 2002/08/06 14:11:06 tgl Exp $
+ * $Id: pg_conversion.h,v 1.6 2002/09/04 20:31:37 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -36,8 +36,8 @@
  *     conowner                        owner of the conversion
  *     conforencoding          FOR encoding id
  *     contoencoding           TO encoding id
- *  conproc                            OID of the conversion proc
- *  condefault                 TRUE is this is a default conversion
+ *     conproc                         OID of the conversion proc
+ *     condefault                      TRUE is this is a default conversion
  * ----------------------------------------------------------------
  */
 CATALOG(pg_conversion)
@@ -65,7 +65,7 @@ typedef FormData_pg_conversion *Form_pg_conversion;
 
 #define Natts_pg_conversion                            7
 #define Anum_pg_conversion_conname             1
-#define Anum_pg_conversion_connamespace        2
+#define Anum_pg_conversion_connamespace 2
 #define Anum_pg_conversion_conowner            3
 #define Anum_pg_conversion_conforencoding              4
 #define Anum_pg_conversion_contoencoding               5
@@ -83,14 +83,14 @@ typedef FormData_pg_conversion *Form_pg_conversion;
 #include "nodes/pg_list.h"
 #include "nodes/parsenodes.h"
 
-extern Oid     ConversionCreate(const char *conname, Oid connamespace,
-                                                        int32 conowner,
-                                                        int4 conforencoding, int4 contoencoding,
-                                                        Oid conproc, bool def);
+extern Oid ConversionCreate(const char *conname, Oid connamespace,
+                                int32 conowner,
+                                int4 conforencoding, int4 contoencoding,
+                                Oid conproc, bool def);
 extern void ConversionDrop(const char *conname, Oid connamespace,
-                                                  int32 conowner, DropBehavior behavior);
+                          int32 conowner, DropBehavior behavior);
 extern void RemoveConversionById(Oid conversionOid);
-extern Oid FindConversion(const char *conname, Oid connamespace);
-extern Oid FindDefaultConversion(Oid connamespace, int4 for_encoding, int4 to_encoding);
+extern Oid     FindConversion(const char *conname, Oid connamespace);
+extern Oid     FindDefaultConversion(Oid connamespace, int4 for_encoding, int4 to_encoding);
 
 #endif   /* PG_CONVERSION_H */
index 41d3707..48d9c42 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_language.h,v 1.19 2002/07/24 19:11:12 petere Exp $
+ * $Id: pg_language.h,v 1.20 2002/09/04 20:31:37 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -38,7 +38,7 @@ CATALOG(pg_language)
        bool            lanpltrusted;   /* PL is trusted */
        Oid                     lanplcallfoid;  /* Call handler for PL */
        Oid                     lanvalidator;   /* optional validation function */
-    aclitem            lanacl[1];              /* Access privileges */
+       aclitem         lanacl[1];              /* Access privileges */
 } FormData_pg_language;
 
 /* ----------------
index 1a9b565..b1a9855 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_namespace.h,v 1.7 2002/06/20 20:29:44 momjian Exp $
+ * $Id: pg_namespace.h,v 1.8 2002/09/04 20:31:37 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -40,7 +40,7 @@ CATALOG(pg_namespace)
 {
        NameData        nspname;
        int4            nspowner;
-    aclitem            nspacl[1];              /* VARIABLE LENGTH FIELD */
+       aclitem         nspacl[1];              /* VARIABLE LENGTH FIELD */
 } FormData_pg_namespace;
 
 /* ----------------
index 71cecd5..e4884b7 100644 (file)
@@ -26,7 +26,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_opclass.h,v 1.45 2002/06/20 20:29:44 momjian Exp $
+ * $Id: pg_opclass.h,v 1.46 2002/09/04 20:31:37 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -131,8 +131,8 @@ DATA(insert OID = 1994 (    403             text_ops                PGNSP PGUID   25 t 0 ));
 DATA(insert OID = 1995 (       405             text_ops                PGNSP PGUID   25 t 0 ));
 DATA(insert OID = 1996 (       403             time_ops                PGNSP PGUID 1083 t 0 ));
 DATA(insert OID = 1997 (       405             time_ops                PGNSP PGUID 1083 t 0 ));
-DATA(insert OID = 1998 (       403             timestamptz_ops PGNSP PGUID 1184 t 0 ));
-DATA(insert OID = 1999 (       405             timestamptz_ops PGNSP PGUID 1184 t 0 ));
+DATA(insert OID = 1998 (       403             timestamptz_ops PGNSP PGUID 1184 t 0 ));
+DATA(insert OID = 1999 (       405             timestamptz_ops PGNSP PGUID 1184 t 0 ));
 DATA(insert OID = 2000 (       403             timetz_ops              PGNSP PGUID 1266 t 0 ));
 DATA(insert OID = 2001 (       405             timetz_ops              PGNSP PGUID 1266 t 0 ));
 DATA(insert OID = 2002 (       403             varbit_ops              PGNSP PGUID 1562 t 0 ));
index ccf32bb..c770150 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_operator.h,v 1.108 2002/09/02 06:22:19 momjian Exp $
+ * $Id: pg_operator.h,v 1.109 2002/09/04 20:31:37 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -93,354 +93,354 @@ typedef FormData_pg_operator *Form_pg_operator;
  * ----------------
  */
 
-DATA(insert OID =  15 ( "="               PGNSP PGUID b f  23  20  16 416  36  97 412  37  76 int48eq eqsel eqjoinsel ));
-DATA(insert OID =  36 ( "<>"      PGNSP PGUID b f  23  20  16 417  15   0   0   0   0 int48ne neqsel neqjoinsel ));
-DATA(insert OID =  37 ( "<"               PGNSP PGUID b f  23  20  16 419  82   0   0   0   0 int48lt scalarltsel scalarltjoinsel ));
-DATA(insert OID =  76 ( ">"               PGNSP PGUID b f  23  20  16 418  80   0   0   0   0 int48gt scalargtsel scalargtjoinsel ));
-DATA(insert OID =  80 ( "<="      PGNSP PGUID b f  23  20  16 430  76   0   0   0   0 int48le scalarltsel scalarltjoinsel ));
-DATA(insert OID =  82 ( ">="      PGNSP PGUID b f  23  20  16 420  37   0   0   0   0 int48ge scalargtsel scalargtjoinsel ));
-
-DATA(insert OID =  58 ( "<"               PGNSP PGUID b f  16  16  16  59   1695   0   0   0   0 boollt scalarltsel scalarltjoinsel ));
-DATA(insert OID =  59 ( ">"               PGNSP PGUID b f  16  16  16  58   1694   0   0   0   0 boolgt scalargtsel scalargtjoinsel ));
-DATA(insert OID =  85 ( "<>"      PGNSP PGUID b f  16  16  16  85  91   0   0   0   0 boolne neqsel neqjoinsel ));
-DATA(insert OID =  91 ( "="               PGNSP PGUID b t  16  16  16  91  85  58  58  58  59 booleq eqsel eqjoinsel ));
+DATA(insert OID =  15 ( "="               PGNSP PGUID b f      23      20      16 416  36      97 412  37      76 int48eq eqsel eqjoinsel ));
+DATA(insert OID =  36 ( "<>"      PGNSP PGUID b f      23      20      16 417  15       0       0       0       0 int48ne neqsel neqjoinsel ));
+DATA(insert OID =  37 ( "<"               PGNSP PGUID b f      23      20      16 419  82       0       0       0       0 int48lt scalarltsel scalarltjoinsel ));
+DATA(insert OID =  76 ( ">"               PGNSP PGUID b f      23      20      16 418  80       0       0       0       0 int48gt scalargtsel scalargtjoinsel ));
+DATA(insert OID =  80 ( "<="      PGNSP PGUID b f      23      20      16 430  76       0       0       0       0 int48le scalarltsel scalarltjoinsel ));
+DATA(insert OID =  82 ( ">="      PGNSP PGUID b f      23      20      16 420  37       0       0       0       0 int48ge scalargtsel scalargtjoinsel ));
+
+DATA(insert OID =  58 ( "<"               PGNSP PGUID b f      16      16      16      59       1695   0       0       0       0 boollt scalarltsel scalarltjoinsel ));
+DATA(insert OID =  59 ( ">"               PGNSP PGUID b f      16      16      16      58       1694   0       0       0       0 boolgt scalargtsel scalargtjoinsel ));
+DATA(insert OID =  85 ( "<>"      PGNSP PGUID b f      16      16      16      85      91       0       0       0       0 boolne neqsel neqjoinsel ));
+DATA(insert OID =  91 ( "="               PGNSP PGUID b t      16      16      16      91      85      58      58      58      59 booleq eqsel eqjoinsel ));
 #define BooleanEqualOperator   91
-DATA(insert OID = 1694 (  "<="    PGNSP PGUID b f  16  16  16 1695 59  0  0   0   0 boolle scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1695 (  ">="    PGNSP PGUID b f  16  16  16 1694 58  0  0   0   0 boolge scalargtsel scalargtjoinsel ));
-
-DATA(insert OID =  92 ( "="               PGNSP PGUID b t  18  18  16  92 630 631 631 631 633 chareq eqsel eqjoinsel ));
-DATA(insert OID =  93 ( "="               PGNSP PGUID b t  19  19  16  93 643 660 660 660 662 nameeq eqsel eqjoinsel ));
-DATA(insert OID =  94 ( "="               PGNSP PGUID b t  21  21  16  94 519  95  95  95 520 int2eq eqsel eqjoinsel ));
-DATA(insert OID =  95 ( "<"               PGNSP PGUID b f  21  21  16 520 524   0   0   0   0 int2lt scalarltsel scalarltjoinsel ));
-DATA(insert OID =  96 ( "="               PGNSP PGUID b t  23  23  16  96 518  97  97  97 521 int4eq eqsel eqjoinsel ));
-DATA(insert OID =  97 ( "<"               PGNSP PGUID b f  23  23  16 521 525   0   0   0   0 int4lt scalarltsel scalarltjoinsel ));
-DATA(insert OID =  98 ( "="               PGNSP PGUID b t  25  25  16  98 531 664 664 664 666 texteq eqsel eqjoinsel ));
-
-DATA(insert OID = 329 (  "="      PGNSP PGUID b f  1000        1000  16  329 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 349 (  "="      PGNSP PGUID b f  1001        1001  16  349 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 374 (  "="      PGNSP PGUID b f  1002        1002  16  374 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 375 (  "="      PGNSP PGUID b f  1003        1003  16  375 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 377 (  "="      PGNSP PGUID b f  1005        1005  16  377 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 378 (  "="      PGNSP PGUID b f  1006        1006  16  378 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 379 (  "="      PGNSP PGUID b f  1007        1007  16  379 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 380 (  "="      PGNSP PGUID b f  1008        1008  16  380 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 381 (  "="      PGNSP PGUID b f  1009        1009  16  381 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 382 (  "="      PGNSP PGUID b f  1028        1028  16  382 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 383 (  "="      PGNSP PGUID b f  1010        1010  16  383 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 384 (  "="      PGNSP PGUID b f  1011        1011  16  384 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 385 (  "="      PGNSP PGUID b f  1012        1012  16  385 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 386 (  "="      PGNSP PGUID b f  1013        1013  16  386 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 390 (  "="      PGNSP PGUID b f  1017        1017  16  390 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 391 (  "="      PGNSP PGUID b f  1018        1018  16  391 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 392 (  "="      PGNSP PGUID b f  1019        1019  16  392 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 393 (  "="      PGNSP PGUID b f  1020        1020  16  393 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 394 (  "="      PGNSP PGUID b f  1021        1021  16  394 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 395 (  "="      PGNSP PGUID b f  1022        1022  16  395 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 396 (  "="      PGNSP PGUID b f  1023        1023  16  396 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 397 (  "="      PGNSP PGUID b f  1024        1024  16  397 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 398 (  "="      PGNSP PGUID b f  1025        1025  16  398 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 400 (  "="      PGNSP PGUID b f  1027        1027  16  400 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 401 (  "="      PGNSP PGUID b f  1034        1034  16  401 0  0      0   0   0 array_eq eqsel eqjoinsel ));
-
-DATA(insert OID = 352 (  "="      PGNSP PGUID b t  28  28  16 352   0   0   0   0   0 xideq eqsel eqjoinsel ));
-DATA(insert OID = 353 (  "="      PGNSP PGUID b t  28  23  16   0   0   0   0   0   0 xideq eqsel eqjoinsel ));
-DATA(insert OID = 387 (  "="      PGNSP PGUID b t  27  27  16 387   0   0   0   0   0 tideq eqsel eqjoinsel ));
+DATA(insert OID = 1694 (  "<="    PGNSP PGUID b f      16      16      16 1695 59      0  0   0   0 boolle scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1695 (  ">="    PGNSP PGUID b f      16      16      16 1694 58      0  0   0   0 boolge scalargtsel scalargtjoinsel ));
+
+DATA(insert OID =  92 ( "="               PGNSP PGUID b t      18      18      16      92 630 631 631 631 633 chareq eqsel eqjoinsel ));
+DATA(insert OID =  93 ( "="               PGNSP PGUID b t      19      19      16      93 643 660 660 660 662 nameeq eqsel eqjoinsel ));
+DATA(insert OID =  94 ( "="               PGNSP PGUID b t      21      21      16      94 519  95      95      95 520 int2eq eqsel eqjoinsel ));
+DATA(insert OID =  95 ( "<"               PGNSP PGUID b f      21      21      16 520 524       0       0       0       0 int2lt scalarltsel scalarltjoinsel ));
+DATA(insert OID =  96 ( "="               PGNSP PGUID b t      23      23      16      96 518  97      97      97 521 int4eq eqsel eqjoinsel ));
+DATA(insert OID =  97 ( "<"               PGNSP PGUID b f      23      23      16 521 525       0       0       0       0 int4lt scalarltsel scalarltjoinsel ));
+DATA(insert OID =  98 ( "="               PGNSP PGUID b t      25      25      16      98 531 664 664 664 666 texteq eqsel eqjoinsel ));
+
+DATA(insert OID = 329 (  "="      PGNSP PGUID b f      1000    1000  16  329 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 349 (  "="      PGNSP PGUID b f      1001    1001  16  349 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 374 (  "="      PGNSP PGUID b f      1002    1002  16  374 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 375 (  "="      PGNSP PGUID b f      1003    1003  16  375 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 377 (  "="      PGNSP PGUID b f      1005    1005  16  377 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 378 (  "="      PGNSP PGUID b f      1006    1006  16  378 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 379 (  "="      PGNSP PGUID b f      1007    1007  16  379 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 380 (  "="      PGNSP PGUID b f      1008    1008  16  380 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 381 (  "="      PGNSP PGUID b f      1009    1009  16  381 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 382 (  "="      PGNSP PGUID b f      1028    1028  16  382 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 383 (  "="      PGNSP PGUID b f      1010    1010  16  383 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 384 (  "="      PGNSP PGUID b f      1011    1011  16  384 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 385 (  "="      PGNSP PGUID b f      1012    1012  16  385 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 386 (  "="      PGNSP PGUID b f      1013    1013  16  386 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 390 (  "="      PGNSP PGUID b f      1017    1017  16  390 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 391 (  "="      PGNSP PGUID b f      1018    1018  16  391 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 392 (  "="      PGNSP PGUID b f      1019    1019  16  392 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 393 (  "="      PGNSP PGUID b f      1020    1020  16  393 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 394 (  "="      PGNSP PGUID b f      1021    1021  16  394 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 395 (  "="      PGNSP PGUID b f      1022    1022  16  395 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 396 (  "="      PGNSP PGUID b f      1023    1023  16  396 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 397 (  "="      PGNSP PGUID b f      1024    1024  16  397 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 398 (  "="      PGNSP PGUID b f      1025    1025  16  398 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 400 (  "="      PGNSP PGUID b f      1027    1027  16  400 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 401 (  "="      PGNSP PGUID b f      1034    1034  16  401 0  0      0       0       0 array_eq eqsel eqjoinsel ));
+
+DATA(insert OID = 352 (  "="      PGNSP PGUID b t      28      28      16 352   0       0       0       0       0 xideq eqsel eqjoinsel ));
+DATA(insert OID = 353 (  "="      PGNSP PGUID b t      28      23      16       0       0       0       0       0       0 xideq eqsel eqjoinsel ));
+DATA(insert OID = 387 (  "="      PGNSP PGUID b t      27      27      16 387   0       0       0       0       0 tideq eqsel eqjoinsel ));
 #define TIDEqualOperator   387
-DATA(insert OID = 388 (  "!"      PGNSP PGUID r f  20   0  20   0   0   0   0   0   0 int8fac - - ));
-DATA(insert OID = 389 (  "!!"     PGNSP PGUID l f   0  20  20   0   0   0   0   0   0 int8fac - - ));
-
-DATA(insert OID = 410 ( "="               PGNSP PGUID b t  20  20  16 410 411 412 412 412 413 int8eq eqsel eqjoinsel ));
-DATA(insert OID = 411 ( "<>"      PGNSP PGUID b f  20  20  16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
-DATA(insert OID = 412 ( "<"               PGNSP PGUID b f  20  20  16 413 415 0 0 0 0 int8lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 413 ( ">"               PGNSP PGUID b f  20  20  16 412 414 0 0 0 0 int8gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 414 ( "<="      PGNSP PGUID b f  20  20  16 415 413 0 0 0 0 int8le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 415 ( ">="      PGNSP PGUID b f  20  20  16 414 412 0 0 0 0 int8ge scalargtsel scalargtjoinsel ));
-
-DATA(insert OID = 416 ( "="               PGNSP PGUID b f  20  23  16  15 417 412 97 418 419 int84eq eqsel eqjoinsel ));
-DATA(insert OID = 417 ( "<>"      PGNSP PGUID b f  20  23  16  36 416 0 0 0 0 int84ne neqsel neqjoinsel ));
-DATA(insert OID = 418 ( "<"               PGNSP PGUID b f  20  23  16  76 430 0 0 0 0 int84lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 419 ( ">"               PGNSP PGUID b f  20  23  16  37 420 0 0 0 0 int84gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 420 ( "<="      PGNSP PGUID b f  20  23  16  82 419 0 0 0 0 int84le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 430 ( ">="      PGNSP PGUID b f  20  23  16  80 418 0 0 0 0 int84ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 439 (  "%"      PGNSP PGUID b f  20  20  20   0   0 0 0 0 0 int8mod - - ));
-DATA(insert OID = 473 (  "@"      PGNSP PGUID l f   0  20  20   0   0 0 0 0 0 int8abs - - ));
-
-DATA(insert OID = 484 (  "-"      PGNSP PGUID l f   0  20  20   0   0   0   0   0   0 int8um - - ));
-DATA(insert OID = 485 (  "<<"     PGNSP PGUID b f 604 604  16   0   0   0   0   0   0 poly_left positionsel positionjoinsel ));
-DATA(insert OID = 486 (  "&<"     PGNSP PGUID b f 604 604  16   0   0   0   0   0   0 poly_overleft positionsel positionjoinsel ));
-DATA(insert OID = 487 (  "&>"     PGNSP PGUID b f 604 604  16   0   0   0   0   0   0 poly_overright positionsel positionjoinsel ));
-DATA(insert OID = 488 (  ">>"     PGNSP PGUID b f 604 604  16   0   0   0   0   0   0 poly_right positionsel positionjoinsel ));
-DATA(insert OID = 489 (  "@"      PGNSP PGUID b f 604 604  16 490   0   0   0   0   0 poly_contained contsel contjoinsel ));
-DATA(insert OID = 490 (  "~"      PGNSP PGUID b f 604 604  16 489   0   0   0   0   0 poly_contain contsel contjoinsel ));
-DATA(insert OID = 491 (  "~="     PGNSP PGUID b f 604 604  16 491   0   0   0   0   0 poly_same eqsel eqjoinsel ));
-DATA(insert OID = 492 (  "&&"     PGNSP PGUID b f 604 604  16 492   0   0   0   0   0 poly_overlap areasel areajoinsel ));
-DATA(insert OID = 493 (  "<<"     PGNSP PGUID b f 603 603  16   0   0   0   0   0   0 box_left positionsel positionjoinsel ));
-DATA(insert OID = 494 (  "&<"     PGNSP PGUID b f 603 603  16   0   0   0   0   0   0 box_overleft positionsel positionjoinsel ));
-DATA(insert OID = 495 (  "&>"     PGNSP PGUID b f 603 603  16   0   0   0   0   0   0 box_overright positionsel positionjoinsel ));
-DATA(insert OID = 496 (  ">>"     PGNSP PGUID b f 603 603  16   0   0   0   0   0   0 box_right positionsel positionjoinsel ));
-DATA(insert OID = 497 (  "@"      PGNSP PGUID b f 603 603  16 498   0   0   0   0   0 box_contained contsel contjoinsel ));
-DATA(insert OID = 498 (  "~"      PGNSP PGUID b f 603 603  16 497   0   0   0   0   0 box_contain contsel contjoinsel ));
-DATA(insert OID = 499 (  "~="     PGNSP PGUID b f 603 603  16 499   0   0   0   0   0 box_same eqsel eqjoinsel ));
-DATA(insert OID = 500 (  "&&"     PGNSP PGUID b f 603 603  16 500   0   0   0   0   0 box_overlap areasel areajoinsel ));
-DATA(insert OID = 501 (  ">="     PGNSP PGUID b f 603 603  16 505 504   0   0   0   0 box_ge areasel areajoinsel ));
-DATA(insert OID = 502 (  ">"      PGNSP PGUID b f 603 603  16 504 505   0   0   0   0 box_gt areasel areajoinsel ));
-DATA(insert OID = 503 (  "="      PGNSP PGUID b f 603 603  16 503   0 504 504 504 502 box_eq eqsel eqjoinsel ));
-DATA(insert OID = 504 (  "<"      PGNSP PGUID b f 603 603  16 502 501   0   0   0   0 box_lt areasel areajoinsel ));
-DATA(insert OID = 505 (  "<="     PGNSP PGUID b f 603 603  16 501 502   0   0   0   0 box_le areasel areajoinsel ));
-DATA(insert OID = 506 (  ">^"     PGNSP PGUID b f 600 600  16   0   0   0   0   0   0 point_above positionsel positionjoinsel ));
-DATA(insert OID = 507 (  "<<"     PGNSP PGUID b f 600 600  16   0   0   0   0   0   0 point_left positionsel positionjoinsel ));
-DATA(insert OID = 508 (  ">>"     PGNSP PGUID b f 600 600  16   0   0   0   0   0   0 point_right positionsel positionjoinsel ));
-DATA(insert OID = 509 (  "<^"     PGNSP PGUID b f 600 600  16   0   0   0   0   0   0 point_below positionsel positionjoinsel ));
-DATA(insert OID = 510 (  "~="     PGNSP PGUID b f 600 600  16 510   0   0   0   0   0 point_eq eqsel eqjoinsel ));
-DATA(insert OID = 511 (  "@"      PGNSP PGUID b f 600 603  16   0   0   0   0   0   0 on_pb - - ));
-DATA(insert OID = 512 (  "@"      PGNSP PGUID b f 600 602  16 755   0   0   0   0   0 on_ppath - - ));
-DATA(insert OID = 513 (  "@@"     PGNSP PGUID l f   0 603 600   0   0   0   0   0   0 box_center - - ));
-DATA(insert OID = 514 (  "*"      PGNSP PGUID b f  23  23  23 514   0   0   0   0   0 int4mul - - ));
-DATA(insert OID = 515 (  "!"      PGNSP PGUID r f  23   0  23   0   0   0   0   0   0 int4fac - - ));
-DATA(insert OID = 516 (  "!!"     PGNSP PGUID l f   0  23  23   0   0   0   0   0   0 int4fac - - ));
-DATA(insert OID = 517 (  "<->"    PGNSP PGUID b f 600 600 701 517   0   0   0   0   0 point_distance - - ));
-DATA(insert OID = 518 (  "<>"     PGNSP PGUID b f  23  23  16 518  96  0  0   0   0 int4ne neqsel neqjoinsel ));
-DATA(insert OID = 519 (  "<>"     PGNSP PGUID b f  21  21  16 519  94  0  0   0   0 int2ne neqsel neqjoinsel ));
-DATA(insert OID = 520 (  ">"      PGNSP PGUID b f  21  21  16  95 522  0  0   0   0 int2gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 521 (  ">"      PGNSP PGUID b f  23  23  16  97 523  0  0   0   0 int4gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 522 (  "<="     PGNSP PGUID b f  21  21  16 524 520  0  0   0   0 int2le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 523 (  "<="     PGNSP PGUID b f  23  23  16 525 521  0  0   0   0 int4le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 524 (  ">="     PGNSP PGUID b f  21  21  16 522  95  0  0   0   0 int2ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 525 (  ">="     PGNSP PGUID b f  23  23  16 523  97  0  0   0   0 int4ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 526 (  "*"      PGNSP PGUID b f  21  21  21 526   0  0  0   0   0 int2mul - - ));
-DATA(insert OID = 527 (  "/"      PGNSP PGUID b f  21  21  21   0   0  0  0   0   0 int2div - - ));
-DATA(insert OID = 528 (  "/"      PGNSP PGUID b f  23  23  23   0   0  0  0   0   0 int4div - - ));
-DATA(insert OID = 529 (  "%"      PGNSP PGUID b f  21  21  21   0   0  0  0   0   0 int2mod - - ));
-DATA(insert OID = 530 (  "%"      PGNSP PGUID b f  23  23  23   0   0  0  0   0   0 int4mod - - ));
-DATA(insert OID = 531 (  "<>"     PGNSP PGUID b f  25  25  16 531  98  0       0   0   0 textne neqsel neqjoinsel ));
-DATA(insert OID = 532 (  "="      PGNSP PGUID b f  21  23  16 533 538   95  97 534 536 int24eq eqsel eqjoinsel ));
-DATA(insert OID = 533 (  "="      PGNSP PGUID b f  23  21  16 532 539   97  95 535 537 int42eq eqsel eqjoinsel ));
-DATA(insert OID = 534 (  "<"      PGNSP PGUID b f  21  23  16 537 542  0  0   0   0 int24lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 535 (  "<"      PGNSP PGUID b f  23  21  16 536 543  0  0   0   0 int42lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 536 (  ">"      PGNSP PGUID b f  21  23  16 535 540  0  0   0   0 int24gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 537 (  ">"      PGNSP PGUID b f  23  21  16 534 541  0  0   0   0 int42gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 538 (  "<>"     PGNSP PGUID b f  21  23  16 539 532  0  0   0   0 int24ne neqsel neqjoinsel ));
-DATA(insert OID = 539 (  "<>"     PGNSP PGUID b f  23  21  16 538 533  0  0   0   0 int42ne neqsel neqjoinsel ));
-DATA(insert OID = 540 (  "<="     PGNSP PGUID b f  21  23  16 543 536  0  0   0   0 int24le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 541 (  "<="     PGNSP PGUID b f  23  21  16 542 537  0  0   0   0 int42le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 542 (  ">="     PGNSP PGUID b f  21  23  16 541 534  0  0   0   0 int24ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 543 (  ">="     PGNSP PGUID b f  23  21  16 540 535  0  0   0   0 int42ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 544 (  "*"      PGNSP PGUID b f  21  23  23 545   0   0   0   0   0 int24mul - - ));
-DATA(insert OID = 545 (  "*"      PGNSP PGUID b f  23  21  23 544   0   0   0   0   0 int42mul - - ));
-DATA(insert OID = 546 (  "/"      PGNSP PGUID b f  21  23  23   0   0   0   0   0   0 int24div - - ));
-DATA(insert OID = 547 (  "/"      PGNSP PGUID b f  23  21  23   0   0   0   0   0   0 int42div - - ));
-DATA(insert OID = 548 (  "%"      PGNSP PGUID b f  21  23  23   0   0   0   0   0   0 int24mod - - ));
-DATA(insert OID = 549 (  "%"      PGNSP PGUID b f  23  21  23   0   0   0   0   0   0 int42mod - - ));
-DATA(insert OID = 550 (  "+"      PGNSP PGUID b f  21  21  21 550   0   0   0   0   0 int2pl - - ));
-DATA(insert OID = 551 (  "+"      PGNSP PGUID b f  23  23  23 551   0   0   0   0   0 int4pl - - ));
-DATA(insert OID = 552 (  "+"      PGNSP PGUID b f  21  23  23 553   0   0   0   0   0 int24pl - - ));
-DATA(insert OID = 553 (  "+"      PGNSP PGUID b f  23  21  23 552   0   0   0   0   0 int42pl - - ));
-DATA(insert OID = 554 (  "-"      PGNSP PGUID b f  21  21  21   0   0   0   0   0   0 int2mi - - ));
-DATA(insert OID = 555 (  "-"      PGNSP PGUID b f  23  23  23   0   0   0   0   0   0 int4mi - - ));
-DATA(insert OID = 556 (  "-"      PGNSP PGUID b f  21  23  23   0   0   0   0   0   0 int24mi - - ));
-DATA(insert OID = 557 (  "-"      PGNSP PGUID b f  23  21  23   0   0   0   0   0   0 int42mi - - ));
-DATA(insert OID = 558 (  "-"      PGNSP PGUID l f   0  23  23   0   0   0   0   0   0 int4um - - ));
-DATA(insert OID = 559 (  "-"      PGNSP PGUID l f   0  21  21   0   0   0   0   0   0 int2um - - ));
-DATA(insert OID = 560 (  "="      PGNSP PGUID b t 702 702  16 560 561 562 562 562 563 abstimeeq eqsel eqjoinsel ));
-DATA(insert OID = 561 (  "<>"     PGNSP PGUID b f 702 702  16 561 560 0 0 0 0 abstimene neqsel neqjoinsel ));
-DATA(insert OID = 562 (  "<"      PGNSP PGUID b f 702 702  16 563 565 0 0 0 0 abstimelt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 563 (  ">"      PGNSP PGUID b f 702 702  16 562 564 0 0 0 0 abstimegt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 564 (  "<="     PGNSP PGUID b f 702 702  16 565 563 0 0 0 0 abstimele scalarltsel scalarltjoinsel ));
-DATA(insert OID = 565 (  ">="     PGNSP PGUID b f 702 702  16 564 562 0 0 0 0 abstimege scalargtsel scalargtjoinsel ));
-DATA(insert OID = 566 (  "="      PGNSP PGUID b t 703 703  16 566 567 568 568 568 569 reltimeeq eqsel eqjoinsel ));
-DATA(insert OID = 567 (  "<>"     PGNSP PGUID b f 703 703  16 567 566 0 0 0 0 reltimene neqsel neqjoinsel ));
-DATA(insert OID = 568 (  "<"      PGNSP PGUID b f 703 703  16 569 571 0 0 0 0 reltimelt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 569 (  ">"      PGNSP PGUID b f 703 703  16 568 570 0 0 0 0 reltimegt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 570 (  "<="     PGNSP PGUID b f 703 703  16 571 569 0 0 0 0 reltimele scalarltsel scalarltjoinsel ));
-DATA(insert OID = 571 (  ">="     PGNSP PGUID b f 703 703  16 570 568 0 0 0 0 reltimege scalargtsel scalargtjoinsel ));
-DATA(insert OID = 572 (  "~="     PGNSP PGUID b f 704 704  16 572   0   0   0   0   0 tintervalsame eqsel eqjoinsel ));
-DATA(insert OID = 573 (  "<<"     PGNSP PGUID b f 704 704  16   0   0   0   0   0   0 tintervalct - - ));
-DATA(insert OID = 574 (  "&&"     PGNSP PGUID b f 704 704  16 574   0   0   0   0   0 tintervalov - - ));
-DATA(insert OID = 575 (  "#="     PGNSP PGUID b f 704 703  16   0 576   0   0   0   0 tintervalleneq - - ));
-DATA(insert OID = 576 (  "#<>"    PGNSP PGUID b f 704 703  16   0 575   0   0   0   0 tintervallenne - - ));
-DATA(insert OID = 577 (  "#<"     PGNSP PGUID b f 704 703  16   0 580   0   0   0   0 tintervallenlt - - ));
-DATA(insert OID = 578 (  "#>"     PGNSP PGUID b f 704 703  16   0 579   0   0   0   0 tintervallengt - - ));
-DATA(insert OID = 579 (  "#<="    PGNSP PGUID b f 704 703  16   0 578   0   0   0   0 tintervallenle - - ));
-DATA(insert OID = 580 (  "#>="    PGNSP PGUID b f 704 703  16   0 577   0   0   0   0 tintervallenge - - ));
-DATA(insert OID = 581 (  "+"      PGNSP PGUID b f 702 703 702   0   0 0 0 0 0 timepl - - ));
-DATA(insert OID = 582 (  "-"      PGNSP PGUID b f 702 703 702   0   0 0 0 0 0 timemi - - ));
-DATA(insert OID = 583 (  "<?>"    PGNSP PGUID b f 702 704  16   0   0   0   0   0   0 intinterval - - ));
-DATA(insert OID = 584 (  "-"      PGNSP PGUID l f   0 700 700   0   0   0   0   0   0 float4um - - ));
-DATA(insert OID = 585 (  "-"      PGNSP PGUID l f   0 701 701   0   0   0   0   0   0 float8um - - ));
-DATA(insert OID = 586 (  "+"      PGNSP PGUID b f 700 700 700 586   0   0   0   0   0 float4pl - - ));
-DATA(insert OID = 587 (  "-"      PGNSP PGUID b f 700 700 700   0   0   0   0   0   0 float4mi - - ));
-DATA(insert OID = 588 (  "/"      PGNSP PGUID b f 700 700 700   0   0   0   0   0   0 float4div - - ));
-DATA(insert OID = 589 (  "*"      PGNSP PGUID b f 700 700 700 589   0   0   0   0   0 float4mul - - ));
-DATA(insert OID = 590 (  "@"      PGNSP PGUID l f   0 700 700   0   0   0   0   0   0 float4abs - - ));
-DATA(insert OID = 591 (  "+"      PGNSP PGUID b f 701 701 701 591   0   0   0   0   0 float8pl - - ));
-DATA(insert OID = 592 (  "-"      PGNSP PGUID b f 701 701 701   0   0   0   0   0   0 float8mi - - ));
-DATA(insert OID = 593 (  "/"      PGNSP PGUID b f 701 701 701   0   0   0   0   0   0 float8div - - ));
-DATA(insert OID = 594 (  "*"      PGNSP PGUID b f 701 701 701 594   0   0   0   0   0 float8mul - - ));
-DATA(insert OID = 595 (  "@"      PGNSP PGUID l f   0 701 701   0   0   0   0   0   0 float8abs - - ));
-DATA(insert OID = 596 (  "|/"     PGNSP PGUID l f   0 701 701   0   0   0   0   0   0 dsqrt - - ));
-DATA(insert OID = 597 (  "||/"    PGNSP PGUID l f   0 701 701   0   0   0   0   0   0 dcbrt - - ));
-DATA(insert OID = 598 (  "%"      PGNSP PGUID l f   0 701 701   0   0   0   0   0   0 dtrunc - - ));
-DATA(insert OID = 599 (  "%"      PGNSP PGUID r f 701   0 701   0   0   0   0   0   0 dround - - ));
-DATA(insert OID = 1284 (  "|"     PGNSP PGUID l f   0 704 702  0  0   0   0   0   0 tintervalstart - - ));
+DATA(insert OID = 388 (  "!"      PGNSP PGUID r f      20       0      20       0       0       0       0       0       0 int8fac - - ));
+DATA(insert OID = 389 (  "!!"     PGNSP PGUID l f       0      20      20       0       0       0       0       0       0 int8fac - - ));
+
+DATA(insert OID = 410 ( "="               PGNSP PGUID b t      20      20      16 410 411 412 412 412 413 int8eq eqsel eqjoinsel ));
+DATA(insert OID = 411 ( "<>"      PGNSP PGUID b f      20      20      16 411 410 0 0 0 0 int8ne neqsel neqjoinsel ));
+DATA(insert OID = 412 ( "<"               PGNSP PGUID b f      20      20      16 413 415 0 0 0 0 int8lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 413 ( ">"               PGNSP PGUID b f      20      20      16 412 414 0 0 0 0 int8gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 414 ( "<="      PGNSP PGUID b f      20      20      16 415 413 0 0 0 0 int8le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 415 ( ">="      PGNSP PGUID b f      20      20      16 414 412 0 0 0 0 int8ge scalargtsel scalargtjoinsel ));
+
+DATA(insert OID = 416 ( "="               PGNSP PGUID b f      20      23      16      15 417 412 97 418 419 int84eq eqsel eqjoinsel ));
+DATA(insert OID = 417 ( "<>"      PGNSP PGUID b f      20      23      16      36 416 0 0 0 0 int84ne neqsel neqjoinsel ));
+DATA(insert OID = 418 ( "<"               PGNSP PGUID b f      20      23      16      76 430 0 0 0 0 int84lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 419 ( ">"               PGNSP PGUID b f      20      23      16      37 420 0 0 0 0 int84gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 420 ( "<="      PGNSP PGUID b f      20      23      16      82 419 0 0 0 0 int84le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 430 ( ">="      PGNSP PGUID b f      20      23      16      80 418 0 0 0 0 int84ge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 439 (  "%"      PGNSP PGUID b f      20      20      20       0       0 0 0 0 0 int8mod - - ));
+DATA(insert OID = 473 (  "@"      PGNSP PGUID l f       0      20      20       0       0 0 0 0 0 int8abs - - ));
+
+DATA(insert OID = 484 (  "-"      PGNSP PGUID l f       0      20      20       0       0       0       0       0       0 int8um - - ));
+DATA(insert OID = 485 (  "<<"     PGNSP PGUID b f 604 604      16       0       0       0       0       0       0 poly_left positionsel positionjoinsel ));
+DATA(insert OID = 486 (  "&<"     PGNSP PGUID b f 604 604      16       0       0       0       0       0       0 poly_overleft positionsel positionjoinsel ));
+DATA(insert OID = 487 (  "&>"     PGNSP PGUID b f 604 604      16       0       0       0       0       0       0 poly_overright positionsel positionjoinsel ));
+DATA(insert OID = 488 (  ">>"     PGNSP PGUID b f 604 604      16       0       0       0       0       0       0 poly_right positionsel positionjoinsel ));
+DATA(insert OID = 489 (  "@"      PGNSP PGUID b f 604 604      16 490   0       0       0       0       0 poly_contained contsel contjoinsel ));
+DATA(insert OID = 490 (  "~"      PGNSP PGUID b f 604 604      16 489   0       0       0       0       0 poly_contain contsel contjoinsel ));
+DATA(insert OID = 491 (  "~="     PGNSP PGUID b f 604 604      16 491   0       0       0       0       0 poly_same eqsel eqjoinsel ));
+DATA(insert OID = 492 (  "&&"     PGNSP PGUID b f 604 604      16 492   0       0       0       0       0 poly_overlap areasel areajoinsel ));
+DATA(insert OID = 493 (  "<<"     PGNSP PGUID b f 603 603      16       0       0       0       0       0       0 box_left positionsel positionjoinsel ));
+DATA(insert OID = 494 (  "&<"     PGNSP PGUID b f 603 603      16       0       0       0       0       0       0 box_overleft positionsel positionjoinsel ));
+DATA(insert OID = 495 (  "&>"     PGNSP PGUID b f 603 603      16       0       0       0       0       0       0 box_overright positionsel positionjoinsel ));
+DATA(insert OID = 496 (  ">>"     PGNSP PGUID b f 603 603      16       0       0       0       0       0       0 box_right positionsel positionjoinsel ));
+DATA(insert OID = 497 (  "@"      PGNSP PGUID b f 603 603      16 498   0       0       0       0       0 box_contained contsel contjoinsel ));
+DATA(insert OID = 498 (  "~"      PGNSP PGUID b f 603 603      16 497   0       0       0       0       0 box_contain contsel contjoinsel ));
+DATA(insert OID = 499 (  "~="     PGNSP PGUID b f 603 603      16 499   0       0       0       0       0 box_same eqsel eqjoinsel ));
+DATA(insert OID = 500 (  "&&"     PGNSP PGUID b f 603 603      16 500   0       0       0       0       0 box_overlap areasel areajoinsel ));
+DATA(insert OID = 501 (  ">="     PGNSP PGUID b f 603 603      16 505 504       0       0       0       0 box_ge areasel areajoinsel ));
+DATA(insert OID = 502 (  ">"      PGNSP PGUID b f 603 603      16 504 505       0       0       0       0 box_gt areasel areajoinsel ));
+DATA(insert OID = 503 (  "="      PGNSP PGUID b f 603 603      16 503   0 504 504 504 502 box_eq eqsel eqjoinsel ));
+DATA(insert OID = 504 (  "<"      PGNSP PGUID b f 603 603      16 502 501       0       0       0       0 box_lt areasel areajoinsel ));
+DATA(insert OID = 505 (  "<="     PGNSP PGUID b f 603 603      16 501 502       0       0       0       0 box_le areasel areajoinsel ));
+DATA(insert OID = 506 (  ">^"     PGNSP PGUID b f 600 600      16       0       0       0       0       0       0 point_above positionsel positionjoinsel ));
+DATA(insert OID = 507 (  "<<"     PGNSP PGUID b f 600 600      16       0       0       0       0       0       0 point_left positionsel positionjoinsel ));
+DATA(insert OID = 508 (  ">>"     PGNSP PGUID b f 600 600      16       0       0       0       0       0       0 point_right positionsel positionjoinsel ));
+DATA(insert OID = 509 (  "<^"     PGNSP PGUID b f 600 600      16       0       0       0       0       0       0 point_below positionsel positionjoinsel ));
+DATA(insert OID = 510 (  "~="     PGNSP PGUID b f 600 600      16 510   0       0       0       0       0 point_eq eqsel eqjoinsel ));
+DATA(insert OID = 511 (  "@"      PGNSP PGUID b f 600 603      16       0       0       0       0       0       0 on_pb - - ));
+DATA(insert OID = 512 (  "@"      PGNSP PGUID b f 600 602      16 755   0       0       0       0       0 on_ppath - - ));
+DATA(insert OID = 513 (  "@@"     PGNSP PGUID l f       0 603 600       0       0       0       0       0       0 box_center - - ));
+DATA(insert OID = 514 (  "*"      PGNSP PGUID b f      23      23      23 514   0       0       0       0       0 int4mul - - ));
+DATA(insert OID = 515 (  "!"      PGNSP PGUID r f      23       0      23       0       0       0       0       0       0 int4fac - - ));
+DATA(insert OID = 516 (  "!!"     PGNSP PGUID l f       0      23      23       0       0       0       0       0       0 int4fac - - ));
+DATA(insert OID = 517 (  "<->"    PGNSP PGUID b f 600 600 701 517       0       0       0       0       0 point_distance - - ));
+DATA(insert OID = 518 (  "<>"     PGNSP PGUID b f      23      23      16 518  96      0  0   0   0 int4ne neqsel neqjoinsel ));
+DATA(insert OID = 519 (  "<>"     PGNSP PGUID b f      21      21      16 519  94      0  0   0   0 int2ne neqsel neqjoinsel ));
+DATA(insert OID = 520 (  ">"      PGNSP PGUID b f      21      21      16      95 522  0  0   0   0 int2gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 521 (  ">"      PGNSP PGUID b f      23      23      16      97 523  0  0   0   0 int4gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 522 (  "<="     PGNSP PGUID b f      21      21      16 524 520      0  0   0   0 int2le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 523 (  "<="     PGNSP PGUID b f      23      23      16 525 521      0  0   0   0 int4le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 524 (  ">="     PGNSP PGUID b f      21      21      16 522  95      0  0   0   0 int2ge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 525 (  ">="     PGNSP PGUID b f      23      23      16 523  97      0  0   0   0 int4ge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 526 (  "*"      PGNSP PGUID b f      21      21      21 526   0      0  0   0   0 int2mul - - ));
+DATA(insert OID = 527 (  "/"      PGNSP PGUID b f      21      21      21       0       0      0  0   0   0 int2div - - ));
+DATA(insert OID = 528 (  "/"      PGNSP PGUID b f      23      23      23       0       0      0  0   0   0 int4div - - ));
+DATA(insert OID = 529 (  "%"      PGNSP PGUID b f      21      21      21       0       0      0  0   0   0 int2mod - - ));
+DATA(insert OID = 530 (  "%"      PGNSP PGUID b f      23      23      23       0       0      0  0   0   0 int4mod - - ));
+DATA(insert OID = 531 (  "<>"     PGNSP PGUID b f      25      25      16 531  98      0       0       0       0 textne neqsel neqjoinsel ));
+DATA(insert OID = 532 (  "="      PGNSP PGUID b f      21      23      16 533 538       95  97 534 536 int24eq eqsel eqjoinsel ));
+DATA(insert OID = 533 (  "="      PGNSP PGUID b f      23      21      16 532 539       97  95 535 537 int42eq eqsel eqjoinsel ));
+DATA(insert OID = 534 (  "<"      PGNSP PGUID b f      21      23      16 537 542      0  0   0   0 int24lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 535 (  "<"      PGNSP PGUID b f      23      21      16 536 543      0  0   0   0 int42lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 536 (  ">"      PGNSP PGUID b f      21      23      16 535 540      0  0   0   0 int24gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 537 (  ">"      PGNSP PGUID b f      23      21      16 534 541      0  0   0   0 int42gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 538 (  "<>"     PGNSP PGUID b f      21      23      16 539 532      0  0   0   0 int24ne neqsel neqjoinsel ));
+DATA(insert OID = 539 (  "<>"     PGNSP PGUID b f      23      21      16 538 533      0  0   0   0 int42ne neqsel neqjoinsel ));
+DATA(insert OID = 540 (  "<="     PGNSP PGUID b f      21      23      16 543 536      0  0   0   0 int24le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 541 (  "<="     PGNSP PGUID b f      23      21      16 542 537      0  0   0   0 int42le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 542 (  ">="     PGNSP PGUID b f      21      23      16 541 534      0  0   0   0 int24ge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 543 (  ">="     PGNSP PGUID b f      23      21      16 540 535      0  0   0   0 int42ge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 544 (  "*"      PGNSP PGUID b f      21      23      23 545   0       0       0       0       0 int24mul - - ));
+DATA(insert OID = 545 (  "*"      PGNSP PGUID b f      23      21      23 544   0       0       0       0       0 int42mul - - ));
+DATA(insert OID = 546 (  "/"      PGNSP PGUID b f      21      23      23       0       0       0       0       0       0 int24div - - ));
+DATA(insert OID = 547 (  "/"      PGNSP PGUID b f      23      21      23       0       0       0       0       0       0 int42div - - ));
+DATA(insert OID = 548 (  "%"      PGNSP PGUID b f      21      23      23       0       0       0       0       0       0 int24mod - - ));
+DATA(insert OID = 549 (  "%"      PGNSP PGUID b f      23      21      23       0       0       0       0       0       0 int42mod - - ));
+DATA(insert OID = 550 (  "+"      PGNSP PGUID b f      21      21      21 550   0       0       0       0       0 int2pl - - ));
+DATA(insert OID = 551 (  "+"      PGNSP PGUID b f      23      23      23 551   0       0       0       0       0 int4pl - - ));
+DATA(insert OID = 552 (  "+"      PGNSP PGUID b f      21      23      23 553   0       0       0       0       0 int24pl - - ));
+DATA(insert OID = 553 (  "+"      PGNSP PGUID b f      23      21      23 552   0       0       0       0       0 int42pl - - ));
+DATA(insert OID = 554 (  "-"      PGNSP PGUID b f      21      21      21       0       0       0       0       0       0 int2mi - - ));
+DATA(insert OID = 555 (  "-"      PGNSP PGUID b f      23      23      23       0       0       0       0       0       0 int4mi - - ));
+DATA(insert OID = 556 (  "-"      PGNSP PGUID b f      21      23      23       0       0       0       0       0       0 int24mi - - ));
+DATA(insert OID = 557 (  "-"      PGNSP PGUID b f      23      21      23       0       0       0       0       0       0 int42mi - - ));
+DATA(insert OID = 558 (  "-"      PGNSP PGUID l f       0      23      23       0       0       0       0       0       0 int4um - - ));
+DATA(insert OID = 559 (  "-"      PGNSP PGUID l f       0      21      21       0       0       0       0       0       0 int2um - - ));
+DATA(insert OID = 560 (  "="      PGNSP PGUID b t 702 702      16 560 561 562 562 562 563 abstimeeq eqsel eqjoinsel ));
+DATA(insert OID = 561 (  "<>"     PGNSP PGUID b f 702 702      16 561 560 0 0 0 0 abstimene neqsel neqjoinsel ));
+DATA(insert OID = 562 (  "<"      PGNSP PGUID b f 702 702      16 563 565 0 0 0 0 abstimelt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 563 (  ">"      PGNSP PGUID b f 702 702      16 562 564 0 0 0 0 abstimegt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 564 (  "<="     PGNSP PGUID b f 702 702      16 565 563 0 0 0 0 abstimele scalarltsel scalarltjoinsel ));
+DATA(insert OID = 565 (  ">="     PGNSP PGUID b f 702 702      16 564 562 0 0 0 0 abstimege scalargtsel scalargtjoinsel ));
+DATA(insert OID = 566 (  "="      PGNSP PGUID b t 703 703      16 566 567 568 568 568 569 reltimeeq eqsel eqjoinsel ));
+DATA(insert OID = 567 (  "<>"     PGNSP PGUID b f 703 703      16 567 566 0 0 0 0 reltimene neqsel neqjoinsel ));
+DATA(insert OID = 568 (  "<"      PGNSP PGUID b f 703 703      16 569 571 0 0 0 0 reltimelt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 569 (  ">"      PGNSP PGUID b f 703 703      16 568 570 0 0 0 0 reltimegt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 570 (  "<="     PGNSP PGUID b f 703 703      16 571 569 0 0 0 0 reltimele scalarltsel scalarltjoinsel ));
+DATA(insert OID = 571 (  ">="     PGNSP PGUID b f 703 703      16 570 568 0 0 0 0 reltimege scalargtsel scalargtjoinsel ));
+DATA(insert OID = 572 (  "~="     PGNSP PGUID b f 704 704      16 572   0       0       0       0       0 tintervalsame eqsel eqjoinsel ));
+DATA(insert OID = 573 (  "<<"     PGNSP PGUID b f 704 704      16       0       0       0       0       0       0 tintervalct - - ));
+DATA(insert OID = 574 (  "&&"     PGNSP PGUID b f 704 704      16 574   0       0       0       0       0 tintervalov - - ));
+DATA(insert OID = 575 (  "#="     PGNSP PGUID b f 704 703      16       0 576   0       0       0       0 tintervalleneq - - ));
+DATA(insert OID = 576 (  "#<>"    PGNSP PGUID b f 704 703      16       0 575   0       0       0       0 tintervallenne - - ));
+DATA(insert OID = 577 (  "#<"     PGNSP PGUID b f 704 703      16       0 580   0       0       0       0 tintervallenlt - - ));
+DATA(insert OID = 578 (  "#>"     PGNSP PGUID b f 704 703      16       0 579   0       0       0       0 tintervallengt - - ));
+DATA(insert OID = 579 (  "#<="    PGNSP PGUID b f 704 703      16       0 578   0       0       0       0 tintervallenle - - ));
+DATA(insert OID = 580 (  "#>="    PGNSP PGUID b f 704 703      16       0 577   0       0       0       0 tintervallenge - - ));
+DATA(insert OID = 581 (  "+"      PGNSP PGUID b f 702 703 702   0       0 0 0 0 0 timepl - - ));
+DATA(insert OID = 582 (  "-"      PGNSP PGUID b f 702 703 702   0       0 0 0 0 0 timemi - - ));
+DATA(insert OID = 583 (  "<?>"    PGNSP PGUID b f 702 704      16       0       0       0       0       0       0 intinterval - - ));
+DATA(insert OID = 584 (  "-"      PGNSP PGUID l f       0 700 700       0       0       0       0       0       0 float4um - - ));
+DATA(insert OID = 585 (  "-"      PGNSP PGUID l f       0 701 701       0       0       0       0       0       0 float8um - - ));
+DATA(insert OID = 586 (  "+"      PGNSP PGUID b f 700 700 700 586       0       0       0       0       0 float4pl - - ));
+DATA(insert OID = 587 (  "-"      PGNSP PGUID b f 700 700 700   0       0       0       0       0       0 float4mi - - ));
+DATA(insert OID = 588 (  "/"      PGNSP PGUID b f 700 700 700   0       0       0       0       0       0 float4div - - ));
+DATA(insert OID = 589 (  "*"      PGNSP PGUID b f 700 700 700 589       0       0       0       0       0 float4mul - - ));
+DATA(insert OID = 590 (  "@"      PGNSP PGUID l f       0 700 700       0       0       0       0       0       0 float4abs - - ));
+DATA(insert OID = 591 (  "+"      PGNSP PGUID b f 701 701 701 591       0       0       0       0       0 float8pl - - ));
+DATA(insert OID = 592 (  "-"      PGNSP PGUID b f 701 701 701   0       0       0       0       0       0 float8mi - - ));
+DATA(insert OID = 593 (  "/"      PGNSP PGUID b f 701 701 701   0       0       0       0       0       0 float8div - - ));
+DATA(insert OID = 594 (  "*"      PGNSP PGUID b f 701 701 701 594       0       0       0       0       0 float8mul - - ));
+DATA(insert OID = 595 (  "@"      PGNSP PGUID l f       0 701 701       0       0       0       0       0       0 float8abs - - ));
+DATA(insert OID = 596 (  "|/"     PGNSP PGUID l f       0 701 701       0       0       0       0       0       0 dsqrt - - ));
+DATA(insert OID = 597 (  "||/"    PGNSP PGUID l f       0 701 701       0       0       0       0       0       0 dcbrt - - ));
+DATA(insert OID = 598 (  "%"      PGNSP PGUID l f       0 701 701       0       0       0       0       0       0 dtrunc - - ));
+DATA(insert OID = 599 (  "%"      PGNSP PGUID r f 701   0 701   0       0       0       0       0       0 dround - - ));
+DATA(insert OID = 1284 (  "|"     PGNSP PGUID l f       0 704 702      0  0   0   0   0   0 tintervalstart - - ));
 DATA(insert OID = 606 (  "<#>"    PGNSP PGUID b f 702 702 704  0  0   0   0   0   0 mktinterval - - ));
-DATA(insert OID = 607 (  "="      PGNSP PGUID b t  26  26  16 607 608 609 609 609 610 oideq eqsel eqjoinsel ));
+DATA(insert OID = 607 (  "="      PGNSP PGUID b t      26      26      16 607 608 609 609 609 610 oideq eqsel eqjoinsel ));
 #define MIN_OIDCMP 607                 /* used by cache code */
-DATA(insert OID = 608 (  "<>"     PGNSP PGUID b f  26  26  16 608 607  0  0   0   0 oidne neqsel neqjoinsel ));
-DATA(insert OID = 609 (  "<"      PGNSP PGUID b f  26  26  16 610 612  0  0   0   0 oidlt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 610 (  ">"      PGNSP PGUID b f  26  26  16 609 611  0  0   0   0 oidgt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 611 (  "<="     PGNSP PGUID b f  26  26  16 612 610  0  0   0   0 oidle scalarltsel scalarltjoinsel ));
-DATA(insert OID = 612 (  ">="     PGNSP PGUID b f  26  26  16 611 609  0  0   0   0 oidge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 608 (  "<>"     PGNSP PGUID b f      26      26      16 608 607      0  0   0   0 oidne neqsel neqjoinsel ));
+DATA(insert OID = 609 (  "<"      PGNSP PGUID b f      26      26      16 610 612      0  0   0   0 oidlt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 610 (  ">"      PGNSP PGUID b f      26      26      16 609 611      0  0   0   0 oidgt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 611 (  "<="     PGNSP PGUID b f      26      26      16 612 610      0  0   0   0 oidle scalarltsel scalarltjoinsel ));
+DATA(insert OID = 612 (  ">="     PGNSP PGUID b f      26      26      16 611 609      0  0   0   0 oidge scalargtsel scalargtjoinsel ));
 #define MAX_OIDCMP 612                 /* used by cache code */
 
-DATA(insert OID = 644 (  "<>"     PGNSP PGUID b f  30  30  16 644 649   0   0   0   0 oidvectorne neqsel neqjoinsel ));
-DATA(insert OID = 645 (  "<"      PGNSP PGUID b f  30  30  16 646 648   0   0   0   0 oidvectorlt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 646 (  ">"      PGNSP PGUID b f  30  30  16 645 647   0   0   0   0 oidvectorgt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 647 (  "<="     PGNSP PGUID b f  30  30  16 648 646   0   0   0   0 oidvectorle scalarltsel scalarltjoinsel ));
-DATA(insert OID = 648 (  ">="     PGNSP PGUID b f  30  30  16 647 645   0   0   0   0 oidvectorge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 649 (  "="      PGNSP PGUID b t  30  30  16 649 644 645 645 645 646 oidvectoreq eqsel eqjoinsel ));
-
-DATA(insert OID = 613 (  "<->"    PGNSP PGUID b f 600 628 701   0   0  0  0   0   0 dist_pl - - ));
-DATA(insert OID = 614 (  "<->"    PGNSP PGUID b f 600 601 701   0   0  0  0   0   0 dist_ps - - ));
-DATA(insert OID = 615 (  "<->"    PGNSP PGUID b f 600 603 701   0   0  0  0   0   0 dist_pb - - ));
-DATA(insert OID = 616 (  "<->"    PGNSP PGUID b f 601 628 701   0   0  0  0   0   0 dist_sl - - ));
-DATA(insert OID = 617 (  "<->"    PGNSP PGUID b f 601 603 701   0   0  0  0   0   0 dist_sb - - ));
-DATA(insert OID = 618 (  "<->"    PGNSP PGUID b f 600 602 701   0   0  0  0   0   0 dist_ppath - - ));
-
-DATA(insert OID = 620 (  "="      PGNSP PGUID b f  700  700    16 620 621      622 622 622 623 float4eq eqsel eqjoinsel ));
-DATA(insert OID = 621 (  "<>"     PGNSP PGUID b f  700  700    16 621 620      0 0   0   0 float4ne neqsel neqjoinsel ));
-DATA(insert OID = 622 (  "<"      PGNSP PGUID b f  700  700    16 623 625      0 0   0   0 float4lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 623 (  ">"      PGNSP PGUID b f  700  700    16 622 624      0 0   0   0 float4gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 624 (  "<="     PGNSP PGUID b f  700  700    16 625 623      0 0   0   0 float4le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 625 (  ">="     PGNSP PGUID b f  700  700    16 624 622      0 0   0   0 float4ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 626 (  "!!="    PGNSP PGUID b f  23   25     16 0   0        0       0   0   0       int4notin - - ));
-DATA(insert OID = 627 (  "!!="    PGNSP PGUID b f  26   25     16 0   0        0       0   0   0       oidnotin - - ));
-DATA(insert OID = 630 (  "<>"     PGNSP PGUID b f  18  18  16 630  92  0 0 0 0 charne neqsel neqjoinsel ));
-
-DATA(insert OID = 631 (  "<"      PGNSP PGUID b f  18  18  16 633 634  0 0 0 0 charlt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 632 (  "<="     PGNSP PGUID b f  18  18  16 634 633  0 0 0 0 charle scalarltsel scalarltjoinsel ));
-DATA(insert OID = 633 (  ">"      PGNSP PGUID b f  18  18  16 631 632  0 0 0 0 chargt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 634 (  ">="     PGNSP PGUID b f  18  18  16 632 631  0 0 0 0 charge scalargtsel scalargtjoinsel ));
-
-DATA(insert OID = 635 (  "+"      PGNSP PGUID b f  18  18  18 0 0  0 0 0 0 charpl - - ));
-DATA(insert OID = 636 (  "-"      PGNSP PGUID b f  18  18  18 0 0  0 0 0 0 charmi - - ));
-DATA(insert OID = 637 (  "*"      PGNSP PGUID b f  18  18  18 0 0  0 0 0 0 charmul - - ));
-DATA(insert OID = 638 (  "/"      PGNSP PGUID b f  18  18  18 0 0  0 0 0 0 chardiv - - ));
-
-DATA(insert OID = 639 (  "~"      PGNSP PGUID b f  19  25  16 0 640    0 0   0   0 nameregexeq regexeqsel regexeqjoinsel ));
+DATA(insert OID = 644 (  "<>"     PGNSP PGUID b f      30      30      16 644 649       0       0       0       0 oidvectorne neqsel neqjoinsel ));
+DATA(insert OID = 645 (  "<"      PGNSP PGUID b f      30      30      16 646 648       0       0       0       0 oidvectorlt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 646 (  ">"      PGNSP PGUID b f      30      30      16 645 647       0       0       0       0 oidvectorgt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 647 (  "<="     PGNSP PGUID b f      30      30      16 648 646       0       0       0       0 oidvectorle scalarltsel scalarltjoinsel ));
+DATA(insert OID = 648 (  ">="     PGNSP PGUID b f      30      30      16 647 645       0       0       0       0 oidvectorge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 649 (  "="      PGNSP PGUID b t      30      30      16 649 644 645 645 645 646 oidvectoreq eqsel eqjoinsel ));
+
+DATA(insert OID = 613 (  "<->"    PGNSP PGUID b f 600 628 701   0       0      0  0   0   0 dist_pl - - ));
+DATA(insert OID = 614 (  "<->"    PGNSP PGUID b f 600 601 701   0       0      0  0   0   0 dist_ps - - ));
+DATA(insert OID = 615 (  "<->"    PGNSP PGUID b f 600 603 701   0       0      0  0   0   0 dist_pb - - ));
+DATA(insert OID = 616 (  "<->"    PGNSP PGUID b f 601 628 701   0       0      0  0   0   0 dist_sl - - ));
+DATA(insert OID = 617 (  "<->"    PGNSP PGUID b f 601 603 701   0       0      0  0   0   0 dist_sb - - ));
+DATA(insert OID = 618 (  "<->"    PGNSP PGUID b f 600 602 701   0       0      0  0   0   0 dist_ppath - - ));
+
+DATA(insert OID = 620 (  "="      PGNSP PGUID b f      700  700        16 620 621      622 622 622 623 float4eq eqsel eqjoinsel ));
+DATA(insert OID = 621 (  "<>"     PGNSP PGUID b f      700  700        16 621 620      0 0   0   0 float4ne neqsel neqjoinsel ));
+DATA(insert OID = 622 (  "<"      PGNSP PGUID b f      700  700        16 623 625      0 0   0   0 float4lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 623 (  ">"      PGNSP PGUID b f      700  700        16 622 624      0 0   0   0 float4gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 624 (  "<="     PGNSP PGUID b f      700  700        16 625 623      0 0   0   0 float4le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 625 (  ">="     PGNSP PGUID b f      700  700        16 624 622      0 0   0   0 float4ge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 626 (  "!!="    PGNSP PGUID b f      23       25 16 0   0    0       0       0       0       int4notin - - ));
+DATA(insert OID = 627 (  "!!="    PGNSP PGUID b f      26       25 16 0   0    0       0       0       0       oidnotin - - ));
+DATA(insert OID = 630 (  "<>"     PGNSP PGUID b f      18      18      16 630  92      0 0 0 0 charne neqsel neqjoinsel ));
+
+DATA(insert OID = 631 (  "<"      PGNSP PGUID b f      18      18      16 633 634      0 0 0 0 charlt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 632 (  "<="     PGNSP PGUID b f      18      18      16 634 633      0 0 0 0 charle scalarltsel scalarltjoinsel ));
+DATA(insert OID = 633 (  ">"      PGNSP PGUID b f      18      18      16 631 632      0 0 0 0 chargt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 634 (  ">="     PGNSP PGUID b f      18      18      16 632 631      0 0 0 0 charge scalargtsel scalargtjoinsel ));
+
+DATA(insert OID = 635 (  "+"      PGNSP PGUID b f      18      18      18 0 0  0 0 0 0 charpl - - ));
+DATA(insert OID = 636 (  "-"      PGNSP PGUID b f      18      18      18 0 0  0 0 0 0 charmi - - ));
+DATA(insert OID = 637 (  "*"      PGNSP PGUID b f      18      18      18 0 0  0 0 0 0 charmul - - ));
+DATA(insert OID = 638 (  "/"      PGNSP PGUID b f      18      18      18 0 0  0 0 0 0 chardiv - - ));
+
+DATA(insert OID = 639 (  "~"      PGNSP PGUID b f      19      25      16 0 640        0 0   0   0 nameregexeq regexeqsel regexeqjoinsel ));
 #define OID_NAME_REGEXEQ_OP            639
-DATA(insert OID = 640 (  "!~"     PGNSP PGUID b f  19  25  16 0 639    0 0   0   0 nameregexne regexnesel regexnejoinsel ));
-DATA(insert OID = 641 (  "~"      PGNSP PGUID b f  25  25  16 0 642    0 0   0   0 textregexeq regexeqsel regexeqjoinsel ));
+DATA(insert OID = 640 (  "!~"     PGNSP PGUID b f      19      25      16 0 639        0 0   0   0 nameregexne regexnesel regexnejoinsel ));
+DATA(insert OID = 641 (  "~"      PGNSP PGUID b f      25      25      16 0 642        0 0   0   0 textregexeq regexeqsel regexeqjoinsel ));
 #define OID_TEXT_REGEXEQ_OP            641
-DATA(insert OID = 642 (  "!~"     PGNSP PGUID b f  25  25  16 0 641    0 0   0   0 textregexne regexnesel regexnejoinsel ));
-DATA(insert OID = 643 (  "<>"     PGNSP PGUID b f  19  19  16 643 93 0 0 0 0 namene neqsel neqjoinsel ));
-DATA(insert OID = 654 (  "||"     PGNSP PGUID b f  25  25  25   0 0    0 0   0   0 textcat - - ));
-
-DATA(insert OID = 660 (  "<"      PGNSP PGUID b f  19  19  16 662 663  0 0 0 0 namelt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 661 (  "<="     PGNSP PGUID b f  19  19  16 663 662  0 0 0 0 namele scalarltsel scalarltjoinsel ));
-DATA(insert OID = 662 (  ">"      PGNSP PGUID b f  19  19  16 660 661  0 0 0 0 namegt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 663 (  ">="     PGNSP PGUID b f  19  19  16 661 660  0 0 0 0 namege scalargtsel scalargtjoinsel ));
-DATA(insert OID = 664 (  "<"      PGNSP PGUID b f  25  25  16 666 667  0 0 0 0 text_lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 665 (  "<="     PGNSP PGUID b f  25  25  16 667 666  0 0 0 0 text_le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 666 (  ">"      PGNSP PGUID b f  25  25  16 664 665  0 0 0 0 text_gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 667 (  ">="     PGNSP PGUID b f  25  25  16 665 664  0 0 0 0 text_ge scalargtsel scalargtjoinsel ));
-
-DATA(insert OID = 670 (  "="      PGNSP PGUID b f  701  701    16 670 671 672 672 672 674 float8eq eqsel eqjoinsel ));
-DATA(insert OID = 671 (  "<>"     PGNSP PGUID b f  701  701    16 671 670      0 0   0   0 float8ne neqsel neqjoinsel ));
-DATA(insert OID = 672 (  "<"      PGNSP PGUID b f  701  701    16 674 675      0 0   0   0 float8lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 673 (  "<="     PGNSP PGUID b f  701  701    16 675 674      0 0   0   0 float8le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 674 (  ">"      PGNSP PGUID b f  701  701    16 672 673      0 0   0   0 float8gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 675 (  ">="     PGNSP PGUID b f  701  701    16 673 672      0 0   0   0 float8ge scalargtsel scalargtjoinsel ));
-
-DATA(insert OID = 682 (  "@"      PGNSP PGUID l f   0  21  21   0   0   0   0   0   0 int2abs - - ));
-DATA(insert OID = 684 (  "+"      PGNSP PGUID b f  20  20  20 684   0   0   0   0   0 int8pl - - ));
-DATA(insert OID = 685 (  "-"      PGNSP PGUID b f  20  20  20   0   0   0   0   0   0 int8mi - - ));
-DATA(insert OID = 686 (  "*"      PGNSP PGUID b f  20  20  20 686   0   0   0   0   0 int8mul - - ));
-DATA(insert OID = 687 (  "/"      PGNSP PGUID b f  20  20  20   0   0   0   0   0   0 int8div - - ));
-DATA(insert OID = 688 (  "+"      PGNSP PGUID b f  20  23  20 692   0   0   0   0   0 int84pl - - ));
-DATA(insert OID = 689 (  "-"      PGNSP PGUID b f  20  23  20   0   0   0   0   0   0 int84mi - - ));
-DATA(insert OID = 690 (  "*"      PGNSP PGUID b f  20  23  20 694   0   0   0   0   0 int84mul - - ));
-DATA(insert OID = 691 (  "/"      PGNSP PGUID b f  20  23  20   0   0   0   0   0   0 int84div - - ));
-DATA(insert OID = 692 (  "+"      PGNSP PGUID b f  23  20  20 688   0   0   0   0   0 int48pl - - ));
-DATA(insert OID = 693 (  "-"      PGNSP PGUID b f  23  20  20   0   0   0   0   0   0 int48mi - - ));
-DATA(insert OID = 694 (  "*"      PGNSP PGUID b f  23  20  20 690   0   0   0   0   0 int48mul - - ));
-DATA(insert OID = 695 (  "/"      PGNSP PGUID b f  23  20  20   0   0   0   0   0   0 int48div - - ));
-
-DATA(insert OID = 706 (  "<->"    PGNSP PGUID b f 603 603 701 706   0  0  0   0   0 box_distance - - ));
-DATA(insert OID = 707 (  "<->"    PGNSP PGUID b f 602 602 701 707   0  0  0   0   0 path_distance - - ));
-DATA(insert OID = 708 (  "<->"    PGNSP PGUID b f 628 628 701 708   0  0  0   0   0 line_distance - - ));
-DATA(insert OID = 709 (  "<->"    PGNSP PGUID b f 601 601 701 709   0  0  0   0   0 lseg_distance - - ));
-DATA(insert OID = 712 (  "<->"    PGNSP PGUID b f 604 604 701 712   0  0  0   0   0 poly_distance - - ));
+DATA(insert OID = 642 (  "!~"     PGNSP PGUID b f      25      25      16 0 641        0 0   0   0 textregexne regexnesel regexnejoinsel ));
+DATA(insert OID = 643 (  "<>"     PGNSP PGUID b f      19      19      16 643 93 0 0 0 0 namene neqsel neqjoinsel ));
+DATA(insert OID = 654 (  "||"     PGNSP PGUID b f      25      25      25       0 0    0 0   0   0 textcat - - ));
+
+DATA(insert OID = 660 (  "<"      PGNSP PGUID b f      19      19      16 662 663      0 0 0 0 namelt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 661 (  "<="     PGNSP PGUID b f      19      19      16 663 662      0 0 0 0 namele scalarltsel scalarltjoinsel ));
+DATA(insert OID = 662 (  ">"      PGNSP PGUID b f      19      19      16 660 661      0 0 0 0 namegt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 663 (  ">="     PGNSP PGUID b f      19      19      16 661 660      0 0 0 0 namege scalargtsel scalargtjoinsel ));
+DATA(insert OID = 664 (  "<"      PGNSP PGUID b f      25      25      16 666 667      0 0 0 0 text_lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 665 (  "<="     PGNSP PGUID b f      25      25      16 667 666      0 0 0 0 text_le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 666 (  ">"      PGNSP PGUID b f      25      25      16 664 665      0 0 0 0 text_gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 667 (  ">="     PGNSP PGUID b f      25      25      16 665 664      0 0 0 0 text_ge scalargtsel scalargtjoinsel ));
+
+DATA(insert OID = 670 (  "="      PGNSP PGUID b f      701  701        16 670 671 672 672 672 674 float8eq eqsel eqjoinsel ));
+DATA(insert OID = 671 (  "<>"     PGNSP PGUID b f      701  701        16 671 670      0 0   0   0 float8ne neqsel neqjoinsel ));
+DATA(insert OID = 672 (  "<"      PGNSP PGUID b f      701  701        16 674 675      0 0   0   0 float8lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 673 (  "<="     PGNSP PGUID b f      701  701        16 675 674      0 0   0   0 float8le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 674 (  ">"      PGNSP PGUID b f      701  701        16 672 673      0 0   0   0 float8gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 675 (  ">="     PGNSP PGUID b f      701  701        16 673 672      0 0   0   0 float8ge scalargtsel scalargtjoinsel ));
+
+DATA(insert OID = 682 (  "@"      PGNSP PGUID l f       0      21      21       0       0       0       0       0       0 int2abs - - ));
+DATA(insert OID = 684 (  "+"      PGNSP PGUID b f      20      20      20 684   0       0       0       0       0 int8pl - - ));
+DATA(insert OID = 685 (  "-"      PGNSP PGUID b f      20      20      20       0       0       0       0       0       0 int8mi - - ));
+DATA(insert OID = 686 (  "*"      PGNSP PGUID b f      20      20      20 686   0       0       0       0       0 int8mul - - ));
+DATA(insert OID = 687 (  "/"      PGNSP PGUID b f      20      20      20       0       0       0       0       0       0 int8div - - ));
+DATA(insert OID = 688 (  "+"      PGNSP PGUID b f      20      23      20 692   0       0       0       0       0 int84pl - - ));
+DATA(insert OID = 689 (  "-"      PGNSP PGUID b f      20      23      20       0       0       0       0       0       0 int84mi - - ));
+DATA(insert OID = 690 (  "*"      PGNSP PGUID b f      20      23      20 694   0       0       0       0       0 int84mul - - ));
+DATA(insert OID = 691 (  "/"      PGNSP PGUID b f      20      23      20       0       0       0       0       0       0 int84div - - ));
+DATA(insert OID = 692 (  "+"      PGNSP PGUID b f      23      20      20 688   0       0       0       0       0 int48pl - - ));
+DATA(insert OID = 693 (  "-"      PGNSP PGUID b f      23      20      20       0       0       0       0       0       0 int48mi - - ));
+DATA(insert OID = 694 (  "*"      PGNSP PGUID b f      23      20      20 690   0       0       0       0       0 int48mul - - ));
+DATA(insert OID = 695 (  "/"      PGNSP PGUID b f      23      20      20       0       0       0       0       0       0 int48div - - ));
+
+DATA(insert OID = 706 (  "<->"    PGNSP PGUID b f 603 603 701 706       0      0  0   0   0 box_distance - - ));
+DATA(insert OID = 707 (  "<->"    PGNSP PGUID b f 602 602 701 707       0      0  0   0   0 path_distance - - ));
+DATA(insert OID = 708 (  "<->"    PGNSP PGUID b f 628 628 701 708       0      0  0   0   0 line_distance - - ));
+DATA(insert OID = 709 (  "<->"    PGNSP PGUID b f 601 601 701 709       0      0  0   0   0 lseg_distance - - ));
+DATA(insert OID = 712 (  "<->"    PGNSP PGUID b f 604 604 701 712       0      0  0   0   0 poly_distance - - ));
 
 /* add translation/rotation/scaling operators for geometric types. - thomas 97/05/10 */
-DATA(insert OID = 731 (  "+"      PGNSP PGUID b f  600  600    600  731  0 0 0 0 0 point_add - - ));
-DATA(insert OID = 732 (  "-"      PGNSP PGUID b f  600  600    600    0  0 0 0 0 0 point_sub - - ));
-DATA(insert OID = 733 (  "*"      PGNSP PGUID b f  600  600    600  733  0 0 0 0 0 point_mul - - ));
-DATA(insert OID = 734 (  "/"      PGNSP PGUID b f  600  600    600    0  0 0 0 0 0 point_div - - ));
-DATA(insert OID = 735 (  "+"      PGNSP PGUID b f  602  602    602  735  0 0 0 0 0 path_add - - ));
-DATA(insert OID = 736 (  "+"      PGNSP PGUID b f  602  600    602    0  0 0 0 0 0 path_add_pt - - ));
-DATA(insert OID = 737 (  "-"      PGNSP PGUID b f  602  600    602    0  0 0 0 0 0 path_sub_pt - - ));
-DATA(insert OID = 738 (  "*"      PGNSP PGUID b f  602  600    602    0  0 0 0 0 0 path_mul_pt - - ));
-DATA(insert OID = 739 (  "/"      PGNSP PGUID b f  602  600    602    0  0 0 0 0 0 path_div_pt - - ));
-DATA(insert OID = 755 (  "~"      PGNSP PGUID b f  602  600     16  512  0 0 0 0 0 path_contain_pt - - ));
-DATA(insert OID = 756 (  "@"      PGNSP PGUID b f  600  604     16  757  0 0 0 0 0 pt_contained_poly - - ));
-DATA(insert OID = 757 (  "~"      PGNSP PGUID b f  604  600     16  756  0 0 0 0 0 poly_contain_pt - - ));
-DATA(insert OID = 758 (  "@"      PGNSP PGUID b f  600  718     16  759  0 0 0 0 0 pt_contained_circle - - ));
-DATA(insert OID = 759 (  "~"      PGNSP PGUID b f  718  600     16  758  0 0 0 0 0 circle_contain_pt - - ));
-
-DATA(insert OID = 773 (  "@"      PGNSP PGUID l f   0  23  23   0   0   0   0   0   0 int4abs - - ));
+DATA(insert OID = 731 (  "+"      PGNSP PGUID b f      600  600        600  731  0 0 0 0 0 point_add - - ));
+DATA(insert OID = 732 (  "-"      PGNSP PGUID b f      600  600        600    0  0 0 0 0 0 point_sub - - ));
+DATA(insert OID = 733 (  "*"      PGNSP PGUID b f      600  600        600  733  0 0 0 0 0 point_mul - - ));
+DATA(insert OID = 734 (  "/"      PGNSP PGUID b f      600  600        600    0  0 0 0 0 0 point_div - - ));
+DATA(insert OID = 735 (  "+"      PGNSP PGUID b f      602  602        602  735  0 0 0 0 0 path_add - - ));
+DATA(insert OID = 736 (  "+"      PGNSP PGUID b f      602  600        602    0  0 0 0 0 0 path_add_pt - - ));
+DATA(insert OID = 737 (  "-"      PGNSP PGUID b f      602  600        602    0  0 0 0 0 0 path_sub_pt - - ));
+DATA(insert OID = 738 (  "*"      PGNSP PGUID b f      602  600        602    0  0 0 0 0 0 path_mul_pt - - ));
+DATA(insert OID = 739 (  "/"      PGNSP PGUID b f      602  600        602    0  0 0 0 0 0 path_div_pt - - ));
+DATA(insert OID = 755 (  "~"      PGNSP PGUID b f      602  600         16  512  0 0 0 0 0 path_contain_pt - - ));
+DATA(insert OID = 756 (  "@"      PGNSP PGUID b f      600  604         16  757  0 0 0 0 0 pt_contained_poly - - ));
+DATA(insert OID = 757 (  "~"      PGNSP PGUID b f      604  600         16  756  0 0 0 0 0 poly_contain_pt - - ));
+DATA(insert OID = 758 (  "@"      PGNSP PGUID b f      600  718         16  759  0 0 0 0 0 pt_contained_circle - - ));
+DATA(insert OID = 759 (  "~"      PGNSP PGUID b f      718  600         16  758  0 0 0 0 0 circle_contain_pt - - ));
+
+DATA(insert OID = 773 (  "@"      PGNSP PGUID l f       0      23      23       0       0       0       0       0       0 int4abs - - ));
 
 /* additional operators for geometric types - thomas 1997-07-09 */
-DATA(insert OID =  792 (  "="     PGNSP PGUID b f  602  602     16  792  0 0 0 0 0 path_n_eq eqsel eqjoinsel ));
-DATA(insert OID =  793 (  "<"     PGNSP PGUID b f  602  602     16  794  0 0 0 0 0 path_n_lt - - ));
-DATA(insert OID =  794 (  ">"     PGNSP PGUID b f  602  602     16  793  0 0 0 0 0 path_n_gt - - ));
-DATA(insert OID =  795 (  "<="    PGNSP PGUID b f  602  602     16  796  0 0 0 0 0 path_n_le - - ));
-DATA(insert OID =  796 (  ">="    PGNSP PGUID b f  602  602     16  795  0 0 0 0 0 path_n_ge - - ));
+DATA(insert OID =  792 (  "="     PGNSP PGUID b f      602  602         16  792  0 0 0 0 0 path_n_eq eqsel eqjoinsel ));
+DATA(insert OID =  793 (  "<"     PGNSP PGUID b f      602  602         16  794  0 0 0 0 0 path_n_lt - - ));
+DATA(insert OID =  794 (  ">"     PGNSP PGUID b f      602  602         16  793  0 0 0 0 0 path_n_gt - - ));
+DATA(insert OID =  795 (  "<="    PGNSP PGUID b f      602  602         16  796  0 0 0 0 0 path_n_le - - ));
+DATA(insert OID =  796 (  ">="    PGNSP PGUID b f      602  602         16  795  0 0 0 0 0 path_n_ge - - ));
 DATA(insert OID =  797 (  "#"     PGNSP PGUID l f      0  602   23    0  0 0 0 0 0 path_npoints - - ));
-DATA(insert OID =  798 (  "?#"    PGNSP PGUID b f  602  602     16    0  0 0 0 0 0 path_inter - - ));
+DATA(insert OID =  798 (  "?#"    PGNSP PGUID b f      602  602         16    0  0 0 0 0 0 path_inter - - ));
 DATA(insert OID =  799 (  "@-@"    PGNSP PGUID l f     0  602  701    0  0 0 0 0 0 path_length - - ));
-DATA(insert OID =  800 (  ">^"    PGNSP PGUID b f  603  603     16    0  0 0 0 0 0 box_above positionsel positionjoinsel ));
-DATA(insert OID =  801 (  "<^"    PGNSP PGUID b f  603  603     16    0  0 0 0 0 0 box_below positionsel positionjoinsel ));
-DATA(insert OID =  802 (  "?#"    PGNSP PGUID b f  603  603     16    0  0 0 0 0 0 box_overlap areasel areajoinsel ));
-DATA(insert OID =  803 (  "#"     PGNSP PGUID b f  603  603    603    0  0 0 0 0 0 box_intersect - - ));
-DATA(insert OID =  804 (  "+"     PGNSP PGUID b f  603  600    603    0  0 0 0 0 0 box_add - - ));
-DATA(insert OID =  805 (  "-"     PGNSP PGUID b f  603  600    603    0  0 0 0 0 0 box_sub - - ));
-DATA(insert OID =  806 (  "*"     PGNSP PGUID b f  603  600    603    0  0 0 0 0 0 box_mul - - ));
-DATA(insert OID =  807 (  "/"     PGNSP PGUID b f  603  600    603    0  0 0 0 0 0 box_div - - ));
-DATA(insert OID =  808 (  "?-"    PGNSP PGUID b f  600  600     16  808  0 0 0 0 0 point_horiz - - ));
-DATA(insert OID =  809 (  "?|"    PGNSP PGUID b f  600  600     16  809  0 0 0 0 0 point_vert - - ));
-
-DATA(insert OID = 811 (  "="      PGNSP PGUID b f 704 704  16 811 812   0   0   0   0 tintervaleq eqsel eqjoinsel ));
-DATA(insert OID = 812 (  "<>"     PGNSP PGUID b f 704 704  16 812 811   0   0   0   0 tintervalne neqsel neqjoinsel ));
-DATA(insert OID = 813 (  "<"      PGNSP PGUID b f 704 704  16 814 816   0   0   0   0 tintervallt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 814 (  ">"      PGNSP PGUID b f 704 704  16 813 815   0   0   0   0 tintervalgt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 815 (  "<="     PGNSP PGUID b f 704 704  16 816 814   0   0   0   0 tintervalle scalarltsel scalarltjoinsel ));
-DATA(insert OID = 816 (  ">="     PGNSP PGUID b f 704 704  16 815 813   0   0   0   0 tintervalge scalargtsel scalargtjoinsel ));
-
-DATA(insert OID = 843 (  "*"      PGNSP PGUID b f  790  700    790 845   0   0   0   0   0 cash_mul_flt4 - - ));
-DATA(insert OID = 844 (  "/"      PGNSP PGUID b f  790  700    790   0   0   0   0   0   0 cash_div_flt4 - - ));
-DATA(insert OID = 845 (  "*"      PGNSP PGUID b f  700  790    790 843   0   0   0   0   0 flt4_mul_cash - - ));
-
-DATA(insert OID = 900 (  "="      PGNSP PGUID b t  790  790    16 900 901      902 902 902 903 cash_eq eqsel eqjoinsel ));
-DATA(insert OID = 901 (  "<>"     PGNSP PGUID b f  790  790    16 901 900      0 0   0   0 cash_ne neqsel neqjoinsel ));
-DATA(insert OID = 902 (  "<"      PGNSP PGUID b f  790  790    16 903 905      0 0   0   0 cash_lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 903 (  ">"      PGNSP PGUID b f  790  790    16 902 904      0 0   0   0 cash_gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 904 (  "<="     PGNSP PGUID b f  790  790    16 905 903      0 0   0   0 cash_le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 905 (  ">="     PGNSP PGUID b f  790  790    16 904 902      0 0   0   0 cash_ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 906 (  "+"      PGNSP PGUID b f  790  790    790 906   0   0   0   0   0 cash_pl - - ));
-DATA(insert OID = 907 (  "-"      PGNSP PGUID b f  790  790    790   0   0   0   0   0   0 cash_mi - - ));
-DATA(insert OID = 908 (  "*"      PGNSP PGUID b f  790  701    790 916   0   0   0   0   0 cash_mul_flt8 - - ));
-DATA(insert OID = 909 (  "/"      PGNSP PGUID b f  790  701    790   0   0   0   0   0   0 cash_div_flt8 - - ));
-DATA(insert OID = 912 (  "*"      PGNSP PGUID b f  790  23     790 917   0   0   0   0   0 cash_mul_int4 - - ));
-DATA(insert OID = 913 (  "/"      PGNSP PGUID b f  790  23     790   0   0   0   0   0   0 cash_div_int4 - - ));
-DATA(insert OID = 914 (  "*"      PGNSP PGUID b f  790  21     790 918   0   0   0   0   0 cash_mul_int2 - - ));
-DATA(insert OID = 915 (  "/"      PGNSP PGUID b f  790  21     790   0   0   0   0   0   0 cash_div_int2 - - ));
-DATA(insert OID = 916 (  "*"      PGNSP PGUID b f  701  790    790 908   0   0   0   0   0 flt8_mul_cash - - ));
-DATA(insert OID = 917 (  "*"      PGNSP PGUID b f  23  790     790 912   0   0   0   0   0 int4_mul_cash - - ));
-DATA(insert OID = 918 (  "*"      PGNSP PGUID b f  21  790     790 914   0   0   0   0   0 int2_mul_cash - - ));
-
-DATA(insert OID = 965 (  "^"      PGNSP PGUID b f  701  701    701 0 0 0 0 0 0 dpow - - ));
-DATA(insert OID = 966 (  "+"      PGNSP PGUID b f 1034 1033 1034 0 0 0 0 0 0 aclinsert - - ));
-DATA(insert OID = 967 (  "-"      PGNSP PGUID b f 1034 1033 1034 0 0 0 0 0 0 aclremove - - ));
+DATA(insert OID =  800 (  ">^"    PGNSP PGUID b f      603  603         16    0  0 0 0 0 0 box_above positionsel positionjoinsel ));
+DATA(insert OID =  801 (  "<^"    PGNSP PGUID b f      603  603         16    0  0 0 0 0 0 box_below positionsel positionjoinsel ));
+DATA(insert OID =  802 (  "?#"    PGNSP PGUID b f      603  603         16    0  0 0 0 0 0 box_overlap areasel areajoinsel ));
+DATA(insert OID =  803 (  "#"     PGNSP PGUID b f      603  603        603    0  0 0 0 0 0 box_intersect - - ));
+DATA(insert OID =  804 (  "+"     PGNSP PGUID b f      603  600        603    0  0 0 0 0 0 box_add - - ));
+DATA(insert OID =  805 (  "-"     PGNSP PGUID b f      603  600        603    0  0 0 0 0 0 box_sub - - ));
+DATA(insert OID =  806 (  "*"     PGNSP PGUID b f      603  600        603    0  0 0 0 0 0 box_mul - - ));
+DATA(insert OID =  807 (  "/"     PGNSP PGUID b f      603  600        603    0  0 0 0 0 0 box_div - - ));
+DATA(insert OID =  808 (  "?-"    PGNSP PGUID b f      600  600         16  808  0 0 0 0 0 point_horiz - - ));
+DATA(insert OID =  809 (  "?|"    PGNSP PGUID b f      600  600         16  809  0 0 0 0 0 point_vert - - ));
+
+DATA(insert OID = 811 (  "="      PGNSP PGUID b f 704 704      16 811 812       0       0       0       0 tintervaleq eqsel eqjoinsel ));
+DATA(insert OID = 812 (  "<>"     PGNSP PGUID b f 704 704      16 812 811       0       0       0       0 tintervalne neqsel neqjoinsel ));
+DATA(insert OID = 813 (  "<"      PGNSP PGUID b f 704 704      16 814 816       0       0       0       0 tintervallt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 814 (  ">"      PGNSP PGUID b f 704 704      16 813 815       0       0       0       0 tintervalgt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 815 (  "<="     PGNSP PGUID b f 704 704      16 816 814       0       0       0       0 tintervalle scalarltsel scalarltjoinsel ));
+DATA(insert OID = 816 (  ">="     PGNSP PGUID b f 704 704      16 815 813       0       0       0       0 tintervalge scalargtsel scalargtjoinsel ));
+
+DATA(insert OID = 843 (  "*"      PGNSP PGUID b f      790  700        790 845   0   0   0   0   0 cash_mul_flt4 - - ));
+DATA(insert OID = 844 (  "/"      PGNSP PGUID b f      790  700        790   0   0   0   0   0   0 cash_div_flt4 - - ));
+DATA(insert OID = 845 (  "*"      PGNSP PGUID b f      700  790        790 843   0   0   0   0   0 flt4_mul_cash - - ));
+
+DATA(insert OID = 900 (  "="      PGNSP PGUID b t      790  790        16 900 901      902 902 902 903 cash_eq eqsel eqjoinsel ));
+DATA(insert OID = 901 (  "<>"     PGNSP PGUID b f      790  790        16 901 900      0 0   0   0 cash_ne neqsel neqjoinsel ));
+DATA(insert OID = 902 (  "<"      PGNSP PGUID b f      790  790        16 903 905      0 0   0   0 cash_lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 903 (  ">"      PGNSP PGUID b f      790  790        16 902 904      0 0   0   0 cash_gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 904 (  "<="     PGNSP PGUID b f      790  790        16 905 903      0 0   0   0 cash_le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 905 (  ">="     PGNSP PGUID b f      790  790        16 904 902      0 0   0   0 cash_ge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 906 (  "+"      PGNSP PGUID b f      790  790        790 906   0   0   0   0   0 cash_pl - - ));
+DATA(insert OID = 907 (  "-"      PGNSP PGUID b f      790  790        790   0   0   0   0   0   0 cash_mi - - ));
+DATA(insert OID = 908 (  "*"      PGNSP PGUID b f      790  701        790 916   0   0   0   0   0 cash_mul_flt8 - - ));
+DATA(insert OID = 909 (  "/"      PGNSP PGUID b f      790  701        790   0   0   0   0   0   0 cash_div_flt8 - - ));
+DATA(insert OID = 912 (  "*"      PGNSP PGUID b f      790  23 790 917   0   0   0   0   0 cash_mul_int4 - - ));
+DATA(insert OID = 913 (  "/"      PGNSP PGUID b f      790  23 790   0   0   0   0   0   0 cash_div_int4 - - ));
+DATA(insert OID = 914 (  "*"      PGNSP PGUID b f      790  21 790 918   0   0   0   0   0 cash_mul_int2 - - ));
+DATA(insert OID = 915 (  "/"      PGNSP PGUID b f      790  21 790   0   0   0   0   0   0 cash_div_int2 - - ));
+DATA(insert OID = 916 (  "*"      PGNSP PGUID b f      701  790        790 908   0   0   0   0   0 flt8_mul_cash - - ));
+DATA(insert OID = 917 (  "*"      PGNSP PGUID b f      23      790 790 912   0   0   0   0   0 int4_mul_cash - - ));
+DATA(insert OID = 918 (  "*"      PGNSP PGUID b f      21      790 790 914   0   0   0   0   0 int2_mul_cash - - ));
+
+DATA(insert OID = 965 (  "^"      PGNSP PGUID b f      701  701        701 0 0 0 0 0 0 dpow - - ));
+DATA(insert OID = 966 (  "+"      PGNSP PGUID b f 1034 1033 1034 0 0 0 0 0 0 aclinsert - - ));
+DATA(insert OID = 967 (  "-"      PGNSP PGUID b f 1034 1033 1034 0 0 0 0 0 0 aclremove - - ));
 DATA(insert OID = 968 (  "~"      PGNSP PGUID b f 1034 1033     16 0 0 0 0 0 0 aclcontains - - ));
 
 /* additional geometric operators - thomas 1997-07-09 */
@@ -448,13 +448,13 @@ DATA(insert OID =  969 (  "@@"       PGNSP PGUID l f      0  601  600    0  0 0 0 0 0 lse
 DATA(insert OID =  970 (  "@@"    PGNSP PGUID l f      0  602  600    0  0 0 0 0 0 path_center - - ));
 DATA(insert OID =  971 (  "@@"    PGNSP PGUID l f      0  604  600    0  0 0 0 0 0 poly_center - - ));
 
-DATA(insert OID =  974 (  "||"    PGNSP PGUID b f 1042 1042 1042    0  0 0 0 0 0 textcat - - ));
-DATA(insert OID =  979 (  "||"    PGNSP PGUID b f 1043 1043 1043    0  0 0 0 0 0 textcat - - ));
+DATA(insert OID =  974 (  "||"    PGNSP PGUID b f 1042 1042 1042        0      0 0 0 0 0 textcat - - ));
+DATA(insert OID =  979 (  "||"    PGNSP PGUID b f 1043 1043 1043        0      0 0 0 0 0 textcat - - ));
 
 DATA(insert OID = 1054 ( "="      PGNSP PGUID b f 1042 1042     16 1054 1057 1058 1058 1058 1060 bpchareq eqsel eqjoinsel ));
-DATA(insert OID = 1055 ( "~"      PGNSP PGUID b f 1042 25       16    0 1056  0 0 0 0 textregexeq regexeqsel regexeqjoinsel ));
+DATA(insert OID = 1055 ( "~"      PGNSP PGUID b f 1042 25       16    0 1056  0 0 0 0 textregexeq regexeqsel regexeqjoinsel ));
 #define OID_BPCHAR_REGEXEQ_OP          1055
-DATA(insert OID = 1056 ( "!~"     PGNSP PGUID b f 1042 25       16    0 1055  0 0 0 0 textregexne regexnesel regexnejoinsel ));
+DATA(insert OID = 1056 ( "!~"     PGNSP PGUID b f 1042 25       16    0 1055  0 0 0 0 textregexne regexnesel regexnejoinsel ));
 DATA(insert OID = 1057 ( "<>"     PGNSP PGUID b f 1042 1042     16 1057 1054  0 0 0 0 bpcharne neqsel neqjoinsel ));
 DATA(insert OID = 1058 ( "<"      PGNSP PGUID b f 1042 1042     16 1060 1061  0 0 0 0 bpcharlt scalarltsel scalarltjoinsel ));
 DATA(insert OID = 1059 ( "<="     PGNSP PGUID b f 1042 1042     16 1061 1060  0 0 0 0 bpcharle scalarltsel scalarltjoinsel ));
@@ -462,9 +462,9 @@ DATA(insert OID = 1060 ( ">"           PGNSP PGUID b f 1042 1042     16 1058 1059  0 0 0 0
 DATA(insert OID = 1061 ( ">="     PGNSP PGUID b f 1042 1042     16 1059 1058  0 0 0 0 bpcharge scalargtsel scalargtjoinsel ));
 
 DATA(insert OID = 1062 ( "="      PGNSP PGUID b t 1043 1043    16      1062 1065 1066 1066 1066 1068 varchareq eqsel eqjoinsel ));
-DATA(insert OID = 1063 ( "~"      PGNSP PGUID b f 1043 25      16 0 1064  0 0 0 0 textregexeq regexeqsel regexeqjoinsel ));
+DATA(insert OID = 1063 ( "~"      PGNSP PGUID b f 1043 25      16 0 1064  0 0 0 0 textregexeq regexeqsel regexeqjoinsel ));
 #define OID_VARCHAR_REGEXEQ_OP         1063
-DATA(insert OID = 1064 ( "!~"     PGNSP PGUID b f 1043 25      16 0 1063  0 0 0 0 textregexne regexnesel regexnejoinsel ));
+DATA(insert OID = 1064 ( "!~"     PGNSP PGUID b f 1043 25      16 0 1063  0 0 0 0 textregexne regexnesel regexnejoinsel ));
 DATA(insert OID = 1065 ( "<>"     PGNSP PGUID b f 1043 1043    16 1065 1062  0 0 0 0 varcharne neqsel neqjoinsel ));
 DATA(insert OID = 1066 ( "<"      PGNSP PGUID b f 1043 1043    16 1068 1069  0 0 0 0 varcharlt scalarltsel scalarltjoinsel ));
 DATA(insert OID = 1067 ( "<="     PGNSP PGUID b f 1043 1043    16 1069 1068  0 0 0 0 varcharle scalarltsel scalarltjoinsel ));
@@ -472,41 +472,41 @@ DATA(insert OID = 1068 ( ">"         PGNSP PGUID b f 1043 1043    16 1066 1067  0 0 0 0
 DATA(insert OID = 1069 ( ">="     PGNSP PGUID b f 1043 1043    16 1067 1066  0 0 0 0 varcharge scalargtsel scalargtjoinsel ));
 
 /* date operators */
-DATA(insert OID = 1076 ( "+"      PGNSP PGUID b f  1082        1186 1114 0 0 0 0 0 0 date_pl_interval - - ));
-DATA(insert OID = 1077 ( "-"      PGNSP PGUID b f  1082        1186 1114 0 0 0 0 0 0 date_mi_interval - - ));
-DATA(insert OID = 1093 ( "="      PGNSP PGUID b t  1082        1082   16 1093 1094 1095 1095 1095 1097 date_eq eqsel eqjoinsel ));
-DATA(insert OID = 1094 ( "<>"     PGNSP PGUID b f  1082        1082   16 1094 1093  0 0 0 0 date_ne neqsel neqjoinsel ));
-DATA(insert OID = 1095 ( "<"      PGNSP PGUID b f  1082        1082   16 1097 1098  0 0 0 0 date_lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1096 ( "<="     PGNSP PGUID b f  1082        1082   16 1098 1097  0 0 0 0 date_le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1097 ( ">"      PGNSP PGUID b f  1082        1082   16 1095 1096  0 0 0 0 date_gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1098 ( ">="     PGNSP PGUID b f  1082        1082   16 1096 1095  0 0 0 0 date_ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1099 ( "-"      PGNSP PGUID b f  1082        1082   23 0 0 0 0 0 0 date_mi - - ));
-DATA(insert OID = 1100 ( "+"      PGNSP PGUID b f  1082          23 1082 0 0 0 0 0 0 date_pli - - ));
-DATA(insert OID = 1101 ( "-"      PGNSP PGUID b f  1082          23 1082 0 0 0 0 0 0 date_mii - - ));
+DATA(insert OID = 1076 ( "+"      PGNSP PGUID b f      1082    1186 1114 0 0 0 0 0 0 date_pl_interval - - ));
+DATA(insert OID = 1077 ( "-"      PGNSP PGUID b f      1082    1186 1114 0 0 0 0 0 0 date_mi_interval - - ));
+DATA(insert OID = 1093 ( "="      PGNSP PGUID b t      1082    1082   16 1093 1094 1095 1095 1095 1097 date_eq eqsel eqjoinsel ));
+DATA(insert OID = 1094 ( "<>"     PGNSP PGUID b f      1082    1082   16 1094 1093  0 0 0 0 date_ne neqsel neqjoinsel ));
+DATA(insert OID = 1095 ( "<"      PGNSP PGUID b f      1082    1082   16 1097 1098  0 0 0 0 date_lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1096 ( "<="     PGNSP PGUID b f      1082    1082   16 1098 1097  0 0 0 0 date_le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1097 ( ">"      PGNSP PGUID b f      1082    1082   16 1095 1096  0 0 0 0 date_gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1098 ( ">="     PGNSP PGUID b f      1082    1082   16 1096 1095  0 0 0 0 date_ge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1099 ( "-"      PGNSP PGUID b f      1082    1082   23 0 0 0 0 0 0 date_mi - - ));
+DATA(insert OID = 1100 ( "+"      PGNSP PGUID b f      1082      23 1082 0 0 0 0 0 0 date_pli - - ));
+DATA(insert OID = 1101 ( "-"      PGNSP PGUID b f      1082      23 1082 0 0 0 0 0 0 date_mii - - ));
 
 /* time operators */
-DATA(insert OID = 1108 ( "="      PGNSP PGUID b f  1083        1083  16 1108 1109 1110 1110 1110 1112 time_eq eqsel eqjoinsel ));
-DATA(insert OID = 1109 ( "<>"     PGNSP PGUID b f  1083        1083  16 1109 1108      0 0   0   0 time_ne neqsel neqjoinsel ));
-DATA(insert OID = 1110 ( "<"      PGNSP PGUID b f  1083        1083  16 1112 1113      0 0   0   0 time_lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1111 ( "<="     PGNSP PGUID b f  1083        1083  16 1113 1112      0 0   0   0 time_le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1112 ( ">"      PGNSP PGUID b f  1083        1083  16 1110 1111      0 0   0   0 time_gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1113 ( ">="     PGNSP PGUID b f  1083        1083  16 1111 1110      0 0   0   0 time_ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1269 (  "-"     PGNSP PGUID b f  1186 1083 1083 0 0 0 0 0 0 interval_mi_time - - ));
+DATA(insert OID = 1108 ( "="      PGNSP PGUID b f      1083    1083  16 1108 1109 1110 1110 1110 1112 time_eq eqsel eqjoinsel ));
+DATA(insert OID = 1109 ( "<>"     PGNSP PGUID b f      1083    1083  16 1109 1108      0 0   0   0 time_ne neqsel neqjoinsel ));
+DATA(insert OID = 1110 ( "<"      PGNSP PGUID b f      1083    1083  16 1112 1113      0 0   0   0 time_lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1111 ( "<="     PGNSP PGUID b f      1083    1083  16 1113 1112      0 0   0   0 time_le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1112 ( ">"      PGNSP PGUID b f      1083    1083  16 1110 1111      0 0   0   0 time_gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1113 ( ">="     PGNSP PGUID b f      1083    1083  16 1111 1110      0 0   0   0 time_ge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1269 (  "-"     PGNSP PGUID b f      1186 1083 1083 0 0 0 0 0 0 interval_mi_time - - ));
 
 /* timetz operators */
-DATA(insert OID = 1295 (  "-"     PGNSP PGUID b f  1186 1266 1266 0 0 0 0 0 0 interval_mi_timetz - - ));
-DATA(insert OID = 1550 ( "="      PGNSP PGUID b f  1266 1266   16 1550 1551 1552 1552 1552 1554 timetz_eq eqsel eqjoinsel ));
-DATA(insert OID = 1551 ( "<>"     PGNSP PGUID b f  1266 1266   16 1551 1550    0 0   0   0 timetz_ne neqsel neqjoinsel ));
-DATA(insert OID = 1552 ( "<"      PGNSP PGUID b f  1266 1266   16 1554 1555    0 0   0   0 timetz_lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1553 ( "<="     PGNSP PGUID b f  1266 1266   16 1555 1554    0 0   0   0 timetz_le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1554 ( ">"      PGNSP PGUID b f  1266 1266   16 1552 1553    0 0   0   0 timetz_gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1555 ( ">="     PGNSP PGUID b f  1266 1266   16 1553 1552    0 0   0   0 timetz_ge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1295 (  "-"     PGNSP PGUID b f      1186 1266 1266 0 0 0 0 0 0 interval_mi_timetz - - ));
+DATA(insert OID = 1550 ( "="      PGNSP PGUID b f      1266 1266       16 1550 1551 1552 1552 1552 1554 timetz_eq eqsel eqjoinsel ));
+DATA(insert OID = 1551 ( "<>"     PGNSP PGUID b f      1266 1266       16 1551 1550    0 0   0   0 timetz_ne neqsel neqjoinsel ));
+DATA(insert OID = 1552 ( "<"      PGNSP PGUID b f      1266 1266       16 1554 1555    0 0   0   0 timetz_lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1553 ( "<="     PGNSP PGUID b f      1266 1266       16 1555 1554    0 0   0   0 timetz_le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1554 ( ">"      PGNSP PGUID b f      1266 1266       16 1552 1553    0 0   0   0 timetz_gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1555 ( ">="     PGNSP PGUID b f      1266 1266       16 1553 1552    0 0   0   0 timetz_ge scalargtsel scalargtjoinsel ));
 
 /* float48 operators */
-DATA(insert OID = 1116 (  "+"          PGNSP PGUID b f 700 701 701 1126         0       0       0   0   0 float48pl - - ));
-DATA(insert OID = 1117 (  "-"          PGNSP PGUID b f 700 701 701      0       0       0       0   0   0 float48mi - - ));
-DATA(insert OID = 1118 (  "/"          PGNSP PGUID b f 700 701 701      0       0       0       0   0   0 float48div - - ));
-DATA(insert OID = 1119 (  "*"          PGNSP PGUID b f 700 701 701 1129         0       0       0   0   0 float48mul - - ));
+DATA(insert OID = 1116 (  "+"          PGNSP PGUID b f 700 701 701 1126         0       0       0       0       0 float48pl - - ));
+DATA(insert OID = 1117 (  "-"          PGNSP PGUID b f 700 701 701  0   0       0       0       0       0 float48mi - - ));
+DATA(insert OID = 1118 (  "/"          PGNSP PGUID b f 700 701 701  0   0       0       0       0       0 float48div - - ));
+DATA(insert OID = 1119 (  "*"          PGNSP PGUID b f 700 701 701 1129         0       0       0       0       0 float48mul - - ));
 DATA(insert OID = 1120 (  "="          PGNSP PGUID b f  700    701  16 1130 1121  622  672 1122 1123 float48eq eqsel eqjoinsel ));
 DATA(insert OID = 1121 (  "<>"         PGNSP PGUID b f  700    701  16 1131 1120  0 0 0 0 float48ne neqsel neqjoinsel ));
 DATA(insert OID = 1122 (  "<"          PGNSP PGUID b f  700    701  16 1133 1125  0 0 0 0 float48lt scalarltsel scalarltjoinsel ));
@@ -515,10 +515,10 @@ DATA(insert OID = 1124 (  "<="            PGNSP PGUID b f  700    701  16 1135 1123  0 0 0 0
 DATA(insert OID = 1125 (  ">="         PGNSP PGUID b f  700    701  16 1134 1122  0 0 0 0 float48ge scalargtsel scalargtjoinsel ));
 
 /* float84 operators */
-DATA(insert OID = 1126 (  "+"          PGNSP PGUID b f 701 700 701 1116         0       0       0   0   0 float84pl - - ));
-DATA(insert OID = 1127 (  "-"          PGNSP PGUID b f 701 700 701      0       0       0       0   0   0 float84mi - - ));
-DATA(insert OID = 1128 (  "/"          PGNSP PGUID b f 701 700 701      0       0       0       0   0   0 float84div - - ));
-DATA(insert OID = 1129 (  "*"          PGNSP PGUID b f 701 700 701 1119         0       0       0   0   0 float84mul - - ));
+DATA(insert OID = 1126 (  "+"          PGNSP PGUID b f 701 700 701 1116         0       0       0       0       0 float84pl - - ));
+DATA(insert OID = 1127 (  "-"          PGNSP PGUID b f 701 700 701  0   0       0       0       0       0 float84mi - - ));
+DATA(insert OID = 1128 (  "/"          PGNSP PGUID b f 701 700 701  0   0       0       0       0       0 float84div - - ));
+DATA(insert OID = 1129 (  "*"          PGNSP PGUID b f 701 700 701 1119         0       0       0       0       0 float84mul - - ));
 DATA(insert OID = 1130 (  "="          PGNSP PGUID b f  701    700  16 1120 1131  672 622 1132 1133 float84eq eqsel eqjoinsel ));
 DATA(insert OID = 1131 (  "<>"         PGNSP PGUID b f  701    700  16 1121 1130  0 0 0 0 float84ne neqsel neqjoinsel ));
 DATA(insert OID = 1132 (  "<"          PGNSP PGUID b f  701    700  16 1123 1135  0 0 0 0 float84lt scalarltsel scalarltjoinsel ));
@@ -527,25 +527,25 @@ DATA(insert OID = 1134 (  "<="            PGNSP PGUID b f  701    700  16 1125 1133  0 0 0 0
 DATA(insert OID = 1135 (  ">="         PGNSP PGUID b f  701    700  16 1124 1132  0 0 0 0 float84ge scalargtsel scalargtjoinsel ));
 
 /* int4 vs oid equality --- use oid (unsigned) comparison */
-DATA(insert OID = 1136 (  "="          PGNSP PGUID b t 23       26   16 1137 1656 0 0 0 0 oideq eqsel eqjoinsel ));
-DATA(insert OID = 1137 (  "="          PGNSP PGUID b t 26       23   16 1136 1661 0 0 0 0 oideq eqsel eqjoinsel ));
+DATA(insert OID = 1136 (  "="          PGNSP PGUID b t 23       26   16 1137 1656 0 0 0 0 oideq eqsel eqjoinsel ));
+DATA(insert OID = 1137 (  "="          PGNSP PGUID b t 26       23   16 1136 1661 0 0 0 0 oideq eqsel eqjoinsel ));
 
-DATA(insert OID = 1158 (  "!"          PGNSP PGUID r f 21        0   23 0 0 0 0 0 0 int2fac - - ));
-DATA(insert OID = 1175 (  "!!"         PGNSP PGUID l f  0       21   23 0 0 0 0 0 0 int2fac - - ));
+DATA(insert OID = 1158 (  "!"          PGNSP PGUID r f 21        0   23 0 0 0 0 0 0 int2fac - - ));
+DATA(insert OID = 1175 (  "!!"         PGNSP PGUID l f  0       21   23 0 0 0 0 0 0 int2fac - - ));
 
 /* LIKE hacks by Keith Parks. */
-DATA(insert OID = 1207 (  "~~"   PGNSP PGUID b f  19   25  16 0 1208 0 0 0 0 namelike likesel likejoinsel ));
+DATA(insert OID = 1207 (  "~~"   PGNSP PGUID b f  19   25      16 0 1208 0 0 0 0 namelike likesel likejoinsel ));
 #define OID_NAME_LIKE_OP               1207
-DATA(insert OID = 1208 (  "!~~"   PGNSP PGUID b f  19   25  16 0 1207 0 0 0 0 namenlike nlikesel nlikejoinsel ));
-DATA(insert OID = 1209 (  "~~"   PGNSP PGUID b f  25   25  16 0 1210 0 0 0 0 textlike likesel likejoinsel ));
+DATA(insert OID = 1208 (  "!~~"   PGNSP PGUID b f  19  25      16 0 1207 0 0 0 0 namenlike nlikesel nlikejoinsel ));
+DATA(insert OID = 1209 (  "~~"   PGNSP PGUID b f  25   25      16 0 1210 0 0 0 0 textlike likesel likejoinsel ));
 #define OID_TEXT_LIKE_OP               1209
-DATA(insert OID = 1210 (  "!~~"   PGNSP PGUID b f  25   25  16 0 1209 0 0 0 0 textnlike nlikesel nlikejoinsel ));
-DATA(insert OID = 1211 (  "~~"   PGNSP PGUID b f  1042 25  16 0 1212 0 0 0 0 textlike likesel likejoinsel ));
+DATA(insert OID = 1210 (  "!~~"   PGNSP PGUID b f  25  25      16 0 1209 0 0 0 0 textnlike nlikesel nlikejoinsel ));
+DATA(insert OID = 1211 (  "~~"   PGNSP PGUID b f  1042 25      16 0 1212 0 0 0 0 textlike likesel likejoinsel ));
 #define OID_BPCHAR_LIKE_OP             1211
-DATA(insert OID = 1212 (  "!~~"   PGNSP PGUID b f  1042 25  16 0 1211 0 0 0 0 textnlike nlikesel nlikejoinsel ));
-DATA(insert OID = 1213 (  "~~"   PGNSP PGUID b f  1043 25  16 0 1214 0 0 0 0 textlike likesel likejoinsel ));
+DATA(insert OID = 1212 (  "!~~"   PGNSP PGUID b f  1042 25     16 0 1211 0 0 0 0 textnlike nlikesel nlikejoinsel ));
+DATA(insert OID = 1213 (  "~~"   PGNSP PGUID b f  1043 25      16 0 1214 0 0 0 0 textlike likesel likejoinsel ));
 #define OID_VARCHAR_LIKE_OP            1213
-DATA(insert OID = 1214 (  "!~~"   PGNSP PGUID b f  1043 25  16 0 1213 0 0 0 0 textnlike nlikesel nlikejoinsel ));
+DATA(insert OID = 1214 (  "!~~"   PGNSP PGUID b f  1043 25     16 0 1213 0 0 0 0 textnlike nlikesel nlikejoinsel ));
 
 /* case-insensitive regex hacks */
 DATA(insert OID = 1226 (  "~*"          PGNSP PGUID b f        19      25      16 0 1227  0 0 0 0 nameicregexeq icregexeqsel icregexeqjoinsel ));
@@ -568,9 +568,9 @@ DATA(insert OID = 1322 (  "<"          PGNSP PGUID b f 1184 1184     16 1324 1325 0 0 0 0
 DATA(insert OID = 1323 (  "<="    PGNSP PGUID b f 1184 1184     16 1325 1324 0 0 0 0 timestamp_le scalarltsel scalarltjoinsel ));
 DATA(insert OID = 1324 (  ">"     PGNSP PGUID b f 1184 1184     16 1322 1323 0 0 0 0 timestamp_gt scalargtsel scalargtjoinsel ));
 DATA(insert OID = 1325 (  ">="    PGNSP PGUID b f 1184 1184     16 1323 1322 0 0 0 0 timestamp_ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1327 (  "+"     PGNSP PGUID b f 1184 1186 1184    0  0 0 0 0 0 timestamptz_pl_span - - ));
-DATA(insert OID = 1328 (  "-"     PGNSP PGUID b f 1184 1184 1186    0  0 0 0 0 0 timestamptz_mi - - ));
-DATA(insert OID = 1329 (  "-"     PGNSP PGUID b f 1184 1186 1184    0  0 0 0 0 0 timestamptz_mi_span - - ));
+DATA(insert OID = 1327 (  "+"     PGNSP PGUID b f 1184 1186 1184        0      0 0 0 0 0 timestamptz_pl_span - - ));
+DATA(insert OID = 1328 (  "-"     PGNSP PGUID b f 1184 1184 1186        0      0 0 0 0 0 timestamptz_mi - - ));
+DATA(insert OID = 1329 (  "-"     PGNSP PGUID b f 1184 1186 1184        0      0 0 0 0 0 timestamptz_mi_span - - ));
 
 /* interval operators */
 DATA(insert OID = 1330 (  "="     PGNSP PGUID b f 1186 1186     16 1330 1331 1332 1332 1332 1334 interval_eq eqsel eqjoinsel ));
@@ -582,92 +582,92 @@ DATA(insert OID = 1335 (  ">="       PGNSP PGUID b f 1186 1186     16 1333 1332 0 0 0
 
 DATA(insert OID = 1336 (  "-"     PGNSP PGUID l f      0 1186 1186    0        0 0 0 0 0 interval_um - - ));
 DATA(insert OID = 1337 (  "+"     PGNSP PGUID b f 1186 1186 1186 1337  0 0 0 0 0 interval_pl - - ));
-DATA(insert OID = 1338 (  "-"     PGNSP PGUID b f 1186 1186 1186    0  0 0 0 0 0 interval_mi - - ));
+DATA(insert OID = 1338 (  "-"     PGNSP PGUID b f 1186 1186 1186        0      0 0 0 0 0 interval_mi - - ));
 
-DATA(insert OID = 1360 (  "+"     PGNSP PGUID b f 1082 1083 1114    0  0 0 0 0 0 datetime_pl - - ));
-DATA(insert OID = 1361 (  "+"     PGNSP PGUID b f 1082 1266 1184    0  0 0 0 0 0 datetimetz_pl - - ));
-DATA(insert OID = 1363 (  "+"     PGNSP PGUID b f 1083 1082 1114    0  0 0 0 0 0 timedate_pl - - ));
-DATA(insert OID = 1366 (  "+"     PGNSP PGUID b f 1266 1082 1184    0  0 0 0 0 0 timetzdate_pl - - ));
+DATA(insert OID = 1360 (  "+"     PGNSP PGUID b f 1082 1083 1114        0      0 0 0 0 0 datetime_pl - - ));
+DATA(insert OID = 1361 (  "+"     PGNSP PGUID b f 1082 1266 1184        0      0 0 0 0 0 datetimetz_pl - - ));
+DATA(insert OID = 1363 (  "+"     PGNSP PGUID b f 1083 1082 1114        0      0 0 0 0 0 timedate_pl - - ));
+DATA(insert OID = 1366 (  "+"     PGNSP PGUID b f 1266 1082 1184        0      0 0 0 0 0 timetzdate_pl - - ));
 
-DATA(insert OID = 1399 (  "-"     PGNSP PGUID b f 1083 1083 1186    0  0 0 0 0 0 time_mi_time - - ));
+DATA(insert OID = 1399 (  "-"     PGNSP PGUID b f 1083 1083 1186        0      0 0 0 0 0 time_mi_time - - ));
 
 /* additional geometric operators - thomas 97/04/18 */
-DATA(insert OID = 1420 (  "@@"   PGNSP PGUID l f    0  718 600   0    0        0        0   0   0 circle_center - - ));
-DATA(insert OID = 1500 (  "="    PGNSP PGUID b f  718  718     16 1500 1501 1502 1502 1502 1503 circle_eq eqsel eqjoinsel ));
-DATA(insert OID = 1501 (  "<>"   PGNSP PGUID b f  718  718     16 1501 1500    0        0   0   0 circle_ne neqsel neqjoinsel ));
-DATA(insert OID = 1502 (  "<"    PGNSP PGUID b f  718  718     16 1503 1505    0        0   0   0 circle_lt areasel areajoinsel ));
-DATA(insert OID = 1503 (  ">"    PGNSP PGUID b f  718  718     16 1502 1504    0        0   0   0 circle_gt areasel areajoinsel ));
-DATA(insert OID = 1504 (  "<="   PGNSP PGUID b f  718  718     16 1505 1503    0        0   0   0 circle_le areasel areajoinsel ));
-DATA(insert OID = 1505 (  ">="   PGNSP PGUID b f  718  718     16 1504 1502    0        0   0   0 circle_ge areasel areajoinsel ));
-
-DATA(insert OID = 1506 (  "<<"   PGNSP PGUID b f  718  718     16        0    0        0        0   0   0 circle_left positionsel positionjoinsel ));
-DATA(insert OID = 1507 (  "&<"   PGNSP PGUID b f  718  718     16        0    0        0        0   0   0 circle_overleft positionsel positionjoinsel ));
-DATA(insert OID = 1508 (  "&>"   PGNSP PGUID b f  718  718     16        0    0        0        0   0   0 circle_overright positionsel positionjoinsel ));
-DATA(insert OID = 1509 (  ">>"   PGNSP PGUID b f  718  718     16        0    0        0        0   0   0 circle_right positionsel positionjoinsel ));
-DATA(insert OID = 1510 (  "@"    PGNSP PGUID b f  718  718     16 1511    0    0        0   0   0 circle_contained contsel contjoinsel ));
-DATA(insert OID = 1511 (  "~"    PGNSP PGUID b f  718  718     16 1510    0    0        0   0   0 circle_contain contsel contjoinsel ));
-DATA(insert OID = 1512 (  "~="   PGNSP PGUID b f  718  718     16 1512    0    0        0   0   0 circle_same eqsel eqjoinsel ));
-DATA(insert OID = 1513 (  "&&"   PGNSP PGUID b f  718  718     16 1513    0    0        0   0   0 circle_overlap areasel areajoinsel ));
-DATA(insert OID = 1514 (  ">^"   PGNSP PGUID b f  718  718     16        0    0        0        0   0   0 circle_above positionsel positionjoinsel ));
-DATA(insert OID = 1515 (  "<^"   PGNSP PGUID b f  718  718     16        0    0        0        0   0   0 circle_below positionsel positionjoinsel ));
-
-DATA(insert OID = 1516 (  "+"    PGNSP PGUID b f  718  600  718          0    0        0        0   0   0 circle_add_pt - - ));
-DATA(insert OID = 1517 (  "-"    PGNSP PGUID b f  718  600  718          0    0        0        0   0   0 circle_sub_pt - - ));
-DATA(insert OID = 1518 (  "*"    PGNSP PGUID b f  718  600  718          0    0        0        0   0   0 circle_mul_pt - - ));
-DATA(insert OID = 1519 (  "/"    PGNSP PGUID b f  718  600  718          0    0        0        0   0   0 circle_div_pt - - ));
-
-DATA(insert OID = 1520 (  "<->"   PGNSP PGUID b f  718  718  701 1520    0     0        0   0   0 circle_distance - - ));
-DATA(insert OID = 1521 (  "#"    PGNSP PGUID l f    0  604     23        0    0        0        0   0   0 poly_npoints - - ));
-DATA(insert OID = 1522 (  "<->"   PGNSP PGUID b f  600  718  701         0    0        0        0   0   0 dist_pc - - ));
-DATA(insert OID = 1523 (  "<->"   PGNSP PGUID b f  718  604  701         0    0        0        0   0   0 dist_cpoly - - ));
+DATA(insert OID = 1420 (  "@@"   PGNSP PGUID l f        0      718 600   0    0        0        0       0       0 circle_center - - ));
+DATA(insert OID = 1500 (  "="    PGNSP PGUID b f  718  718 16 1500 1501 1502 1502 1502 1503 circle_eq eqsel eqjoinsel ));
+DATA(insert OID = 1501 (  "<>"   PGNSP PGUID b f  718  718 16 1501 1500        0        0       0       0 circle_ne neqsel neqjoinsel ));
+DATA(insert OID = 1502 (  "<"    PGNSP PGUID b f  718  718 16 1503 1505        0        0       0       0 circle_lt areasel areajoinsel ));
+DATA(insert OID = 1503 (  ">"    PGNSP PGUID b f  718  718 16 1502 1504        0        0       0       0 circle_gt areasel areajoinsel ));
+DATA(insert OID = 1504 (  "<="   PGNSP PGUID b f  718  718 16 1505 1503        0        0       0       0 circle_le areasel areajoinsel ));
+DATA(insert OID = 1505 (  ">="   PGNSP PGUID b f  718  718 16 1504 1502        0        0       0       0 circle_ge areasel areajoinsel ));
+
+DATA(insert OID = 1506 (  "<<"   PGNSP PGUID b f  718  718 16    0    0        0        0       0       0 circle_left positionsel positionjoinsel ));
+DATA(insert OID = 1507 (  "&<"   PGNSP PGUID b f  718  718 16    0    0        0        0       0       0 circle_overleft positionsel positionjoinsel ));
+DATA(insert OID = 1508 (  "&>"   PGNSP PGUID b f  718  718 16    0    0        0        0       0       0 circle_overright positionsel positionjoinsel ));
+DATA(insert OID = 1509 (  ">>"   PGNSP PGUID b f  718  718 16    0    0        0        0       0       0 circle_right positionsel positionjoinsel ));
+DATA(insert OID = 1510 (  "@"    PGNSP PGUID b f  718  718 16 1511    0        0        0       0       0 circle_contained contsel contjoinsel ));
+DATA(insert OID = 1511 (  "~"    PGNSP PGUID b f  718  718 16 1510    0        0        0       0       0 circle_contain contsel contjoinsel ));
+DATA(insert OID = 1512 (  "~="   PGNSP PGUID b f  718  718 16 1512    0        0        0       0       0 circle_same eqsel eqjoinsel ));
+DATA(insert OID = 1513 (  "&&"   PGNSP PGUID b f  718  718 16 1513    0        0        0       0       0 circle_overlap areasel areajoinsel ));
+DATA(insert OID = 1514 (  ">^"   PGNSP PGUID b f  718  718 16    0    0        0        0       0       0 circle_above positionsel positionjoinsel ));
+DATA(insert OID = 1515 (  "<^"   PGNSP PGUID b f  718  718 16    0    0        0        0       0       0 circle_below positionsel positionjoinsel ));
+
+DATA(insert OID = 1516 (  "+"    PGNSP PGUID b f  718  600  718          0    0        0        0       0       0 circle_add_pt - - ));
+DATA(insert OID = 1517 (  "-"    PGNSP PGUID b f  718  600  718          0    0        0        0       0       0 circle_sub_pt - - ));
+DATA(insert OID = 1518 (  "*"    PGNSP PGUID b f  718  600  718          0    0        0        0       0       0 circle_mul_pt - - ));
+DATA(insert OID = 1519 (  "/"    PGNSP PGUID b f  718  600  718          0    0        0        0       0       0 circle_div_pt - - ));
+
+DATA(insert OID = 1520 (  "<->"   PGNSP PGUID b f  718 718  701 1520    0      0        0       0       0 circle_distance - - ));
+DATA(insert OID = 1521 (  "#"    PGNSP PGUID l f        0      604 23    0    0        0        0       0       0 poly_npoints - - ));
+DATA(insert OID = 1522 (  "<->"   PGNSP PGUID b f  600 718  701          0    0        0        0       0       0 dist_pc - - ));
+DATA(insert OID = 1523 (  "<->"   PGNSP PGUID b f  718 604  701          0    0        0        0       0       0 dist_cpoly - - ));
 
 /* additional geometric operators - thomas 1997-07-09 */
-DATA(insert OID = 1524 (  "<->"   PGNSP PGUID b f  628  603  701         0  0 0 0 0 0 dist_lb - - ));
-
-DATA(insert OID = 1525 (  "?#"   PGNSP PGUID b f  601  601     16 1525  0 0 0 0 0 lseg_intersect - - ));
-DATA(insert OID = 1526 (  "?||"   PGNSP PGUID b f  601  601    16 1526  0 0 0 0 0 lseg_parallel - - ));
-DATA(insert OID = 1527 (  "?-|"   PGNSP PGUID b f  601  601    16 1527  0 0 0 0 0 lseg_perp - - ));
-DATA(insert OID = 1528 (  "?-"   PGNSP PGUID l f    0  601     16        0  0 0 0 0 0 lseg_horizontal - - ));
-DATA(insert OID = 1529 (  "?|"   PGNSP PGUID l f    0  601     16        0  0 0 0 0 0 lseg_vertical - - ));
-DATA(insert OID = 1535 (  "="    PGNSP PGUID b f  601  601     16 1535 1586 0 0 0 0 lseg_eq eqsel eqjoinsel ));
-DATA(insert OID = 1536 (  "#"    PGNSP PGUID b f  601  601  600 1536  0 0 0 0 0 lseg_interpt - - ));
-DATA(insert OID = 1537 (  "?#"   PGNSP PGUID b f  601  628     16        0  0 0 0 0 0 inter_sl - - ));
-DATA(insert OID = 1538 (  "?#"   PGNSP PGUID b f  601  603     16        0  0 0 0 0 0 inter_sb - - ));
-DATA(insert OID = 1539 (  "?#"   PGNSP PGUID b f  628  603     16        0  0 0 0 0 0 inter_lb - - ));
-
-DATA(insert OID = 1546 (  "@"    PGNSP PGUID b f  600  628     16        0  0 0 0 0 0 on_pl - - ));
-DATA(insert OID = 1547 (  "@"    PGNSP PGUID b f  600  601     16        0  0 0 0 0 0 on_ps - - ));
-DATA(insert OID = 1548 (  "@"    PGNSP PGUID b f  601  628     16        0  0 0 0 0 0 on_sl - - ));
-DATA(insert OID = 1549 (  "@"    PGNSP PGUID b f  601  603     16        0  0 0 0 0 0 on_sb - - ));
-
-DATA(insert OID = 1557 (  "##"   PGNSP PGUID b f  600  628  600          0  0 0 0 0 0 close_pl - - ));
-DATA(insert OID = 1558 (  "##"   PGNSP PGUID b f  600  601  600          0  0 0 0 0 0 close_ps - - ));
-DATA(insert OID = 1559 (  "##"   PGNSP PGUID b f  600  603  600          0  0 0 0 0 0 close_pb - - ));
-
-DATA(insert OID = 1566 (  "##"   PGNSP PGUID b f  601  628  600          0  0 0 0 0 0 close_sl - - ));
-DATA(insert OID = 1567 (  "##"   PGNSP PGUID b f  601  603  600          0  0 0 0 0 0 close_sb - - ));
-DATA(insert OID = 1568 (  "##"   PGNSP PGUID b f  628  603  600          0  0 0 0 0 0 close_lb - - ));
-DATA(insert OID = 1577 (  "##"   PGNSP PGUID b f  628  601  600          0  0 0 0 0 0 close_ls - - ));
-DATA(insert OID = 1578 (  "##"   PGNSP PGUID b f  601  601  600          0  0 0 0 0 0 close_lseg - - ));
-DATA(insert OID = 1583 (  "*"    PGNSP PGUID b f 1186  701 1186          0  0 0 0 0 0 interval_mul - - ));
+DATA(insert OID = 1524 (  "<->"   PGNSP PGUID b f  628 603  701          0  0 0 0 0 0 dist_lb - - ));
+
+DATA(insert OID = 1525 (  "?#"   PGNSP PGUID b f  601  601 16 1525  0 0 0 0 0 lseg_intersect - - ));
+DATA(insert OID = 1526 (  "?||"   PGNSP PGUID b f  601 601 16 1526  0 0 0 0 0 lseg_parallel - - ));
+DATA(insert OID = 1527 (  "?-|"   PGNSP PGUID b f  601 601 16 1527  0 0 0 0 0 lseg_perp - - ));
+DATA(insert OID = 1528 (  "?-"   PGNSP PGUID l f        0      601 16    0  0 0 0 0 0 lseg_horizontal - - ));
+DATA(insert OID = 1529 (  "?|"   PGNSP PGUID l f        0      601 16    0  0 0 0 0 0 lseg_vertical - - ));
+DATA(insert OID = 1535 (  "="    PGNSP PGUID b f  601  601 16 1535 1586 0 0 0 0 lseg_eq eqsel eqjoinsel ));
+DATA(insert OID = 1536 (  "#"    PGNSP PGUID b f  601  601  600 1536  0 0 0 0 0 lseg_interpt - - ));
+DATA(insert OID = 1537 (  "?#"   PGNSP PGUID b f  601  628 16    0  0 0 0 0 0 inter_sl - - ));
+DATA(insert OID = 1538 (  "?#"   PGNSP PGUID b f  601  603 16    0  0 0 0 0 0 inter_sb - - ));
+DATA(insert OID = 1539 (  "?#"   PGNSP PGUID b f  628  603 16    0  0 0 0 0 0 inter_lb - - ));
+
+DATA(insert OID = 1546 (  "@"    PGNSP PGUID b f  600  628 16    0  0 0 0 0 0 on_pl - - ));
+DATA(insert OID = 1547 (  "@"    PGNSP PGUID b f  600  601 16    0  0 0 0 0 0 on_ps - - ));
+DATA(insert OID = 1548 (  "@"    PGNSP PGUID b f  601  628 16    0  0 0 0 0 0 on_sl - - ));
+DATA(insert OID = 1549 (  "@"    PGNSP PGUID b f  601  603 16    0  0 0 0 0 0 on_sb - - ));
+
+DATA(insert OID = 1557 (  "##"   PGNSP PGUID b f  600  628  600          0  0 0 0 0 0 close_pl - - ));
+DATA(insert OID = 1558 (  "##"   PGNSP PGUID b f  600  601  600          0  0 0 0 0 0 close_ps - - ));
+DATA(insert OID = 1559 (  "##"   PGNSP PGUID b f  600  603  600          0  0 0 0 0 0 close_pb - - ));
+
+DATA(insert OID = 1566 (  "##"   PGNSP PGUID b f  601  628  600          0  0 0 0 0 0 close_sl - - ));
+DATA(insert OID = 1567 (  "##"   PGNSP PGUID b f  601  603  600          0  0 0 0 0 0 close_sb - - ));
+DATA(insert OID = 1568 (  "##"   PGNSP PGUID b f  628  603  600          0  0 0 0 0 0 close_lb - - ));
+DATA(insert OID = 1577 (  "##"   PGNSP PGUID b f  628  601  600          0  0 0 0 0 0 close_ls - - ));
+DATA(insert OID = 1578 (  "##"   PGNSP PGUID b f  601  601  600          0  0 0 0 0 0 close_lseg - - ));
+DATA(insert OID = 1583 (  "*"    PGNSP PGUID b f 1186  701 1186          0  0 0 0 0 0 interval_mul - - ));
 DATA(insert OID = 1584 (  "*"    PGNSP PGUID b f  701 1186 1186          0  0 0 0 0 0 mul_d_interval - - ));
-DATA(insert OID = 1585 (  "/"    PGNSP PGUID b f 1186  701 1186          0  0 0 0 0 0 interval_div - - ));
+DATA(insert OID = 1585 (  "/"    PGNSP PGUID b f 1186  701 1186          0  0 0 0 0 0 interval_div - - ));
 
-DATA(insert OID = 1586 (  "<>"   PGNSP PGUID b f  601  601     16 1586 1535 0 0 0 0 lseg_ne neqsel neqjoinsel ));
-DATA(insert OID = 1587 (  "<"    PGNSP PGUID b f  601  601     16 1589 1590 0 0 0 0 lseg_lt - - ));
-DATA(insert OID = 1588 (  "<="   PGNSP PGUID b f  601  601     16 1590 1589 0 0 0 0 lseg_le - - ));
-DATA(insert OID = 1589 (  ">"    PGNSP PGUID b f  601  601     16 1587 1588 0 0 0 0 lseg_gt - - ));
-DATA(insert OID = 1590 (  ">="   PGNSP PGUID b f  601  601     16 1588 1587 0 0 0 0 lseg_ge - - ));
+DATA(insert OID = 1586 (  "<>"   PGNSP PGUID b f  601  601 16 1586 1535 0 0 0 0 lseg_ne neqsel neqjoinsel ));
+DATA(insert OID = 1587 (  "<"    PGNSP PGUID b f  601  601 16 1589 1590 0 0 0 0 lseg_lt - - ));
+DATA(insert OID = 1588 (  "<="   PGNSP PGUID b f  601  601 16 1590 1589 0 0 0 0 lseg_le - - ));
+DATA(insert OID = 1589 (  ">"    PGNSP PGUID b f  601  601 16 1587 1588 0 0 0 0 lseg_gt - - ));
+DATA(insert OID = 1590 (  ">="   PGNSP PGUID b f  601  601 16 1588 1587 0 0 0 0 lseg_ge - - ));
 
 DATA(insert OID = 1591 (  "@-@"   PGNSP PGUID l f 0  601       701    0  0 0 0 0 0 lseg_length - - ));
 
-DATA(insert OID = 1611 (  "?#"   PGNSP PGUID b f  628  628     16 1611  0 0 0 0 0 line_intersect - - ));
-DATA(insert OID = 1612 (  "?||"   PGNSP PGUID b f  628  628    16 1612  0 0 0 0 0 line_parallel - - ));
-DATA(insert OID = 1613 (  "?-|"   PGNSP PGUID b f  628  628    16 1613  0 0 0 0 0 line_perp - - ));
-DATA(insert OID = 1614 (  "?-"   PGNSP PGUID l f    0  628     16        0  0 0 0 0 0 line_horizontal - - ));
-DATA(insert OID = 1615 (  "?|"   PGNSP PGUID l f    0  628     16        0  0 0 0 0 0 line_vertical - - ));
-DATA(insert OID = 1616 (  "="    PGNSP PGUID b f  628  628     16 1616  0 0 0 0 0 line_eq eqsel eqjoinsel ));
-DATA(insert OID = 1617 (  "#"    PGNSP PGUID b f  628  628  600 1617  0 0 0 0 0 line_interpt - - ));
+DATA(insert OID = 1611 (  "?#"   PGNSP PGUID b f  628  628 16 1611  0 0 0 0 0 line_intersect - - ));
+DATA(insert OID = 1612 (  "?||"   PGNSP PGUID b f  628 628 16 1612  0 0 0 0 0 line_parallel - - ));
+DATA(insert OID = 1613 (  "?-|"   PGNSP PGUID b f  628 628 16 1613  0 0 0 0 0 line_perp - - ));
+DATA(insert OID = 1614 (  "?-"   PGNSP PGUID l f        0      628 16    0  0 0 0 0 0 line_horizontal - - ));
+DATA(insert OID = 1615 (  "?|"   PGNSP PGUID l f        0      628 16    0  0 0 0 0 0 line_vertical - - ));
+DATA(insert OID = 1616 (  "="    PGNSP PGUID b f  628  628 16 1616  0 0 0 0 0 line_eq eqsel eqjoinsel ));
+DATA(insert OID = 1617 (  "#"    PGNSP PGUID b f  628  628  600 1617  0 0 0 0 0 line_interpt - - ));
 
 /* MAC type */
 DATA(insert OID = 1220 (  "="     PGNSP PGUID b f 829 829       16 1220 1221 1222 1222 1222 1224 macaddr_eq eqsel eqjoinsel ));
@@ -710,30 +710,30 @@ DATA(insert OID = 1004 ( ">>="       PGNSP PGUID b f 650 650       16 827   0   0   0
 #define OID_CIDR_SUPEQ_OP      1004
 
 /* case-insensitive LIKE hacks */
-DATA(insert OID = 1625 (  "~~*"   PGNSP PGUID b f  19   25  16 0 1626 0 0 0 0 nameiclike iclikesel iclikejoinsel ));
+DATA(insert OID = 1625 (  "~~*"   PGNSP PGUID b f  19  25      16 0 1626 0 0 0 0 nameiclike iclikesel iclikejoinsel ));
 #define OID_NAME_ICLIKE_OP             1625
-DATA(insert OID = 1626 (  "!~~*"  PGNSP PGUID b f  19   25  16 0 1625 0 0 0 0 nameicnlike icnlikesel icnlikejoinsel ));
-DATA(insert OID = 1627 (  "~~*"   PGNSP PGUID b f  25   25  16 0 1628 0 0 0 0 texticlike iclikesel iclikejoinsel ));
+DATA(insert OID = 1626 (  "!~~*"  PGNSP PGUID b f  19  25      16 0 1625 0 0 0 0 nameicnlike icnlikesel icnlikejoinsel ));
+DATA(insert OID = 1627 (  "~~*"   PGNSP PGUID b f  25  25      16 0 1628 0 0 0 0 texticlike iclikesel iclikejoinsel ));
 #define OID_TEXT_ICLIKE_OP             1627
-DATA(insert OID = 1628 (  "!~~*"  PGNSP PGUID b f  25   25  16 0 1627 0 0 0 0 texticnlike icnlikesel icnlikejoinsel ));
-DATA(insert OID = 1629 (  "~~*"   PGNSP PGUID b f  1042 25  16 0 1630 0 0 0 0 texticlike iclikesel iclikejoinsel ));
+DATA(insert OID = 1628 (  "!~~*"  PGNSP PGUID b f  25  25      16 0 1627 0 0 0 0 texticnlike icnlikesel icnlikejoinsel ));
+DATA(insert OID = 1629 (  "~~*"   PGNSP PGUID b f  1042 25     16 0 1630 0 0 0 0 texticlike iclikesel iclikejoinsel ));
 #define OID_BPCHAR_ICLIKE_OP   1629
-DATA(insert OID = 1630 (  "!~~*"  PGNSP PGUID b f  1042 25  16 0 1629 0 0 0 0 texticnlike icnlikesel icnlikejoinsel ));
-DATA(insert OID = 1631 (  "~~*"   PGNSP PGUID b f  1043 25  16 0 1632 0 0 0 0 texticlike iclikesel iclikejoinsel ));
+DATA(insert OID = 1630 (  "!~~*"  PGNSP PGUID b f  1042 25     16 0 1629 0 0 0 0 texticnlike icnlikesel icnlikejoinsel ));
+DATA(insert OID = 1631 (  "~~*"   PGNSP PGUID b f  1043 25     16 0 1632 0 0 0 0 texticlike iclikesel iclikejoinsel ));
 #define OID_VARCHAR_ICLIKE_OP  1631
-DATA(insert OID = 1632 (  "!~~*"  PGNSP PGUID b f  1043 25  16 0 1631 0 0 0 0 texticnlike icnlikesel icnlikejoinsel ));
+DATA(insert OID = 1632 (  "!~~*"  PGNSP PGUID b f  1043 25     16 0 1631 0 0 0 0 texticnlike icnlikesel icnlikejoinsel ));
 
 /* int4 vs oid comparisons --- use oid (unsigned) comparison */
-DATA(insert OID = 1656 (  "<>"    PGNSP PGUID b f  23  26  16 1661 1136        0  0   0   0 oidne neqsel neqjoinsel ));
-DATA(insert OID = 1657 (  "<"     PGNSP PGUID b f  23  26  16 1663 1660        0  0   0   0 oidlt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1658 (  ">"     PGNSP PGUID b f  23  26  16 1662 1659        0  0   0   0 oidgt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1659 (  "<="    PGNSP PGUID b f  23  26  16 1665 1658        0  0   0   0 oidle scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1660 (  ">="    PGNSP PGUID b f  23  26  16 1664 1657        0  0   0   0 oidge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1661 (  "<>"    PGNSP PGUID b f  26  23  16 1656 1137        0  0   0   0 oidne neqsel neqjoinsel ));
-DATA(insert OID = 1662 (  "<"     PGNSP PGUID b f  26  23  16 1658 1665        0  0   0   0 oidlt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1663 (  ">"     PGNSP PGUID b f  26  23  16 1657 1664        0  0   0   0 oidgt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1664 (  "<="    PGNSP PGUID b f  26  23  16 1660 1663        0  0   0   0 oidle scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1665 (  ">="    PGNSP PGUID b f  26  23  16 1659 1662        0  0   0   0 oidge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1656 (  "<>"    PGNSP PGUID b f      23      26      16 1661 1136    0  0   0   0 oidne neqsel neqjoinsel ));
+DATA(insert OID = 1657 (  "<"     PGNSP PGUID b f      23      26      16 1663 1660    0  0   0   0 oidlt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1658 (  ">"     PGNSP PGUID b f      23      26      16 1662 1659    0  0   0   0 oidgt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1659 (  "<="    PGNSP PGUID b f      23      26      16 1665 1658    0  0   0   0 oidle scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1660 (  ">="    PGNSP PGUID b f      23      26      16 1664 1657    0  0   0   0 oidge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1661 (  "<>"    PGNSP PGUID b f      26      23      16 1656 1137    0  0   0   0 oidne neqsel neqjoinsel ));
+DATA(insert OID = 1662 (  "<"     PGNSP PGUID b f      26      23      16 1658 1665    0  0   0   0 oidlt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1663 (  ">"     PGNSP PGUID b f      26      23      16 1657 1664    0  0   0   0 oidgt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1664 (  "<="    PGNSP PGUID b f      26      23      16 1660 1663    0  0   0   0 oidle scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1665 (  ">="    PGNSP PGUID b f      26      23      16 1659 1662    0  0   0   0 oidge scalargtsel scalargtjoinsel ));
 
 /* NUMERIC type - OID's 1700-1799 */
 DATA(insert OID = 1751 (  "-"     PGNSP PGUID l f      0 1700 1700    0        0 0 0 0 0 numeric_uminus - - ));
@@ -744,81 +744,81 @@ DATA(insert OID = 1755 (  "<="       PGNSP PGUID b f 1700 1700     16 1757 1756 0 0 0
 DATA(insert OID = 1756 (  ">"     PGNSP PGUID b f 1700 1700     16 1754 1755 0 0 0 0 numeric_gt scalargtsel scalargtjoinsel ));
 DATA(insert OID = 1757 (  ">="    PGNSP PGUID b f 1700 1700     16 1755 1754 0 0 0 0 numeric_ge scalargtsel scalargtjoinsel ));
 DATA(insert OID = 1758 (  "+"     PGNSP PGUID b f 1700 1700 1700 1758  0 0 0 0 0 numeric_add - - ));
-DATA(insert OID = 1759 (  "-"     PGNSP PGUID b f 1700 1700 1700    0  0 0 0 0 0 numeric_sub - - ));
+DATA(insert OID = 1759 (  "-"     PGNSP PGUID b f 1700 1700 1700        0      0 0 0 0 0 numeric_sub - - ));
 DATA(insert OID = 1760 (  "*"     PGNSP PGUID b f 1700 1700 1700 1760  0 0 0 0 0 numeric_mul - - ));
-DATA(insert OID = 1761 (  "/"     PGNSP PGUID b f 1700 1700 1700    0  0 0 0 0 0 numeric_div - - ));
-DATA(insert OID = 1762 (  "%"     PGNSP PGUID b f 1700 1700 1700    0  0 0 0 0 0 numeric_mod - - ));
+DATA(insert OID = 1761 (  "/"     PGNSP PGUID b f 1700 1700 1700        0      0 0 0 0 0 numeric_div - - ));
+DATA(insert OID = 1762 (  "%"     PGNSP PGUID b f 1700 1700 1700        0      0 0 0 0 0 numeric_mod - - ));
 DATA(insert OID = 1763 (  "@"     PGNSP PGUID l f      0 1700 1700    0        0 0 0 0 0 numeric_abs - - ));
 
-DATA(insert OID = 1784 (  "="    PGNSP PGUID b f 1560 1560     16 1784 1785 1786 1786 1786 1787 biteq eqsel eqjoinsel ));
-DATA(insert OID = 1785 (  "<>"   PGNSP PGUID b f 1560 1560     16 1785 1784    0        0   0   0 bitne neqsel neqjoinsel ));
-DATA(insert OID = 1786 (  "<"    PGNSP PGUID b f 1560 1560     16 1787 1789    0        0   0   0 bitlt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1787 (  ">"    PGNSP PGUID b f 1560 1560     16 1786 1788    0        0   0   0 bitgt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1788 (  "<="   PGNSP PGUID b f 1560 1560     16 1789 1787    0        0   0   0 bitle scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1789 (  ">="   PGNSP PGUID b f 1560 1560     16 1788 1786    0        0   0   0 bitge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1791 (  "&"    PGNSP PGUID b f 1560 1560 1560 1791    0      0        0   0   0 bitand - - ));
-DATA(insert OID = 1792 (  "|"    PGNSP PGUID b f 1560 1560 1560 1792    0      0        0   0   0 bitor - - ));
-DATA(insert OID = 1793 (  "#"    PGNSP PGUID b f 1560 1560 1560 1793    0      0        0   0   0 bitxor - - ));
-DATA(insert OID = 1794 (  "~"    PGNSP PGUID l f    0 1560 1560          0    0        0        0   0   0 bitnot - - ));
-DATA(insert OID = 1795 (  "<<"   PGNSP PGUID b f 1560   23 1560          0    0        0        0   0   0 bitshiftleft - - ));
-DATA(insert OID = 1796 (  ">>"   PGNSP PGUID b f 1560   23 1560          0    0        0        0   0   0 bitshiftright - - ));
-DATA(insert OID = 1797 (  "||"   PGNSP PGUID b f 1560 1560 1560          0    0        0        0   0   0 bitcat - - ));
-
-DATA(insert OID = 1800 (  "+"     PGNSP PGUID b f 1083 1186 1083    0  0 0 0 0 0 time_pl_interval - - ));
-DATA(insert OID = 1801 (  "-"     PGNSP PGUID b f 1083 1186 1083    0  0 0 0 0 0 time_mi_interval - - ));
-DATA(insert OID = 1802 (  "+"     PGNSP PGUID b f 1266 1186 1266    0  0 0 0 0 0 timetz_pl_interval - - ));
-DATA(insert OID = 1803 (  "-"     PGNSP PGUID b f 1266 1186 1266    0  0 0 0 0 0 timetz_mi_interval - - ));
-
-DATA(insert OID = 1804 (  "="    PGNSP PGUID b f 1562 1562     16 1804 1805 1806 1806 1806 1807 varbiteq eqsel eqjoinsel ));
-DATA(insert OID = 1805 (  "<>"   PGNSP PGUID b f 1562 1562     16 1805 1804    0        0   0   0 varbitne neqsel neqjoinsel ));
-DATA(insert OID = 1806 (  "<"    PGNSP PGUID b f 1562 1562     16 1807 1809    0        0   0   0 varbitlt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1807 (  ">"    PGNSP PGUID b f 1562 1562     16 1806 1808    0        0   0   0 varbitgt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1808 (  "<="   PGNSP PGUID b f 1562 1562     16 1809 1807    0        0   0   0 varbitle scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1809 (  ">="   PGNSP PGUID b f 1562 1562     16 1808 1806    0        0   0   0 varbitge scalargtsel scalargtjoinsel ));
-
-DATA(insert OID = 1849 (  "+"     PGNSP PGUID b f 1186 1083 1083    0  0 0 0 0 0 interval_pl_time - - ));
-
-DATA(insert OID = 1862 ( "="      PGNSP PGUID b f  21  20  16 1868  1863  95 412 1864 1865 int28eq eqsel eqjoinsel ));
-DATA(insert OID = 1863 ( "<>"     PGNSP PGUID b f  21  20  16 1869  1862   0   0   0   0 int28ne neqsel neqjoinsel ));
-DATA(insert OID = 1864 ( "<"      PGNSP PGUID b f  21  20  16 1871  1867   0   0   0   0 int28lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1865 ( ">"      PGNSP PGUID b f  21  20  16 1870  1866   0   0   0   0 int28gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1866 ( "<="     PGNSP PGUID b f  21  20  16 1873  1865   0   0   0   0 int28le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1867 ( ">="     PGNSP PGUID b f  21  20  16 1872  1864   0   0   0   0 int28ge scalargtsel scalargtjoinsel ));
-
-DATA(insert OID = 1868 ( "="      PGNSP PGUID b f  20  21  16  1862 1869 412 95 1870 1871 int82eq eqsel eqjoinsel ));
-DATA(insert OID = 1869 ( "<>"     PGNSP PGUID b f  20  21  16  1863 1868   0  0   0   0 int82ne neqsel neqjoinsel ));
-DATA(insert OID = 1870 ( "<"      PGNSP PGUID b f  20  21  16  1865 1873   0  0   0   0 int82lt scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1871 ( ">"      PGNSP PGUID b f  20  21  16  1864 1872   0  0   0   0 int82gt scalargtsel scalargtjoinsel ));
-DATA(insert OID = 1872 ( "<="     PGNSP PGUID b f  20  21  16  1867 1871   0  0   0   0 int82le scalarltsel scalarltjoinsel ));
-DATA(insert OID = 1873 ( ">="     PGNSP PGUID b f  20  21  16  1866 1870   0  0   0   0 int82ge scalargtsel scalargtjoinsel ));
-
-DATA(insert OID = 1874 ( "&"      PGNSP PGUID b f  21  21  21  1874      0   0  0   0   0 int2and - - ));
-DATA(insert OID = 1875 ( "|"      PGNSP PGUID b f  21  21  21  1875      0   0  0   0   0 int2or - - ));
-DATA(insert OID = 1876 ( "#"      PGNSP PGUID b f  21  21  21  1876      0   0  0   0   0 int2xor - - ));
-DATA(insert OID = 1877 ( "~"      PGNSP PGUID l f   0  21  21   0        0   0  0   0   0 int2not - - ));
-DATA(insert OID = 1878 ( "<<"     PGNSP PGUID b f  21  23  21   0        0   0  0   0   0 int2shl - - ));
-DATA(insert OID = 1879 ( ">>"     PGNSP PGUID b f  21  23  21   0        0   0  0   0   0 int2shr - - ));
-
-DATA(insert OID = 1880 ( "&"      PGNSP PGUID b f  23  23  23  1880      0   0  0   0   0 int4and - - ));
-DATA(insert OID = 1881 ( "|"      PGNSP PGUID b f  23  23  23  1881      0   0  0   0   0 int4or - - ));
-DATA(insert OID = 1882 ( "#"      PGNSP PGUID b f  23  23  23  1882      0   0  0   0   0 int4xor - - ));
-DATA(insert OID = 1883 ( "~"      PGNSP PGUID l f   0  23  23   0        0   0  0   0   0 int4not - - ));
-DATA(insert OID = 1884 ( "<<"     PGNSP PGUID b f  23  23  23   0        0   0  0   0   0 int4shl - - ));
-DATA(insert OID = 1885 ( ">>"     PGNSP PGUID b f  23  23  23   0        0   0  0   0   0 int4shr - - ));
-
-DATA(insert OID = 1886 ( "&"      PGNSP PGUID b f  20  20  20  1886      0   0  0   0   0 int8and - - ));
-DATA(insert OID = 1887 ( "|"      PGNSP PGUID b f  20  20  20  1887      0   0  0   0   0 int8or - - ));
-DATA(insert OID = 1888 ( "#"      PGNSP PGUID b f  20  20  20  1888      0   0  0   0   0 int8xor - - ));
-DATA(insert OID = 1889 ( "~"      PGNSP PGUID l f   0  20  20   0        0   0  0   0   0 int8not - - ));
-DATA(insert OID = 1890 ( "<<"     PGNSP PGUID b f  20  23  20   0        0   0  0   0   0 int8shl - - ));
-DATA(insert OID = 1891 ( ">>"     PGNSP PGUID b f  20  23  20   0        0   0  0   0   0 int8shr - - ));
-
-DATA(insert OID = 1916 (  "+"     PGNSP PGUID l f   0  20  20  0       0       0       0   0   0 int8up - - ));
-DATA(insert OID = 1917 (  "+"     PGNSP PGUID l f   0  21  21  0       0       0       0   0   0 int2up - - ));
-DATA(insert OID = 1918 (  "+"     PGNSP PGUID l f   0  23  23  0       0       0       0   0   0 int4up - - ));
-DATA(insert OID = 1919 (  "+"     PGNSP PGUID l f   0  700 700 0       0       0       0   0   0 float4up - - ));
-DATA(insert OID = 1920 (  "+"     PGNSP PGUID l f   0  701 701 0       0       0       0   0   0 float8up - - ));
-DATA(insert OID = 1921 (  "+"     PGNSP PGUID l f   0 1700 1700        0       0       0       0   0   0 numeric_uplus - - ));
+DATA(insert OID = 1784 (  "="    PGNSP PGUID b f 1560 1560 16 1784 1785 1786 1786 1786 1787 biteq eqsel eqjoinsel ));
+DATA(insert OID = 1785 (  "<>"   PGNSP PGUID b f 1560 1560 16 1785 1784        0        0       0       0 bitne neqsel neqjoinsel ));
+DATA(insert OID = 1786 (  "<"    PGNSP PGUID b f 1560 1560 16 1787 1789        0        0       0       0 bitlt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1787 (  ">"    PGNSP PGUID b f 1560 1560 16 1786 1788        0        0       0       0 bitgt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1788 (  "<="   PGNSP PGUID b f 1560 1560 16 1789 1787        0        0       0       0 bitle scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1789 (  ">="   PGNSP PGUID b f 1560 1560 16 1788 1786        0        0       0       0 bitge scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1791 (  "&"    PGNSP PGUID b f 1560 1560 1560 1791    0      0        0       0       0 bitand - - ));
+DATA(insert OID = 1792 (  "|"    PGNSP PGUID b f 1560 1560 1560 1792    0      0        0       0       0 bitor - - ));
+DATA(insert OID = 1793 (  "#"    PGNSP PGUID b f 1560 1560 1560 1793    0      0        0       0       0 bitxor - - ));
+DATA(insert OID = 1794 (  "~"    PGNSP PGUID l f        0 1560 1560      0    0        0        0       0       0 bitnot - - ));
+DATA(insert OID = 1795 (  "<<"   PGNSP PGUID b f 1560   23 1560          0    0        0        0       0       0 bitshiftleft - - ));
+DATA(insert OID = 1796 (  ">>"   PGNSP PGUID b f 1560   23 1560          0    0        0        0       0       0 bitshiftright - - ));
+DATA(insert OID = 1797 (  "||"   PGNSP PGUID b f 1560 1560 1560          0    0        0        0       0       0 bitcat - - ));
+
+DATA(insert OID = 1800 (  "+"     PGNSP PGUID b f 1083 1186 1083        0      0 0 0 0 0 time_pl_interval - - ));
+DATA(insert OID = 1801 (  "-"     PGNSP PGUID b f 1083 1186 1083        0      0 0 0 0 0 time_mi_interval - - ));
+DATA(insert OID = 1802 (  "+"     PGNSP PGUID b f 1266 1186 1266        0      0 0 0 0 0 timetz_pl_interval - - ));
+DATA(insert OID = 1803 (  "-"     PGNSP PGUID b f 1266 1186 1266        0      0 0 0 0 0 timetz_mi_interval - - ));
+
+DATA(insert OID = 1804 (  "="    PGNSP PGUID b f 1562 1562 16 1804 1805 1806 1806 1806 1807 varbiteq eqsel eqjoinsel ));
+DATA(insert OID = 1805 (  "<>"   PGNSP PGUID b f 1562 1562 16 1805 1804        0        0       0       0 varbitne neqsel neqjoinsel ));
+DATA(insert OID = 1806 (  "<"    PGNSP PGUID b f 1562 1562 16 1807 1809        0        0       0       0 varbitlt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1807 (  ">"    PGNSP PGUID b f 1562 1562 16 1806 1808        0        0       0       0 varbitgt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1808 (  "<="   PGNSP PGUID b f 1562 1562 16 1809 1807        0        0       0       0 varbitle scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1809 (  ">="   PGNSP PGUID b f 1562 1562 16 1808 1806        0        0       0       0 varbitge scalargtsel scalargtjoinsel ));
+
+DATA(insert OID = 1849 (  "+"     PGNSP PGUID b f 1186 1083 1083        0      0 0 0 0 0 interval_pl_time - - ));
+
+DATA(insert OID = 1862 ( "="      PGNSP PGUID b f      21      20      16 1868  1863  95 412 1864 1865 int28eq eqsel eqjoinsel ));
+DATA(insert OID = 1863 ( "<>"     PGNSP PGUID b f      21      20      16 1869  1862   0       0       0       0 int28ne neqsel neqjoinsel ));
+DATA(insert OID = 1864 ( "<"      PGNSP PGUID b f      21      20      16 1871  1867   0       0       0       0 int28lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1865 ( ">"      PGNSP PGUID b f      21      20      16 1870  1866   0       0       0       0 int28gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1866 ( "<="     PGNSP PGUID b f      21      20      16 1873  1865   0       0       0       0 int28le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1867 ( ">="     PGNSP PGUID b f      21      20      16 1872  1864   0       0       0       0 int28ge scalargtsel scalargtjoinsel ));
+
+DATA(insert OID = 1868 ( "="      PGNSP PGUID b f      20      21      16      1862 1869 412 95 1870 1871 int82eq eqsel eqjoinsel ));
+DATA(insert OID = 1869 ( "<>"     PGNSP PGUID b f      20      21      16      1863 1868       0  0   0   0 int82ne neqsel neqjoinsel ));
+DATA(insert OID = 1870 ( "<"      PGNSP PGUID b f      20      21      16      1865 1873       0  0   0   0 int82lt scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1871 ( ">"      PGNSP PGUID b f      20      21      16      1864 1872       0  0   0   0 int82gt scalargtsel scalargtjoinsel ));
+DATA(insert OID = 1872 ( "<="     PGNSP PGUID b f      20      21      16      1867 1871       0  0   0   0 int82le scalarltsel scalarltjoinsel ));
+DATA(insert OID = 1873 ( ">="     PGNSP PGUID b f      20      21      16      1866 1870       0  0   0   0 int82ge scalargtsel scalargtjoinsel ));
+
+DATA(insert OID = 1874 ( "&"      PGNSP PGUID b f      21      21      21      1874      0   0  0       0       0 int2and - - ));
+DATA(insert OID = 1875 ( "|"      PGNSP PGUID b f      21      21      21      1875      0   0  0       0       0 int2or - - ));
+DATA(insert OID = 1876 ( "#"      PGNSP PGUID b f      21      21      21      1876      0   0  0       0       0 int2xor - - ));
+DATA(insert OID = 1877 ( "~"      PGNSP PGUID l f       0      21      21       0        0   0  0       0       0 int2not - - ));
+DATA(insert OID = 1878 ( "<<"     PGNSP PGUID b f      21      23      21       0        0   0  0       0       0 int2shl - - ));
+DATA(insert OID = 1879 ( ">>"     PGNSP PGUID b f      21      23      21       0        0   0  0       0       0 int2shr - - ));
+
+DATA(insert OID = 1880 ( "&"      PGNSP PGUID b f      23      23      23      1880      0   0  0       0       0 int4and - - ));
+DATA(insert OID = 1881 ( "|"      PGNSP PGUID b f      23      23      23      1881      0   0  0       0       0 int4or - - ));
+DATA(insert OID = 1882 ( "#"      PGNSP PGUID b f      23      23      23      1882      0   0  0       0       0 int4xor - - ));
+DATA(insert OID = 1883 ( "~"      PGNSP PGUID l f       0      23      23       0        0   0  0       0       0 int4not - - ));
+DATA(insert OID = 1884 ( "<<"     PGNSP PGUID b f      23      23      23       0        0   0  0       0       0 int4shl - - ));
+DATA(insert OID = 1885 ( ">>"     PGNSP PGUID b f      23      23      23       0        0   0  0       0       0 int4shr - - ));
+
+DATA(insert OID = 1886 ( "&"      PGNSP PGUID b f      20      20      20      1886      0   0  0       0       0 int8and - - ));
+DATA(insert OID = 1887 ( "|"      PGNSP PGUID b f      20      20      20      1887      0   0  0       0       0 int8or - - ));
+DATA(insert OID = 1888 ( "#"      PGNSP PGUID b f      20      20      20      1888      0   0  0       0       0 int8xor - - ));
+DATA(insert OID = 1889 ( "~"      PGNSP PGUID l f       0      20      20       0        0   0  0       0       0 int8not - - ));
+DATA(insert OID = 1890 ( "<<"     PGNSP PGUID b f      20      23      20       0        0   0  0       0       0 int8shl - - ));
+DATA(insert OID = 1891 ( ">>"     PGNSP PGUID b f      20      23      20       0        0   0  0       0       0 int8shr - - ));
+
+DATA(insert OID = 1916 (  "+"     PGNSP PGUID l f       0      20      20      0       0       0       0       0       0 int8up - - ));
+DATA(insert OID = 1917 (  "+"     PGNSP PGUID l f       0      21      21      0       0       0       0       0       0 int2up - - ));
+DATA(insert OID = 1918 (  "+"     PGNSP PGUID l f       0      23      23      0       0       0       0       0       0 int4up - - ));
+DATA(insert OID = 1919 (  "+"     PGNSP PGUID l f       0      700 700 0       0       0       0       0       0 float4up - - ));
+DATA(insert OID = 1920 (  "+"     PGNSP PGUID l f       0      701 701 0       0       0       0       0       0 float8up - - ));
+DATA(insert OID = 1921 (  "+"     PGNSP PGUID l f       0 1700 1700    0       0       0       0       0       0 numeric_uplus - - ));
 
 /* bytea operators */
 DATA(insert OID = 1955 ( "="      PGNSP PGUID b t 17 17        16 1955 1956 1957 1957 1957 1959 byteaeq eqsel eqjoinsel ));
@@ -839,36 +839,36 @@ DATA(insert OID = 2062 (  "<"        PGNSP PGUID b f 1114 1114     16 2064 2065 0 0 0 0
 DATA(insert OID = 2063 (  "<="    PGNSP PGUID b f 1114 1114     16 2065 2064 0 0 0 0 timestamp_le scalarltsel scalarltjoinsel ));
 DATA(insert OID = 2064 (  ">"     PGNSP PGUID b f 1114 1114     16 2062 2063 0 0 0 0 timestamp_gt scalargtsel scalargtjoinsel ));
 DATA(insert OID = 2065 (  ">="    PGNSP PGUID b f 1114 1114     16 2063 2062 0 0 0 0 timestamp_ge scalargtsel scalargtjoinsel ));
-DATA(insert OID = 2066 (  "+"     PGNSP PGUID b f 1114 1186 1114    0  0 0 0 0 0 timestamp_pl_span - - ));
-DATA(insert OID = 2067 (  "-"     PGNSP PGUID b f 1114 1114 1186    0  0 0 0 0 0 timestamp_mi - - ));
-DATA(insert OID = 2068 (  "-"     PGNSP PGUID b f 1114 1186 1114    0  0 0 0 0 0 timestamp_mi_span - - ));
+DATA(insert OID = 2066 (  "+"     PGNSP PGUID b f 1114 1186 1114        0      0 0 0 0 0 timestamp_pl_span - - ));
+DATA(insert OID = 2067 (  "-"     PGNSP PGUID b f 1114 1114 1186        0      0 0 0 0 0 timestamp_mi - - ));
+DATA(insert OID = 2068 (  "-"     PGNSP PGUID b f 1114 1186 1114        0      0 0 0 0 0 timestamp_mi_span - - ));
 
 /* array equality operators */
-DATA(insert OID = 2222 (  "="     PGNSP PGUID b f  2207        2207  16  2222 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2223 (  "="     PGNSP PGUID b f  2208        2208  16  2223 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2224 (  "="     PGNSP PGUID b f  2209        2209  16  2224 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2225 (  "="     PGNSP PGUID b f  2210        2210  16  2225 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2226 (  "="     PGNSP PGUID b f  2211        2211  16  2226 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-
-DATA(insert OID = 2227 (  "="     PGNSP PGUID b f   629         629  16  2227 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2228 (  "="     PGNSP PGUID b f   651         651  16  2228 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2229 (  "="     PGNSP PGUID b f   719         719  16  2229 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2230 (  "="     PGNSP PGUID b f   791         791  16  2230 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2231 (  "="     PGNSP PGUID b f  1014        1014  16  2231 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2232 (  "="     PGNSP PGUID b f  1015        1015  16  2232 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2233 (  "="     PGNSP PGUID b f  1016        1016  16  2233 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2234 (  "="     PGNSP PGUID b f  1040        1040  16  2234 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2235 (  "="     PGNSP PGUID b f  1041        1041  16  2235 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2236 (  "="     PGNSP PGUID b f  1115        1115  16  2236 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2237 (  "="     PGNSP PGUID b f  1182        1182  16  2237 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2238 (  "="     PGNSP PGUID b f  1183        1183  16  2238 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2239 (  "="     PGNSP PGUID b f  1185        1185  16  2239 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2240 (  "="     PGNSP PGUID b f  1187        1187  16  2240 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2241 (  "="     PGNSP PGUID b f  1231        1231  16  2241 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2242 (  "="     PGNSP PGUID b f  1270        1270  16  2242 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2243 (  "="     PGNSP PGUID b f  1561        1561  16  2243 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2244 (  "="     PGNSP PGUID b f  1563        1563  16  2244 0  0     0   0   0 array_eq eqsel eqjoinsel ));
-DATA(insert OID = 2245 (  "="     PGNSP PGUID b f  2201        2201  16  2245 0  0     0   0   0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2222 (  "="     PGNSP PGUID b f      2207    2207  16  2222 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2223 (  "="     PGNSP PGUID b f      2208    2208  16  2223 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2224 (  "="     PGNSP PGUID b f      2209    2209  16  2224 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2225 (  "="     PGNSP PGUID b f      2210    2210  16  2225 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2226 (  "="     PGNSP PGUID b f      2211    2211  16  2226 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+
+DATA(insert OID = 2227 (  "="     PGNSP PGUID b f       629     629  16  2227 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2228 (  "="     PGNSP PGUID b f       651     651  16  2228 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2229 (  "="     PGNSP PGUID b f       719     719  16  2229 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2230 (  "="     PGNSP PGUID b f       791     791  16  2230 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2231 (  "="     PGNSP PGUID b f      1014    1014  16  2231 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2232 (  "="     PGNSP PGUID b f      1015    1015  16  2232 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2233 (  "="     PGNSP PGUID b f      1016    1016  16  2233 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2234 (  "="     PGNSP PGUID b f      1040    1040  16  2234 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2235 (  "="     PGNSP PGUID b f      1041    1041  16  2235 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2236 (  "="     PGNSP PGUID b f      1115    1115  16  2236 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2237 (  "="     PGNSP PGUID b f      1182    1182  16  2237 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2238 (  "="     PGNSP PGUID b f      1183    1183  16  2238 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2239 (  "="     PGNSP PGUID b f      1185    1185  16  2239 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2240 (  "="     PGNSP PGUID b f      1187    1187  16  2240 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2241 (  "="     PGNSP PGUID b f      1231    1231  16  2241 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2242 (  "="     PGNSP PGUID b f      1270    1270  16  2242 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2243 (  "="     PGNSP PGUID b f      1561    1561  16  2243 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2244 (  "="     PGNSP PGUID b f      1563    1563  16  2244 0  0 0   0       0 array_eq eqsel eqjoinsel ));
+DATA(insert OID = 2245 (  "="     PGNSP PGUID b f      2201    2201  16  2245 0  0 0   0       0 array_eq eqsel eqjoinsel ));
 
 
 /*
index 256bd1c..6e351df 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_proc.h,v 1.269 2002/09/03 21:45:43 petere Exp $
+ * $Id: pg_proc.h,v 1.270 2002/09/04 20:31:38 momjian Exp $
  *
  * NOTES
  *       The script catalog/genbki.sh reads this file and generates .bki
@@ -95,55 +95,55 @@ typedef FormData_pg_proc *Form_pg_proc;
 
 DATA(insert OID = 1242 (  boolin                  PGNSP PGUID 12 f f t f i 1 16 "2275"  boolin - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1243 (  boolout                 PGNSP PGUID 12 f f t f i 1 2275 "16" boolout - _null_ ));
+DATA(insert OID = 1243 (  boolout                 PGNSP PGUID 12 f f t f i 1 2275 "16" boolout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1244 (  byteain                 PGNSP PGUID 12 f f t f i 1 17 "2275" byteain - _null_ ));
+DATA(insert OID = 1244 (  byteain                 PGNSP PGUID 12 f f t f i 1 17 "2275" byteain - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  31 (  byteaout                 PGNSP PGUID 12 f f t f i 1 2275 "17" byteaout - _null_ ));
+DATA(insert OID =  31 (  byteaout                 PGNSP PGUID 12 f f t f i 1 2275 "17" byteaout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1245 (  charin                  PGNSP PGUID 12 f f t f i 1 18 "2275" charin - _null_ ));
+DATA(insert OID = 1245 (  charin                  PGNSP PGUID 12 f f t f i 1 18 "2275" charin - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  33 (  charout                  PGNSP PGUID 12 f f t f i 1 2275 "18" charout - _null_ ));
+DATA(insert OID =  33 (  charout                  PGNSP PGUID 12 f f t f i 1 2275 "18" charout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  34 (  namein                           PGNSP PGUID 12 f f t f i 1 19 "2275" namein - _null_ ));
+DATA(insert OID =  34 (  namein                           PGNSP PGUID 12 f f t f i 1 19 "2275" namein - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  35 (  nameout                  PGNSP PGUID 12 f f t f i 1 2275 "19" nameout - _null_ ));
+DATA(insert OID =  35 (  nameout                  PGNSP PGUID 12 f f t f i 1 2275 "19" nameout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  38 (  int2in                           PGNSP PGUID 12 f f t f i 1 21 "2275" int2in - _null_ ));
+DATA(insert OID =  38 (  int2in                           PGNSP PGUID 12 f f t f i 1 21 "2275" int2in - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  39 (  int2out                  PGNSP PGUID 12 f f t f i 1 2275 "21" int2out - _null_ ));
+DATA(insert OID =  39 (  int2out                  PGNSP PGUID 12 f f t f i 1 2275 "21" int2out - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  40 (  int2vectorin     PGNSP PGUID 12 f f t f i 1 22 "2275" int2vectorin - _null_ ));
+DATA(insert OID =  40 (  int2vectorin     PGNSP PGUID 12 f f t f i 1 22 "2275" int2vectorin - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  41 (  int2vectorout    PGNSP PGUID 12 f f t f i 1 2275 "22" int2vectorout - _null_ ));
+DATA(insert OID =  41 (  int2vectorout    PGNSP PGUID 12 f f t f i 1 2275 "22" int2vectorout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  42 (  int4in                           PGNSP PGUID 12 f f t f i 1 23 "2275" int4in - _null_ ));
+DATA(insert OID =  42 (  int4in                           PGNSP PGUID 12 f f t f i 1 23 "2275" int4in - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  43 (  int4out                  PGNSP PGUID 12 f f t f i 1 2275 "23" int4out - _null_ ));
+DATA(insert OID =  43 (  int4out                  PGNSP PGUID 12 f f t f i 1 2275 "23" int4out - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  44 (  regprocin                PGNSP PGUID 12 f f t f s 1 24 "2275" regprocin - _null_ ));
+DATA(insert OID =  44 (  regprocin                PGNSP PGUID 12 f f t f s 1 24 "2275" regprocin - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  45 (  regprocout               PGNSP PGUID 12 f f t f s 1 2275 "24" regprocout - _null_ ));
+DATA(insert OID =  45 (  regprocout               PGNSP PGUID 12 f f t f s 1 2275 "24" regprocout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  46 (  textin                           PGNSP PGUID 12 f f t f i 1 25 "2275" textin - _null_ ));
+DATA(insert OID =  46 (  textin                           PGNSP PGUID 12 f f t f i 1 25 "2275" textin - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  47 (  textout                  PGNSP PGUID 12 f f t f i 1 2275 "25" textout - _null_ ));
+DATA(insert OID =  47 (  textout                  PGNSP PGUID 12 f f t f i 1 2275 "25" textout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  48 (  tidin                    PGNSP PGUID 12 f f t f i 1 27 "2275" tidin - _null_ ));
+DATA(insert OID =  48 (  tidin                    PGNSP PGUID 12 f f t f i 1 27 "2275" tidin - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  49 (  tidout                           PGNSP PGUID 12 f f t f i 1 2275 "27" tidout - _null_ ));
+DATA(insert OID =  49 (  tidout                           PGNSP PGUID 12 f f t f i 1 2275 "27" tidout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  50 (  xidin                    PGNSP PGUID 12 f f t f i 1 28 "2275" xidin - _null_ ));
+DATA(insert OID =  50 (  xidin                    PGNSP PGUID 12 f f t f i 1 28 "2275" xidin - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  51 (  xidout                           PGNSP PGUID 12 f f t f i 1 2275 "28" xidout - _null_ ));
+DATA(insert OID =  51 (  xidout                           PGNSP PGUID 12 f f t f i 1 2275 "28" xidout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  52 (  cidin                    PGNSP PGUID 12 f f t f i 1 29 "2275" cidin - _null_ ));
+DATA(insert OID =  52 (  cidin                    PGNSP PGUID 12 f f t f i 1 29 "2275" cidin - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  53 (  cidout                           PGNSP PGUID 12 f f t f i 1 2275 "29" cidout - _null_ ));
+DATA(insert OID =  53 (  cidout                           PGNSP PGUID 12 f f t f i 1 2275 "29" cidout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  54 (  oidvectorin      PGNSP PGUID 12 f f t f i 1 30 "2275" oidvectorin - _null_ ));
+DATA(insert OID =  54 (  oidvectorin      PGNSP PGUID 12 f f t f i 1 30 "2275" oidvectorin - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  55 (  oidvectorout     PGNSP PGUID 12 f f t f i 1 2275 "30" oidvectorout - _null_ ));
+DATA(insert OID =  55 (  oidvectorout     PGNSP PGUID 12 f f t f i 1 2275 "30" oidvectorout - _null_ ));
 DESCR("(internal)");
 DATA(insert OID =  56 (  boollt                           PGNSP PGUID 12 f f t f i 2 16 "16 16"        boollt - _null_ ));
 DESCR("less-than");
@@ -229,14 +229,14 @@ DESCR("join selectivity of > and related operators on scalar datatypes");
 
 DATA(insert OID =  109 (  unknownin               PGNSP PGUID 12 f f t f i 1 705 "2275"        unknownin - _null_ ));
 DESCR("(internal)");
-DATA(insert OID =  110 (  unknownout      PGNSP PGUID 12 f f t f i 1 2275  "705"       unknownout - _null_ ));
+DATA(insert OID =  110 (  unknownout      PGNSP PGUID 12 f f t f i 1 2275      "705"   unknownout - _null_ ));
 DESCR("(internal)");
 
-DATA(insert OID = 112 (  text                     PGNSP PGUID 12 f f t f i 1  25 "23"  int4_text - _null_ ));
+DATA(insert OID = 112 (  text                     PGNSP PGUID 12 f f t f i 1  25 "23"  int4_text - _null_ ));
 DESCR("convert int4 to text");
-DATA(insert OID = 113 (  text                     PGNSP PGUID 12 f f t f i 1  25 "21"  int2_text - _null_ ));
+DATA(insert OID = 113 (  text                     PGNSP PGUID 12 f f t f i 1  25 "21"  int2_text - _null_ ));
 DESCR("convert int2 to text");
-DATA(insert OID = 114 (  text                     PGNSP PGUID 12 f f t f i 1  25 "26"  oid_text - _null_ ));
+DATA(insert OID = 114 (  text                     PGNSP PGUID 12 f f t f i 1  25 "26"  oid_text - _null_ ));
 DESCR("convert oid to text");
 
 DATA(insert OID = 115 (  box_above                PGNSP PGUID 12 f f t f i 2  16 "603 603"  box_above - _null_ ));
@@ -260,31 +260,31 @@ DATA(insert OID = 123 (  box_in                      PGNSP PGUID 12 f f t f i 1 603 "2275"  box_
 DESCR("(internal)");
 DATA(insert OID = 124 (  box_out                  PGNSP PGUID 12 f f t f i 1 2275 "603"  box_out - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 125 (  box_overlap      PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_overlap - _null_ ));
+DATA(insert OID = 125 (  box_overlap      PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_overlap - _null_ ));
 DESCR("overlaps");
-DATA(insert OID = 126 (  box_ge                           PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_ge - _null_ ));
+DATA(insert OID = 126 (  box_ge                           PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_ge - _null_ ));
 DESCR("greater-than-or-equal by area");
-DATA(insert OID = 127 (  box_gt                           PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_gt - _null_ ));
+DATA(insert OID = 127 (  box_gt                           PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_gt - _null_ ));
 DESCR("greater-than by area");
-DATA(insert OID = 128 (  box_eq                           PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_eq - _null_ ));
+DATA(insert OID = 128 (  box_eq                           PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_eq - _null_ ));
 DESCR("equal by area");
-DATA(insert OID = 129 (  box_lt                           PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_lt - _null_ ));
+DATA(insert OID = 129 (  box_lt                           PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_lt - _null_ ));
 DESCR("less-than by area");
-DATA(insert OID = 130 (  box_le                           PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_le - _null_ ));
+DATA(insert OID = 130 (  box_le                           PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_le - _null_ ));
 DESCR("less-than-or-equal by area");
-DATA(insert OID = 131 (  point_above      PGNSP PGUID 12 f f t f i 2 16 "600 600"  point_above - _null_ ));
+DATA(insert OID = 131 (  point_above      PGNSP PGUID 12 f f t f i 2 16 "600 600"      point_above - _null_ ));
 DESCR("is above");
-DATA(insert OID = 132 (  point_left               PGNSP PGUID 12 f f t f i 2 16 "600 600"  point_left - _null_ ));
+DATA(insert OID = 132 (  point_left               PGNSP PGUID 12 f f t f i 2 16 "600 600"      point_left - _null_ ));
 DESCR("is left of");
-DATA(insert OID = 133 (  point_right      PGNSP PGUID 12 f f t f i 2 16 "600 600"  point_right - _null_ ));
+DATA(insert OID = 133 (  point_right      PGNSP PGUID 12 f f t f i 2 16 "600 600"      point_right - _null_ ));
 DESCR("is right of");
-DATA(insert OID = 134 (  point_below      PGNSP PGUID 12 f f t f i 2 16 "600 600"  point_below - _null_ ));
+DATA(insert OID = 134 (  point_below      PGNSP PGUID 12 f f t f i 2 16 "600 600"      point_below - _null_ ));
 DESCR("is below");
-DATA(insert OID = 135 (  point_eq                 PGNSP PGUID 12 f f t f i 2 16 "600 600"  point_eq - _null_ ));
+DATA(insert OID = 135 (  point_eq                 PGNSP PGUID 12 f f t f i 2 16 "600 600"      point_eq - _null_ ));
 DESCR("same as");
-DATA(insert OID = 136 (  on_pb                    PGNSP PGUID 12 f f t f i 2 16 "600 603"  on_pb - _null_ ));
+DATA(insert OID = 136 (  on_pb                    PGNSP PGUID 12 f f t f i 2 16 "600 603"      on_pb - _null_ ));
 DESCR("point is inside");
-DATA(insert OID = 137 (  on_ppath                 PGNSP PGUID 12 f f t f i 2 16 "600 602"  on_ppath - _null_ ));
+DATA(insert OID = 137 (  on_ppath                 PGNSP PGUID 12 f f t f i 2 16 "600 602"      on_ppath - _null_ ));
 DESCR("contained in");
 DATA(insert OID = 138 (  box_center               PGNSP PGUID 12 f f t f i 1 600 "603"  box_center - _null_ ));
 DESCR("center of");
@@ -380,19 +380,19 @@ DATA(insert OID = 184 (  oideq                       PGNSP PGUID 12 f f t f i 2 16 "26 26"        oideq
 DESCR("equal");
 DATA(insert OID = 185 (  oidne                    PGNSP PGUID 12 f f t f i 2 16 "26 26"        oidne - _null_ ));
 DESCR("not equal");
-DATA(insert OID = 186 (  box_same                 PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_same - _null_ ));
+DATA(insert OID = 186 (  box_same                 PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_same - _null_ ));
 DESCR("same as");
-DATA(insert OID = 187 (  box_contain      PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_contain - _null_ ));
+DATA(insert OID = 187 (  box_contain      PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_contain - _null_ ));
 DESCR("contains");
-DATA(insert OID = 188 (  box_left                 PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_left - _null_ ));
+DATA(insert OID = 188 (  box_left                 PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_left - _null_ ));
 DESCR("is left of");
-DATA(insert OID = 189 (  box_overleft     PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_overleft - _null_ ));
+DATA(insert OID = 189 (  box_overleft     PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_overleft - _null_ ));
 DESCR("overlaps, but does not extend to right of");
-DATA(insert OID = 190 (  box_overright    PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_overright - _null_ ));
+DATA(insert OID = 190 (  box_overright    PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_overright - _null_ ));
 DESCR("overlaps, but does not extend to left of");
-DATA(insert OID = 191 (  box_right                PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_right - _null_ ));
+DATA(insert OID = 191 (  box_right                PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_right - _null_ ));
 DESCR("is right of");
-DATA(insert OID = 192 (  box_contained    PGNSP PGUID 12 f f t f i 2 16 "603 603"  box_contained - _null_ ));
+DATA(insert OID = 192 (  box_contained    PGNSP PGUID 12 f f t f i 2 16 "603 603"      box_contained - _null_ ));
 DESCR("contained in");
 DATA(insert OID = 193 (  rt_box_union     PGNSP PGUID 12 f f t f i 2 603 "603 603"  rt_box_union - _null_ ));
 DESCR("r-tree");
@@ -510,69 +510,69 @@ DATA(insert OID = 246 (  tintervalin         PGNSP PGUID 12 f f t f s 1 704 "2275"  t
 DESCR("(internal)");
 DATA(insert OID = 247 (  tintervalout     PGNSP PGUID 12 f f t f s 1 2275 "704"  tintervalout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 248 (  intinterval      PGNSP PGUID 12 f f t f i 2 16 "702 704"  intinterval - _null_ ));
+DATA(insert OID = 248 (  intinterval      PGNSP PGUID 12 f f t f i 2 16 "702 704"      intinterval - _null_ ));
 DESCR("abstime in tinterval");
 DATA(insert OID = 249 (  tintervalrel     PGNSP PGUID 12 f f t f i 1 703 "704"  tintervalrel - _null_ ));
 DESCR("");
 DATA(insert OID = 250 (  timenow                  PGNSP PGUID 12 f f t f s 0 702 ""  timenow - _null_ ));
 DESCR("Current date and time (abstime)");
-DATA(insert OID = 251 (  abstimeeq                PGNSP PGUID 12 f f t f i 2 16 "702 702"  abstimeeq - _null_ ));
+DATA(insert OID = 251 (  abstimeeq                PGNSP PGUID 12 f f t f i 2 16 "702 702"      abstimeeq - _null_ ));
 DESCR("equal");
-DATA(insert OID = 252 (  abstimene                PGNSP PGUID 12 f f t f i 2 16 "702 702"  abstimene - _null_ ));
+DATA(insert OID = 252 (  abstimene                PGNSP PGUID 12 f f t f i 2 16 "702 702"      abstimene - _null_ ));
 DESCR("not equal");
-DATA(insert OID = 253 (  abstimelt                PGNSP PGUID 12 f f t f i 2 16 "702 702"  abstimelt - _null_ ));
+DATA(insert OID = 253 (  abstimelt                PGNSP PGUID 12 f f t f i 2 16 "702 702"      abstimelt - _null_ ));
 DESCR("less-than");
-DATA(insert OID = 254 (  abstimegt                PGNSP PGUID 12 f f t f i 2 16 "702 702"  abstimegt - _null_ ));
+DATA(insert OID = 254 (  abstimegt                PGNSP PGUID 12 f f t f i 2 16 "702 702"      abstimegt - _null_ ));
 DESCR("greater-than");
-DATA(insert OID = 255 (  abstimele                PGNSP PGUID 12 f f t f i 2 16 "702 702"  abstimele - _null_ ));
+DATA(insert OID = 255 (  abstimele                PGNSP PGUID 12 f f t f i 2 16 "702 702"      abstimele - _null_ ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 256 (  abstimege                PGNSP PGUID 12 f f t f i 2 16 "702 702"  abstimege - _null_ ));
+DATA(insert OID = 256 (  abstimege                PGNSP PGUID 12 f f t f i 2 16 "702 702"      abstimege - _null_ ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 257 (  reltimeeq                PGNSP PGUID 12 f f t f i 2 16 "703 703"  reltimeeq - _null_ ));
+DATA(insert OID = 257 (  reltimeeq                PGNSP PGUID 12 f f t f i 2 16 "703 703"      reltimeeq - _null_ ));
 DESCR("equal");
-DATA(insert OID = 258 (  reltimene                PGNSP PGUID 12 f f t f i 2 16 "703 703"  reltimene - _null_ ));
+DATA(insert OID = 258 (  reltimene                PGNSP PGUID 12 f f t f i 2 16 "703 703"      reltimene - _null_ ));
 DESCR("not equal");
-DATA(insert OID = 259 (  reltimelt                PGNSP PGUID 12 f f t f i 2 16 "703 703"  reltimelt - _null_ ));
+DATA(insert OID = 259 (  reltimelt                PGNSP PGUID 12 f f t f i 2 16 "703 703"      reltimelt - _null_ ));
 DESCR("less-than");
-DATA(insert OID = 260 (  reltimegt                PGNSP PGUID 12 f f t f i 2 16 "703 703"  reltimegt - _null_ ));
+DATA(insert OID = 260 (  reltimegt                PGNSP PGUID 12 f f t f i 2 16 "703 703"      reltimegt - _null_ ));
 DESCR("greater-than");
-DATA(insert OID = 261 (  reltimele                PGNSP PGUID 12 f f t f i 2 16 "703 703"  reltimele - _null_ ));
+DATA(insert OID = 261 (  reltimele                PGNSP PGUID 12 f f t f i 2 16 "703 703"      reltimele - _null_ ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 262 (  reltimege                PGNSP PGUID 12 f f t f i 2 16 "703 703"  reltimege - _null_ ));
+DATA(insert OID = 262 (  reltimege                PGNSP PGUID 12 f f t f i 2 16 "703 703"      reltimege - _null_ ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 263 (  tintervalsame    PGNSP PGUID 12 f f t f i 2 16 "704 704"  tintervalsame - _null_ ));
+DATA(insert OID = 263 (  tintervalsame    PGNSP PGUID 12 f f t f i 2 16 "704 704"      tintervalsame - _null_ ));
 DESCR("same as");
-DATA(insert OID = 264 (  tintervalct      PGNSP PGUID 12 f f t f i 2 16 "704 704"  tintervalct - _null_ ));
+DATA(insert OID = 264 (  tintervalct      PGNSP PGUID 12 f f t f i 2 16 "704 704"      tintervalct - _null_ ));
 DESCR("less-than");
-DATA(insert OID = 265 (  tintervalov      PGNSP PGUID 12 f f t f i 2 16 "704 704"  tintervalov - _null_ ));
+DATA(insert OID = 265 (  tintervalov      PGNSP PGUID 12 f f t f i 2 16 "704 704"      tintervalov - _null_ ));
 DESCR("overlaps");
-DATA(insert OID = 266 (  tintervalleneq    PGNSP PGUID 12 f f t f i 2 16 "704 703"  tintervalleneq - _null_ ));
+DATA(insert OID = 266 (  tintervalleneq    PGNSP PGUID 12 f f t f i 2 16 "704 703"     tintervalleneq - _null_ ));
 DESCR("length equal");
-DATA(insert OID = 267 (  tintervallenne    PGNSP PGUID 12 f f t f i 2 16 "704 703"  tintervallenne - _null_ ));
+DATA(insert OID = 267 (  tintervallenne    PGNSP PGUID 12 f f t f i 2 16 "704 703"     tintervallenne - _null_ ));
 DESCR("length not equal to");
-DATA(insert OID = 268 (  tintervallenlt    PGNSP PGUID 12 f f t f i 2 16 "704 703"  tintervallenlt - _null_ ));
+DATA(insert OID = 268 (  tintervallenlt    PGNSP PGUID 12 f f t f i 2 16 "704 703"     tintervallenlt - _null_ ));
 DESCR("length less-than");
-DATA(insert OID = 269 (  tintervallengt    PGNSP PGUID 12 f f t f i 2 16 "704 703"  tintervallengt - _null_ ));
+DATA(insert OID = 269 (  tintervallengt    PGNSP PGUID 12 f f t f i 2 16 "704 703"     tintervallengt - _null_ ));
 DESCR("length greater-than");
-DATA(insert OID = 270 (  tintervallenle    PGNSP PGUID 12 f f t f i 2 16 "704 703"  tintervallenle - _null_ ));
+DATA(insert OID = 270 (  tintervallenle    PGNSP PGUID 12 f f t f i 2 16 "704 703"     tintervallenle - _null_ ));
 DESCR("length less-than-or-equal");
-DATA(insert OID = 271 (  tintervallenge    PGNSP PGUID 12 f f t f i 2 16 "704 703"  tintervallenge - _null_ ));
+DATA(insert OID = 271 (  tintervallenge    PGNSP PGUID 12 f f t f i 2 16 "704 703"     tintervallenge - _null_ ));
 DESCR("length greater-than-or-equal");
 DATA(insert OID = 272 (  tintervalstart    PGNSP PGUID 12 f f t f i 1 702 "704"  tintervalstart - _null_ ));
 DESCR("start of interval");
 DATA(insert OID = 273 (  tintervalend     PGNSP PGUID 12 f f t f i 1 702 "704"  tintervalend - _null_ ));
 DESCR("");
-DATA(insert OID = 274 (  timeofday                PGNSP PGUID 12 f f t f v 0 25 ""     timeofday - _null_ ));
+DATA(insert OID = 274 (  timeofday                PGNSP PGUID 12 f f t f v 0 25 "" timeofday - _null_ ));
 DESCR("Current date and time - increments during transactions");
-DATA(insert OID = 275 (  isfinite                 PGNSP PGUID 12 f f t f i 1 16 "702"  abstime_finite - _null_ ));
+DATA(insert OID = 275 (  isfinite                 PGNSP PGUID 12 f f t f i 1 16 "702"  abstime_finite - _null_ ));
 DESCR("");
 
 DATA(insert OID = 276 (  int2fac                  PGNSP PGUID 12 f f t f i 1 23 "21"  int2fac - _null_ ));
 DESCR("factorial");
 
-DATA(insert OID = 277 (  inter_sl                 PGNSP PGUID 12 f f t f i 2 16 "601 628"  inter_sl - _null_ ));
+DATA(insert OID = 277 (  inter_sl                 PGNSP PGUID 12 f f t f i 2 16 "601 628"      inter_sl - _null_ ));
 DESCR("");
-DATA(insert OID = 278 (  inter_lb                 PGNSP PGUID 12 f f t f i 2 16 "628 603"  inter_lb - _null_ ));
+DATA(insert OID = 278 (  inter_lb                 PGNSP PGUID 12 f f t f i 2 16 "628 603"      inter_lb - _null_ ));
 DESCR("");
 
 DATA(insert OID = 279 (  float48mul               PGNSP PGUID 12 f f t f i 2 701 "700 701"  float48mul - _null_ ));
@@ -592,58 +592,58 @@ DESCR("add");
 DATA(insert OID = 286 (  float84mi                PGNSP PGUID 12 f f t f i 2 701 "701 700"  float84mi - _null_ ));
 DESCR("subtract");
 
-DATA(insert OID = 287 (  float4eq                 PGNSP PGUID 12 f f t f i 2 16 "700 700"  float4eq - _null_ ));
+DATA(insert OID = 287 (  float4eq                 PGNSP PGUID 12 f f t f i 2 16 "700 700"      float4eq - _null_ ));
 DESCR("equal");
-DATA(insert OID = 288 (  float4ne                 PGNSP PGUID 12 f f t f i 2 16 "700 700"  float4ne - _null_ ));
+DATA(insert OID = 288 (  float4ne                 PGNSP PGUID 12 f f t f i 2 16 "700 700"      float4ne - _null_ ));
 DESCR("not equal");
-DATA(insert OID = 289 (  float4lt                 PGNSP PGUID 12 f f t f i 2 16 "700 700"  float4lt - _null_ ));
+DATA(insert OID = 289 (  float4lt                 PGNSP PGUID 12 f f t f i 2 16 "700 700"      float4lt - _null_ ));
 DESCR("less-than");
-DATA(insert OID = 290 (  float4le                 PGNSP PGUID 12 f f t f i 2 16 "700 700"  float4le - _null_ ));
+DATA(insert OID = 290 (  float4le                 PGNSP PGUID 12 f f t f i 2 16 "700 700"      float4le - _null_ ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 291 (  float4gt                 PGNSP PGUID 12 f f t f i 2 16 "700 700"  float4gt - _null_ ));
+DATA(insert OID = 291 (  float4gt                 PGNSP PGUID 12 f f t f i 2 16 "700 700"      float4gt - _null_ ));
 DESCR("greater-than");
-DATA(insert OID = 292 (  float4ge                 PGNSP PGUID 12 f f t f i 2 16 "700 700"  float4ge - _null_ ));
+DATA(insert OID = 292 (  float4ge                 PGNSP PGUID 12 f f t f i 2 16 "700 700"      float4ge - _null_ ));
 DESCR("greater-than-or-equal");
 
-DATA(insert OID = 293 (  float8eq                 PGNSP PGUID 12 f f t f i 2 16 "701 701"  float8eq - _null_ ));
+DATA(insert OID = 293 (  float8eq                 PGNSP PGUID 12 f f t f i 2 16 "701 701"      float8eq - _null_ ));
 DESCR("equal");
-DATA(insert OID = 294 (  float8ne                 PGNSP PGUID 12 f f t f i 2 16 "701 701"  float8ne - _null_ ));
+DATA(insert OID = 294 (  float8ne                 PGNSP PGUID 12 f f t f i 2 16 "701 701"      float8ne - _null_ ));
 DESCR("not equal");
-DATA(insert OID = 295 (  float8lt                 PGNSP PGUID 12 f f t f i 2 16 "701 701"  float8lt - _null_ ));
+DATA(insert OID = 295 (  float8lt                 PGNSP PGUID 12 f f t f i 2 16 "701 701"      float8lt - _null_ ));
 DESCR("less-than");
-DATA(insert OID = 296 (  float8le                 PGNSP PGUID 12 f f t f i 2 16 "701 701"  float8le - _null_ ));
+DATA(insert OID = 296 (  float8le                 PGNSP PGUID 12 f f t f i 2 16 "701 701"      float8le - _null_ ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 297 (  float8gt                 PGNSP PGUID 12 f f t f i 2 16 "701 701"  float8gt - _null_ ));
+DATA(insert OID = 297 (  float8gt                 PGNSP PGUID 12 f f t f i 2 16 "701 701"      float8gt - _null_ ));
 DESCR("greater-than");
-DATA(insert OID = 298 (  float8ge                 PGNSP PGUID 12 f f t f i 2 16 "701 701"  float8ge - _null_ ));
+DATA(insert OID = 298 (  float8ge                 PGNSP PGUID 12 f f t f i 2 16 "701 701"      float8ge - _null_ ));
 DESCR("greater-than-or-equal");
 
-DATA(insert OID = 299 (  float48eq                PGNSP PGUID 12 f f t f i 2 16 "700 701"  float48eq - _null_ ));
+DATA(insert OID = 299 (  float48eq                PGNSP PGUID 12 f f t f i 2 16 "700 701"      float48eq - _null_ ));
 DESCR("equal");
 
 /* OIDS 300 - 399 */
 
-DATA(insert OID = 300 (  float48ne                PGNSP PGUID 12 f f t f i 2 16 "700 701"  float48ne - _null_ ));
+DATA(insert OID = 300 (  float48ne                PGNSP PGUID 12 f f t f i 2 16 "700 701"      float48ne - _null_ ));
 DESCR("not equal");
-DATA(insert OID = 301 (  float48lt                PGNSP PGUID 12 f f t f i 2 16 "700 701"  float48lt - _null_ ));
+DATA(insert OID = 301 (  float48lt                PGNSP PGUID 12 f f t f i 2 16 "700 701"      float48lt - _null_ ));
 DESCR("less-than");
-DATA(insert OID = 302 (  float48le                PGNSP PGUID 12 f f t f i 2 16 "700 701"  float48le - _null_ ));
+DATA(insert OID = 302 (  float48le                PGNSP PGUID 12 f f t f i 2 16 "700 701"      float48le - _null_ ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 303 (  float48gt                PGNSP PGUID 12 f f t f i 2 16 "700 701"  float48gt - _null_ ));
+DATA(insert OID = 303 (  float48gt                PGNSP PGUID 12 f f t f i 2 16 "700 701"      float48gt - _null_ ));
 DESCR("greater-than");
-DATA(insert OID = 304 (  float48ge                PGNSP PGUID 12 f f t f i 2 16 "700 701"  float48ge - _null_ ));
+DATA(insert OID = 304 (  float48ge                PGNSP PGUID 12 f f t f i 2 16 "700 701"      float48ge - _null_ ));
 DESCR("greater-than-or-equal");
-DATA(insert OID = 305 (  float84eq                PGNSP PGUID 12 f f t f i 2 16 "701 700"  float84eq - _null_ ));
+DATA(insert OID = 305 (  float84eq                PGNSP PGUID 12 f f t f i 2 16 "701 700"      float84eq - _null_ ));
 DESCR("equal");
-DATA(insert OID = 306 (  float84ne                PGNSP PGUID 12 f f t f i 2 16 "701 700"  float84ne - _null_ ));
+DATA(insert OID = 306 (  float84ne                PGNSP PGUID 12 f f t f i 2 16 "701 700"      float84ne - _null_ ));
 DESCR("not equal");
-DATA(insert OID = 307 (  float84lt                PGNSP PGUID 12 f f t f i 2 16 "701 700"  float84lt - _null_ ));
+DATA(insert OID = 307 (  float84lt                PGNSP PGUID 12 f f t f i 2 16 "701 700"      float84lt - _null_ ));
 DESCR("less-than");
-DATA(insert OID = 308 (  float84le                PGNSP PGUID 12 f f t f i 2 16 "701 700"  float84le - _null_ ));
+DATA(insert OID = 308 (  float84le                PGNSP PGUID 12 f f t f i 2 16 "701 700"      float84le - _null_ ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 309 (  float84gt                PGNSP PGUID 12 f f t f i 2 16 "701 700"  float84gt - _null_ ));
+DATA(insert OID = 309 (  float84gt                PGNSP PGUID 12 f f t f i 2 16 "701 700"      float84gt - _null_ ));
 DESCR("greater-than");
-DATA(insert OID = 310 (  float84ge                PGNSP PGUID 12 f f t f i 2 16 "701 700"  float84ge - _null_ ));
+DATA(insert OID = 310 (  float84ge                PGNSP PGUID 12 f f t f i 2 16 "701 700"      float84ge - _null_ ));
 DESCR("greater-than-or-equal");
 
 DATA(insert OID = 311 (  float8                           PGNSP PGUID 12 f f t f i 1 701 "700"  ftod - _null_ ));
@@ -654,7 +654,7 @@ DATA(insert OID = 313 (  int4                          PGNSP PGUID 12 f f t f i 1  23  "21"  i2toi4
 DESCR("convert int2 to int4");
 DATA(insert OID = 314 (  int2                     PGNSP PGUID 12 f f t f i 1  21  "23"  i4toi2 - _null_ ));
 DESCR("convert int4 to int2");
-DATA(insert OID = 315 (  int2vectoreq     PGNSP PGUID 12 f f t f i 2  16  "22 22"  int2vectoreq - _null_ ));
+DATA(insert OID = 315 (  int2vectoreq     PGNSP PGUID 12 f f t f i 2  16  "22 22"      int2vectoreq - _null_ ));
 DESCR("equal");
 DATA(insert OID = 316 (  float8                           PGNSP PGUID 12 f f t f i 1 701  "23"  i4tod - _null_ ));
 DESCR("convert int4 to float8");
@@ -669,7 +669,7 @@ DATA(insert OID = 320 (  rtinsert              PGNSP PGUID 12 f f t f v 6 2281 "2281 2281
 DESCR("r-tree(internal)");
 DATA(insert OID = 322 (  rtgettuple               PGNSP PGUID 12 f f t f v 2 16 "2281 2281"  rtgettuple - _null_ ));
 DESCR("r-tree(internal)");
-DATA(insert OID = 323 (  rtbuild                  PGNSP PGUID 12 f f t f v 3 2278 "2281 2281 2281"     rtbuild - _null_ ));
+DATA(insert OID = 323 (  rtbuild                  PGNSP PGUID 12 f f t f v 3 2278 "2281 2281 2281" rtbuild - _null_ ));
 DESCR("r-tree(internal)");
 DATA(insert OID = 324 (  rtbeginscan      PGNSP PGUID 12 f f t f v 3 2281 "2281 2281 2281"  rtbeginscan - _null_ ));
 DESCR("r-tree(internal)");
@@ -681,7 +681,7 @@ DATA(insert OID = 327 (  rtrestrpos            PGNSP PGUID 12 f f t f v 1 2278 "2281"       r
 DESCR("r-tree(internal)");
 DATA(insert OID = 328 (  rtrescan                 PGNSP PGUID 12 f f t f v 2 2278 "2281 2281"  rtrescan - _null_ ));
 DESCR("r-tree(internal)");
-DATA(insert OID = 321 (  rtbulkdelete     PGNSP PGUID 12 f f t f v 3 2281 "2281 2281 2281"     rtbulkdelete - _null_ ));
+DATA(insert OID = 321 (  rtbulkdelete     PGNSP PGUID 12 f f t f v 3 2281 "2281 2281 2281" rtbulkdelete - _null_ ));
 DESCR("r-tree(internal)");
 DATA(insert OID = 1265 (  rtcostestimate   PGNSP PGUID 12 f f t f v 8 2278 "2281 2281 2281 2281 2281 2281 2281 2281"  rtcostestimate - _null_ ));
 DESCR("r-tree(internal)");
@@ -700,28 +700,28 @@ DATA(insert OID = 336 (  btmarkpos                   PGNSP PGUID 12 f f t f v 1 2278 "2281"       bt
 DESCR("btree(internal)");
 DATA(insert OID = 337 (  btrestrpos               PGNSP PGUID 12 f f t f v 1 2278 "2281"       btrestrpos - _null_ ));
 DESCR("btree(internal)");
-DATA(insert OID = 338 (  btbuild                  PGNSP PGUID 12 f f t f v 3 2278 "2281 2281 2281"     btbuild - _null_ ));
+DATA(insert OID = 338 (  btbuild                  PGNSP PGUID 12 f f t f v 3 2278 "2281 2281 2281" btbuild - _null_ ));
 DESCR("btree(internal)");
-DATA(insert OID = 332 (  btbulkdelete     PGNSP PGUID 12 f f t f v 3 2281 "2281 2281 2281"     btbulkdelete - _null_ ));
+DATA(insert OID = 332 (  btbulkdelete     PGNSP PGUID 12 f f t f v 3 2281 "2281 2281 2281" btbulkdelete - _null_ ));
 DESCR("btree(internal)");
 DATA(insert OID = 1268 (  btcostestimate   PGNSP PGUID 12 f f t f v 8 2278 "2281 2281 2281 2281 2281 2281 2281 2281"  btcostestimate - _null_ ));
 DESCR("btree(internal)");
 
-DATA(insert OID = 339 (  poly_same                PGNSP PGUID 12 f f t f i 2 16 "604 604"  poly_same - _null_ ));
+DATA(insert OID = 339 (  poly_same                PGNSP PGUID 12 f f t f i 2 16 "604 604"      poly_same - _null_ ));
 DESCR("same as");
-DATA(insert OID = 340 (  poly_contain     PGNSP PGUID 12 f f t f i 2 16 "604 604"  poly_contain - _null_ ));
+DATA(insert OID = 340 (  poly_contain     PGNSP PGUID 12 f f t f i 2 16 "604 604"      poly_contain - _null_ ));
 DESCR("contains");
-DATA(insert OID = 341 (  poly_left                PGNSP PGUID 12 f f t f i 2 16 "604 604"  poly_left - _null_ ));
+DATA(insert OID = 341 (  poly_left                PGNSP PGUID 12 f f t f i 2 16 "604 604"      poly_left - _null_ ));
 DESCR("is left of");
-DATA(insert OID = 342 (  poly_overleft    PGNSP PGUID 12 f f t f i 2 16 "604 604"  poly_overleft - _null_ ));
+DATA(insert OID = 342 (  poly_overleft    PGNSP PGUID 12 f f t f i 2 16 "604 604"      poly_overleft - _null_ ));
 DESCR("overlaps, but does not extend to right of");
-DATA(insert OID = 343 (  poly_overright    PGNSP PGUID 12 f f t f i 2 16 "604 604"  poly_overright - _null_ ));
+DATA(insert OID = 343 (  poly_overright    PGNSP PGUID 12 f f t f i 2 16 "604 604"     poly_overright - _null_ ));
 DESCR("overlaps, but does not extend to left of");
-DATA(insert OID = 344 (  poly_right               PGNSP PGUID 12 f f t f i 2 16 "604 604"  poly_right - _null_ ));
+DATA(insert OID = 344 (  poly_right               PGNSP PGUID 12 f f t f i 2 16 "604 604"      poly_right - _null_ ));
 DESCR("is right of");
-DATA(insert OID = 345 (  poly_contained    PGNSP PGUID 12 f f t f i 2 16 "604 604"  poly_contained - _null_ ));
+DATA(insert OID = 345 (  poly_contained    PGNSP PGUID 12 f f t f i 2 16 "604 604"     poly_contained - _null_ ));
 DESCR("contained in");
-DATA(insert OID = 346 (  poly_overlap     PGNSP PGUID 12 f f t f i 2 16 "604 604"  poly_overlap - _null_ ));
+DATA(insert OID = 346 (  poly_overlap     PGNSP PGUID 12 f f t f i 2 16 "604 604"      poly_overlap - _null_ ));
 DESCR("overlaps");
 DATA(insert OID = 347 (  poly_in                  PGNSP PGUID 12 f f t f i 1 604 "2275"  poly_in - _null_ ));
 DESCR("(internal)");
@@ -734,15 +734,15 @@ DATA(insert OID = 351 (  btint4cmp                   PGNSP PGUID 12 f f t f i 2 23 "23 23"        bti
 DESCR("btree less-equal-greater");
 DATA(insert OID = 842 (  btint8cmp                PGNSP PGUID 12 f f t f i 2 23 "20 20"        btint8cmp - _null_ ));
 DESCR("btree less-equal-greater");
-DATA(insert OID = 354 (  btfloat4cmp      PGNSP PGUID 12 f f t f i 2 23 "700 700"  btfloat4cmp - _null_ ));
+DATA(insert OID = 354 (  btfloat4cmp      PGNSP PGUID 12 f f t f i 2 23 "700 700"      btfloat4cmp - _null_ ));
 DESCR("btree less-equal-greater");
-DATA(insert OID = 355 (  btfloat8cmp      PGNSP PGUID 12 f f t f i 2 23 "701 701"  btfloat8cmp - _null_ ));
+DATA(insert OID = 355 (  btfloat8cmp      PGNSP PGUID 12 f f t f i 2 23 "701 701"      btfloat8cmp - _null_ ));
 DESCR("btree less-equal-greater");
 DATA(insert OID = 356 (  btoidcmp                 PGNSP PGUID 12 f f t f i 2 23 "26 26"        btoidcmp - _null_ ));
 DESCR("btree less-equal-greater");
 DATA(insert OID = 404 (  btoidvectorcmp    PGNSP PGUID 12 f f t f i 2 23 "30 30"       btoidvectorcmp - _null_ ));
 DESCR("btree less-equal-greater");
-DATA(insert OID = 357 (  btabstimecmp     PGNSP PGUID 12 f f t f i 2 23 "702 702"  btabstimecmp - _null_ ));
+DATA(insert OID = 357 (  btabstimecmp     PGNSP PGUID 12 f f t f i 2 23 "702 702"      btabstimecmp - _null_ ));
 DESCR("btree less-equal-greater");
 DATA(insert OID = 358 (  btcharcmp                PGNSP PGUID 12 f f t f i 2 23 "18 18"        btcharcmp - _null_ ));
 DESCR("btree less-equal-greater");
@@ -767,15 +767,15 @@ DATA(insert OID = 367 (  close_pb            PGNSP PGUID 12 f f t f i 2 600 "600 603"
 DESCR("closest point on box");
 DATA(insert OID = 368 (  close_sb                 PGNSP PGUID 12 f f t f i 2 600 "601 603"  close_sb - _null_ ));
 DESCR("closest point to line segment on box");
-DATA(insert OID = 369 (  on_ps                    PGNSP PGUID 12 f f t f i 2 16 "600 601"  on_ps - _null_ ));
+DATA(insert OID = 369 (  on_ps                    PGNSP PGUID 12 f f t f i 2 16 "600 601"      on_ps - _null_ ));
 DESCR("point contained in segment");
 DATA(insert OID = 370 (  path_distance    PGNSP PGUID 12 f f t f i 2 701 "602 602"  path_distance - _null_ ));
 DESCR("distance between paths");
 DATA(insert OID = 371 (  dist_ppath               PGNSP PGUID 12 f f t f i 2 701 "600 602"  dist_ppath - _null_ ));
 DESCR("distance between point and path");
-DATA(insert OID = 372 (  on_sb                    PGNSP PGUID 12 f f t f i 2 16 "601 603"  on_sb - _null_ ));
+DATA(insert OID = 372 (  on_sb                    PGNSP PGUID 12 f f t f i 2 16 "601 603"      on_sb - _null_ ));
 DESCR("contained in");
-DATA(insert OID = 373 (  inter_sb                 PGNSP PGUID 12 f f t f i 2 16 "601 603"  inter_sb - _null_ ));
+DATA(insert OID = 373 (  inter_sb                 PGNSP PGUID 12 f f t f i 2 16 "601 603"      inter_sb - _null_ ));
 DESCR("intersects?");
 
 /* OIDS 400 - 499 */
@@ -803,9 +803,9 @@ DATA(insert OID = 446 (  hashmarkpos           PGNSP PGUID 12 f f t f v 1 2278 "2281"       h
 DESCR("hash(internal)");
 DATA(insert OID = 447 (  hashrestrpos     PGNSP PGUID 12 f f t f v 1 2278 "2281"       hashrestrpos - _null_ ));
 DESCR("hash(internal)");
-DATA(insert OID = 448 (  hashbuild                PGNSP PGUID 12 f f t f v 3 2278 "2281 2281 2281"     hashbuild - _null_ ));
+DATA(insert OID = 448 (  hashbuild                PGNSP PGUID 12 f f t f v 3 2278 "2281 2281 2281" hashbuild - _null_ ));
 DESCR("hash(internal)");
-DATA(insert OID = 442 (  hashbulkdelete    PGNSP PGUID 12 f f t f v 3 2281 "2281 2281 2281"    hashbulkdelete - _null_ ));
+DATA(insert OID = 442 (  hashbulkdelete    PGNSP PGUID 12 f f t f v 3 2281 "2281 2281 2281" hashbulkdelete - _null_ ));
 DESCR("hash(internal)");
 DATA(insert OID = 438 (  hashcostestimate  PGNSP PGUID 12 f f t f v 8 2278 "2281 2281 2281 2281 2281 2281 2281 2281"  hashcostestimate - _null_ ));
 DESCR("hash(internal)");
@@ -816,9 +816,9 @@ DATA(insert OID = 450 (  hashint4              PGNSP PGUID 12 f f t f i 1 23 "23"  hashin
 DESCR("hash");
 DATA(insert OID = 949 (  hashint8                 PGNSP PGUID 12 f f t f i 1 23 "20"  hashint8 - _null_ ));
 DESCR("hash");
-DATA(insert OID = 451 (  hashfloat4               PGNSP PGUID 12 f f t f i 1 23 "700"  hashfloat4 - _null_ ));
+DATA(insert OID = 451 (  hashfloat4               PGNSP PGUID 12 f f t f i 1 23 "700"  hashfloat4 - _null_ ));
 DESCR("hash");
-DATA(insert OID = 452 (  hashfloat8               PGNSP PGUID 12 f f t f i 1 23 "701"  hashfloat8 - _null_ ));
+DATA(insert OID = 452 (  hashfloat8               PGNSP PGUID 12 f f t f i 1 23 "701"  hashfloat8 - _null_ ));
 DESCR("hash");
 DATA(insert OID = 453 (  hashoid                  PGNSP PGUID 12 f f t f i 1 23 "26"  hashoid - _null_ ));
 DESCR("hash");
@@ -826,20 +826,20 @@ DATA(insert OID = 454 (  hashchar            PGNSP PGUID 12 f f t f i 1 23 "18"  hashch
 DESCR("hash");
 DATA(insert OID = 455 (  hashname                 PGNSP PGUID 12 f f t f i 1 23 "19"  hashname - _null_ ));
 DESCR("hash");
-DATA(insert OID = 456 (  hashvarlena      PGNSP PGUID 12 f f t f i 1 23 "2281" hashvarlena - _null_ ));
+DATA(insert OID = 456 (  hashvarlena      PGNSP PGUID 12 f f t f i 1 23 "2281" hashvarlena - _null_ ));
 DESCR("hash any varlena type");
 DATA(insert OID = 457 (  hashoidvector    PGNSP PGUID 12 f f t f i 1 23 "30"  hashoidvector - _null_ ));
 DESCR("hash");
-DATA(insert OID = 399 (  hashmacaddr      PGNSP PGUID 12 f f t f i 1 23 "829"  hashmacaddr - _null_ ));
+DATA(insert OID = 399 (  hashmacaddr      PGNSP PGUID 12 f f t f i 1 23 "829"  hashmacaddr - _null_ ));
 DESCR("hash");
 DATA(insert OID = 458 (  text_larger      PGNSP PGUID 12 f f t f i 2 25 "25 25"        text_larger - _null_ ));
 DESCR("larger of two");
 DATA(insert OID = 459 (  text_smaller     PGNSP PGUID 12 f f t f i 2 25 "25 25"        text_smaller - _null_ ));
 DESCR("smaller of two");
 
-DATA(insert OID = 460 (  int8in                           PGNSP PGUID 12 f f t f i 1 20 "2275" int8in - _null_ ));
+DATA(insert OID = 460 (  int8in                           PGNSP PGUID 12 f f t f i 1 20 "2275" int8in - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 461 (  int8out                  PGNSP PGUID 12 f f t f i 1 2275 "20" int8out - _null_ ));
+DATA(insert OID = 461 (  int8out                  PGNSP PGUID 12 f f t f i 1 2275 "20" int8out - _null_ ));
 DESCR("(internal)");
 DATA(insert OID = 462 (  int8um                           PGNSP PGUID 12 f f t f i 1 20 "20"  int8um - _null_ ));
 DESCR("negate");
@@ -877,18 +877,18 @@ DESCR("less-than-or-equal");
 DATA(insert OID = 479 (  int84ge                  PGNSP PGUID 12 f f t f i 2 16 "20 23"        int84ge - _null_ ));
 DESCR("greater-than-or-equal");
 
-DATA(insert OID = 480 (  int4                     PGNSP PGUID 12 f f t f i 1  23 "20"  int84 - _null_ ));
+DATA(insert OID = 480 (  int4                     PGNSP PGUID 12 f f t f i 1  23 "20"  int84 - _null_ ));
 DESCR("convert int8 to int4");
-DATA(insert OID = 481 (  int8                     PGNSP PGUID 12 f f t f i 1  20 "23"  int48 - _null_ ));
+DATA(insert OID = 481 (  int8                     PGNSP PGUID 12 f f t f i 1  20 "23"  int48 - _null_ ));
 DESCR("convert int4 to int8");
-DATA(insert OID = 482 (  float8                           PGNSP PGUID 12 f f t f i 1 701 "20"  i8tod - _null_ ));
+DATA(insert OID = 482 (  float8                           PGNSP PGUID 12 f f t f i 1 701 "20"  i8tod - _null_ ));
 DESCR("convert int8 to float8");
 DATA(insert OID = 483 (  int8                     PGNSP PGUID 12 f f t f i 1  20 "701"  dtoi8 - _null_ ));
 DESCR("convert float8 to int8");
 
-DATA(insert OID = 714 (  int2                     PGNSP PGUID 12 f f t f i 1  21 "20"  int82 - _null_ ));
+DATA(insert OID = 714 (  int2                     PGNSP PGUID 12 f f t f i 1  21 "20"  int82 - _null_ ));
 DESCR("convert int8 to int2");
-DATA(insert OID = 754 (  int8                     PGNSP PGUID 12 f f t f i 1  20 "21"  int28 - _null_ ));
+DATA(insert OID = 754 (  int8                     PGNSP PGUID 12 f f t f i 1  20 "21"  int28 - _null_ ));
 DESCR("convert int2 to int8");
 
 /* OIDS 500 - 599 */
@@ -931,7 +931,7 @@ DATA(insert OID = 681 (  oidvectorgt           PGNSP PGUID 12 f f t f i 2 16 "30 30"        oi
 DESCR("greater-than");
 
 /* OIDS 700 - 799 */
-DATA(insert OID = 710 (  getpgusername    PGNSP PGUID 12 f f t f s 0 19 ""     current_user - _null_ ));
+DATA(insert OID = 710 (  getpgusername    PGNSP PGUID 12 f f t f s 0 19 "" current_user - _null_ ));
 DESCR("deprecated -- use current_user");
 DATA(insert OID = 711 (  userfntest               PGNSP PGUID 12 f f t f i 1 23 "23"  userfntest - _null_ ));
 DESCR("");
@@ -978,9 +978,9 @@ DESCR("greater-than-or-equal");
 DATA(insert OID = 744 (  array_eq                 PGNSP PGUID 12 f f t f i 2 16 "2277 2277" array_eq - _null_ ));
 DESCR("array equal");
 
-DATA(insert OID = 745 (  current_user     PGNSP PGUID 12 f f t f s 0 19 ""     current_user - _null_ ));
+DATA(insert OID = 745 (  current_user     PGNSP PGUID 12 f f t f s 0 19 "" current_user - _null_ ));
 DESCR("current user name");
-DATA(insert OID = 746 (  session_user     PGNSP PGUID 12 f f t f s 0 19 ""     session_user - _null_ ));
+DATA(insert OID = 746 (  session_user     PGNSP PGUID 12 f f t f s 0 19 "" session_user - _null_ ));
 DESCR("session user name");
 
 DATA(insert OID = 747 (  array_dims               PGNSP PGUID 12 f f t f i 1 25 "2277" array_dims - _null_ ));
@@ -994,9 +994,9 @@ DATA(insert OID = 760 (  smgrin                        PGNSP PGUID 12 f f t f s 1 210 "2275"  smgr
 DESCR("storage manager(internal)");
 DATA(insert OID = 761 (  smgrout                  PGNSP PGUID 12 f f t f s 1 2275 "210"  smgrout - _null_ ));
 DESCR("storage manager(internal)");
-DATA(insert OID = 762 (  smgreq                           PGNSP PGUID 12 f f t f i 2 16 "210 210"  smgreq - _null_ ));
+DATA(insert OID = 762 (  smgreq                           PGNSP PGUID 12 f f t f i 2 16 "210 210"      smgreq - _null_ ));
 DESCR("storage manager");
-DATA(insert OID = 763 (  smgrne                           PGNSP PGUID 12 f f t f i 2 16 "210 210"  smgrne - _null_ ));
+DATA(insert OID = 763 (  smgrne                           PGNSP PGUID 12 f f t f i 2 16 "210 210"      smgrne - _null_ ));
 DESCR("storage manager");
 
 DATA(insert OID = 764 (  lo_import                PGNSP PGUID 12 f f t f v 1 26 "25"  lo_import - _null_ ));
@@ -1029,24 +1029,24 @@ DATA(insert OID = 780 (  gistmarkpos       PGNSP PGUID 12 f f t f v 1 2278 "2281"       g
 DESCR("gist(internal)");
 DATA(insert OID = 781 (  gistrestrpos     PGNSP PGUID 12 f f t f v 1 2278 "2281"       gistrestrpos - _null_ ));
 DESCR("gist(internal)");
-DATA(insert OID = 782 (  gistbuild                PGNSP PGUID 12 f f t f v 3 2278 "2281 2281 2281"     gistbuild - _null_ ));
+DATA(insert OID = 782 (  gistbuild                PGNSP PGUID 12 f f t f v 3 2278 "2281 2281 2281" gistbuild - _null_ ));
 DESCR("gist(internal)");
-DATA(insert OID = 776 (  gistbulkdelete    PGNSP PGUID 12 f f t f v 3 2281 "2281 2281 2281"    gistbulkdelete - _null_ ));
+DATA(insert OID = 776 (  gistbulkdelete    PGNSP PGUID 12 f f t f v 3 2281 "2281 2281 2281" gistbulkdelete - _null_ ));
 DESCR("gist(internal)");
 DATA(insert OID = 772 (  gistcostestimate  PGNSP PGUID 12 f f t f v 8 2278 "2281 2281 2281 2281 2281 2281 2281 2281"  gistcostestimate - _null_ ));
 DESCR("gist(internal)");
 
-DATA(insert OID = 784 (  tintervaleq      PGNSP PGUID 12 f f t f i 2 16 "704 704"  tintervaleq - _null_ ));
+DATA(insert OID = 784 (  tintervaleq      PGNSP PGUID 12 f f t f i 2 16 "704 704"      tintervaleq - _null_ ));
 DESCR("equal");
-DATA(insert OID = 785 (  tintervalne      PGNSP PGUID 12 f f t f i 2 16 "704 704"  tintervalne - _null_ ));
+DATA(insert OID = 785 (  tintervalne      PGNSP PGUID 12 f f t f i 2 16 "704 704"      tintervalne - _null_ ));
 DESCR("not equal");
-DATA(insert OID = 786 (  tintervallt      PGNSP PGUID 12 f f t f i 2 16 "704 704"  tintervallt - _null_ ));
+DATA(insert OID = 786 (  tintervallt      PGNSP PGUID 12 f f t f i 2 16 "704 704"      tintervallt - _null_ ));
 DESCR("less-than");
-DATA(insert OID = 787 (  tintervalgt      PGNSP PGUID 12 f f t f i 2 16 "704 704"  tintervalgt - _null_ ));
+DATA(insert OID = 787 (  tintervalgt      PGNSP PGUID 12 f f t f i 2 16 "704 704"      tintervalgt - _null_ ));
 DESCR("greater-than");
-DATA(insert OID = 788 (  tintervalle      PGNSP PGUID 12 f f t f i 2 16 "704 704"  tintervalle - _null_ ));
+DATA(insert OID = 788 (  tintervalle      PGNSP PGUID 12 f f t f i 2 16 "704 704"      tintervalle - _null_ ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 789 (  tintervalge      PGNSP PGUID 12 f f t f i 2 16 "704 704"  tintervalge - _null_ ));
+DATA(insert OID = 789 (  tintervalge      PGNSP PGUID 12 f f t f i 2 16 "704 704"      tintervalge - _null_ ));
 DESCR("greater-than-or-equal");
 
 /* OIDS 800 - 899 */
@@ -1058,9 +1058,9 @@ DESCR("convert text to int2");
 DATA(insert OID = 819 (  int4                     PGNSP PGUID 12 f f t f i 1 23 "25"  text_int4 - _null_ ));
 DESCR("convert text to int4");
 
-DATA(insert OID = 838 (  float8                           PGNSP PGUID 12 f f t f i 1 701 "25"  text_float8 - _null_ ));
+DATA(insert OID = 838 (  float8                           PGNSP PGUID 12 f f t f i 1 701 "25"  text_float8 - _null_ ));
 DESCR("convert text to float8");
-DATA(insert OID = 839 (  float4                           PGNSP PGUID 12 f f t f i 1 700 "25"  text_float4 - _null_ ));
+DATA(insert OID = 839 (  float4                           PGNSP PGUID 12 f f t f i 1 700 "25"  text_float4 - _null_ ));
 DESCR("convert text to float4");
 DATA(insert OID = 840 (  text                     PGNSP PGUID 12 f f t f i 1  25 "701"  float8_text - _null_ ));
 DESCR("convert float8 to text");
@@ -1102,20 +1102,20 @@ DESCR("does not match LIKE expression");
 DATA(insert OID =  860 (  bpchar                  PGNSP PGUID 12 f f t f i 1 1042 "18"  char_bpchar - _null_ ));
 DESCR("convert char to char()");
 
-DATA(insert OID = 861 ( current_database       PGNSP PGUID 12 f f t f i 0 19 "" current_database - _null_ ));
+DATA(insert OID = 861 ( current_database          PGNSP PGUID 12 f f t f i 0 19 "" current_database - _null_ ));
 DESCR("returns the current database");
 
-DATA(insert OID =  862 (  int4_mul_cash                   PGNSP PGUID 12 f f t f i 2 790 "23 790"  int4_mul_cash - _null_ ));
+DATA(insert OID =  862 (  int4_mul_cash                   PGNSP PGUID 12 f f t f i 2 790 "23 790"      int4_mul_cash - _null_ ));
 DESCR("multiply");
-DATA(insert OID =  863 (  int2_mul_cash                   PGNSP PGUID 12 f f t f i 2 790 "21 790"  int2_mul_cash - _null_ ));
+DATA(insert OID =  863 (  int2_mul_cash                   PGNSP PGUID 12 f f t f i 2 790 "21 790"      int2_mul_cash - _null_ ));
 DESCR("multiply");
-DATA(insert OID =  864 (  cash_mul_int4                   PGNSP PGUID 12 f f t f i 2 790 "790 23"  cash_mul_int4 - _null_ ));
+DATA(insert OID =  864 (  cash_mul_int4                   PGNSP PGUID 12 f f t f i 2 790 "790 23"      cash_mul_int4 - _null_ ));
 DESCR("multiply");
-DATA(insert OID =  865 (  cash_div_int4                   PGNSP PGUID 12 f f t f i 2 790 "790 23"  cash_div_int4 - _null_ ));
+DATA(insert OID =  865 (  cash_div_int4                   PGNSP PGUID 12 f f t f i 2 790 "790 23"      cash_div_int4 - _null_ ));
 DESCR("divide");
-DATA(insert OID =  866 (  cash_mul_int2                   PGNSP PGUID 12 f f t f i 2 790 "790 21"  cash_mul_int2 - _null_ ));
+DATA(insert OID =  866 (  cash_mul_int2                   PGNSP PGUID 12 f f t f i 2 790 "790 21"      cash_mul_int2 - _null_ ));
 DESCR("multiply");
-DATA(insert OID =  867 (  cash_div_int2                   PGNSP PGUID 12 f f t f i 2 790 "790 21"  cash_div_int2 - _null_ ));
+DATA(insert OID =  867 (  cash_div_int2                   PGNSP PGUID 12 f f t f i 2 790 "790 21"      cash_div_int2 - _null_ ));
 DESCR("divide");
 
 DATA(insert OID =  886 (  cash_in                 PGNSP PGUID 12 f f t f i 1 790 "2275"  cash_in - _null_ ));
@@ -1203,7 +1203,7 @@ DESCR("closest point to line segment on line");
 DATA(insert OID = 963 (  close_lb                 PGNSP PGUID 12 f f t f i 2 600 "628 603"  close_lb - _null_ ));
 DESCR("closest point to line on box");
 
-DATA(insert OID = 964 (  lo_unlink                PGNSP PGUID 12 f f t f v 1  23 "26"  lo_unlink - _null_ ));
+DATA(insert OID = 964 (  lo_unlink                PGNSP PGUID 12 f f t f v 1  23 "26"  lo_unlink - _null_ ));
 DESCR("large object unlink(delete)");
 
 DATA(insert OID = 973 (  path_inter               PGNSP PGUID 12 f f t f i 2  16 "602 602"  path_inter - _null_ ));
@@ -1220,23 +1220,23 @@ DATA(insert OID = 980 (  box_intersect     PGNSP PGUID 12 f f t f i 2 603 "603 60
 DESCR("box intersection (another box)");
 DATA(insert OID = 981 (  diagonal                 PGNSP PGUID 12 f f t f i 1 601 "603"  box_diagonal - _null_ ));
 DESCR("box diagonal");
-DATA(insert OID = 982 (  path_n_lt                PGNSP PGUID 12 f f t f i 2 16 "602 602"  path_n_lt - _null_ ));
+DATA(insert OID = 982 (  path_n_lt                PGNSP PGUID 12 f f t f i 2 16 "602 602"      path_n_lt - _null_ ));
 DESCR("less-than");
-DATA(insert OID = 983 (  path_n_gt                PGNSP PGUID 12 f f t f i 2 16 "602 602"  path_n_gt - _null_ ));
+DATA(insert OID = 983 (  path_n_gt                PGNSP PGUID 12 f f t f i 2 16 "602 602"      path_n_gt - _null_ ));
 DESCR("greater-than");
-DATA(insert OID = 984 (  path_n_eq                PGNSP PGUID 12 f f t f i 2 16 "602 602"  path_n_eq - _null_ ));
+DATA(insert OID = 984 (  path_n_eq                PGNSP PGUID 12 f f t f i 2 16 "602 602"      path_n_eq - _null_ ));
 DESCR("equal");
-DATA(insert OID = 985 (  path_n_le                PGNSP PGUID 12 f f t f i 2 16 "602 602"  path_n_le - _null_ ));
+DATA(insert OID = 985 (  path_n_le                PGNSP PGUID 12 f f t f i 2 16 "602 602"      path_n_le - _null_ ));
 DESCR("less-than-or-equal");
-DATA(insert OID = 986 (  path_n_ge                PGNSP PGUID 12 f f t f i 2 16 "602 602"  path_n_ge - _null_ ));
+DATA(insert OID = 986 (  path_n_ge                PGNSP PGUID 12 f f t f i 2 16 "602 602"      path_n_ge - _null_ ));
 DESCR("greater-than-or-equal");
 DATA(insert OID = 987 (  path_length      PGNSP PGUID 12 f f t f i 1 701 "602"  path_length - _null_ ));
 DESCR("sum of path segments");
-DATA(insert OID = 988 (  point_ne                 PGNSP PGUID 12 f f t f i 2 16 "600 600"  point_ne - _null_ ));
+DATA(insert OID = 988 (  point_ne                 PGNSP PGUID 12 f f t f i 2 16 "600 600"      point_ne - _null_ ));
 DESCR("not equal");
-DATA(insert OID = 989 (  point_vert               PGNSP PGUID 12 f f t f i 2 16 "600 600"  point_vert - _null_ ));
+DATA(insert OID = 989 (  point_vert               PGNSP PGUID 12 f f t f i 2 16 "600 600"      point_vert - _null_ ));
 DESCR("vertically aligned?");
-DATA(insert OID = 990 (  point_horiz      PGNSP PGUID 12 f f t f i 2 16 "600 600"  point_horiz - _null_ ));
+DATA(insert OID = 990 (  point_horiz      PGNSP PGUID 12 f f t f i 2 16 "600 600"      point_horiz - _null_ ));
 DESCR("horizontally aligned?");
 DATA(insert OID = 991 (  point_distance    PGNSP PGUID 12 f f t f i 2 701 "600 600"  point_distance - _null_ ));
 DESCR("distance between");
@@ -1244,17 +1244,17 @@ DATA(insert OID = 992 (  slope                     PGNSP PGUID 12 f f t f i 2 701 "600 600"  po
 DESCR("slope between points");
 DATA(insert OID = 993 (  lseg                     PGNSP PGUID 12 f f t f i 2 601 "600 600"  lseg_construct - _null_ ));
 DESCR("convert points to line segment");
-DATA(insert OID = 994 (  lseg_intersect    PGNSP PGUID 12 f f t f i 2 16 "601 601"  lseg_intersect - _null_ ));
+DATA(insert OID = 994 (  lseg_intersect    PGNSP PGUID 12 f f t f i 2 16 "601 601"     lseg_intersect - _null_ ));
 DESCR("intersect?");
-DATA(insert OID = 995 (  lseg_parallel    PGNSP PGUID 12 f f t f i 2 16 "601 601"  lseg_parallel - _null_ ));
+DATA(insert OID = 995 (  lseg_parallel    PGNSP PGUID 12 f f t f i 2 16 "601 601"      lseg_parallel - _null_ ));
 DESCR("parallel?");
-DATA(insert OID = 996 (  lseg_perp                PGNSP PGUID 12 f f t f i 2 16 "601 601"  lseg_perp - _null_ ));
+DATA(insert OID = 996 (  lseg_perp                PGNSP PGUID 12 f f t f i 2 16 "601 601"      lseg_perp - _null_ ));
 DESCR("perpendicular?");
-DATA(insert OID = 997 (  lseg_vertical    PGNSP PGUID 12 f f t f i 1 16 "601"  lseg_vertical - _null_ ));
+DATA(insert OID = 997 (  lseg_vertical    PGNSP PGUID 12 f f t f i 1 16 "601"  lseg_vertical - _null_ ));
 DESCR("vertical?");
-DATA(insert OID = 998 (  lseg_horizontal   PGNSP PGUID 12 f f t f i 1 16 "601"  lseg_horizontal - _null_ ));
+DATA(insert OID = 998 (  lseg_horizontal   PGNSP PGUID 12 f f t f i 1 16 "601" lseg_horizontal - _null_ ));
 DESCR("horizontal?");
-DATA(insert OID = 999 (  lseg_eq                  PGNSP PGUID 12 f f t f i 2 16 "601 601"  lseg_eq - _null_ ));
+DATA(insert OID = 999 (  lseg_eq                  PGNSP PGUID 12 f f t f i 2 16 "601 601"      lseg_eq - _null_ ));
 DESCR("equal");
 
 DATA(insert OID =  748 (  date                    PGNSP PGUID 12 f f t f s 1 1082 "25" text_date - _null_ ));
@@ -1275,17 +1275,17 @@ DESCR("convert timetz to text");
 DATA(insert OID = 1026 (  timezone                PGNSP PGUID 12 f f t f s 2 1186 "1186 1184"  timestamptz_izone - _null_ ));
 DESCR("time zone");
 
-DATA(insert OID = 1029 (  nullvalue               PGNSP PGUID 12 f f f f i 1 16 "2276" nullvalue - _null_ ));
+DATA(insert OID = 1029 (  nullvalue               PGNSP PGUID 12 f f f f i 1 16 "2276" nullvalue - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1030 (  nonnullvalue    PGNSP PGUID 12 f f f f i 1 16 "2276" nonnullvalue - _null_ ));
+DATA(insert OID = 1030 (  nonnullvalue    PGNSP PGUID 12 f f f f i 1 16 "2276" nonnullvalue - _null_ ));
 DESCR("(internal)");
 DATA(insert OID = 1031 (  aclitemin               PGNSP PGUID 12 f f t f s 1 1033 "2275"  aclitemin - _null_ ));
 DESCR("(internal)");
 DATA(insert OID = 1032 (  aclitemout      PGNSP PGUID 12 f f t f s 1 2275 "1033"  aclitemout - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1035 (  aclinsert               PGNSP PGUID 12 f f t f s 2 1034 "1034 1033"  aclinsert - _null_ ));
+DATA(insert OID = 1035 (  aclinsert               PGNSP PGUID 12 f f t f s 2 1034 "1034 1033"  aclinsert - _null_ ));
 DESCR("add/update ACL item");
-DATA(insert OID = 1036 (  aclremove               PGNSP PGUID 12 f f t f s 2 1034 "1034 1033"  aclremove - _null_ ));
+DATA(insert OID = 1036 (  aclremove               PGNSP PGUID 12 f f t f s 2 1034 "1034 1033"  aclremove - _null_ ));
 DESCR("remove ACL item");
 DATA(insert OID = 1037 (  aclcontains     PGNSP PGUID 12 f f t f s 2 16 "1034 1033"    aclcontains - _null_ ));
 DESCR("does ACL contain item?");
@@ -1364,9 +1364,9 @@ DATA(insert OID = 1106 (  time_ne            PGNSP PGUID 12 f f t f i 2 16 "1083 1083"
 DESCR("not equal");
 DATA(insert OID = 1107 (  time_cmp                PGNSP PGUID 12 f f t f i 2 23 "1083 1083"    time_cmp - _null_ ));
 DESCR("less-equal-greater");
-DATA(insert OID = 1138 (  date_larger     PGNSP PGUID 12 f f t f i 2 1082 "1082 1082"  date_larger - _null_ ));
+DATA(insert OID = 1138 (  date_larger     PGNSP PGUID 12 f f t f i 2 1082 "1082 1082"  date_larger - _null_ ));
 DESCR("larger of two");
-DATA(insert OID = 1139 (  date_smaller    PGNSP PGUID 12 f f t f i 2 1082 "1082 1082"  date_smaller - _null_ ));
+DATA(insert OID = 1139 (  date_smaller    PGNSP PGUID 12 f f t f i 2 1082 "1082 1082"  date_smaller - _null_ ));
 DESCR("smaller of two");
 DATA(insert OID = 1140 (  date_mi                 PGNSP PGUID 12 f f t f i 2 23 "1082 1082"    date_mi - _null_ ));
 DESCR("subtract");
@@ -1427,9 +1427,9 @@ DATA(insert OID = 1167 (  interval_gt        PGNSP PGUID 12 f f t f i 2 16 "1186 118
 DESCR("greater-than");
 DATA(insert OID = 1168 (  interval_um     PGNSP PGUID 12 f f t f i 1 1186 "1186"  interval_um - _null_ ));
 DESCR("subtract");
-DATA(insert OID = 1169 (  interval_pl     PGNSP PGUID 12 f f t f i 2 1186 "1186 1186"  interval_pl - _null_ ));
+DATA(insert OID = 1169 (  interval_pl     PGNSP PGUID 12 f f t f i 2 1186 "1186 1186"  interval_pl - _null_ ));
 DESCR("add");
-DATA(insert OID = 1170 (  interval_mi     PGNSP PGUID 12 f f t f i 2 1186 "1186 1186"  interval_mi - _null_ ));
+DATA(insert OID = 1170 (  interval_mi     PGNSP PGUID 12 f f t f i 2 1186 "1186 1186"  interval_mi - _null_ ));
 DESCR("subtract");
 DATA(insert OID = 1171 (  date_part               PGNSP PGUID 12 f f t f s 2  701 "25 1184"    timestamptz_part - _null_ ));
 DESCR("extract field from timestamp with time zone");
@@ -1439,7 +1439,7 @@ DATA(insert OID = 1173 (  timestamptz        PGNSP PGUID 12 f f t f s 1 1184 "702"        a
 DESCR("convert abstime to timestamp with time zone");
 DATA(insert OID = 1174 (  timestamptz     PGNSP PGUID 12 f f t f s 1 1184 "1082"  date_timestamptz - _null_ ));
 DESCR("convert date to timestamp with time zone");
-DATA(insert OID = 1176 (  timestamptz     PGNSP PGUID 14 f f t f s 2 1184 "1082 1083"  "select timestamptz($1 + $2)" - _null_ ));
+DATA(insert OID = 1176 (  timestamptz     PGNSP PGUID 14 f f t f s 2 1184 "1082 1083"  "select timestamptz($1 + $2)" - _null_ ));
 DESCR("convert date and time to timestamp with time zone");
 DATA(insert OID = 1177 (  interval                PGNSP PGUID 12 f f t f i 1 1186 "703"        reltime_interval - _null_ ));
 DESCR("convert reltime to interval");
@@ -1452,7 +1452,7 @@ DESCR("convert timestamp with time zone to abstime");
 DATA(insert OID = 1181 (  age                     PGNSP PGUID 12 f f t f s 1 23 "28"  xid_age - _null_ ));
 DESCR("age of a transaction ID, in transactions before current transaction");
 
-DATA(insert OID = 1188 (  timestamptz_mi   PGNSP PGUID 12 f f t f i 2 1186 "1184 1184"  timestamp_mi - _null_ ));
+DATA(insert OID = 1188 (  timestamptz_mi   PGNSP PGUID 12 f f t f i 2 1186 "1184 1184" timestamp_mi - _null_ ));
 DESCR("subtract");
 DATA(insert OID = 1189 (  timestamptz_pl_span PGNSP PGUID 12 f f t f i 2 1184 "1184 1186"  timestamptz_pl_span - _null_ ));
 DESCR("plus");
@@ -1516,9 +1516,9 @@ DESCR("absolute value");
 DATA(insert OID = 1263 (  interval                PGNSP PGUID 12 f f t f s 1 1186 "25"  text_interval - _null_ ));
 DESCR("convert text to interval");
 
-DATA(insert OID = 1271 (  overlaps                PGNSP PGUID 12 f f f f i 4 16 "1266 1266 1266 1266"  overlaps_timetz - _null_ ));
+DATA(insert OID = 1271 (  overlaps                PGNSP PGUID 12 f f f f i 4 16 "1266 1266 1266 1266"  overlaps_timetz - _null_ ));
 DESCR("SQL92 interval comparison");
-DATA(insert OID = 1272 (  datetime_pl     PGNSP PGUID 12 f f t f i 2 1114 "1082 1083"  datetime_timestamp - _null_ ));
+DATA(insert OID = 1272 (  datetime_pl     PGNSP PGUID 12 f f t f i 2 1114 "1082 1083"  datetime_timestamp - _null_ ));
 DESCR("convert date and time to timestamp");
 DATA(insert OID = 1273 (  date_part               PGNSP PGUID 12 f f t f i 2  701 "25 1266"    timetz_part - _null_ ));
 DESCR("extract field from time with time zone");
@@ -1556,11 +1556,11 @@ DESCR("latest tid of a tuple");
 DATA(insert OID = 1294 ( currtid2                 PGNSP PGUID 12 f f t f v 2 27 "25 27"        currtid_byrelname - _null_ ));
 DESCR("latest tid of a tuple");
 
-DATA(insert OID = 1296 (  timedate_pl     PGNSP PGUID 14 f f t f i 2 1114 "1083 1082"  "select ($2 + $1)" - _null_ ));
+DATA(insert OID = 1296 (  timedate_pl     PGNSP PGUID 14 f f t f i 2 1114 "1083 1082"  "select ($2 + $1)" - _null_ ));
 DESCR("convert time and date to timestamp");
-DATA(insert OID = 1297 (  datetimetz_pl    PGNSP PGUID 12 f f t f i 2 1184 "1082 1266"  datetimetz_timestamptz - _null_ ));
+DATA(insert OID = 1297 (  datetimetz_pl    PGNSP PGUID 12 f f t f i 2 1184 "1082 1266" datetimetz_timestamptz - _null_ ));
 DESCR("convert date and time with time zone to timestamp with time zone");
-DATA(insert OID = 1298 (  timetzdate_pl    PGNSP PGUID 14 f f t f i 2 1184 "1266 1082"  "select ($2 + $1)" - _null_ ));
+DATA(insert OID = 1298 (  timetzdate_pl    PGNSP PGUID 14 f f t f i 2 1184 "1266 1082" "select ($2 + $1)" - _null_ ));
 DESCR("convert time with time zone and date to timestamp");
 DATA(insert OID = 1299 (  now                     PGNSP PGUID 12 f f t f s 0 1184 ""  now - _null_ ));
 DESCR("current transaction time");
@@ -1594,22 +1594,22 @@ DESCR("SQL92 interval comparison");
 DATA(insert OID = 1311 ( overlaps                       PGNSP PGUID 14 f f f f i 4 16 "1083 1186 1083 1083"    "select ($1, ($1 + $2)) overlaps ($3, $4)" - _null_ ));
 DESCR("SQL92 interval comparison");
 
-DATA(insert OID = 1312 (  timestamp_in          PGNSP PGUID 12 f f t f s 1 1114 "2275" timestamp_in - _null_ ));
+DATA(insert OID = 1312 (  timestamp_in          PGNSP PGUID 12 f f t f s 1 1114 "2275" timestamp_in - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1313 (  timestamp_out                 PGNSP PGUID 12 f f t f s 1 2275 "1114" timestamp_out - _null_ ));
+DATA(insert OID = 1313 (  timestamp_out                 PGNSP PGUID 12 f f t f s 1 2275 "1114" timestamp_out - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1314 (  timestamptz_cmp       PGNSP PGUID 12 f f t f i 2     23 "1184 1184"  timestamp_cmp - _null_ ));
+DATA(insert OID = 1314 (  timestamptz_cmp       PGNSP PGUID 12 f f t f i 2 23 "1184 1184"      timestamp_cmp - _null_ ));
 DESCR("less-equal-greater");
-DATA(insert OID = 1315 (  interval_cmp          PGNSP PGUID 12 f f t f i 2     23 "1186 1186"  interval_cmp - _null_ ));
+DATA(insert OID = 1315 (  interval_cmp          PGNSP PGUID 12 f f t f i 2 23 "1186 1186"      interval_cmp - _null_ ));
 DESCR("less-equal-greater");
 DATA(insert OID = 1316 (  time                          PGNSP PGUID 12 f f t f i 1 1083 "1114"  timestamp_time - _null_ ));
 DESCR("convert timestamp to time");
 
-DATA(insert OID = 1317 (  length                        PGNSP PGUID 12 f f t f i 1     23 "25"  textlen - _null_ ));
+DATA(insert OID = 1317 (  length                        PGNSP PGUID 12 f f t f i 1 23 "25"  textlen - _null_ ));
 DESCR("length");
-DATA(insert OID = 1318 (  length                        PGNSP PGUID 12 f f t f i 1     23 "1042"  bpcharlen - _null_ ));
+DATA(insert OID = 1318 (  length                        PGNSP PGUID 12 f f t f i 1 23 "1042"  bpcharlen - _null_ ));
 DESCR("character length");
-DATA(insert OID = 1319 (  length                        PGNSP PGUID 12 f f t f i 1     23 "1043"  varcharlen - _null_ ));
+DATA(insert OID = 1319 (  length                        PGNSP PGUID 12 f f t f i 1 23 "1043"  varcharlen - _null_ ));
 DESCR("character length");
 
 DATA(insert OID = 1326 (  interval_div          PGNSP PGUID 12 f f t f i 2 1186 "1186 701"  interval_div - _null_ ));
@@ -1638,9 +1638,9 @@ DESCR("exponential");
  * This form of obj_description is now deprecated, since it will fail if
  * OIDs are not unique across system catalogs. Use the other forms instead.
  */
-DATA(insert OID = 1348 (  obj_description       PGNSP PGUID 14 f f t f s 1     25 "26"  "select description from pg_description where objoid = $1 and objsubid = 0" - _null_ ));
+DATA(insert OID = 1348 (  obj_description       PGNSP PGUID 14 f f t f s 1 25 "26"  "select description from pg_description where objoid = $1 and objsubid = 0" - _null_ ));
 DESCR("get description for object id (deprecated)");
-DATA(insert OID = 1349 (  oidvectortypes        PGNSP PGUID 12 f f t f s 1     25 "30"  oidvectortypes - _null_ ));
+DATA(insert OID = 1349 (  oidvectortypes        PGNSP PGUID 12 f f t f s 1 25 "30"  oidvectortypes - _null_ ));
 DESCR("print type names of oidvector field");
 
 
@@ -1662,7 +1662,7 @@ DATA(insert OID = 1357 (  timetz_gt                  PGNSP PGUID 12 f f t f i 2 16 "1266 1266
 DESCR("greater-than");
 DATA(insert OID = 1358 (  timetz_cmp      PGNSP PGUID 12 f f t f i 2 23 "1266 1266"    timetz_cmp - _null_ ));
 DESCR("less-equal-greater");
-DATA(insert OID = 1359 (  timestamptz     PGNSP PGUID 12 f f t f i 2 1184 "1082 1266"  datetimetz_timestamptz - _null_ ));
+DATA(insert OID = 1359 (  timestamptz     PGNSP PGUID 12 f f t f i 2 1184 "1082 1266"  datetimetz_timestamptz - _null_ ));
 DESCR("convert date and time with time zone to timestamp with time zone");
 
 DATA(insert OID = 1364 (  time                    PGNSP PGUID 14 f f t f i 1 1083 "702"  "select time(cast($1 as timestamp without time zone))" - _null_ ));
@@ -1677,25 +1677,25 @@ DESCR("character length");
 
 DATA(insert OID = 1370 (  interval                      PGNSP PGUID 12 f f t f i 1 1186 "1083"  time_interval - _null_ ));
 DESCR("convert time to interval");
-DATA(insert OID = 1372 (  char_length           PGNSP PGUID 12 f f t f i 1     23       "1042"  bpcharlen - _null_ ));
+DATA(insert OID = 1372 (  char_length           PGNSP PGUID 12 f f t f i 1 23   "1042"  bpcharlen - _null_ ));
 DESCR("character length");
-DATA(insert OID = 1373 (  char_length           PGNSP PGUID 12 f f t f i 1     23       "1043"  varcharlen - _null_ ));
+DATA(insert OID = 1373 (  char_length           PGNSP PGUID 12 f f t f i 1 23   "1043"  varcharlen - _null_ ));
 DESCR("character length");
 
-DATA(insert OID = 1374 (  octet_length                  PGNSP PGUID 12 f f t f i 1     23       "25"  textoctetlen - _null_ ));
+DATA(insert OID = 1374 (  octet_length                  PGNSP PGUID 12 f f t f i 1 23   "25"  textoctetlen - _null_ ));
 DESCR("octet length");
-DATA(insert OID = 1375 (  octet_length                  PGNSP PGUID 12 f f t f i 1     23       "1042"  bpcharoctetlen - _null_ ));
+DATA(insert OID = 1375 (  octet_length                  PGNSP PGUID 12 f f t f i 1 23   "1042"  bpcharoctetlen - _null_ ));
 DESCR("octet length");
-DATA(insert OID = 1376 (  octet_length                  PGNSP PGUID 12 f f t f i 1     23       "1043"  varcharoctetlen - _null_ ));
+DATA(insert OID = 1376 (  octet_length                  PGNSP PGUID 12 f f t f i 1 23   "1043"  varcharoctetlen - _null_ ));
 DESCR("octet length");
 
-DATA(insert OID = 1377 (  time_larger     PGNSP PGUID 12 f f t f i 2 1083 "1083 1083"  time_larger - _null_ ));
+DATA(insert OID = 1377 (  time_larger     PGNSP PGUID 12 f f t f i 2 1083 "1083 1083"  time_larger - _null_ ));
 DESCR("larger of two");
-DATA(insert OID = 1378 (  time_smaller    PGNSP PGUID 12 f f t f i 2 1083 "1083 1083"  time_smaller - _null_ ));
+DATA(insert OID = 1378 (  time_smaller    PGNSP PGUID 12 f f t f i 2 1083 "1083 1083"  time_smaller - _null_ ));
 DESCR("smaller of two");
-DATA(insert OID = 1379 (  timetz_larger    PGNSP PGUID 12 f f t f i 2 1266 "1266 1266"  timetz_larger - _null_ ));
+DATA(insert OID = 1379 (  timetz_larger    PGNSP PGUID 12 f f t f i 2 1266 "1266 1266" timetz_larger - _null_ ));
 DESCR("larger of two");
-DATA(insert OID = 1380 (  timetz_smaller   PGNSP PGUID 12 f f t f i 2 1266 "1266 1266"  timetz_smaller - _null_ ));
+DATA(insert OID = 1380 (  timetz_smaller   PGNSP PGUID 12 f f t f i 2 1266 "1266 1266" timetz_smaller - _null_ ));
 DESCR("smaller of two");
 
 DATA(insert OID = 1381 (  char_length     PGNSP PGUID 12 f f t f i 1 23 "25"  textlen - _null_ ));
@@ -1707,7 +1707,7 @@ DATA(insert OID = 1383 (  date_part    PGNSP PGUID 14 f f t f s 2  701 "25 703"
 DESCR("extract field from reltime");
 DATA(insert OID = 1384 (  date_part    PGNSP PGUID 14 f f t f i 2  701 "25 1082"       "select date_part($1, cast($2 as timestamp without time zone))" - _null_ ));
 DESCR("extract field from date");
-DATA(insert OID = 1385 (  date_part       PGNSP PGUID 12 f f t f i 2  701 "25 1083"  time_part - _null_ ));
+DATA(insert OID = 1385 (  date_part    PGNSP PGUID 12 f f t f i 2  701 "25 1083"  time_part - _null_ ));
 DESCR("extract field from time");
 DATA(insert OID = 1386 (  age             PGNSP PGUID 14 f f t f s 1 1186 "1184"  "select age(cast(current_date as timestamp with time zone), $1)" - _null_ ));
 DESCR("date difference from today preserving months and years");
@@ -1745,9 +1745,9 @@ DESCR("convert varchar to name");
 DATA(insert OID = 1401 (  varchar         PGNSP PGUID 12 f f t f i 1 1043 "19"  name_text - _null_ ));
 DESCR("convert name to varchar");
 
-DATA(insert OID = 1402 (  current_schema       PGNSP PGUID 12 f f t f s 0    19 ""     current_schema - _null_ ));
+DATA(insert OID = 1402 (  current_schema       PGNSP PGUID 12 f f t f s 0        19 "" current_schema - _null_ ));
 DESCR("current schema name");
-DATA(insert OID = 1403 (  current_schemas      PGNSP PGUID 12 f f t f s 1  1003 "16"   current_schemas - _null_ ));
+DATA(insert OID = 1403 (  current_schemas      PGNSP PGUID 12 f f t f s 1      1003 "16"       current_schemas - _null_ ));
 DESCR("current schema search list");
 
 DATA(insert OID = 1404 (  overlay                      PGNSP PGUID 14 f f t f i 4 25 "25 25 23 23"  "select substring($1, 1, ($3 - 1)) || $2 || substring($1, ($3 + $4))" - _null_ ));
@@ -1778,12 +1778,12 @@ DESCR("lines horizontal?");
 DATA(insert OID = 1416 (  point                                PGNSP PGUID 12 f f t f i 1 600 "718"    circle_center - _null_ ));
 DESCR("center of");
 
-DATA(insert OID = 1417 (  isnottrue                    PGNSP PGUID 12 f f f f i 1 16 "16"  isnottrue - _null_ ));
+DATA(insert OID = 1417 (  isnottrue                    PGNSP PGUID 12 f f f f i 1 16 "16"      isnottrue - _null_ ));
 DESCR("bool is not true (ie, false or unknown)");
-DATA(insert OID = 1418 (  isnotfalse           PGNSP PGUID 12 f f f f i 1 16 "16"  isnotfalse - _null_ ));
+DATA(insert OID = 1418 (  isnotfalse           PGNSP PGUID 12 f f f f i 1 16 "16"      isnotfalse - _null_ ));
 DESCR("bool is not false (ie, true or unknown)");
 
-DATA(insert OID = 1419 (  time                         PGNSP PGUID 12 f f t f i 1 1083 "1186"  interval_time - _null_ ));
+DATA(insert OID = 1419 (  time                         PGNSP PGUID 12 f f t f i 1 1083 "1186"  interval_time - _null_ ));
 DESCR("convert interval to time");
 
 DATA(insert OID = 1421 (  box                          PGNSP PGUID 12 f f t f i 2 603 "600 600"        points_box - _null_ ));
@@ -1937,7 +1937,7 @@ DATA(insert OID = 1490 (  line_in                 PGNSP PGUID 12 f f t f i 1 628 "2275"  line_
 DESCR("(internal)");
 DATA(insert OID = 1491 (  line_out                     PGNSP PGUID 12 f f t f i 1 2275 "628"   line_out - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1492 (  line_eq                      PGNSP PGUID 12 f f t f i 2  16 "628 628"        line_eq - _null_ ));
+DATA(insert OID = 1492 (  line_eq                      PGNSP PGUID 12 f f t f i 2      16 "628 628"    line_eq - _null_ ));
 DESCR("lines equal?");
 DATA(insert OID = 1493 (  line                         PGNSP PGUID 12 f f t f i 2 628 "600 600"        line_construct_pp - _null_ ));
 DESCR("line from points");
@@ -1983,9 +1983,9 @@ DESCR("# points in path");
 DATA(insert OID = 1556 (  npoints                      PGNSP PGUID 12 f f t f i 1      23 "604"  poly_npoints - _null_ ));
 DESCR("number of points in polygon");
 
-DATA(insert OID = 1564 (  bit_in                       PGNSP PGUID 12 f f t f i 1 1560 "2275"  bit_in - _null_ ));
+DATA(insert OID = 1564 (  bit_in                       PGNSP PGUID 12 f f t f i 1 1560 "2275"  bit_in - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1565 (  bit_out                      PGNSP PGUID 12 f f t f i 1 2275 "1560"  bit_out - _null_ ));
+DATA(insert OID = 1565 (  bit_out                      PGNSP PGUID 12 f f t f i 1 2275 "1560"  bit_out - _null_ ));
 DESCR("(internal)");
 
 DATA(insert OID = 1569 (  like                         PGNSP PGUID 12 f f t f i 2 16 "25 25"  textlike - _null_ ));
@@ -1999,18 +1999,18 @@ DESCR("does not match LIKE expression");
 
 
 /* SEQUENCEs nextval & currval functions */
-DATA(insert OID = 1574 (  nextval                      PGNSP PGUID 12 f f t f v 1 20 "25"  nextval - _null_ ));
+DATA(insert OID = 1574 (  nextval                      PGNSP PGUID 12 f f t f v 1 20 "25"      nextval - _null_ ));
 DESCR("sequence next value");
-DATA(insert OID = 1575 (  currval                      PGNSP PGUID 12 f f t f v 1 20 "25"  currval - _null_ ));
+DATA(insert OID = 1575 (  currval                      PGNSP PGUID 12 f f t f v 1 20 "25"      currval - _null_ ));
 DESCR("sequence current value");
 DATA(insert OID = 1576 (  setval                       PGNSP PGUID 12 f f t f v 2 20 "25 20"  setval - _null_ ));
 DESCR("set sequence value");
 DATA(insert OID = 1765 (  setval                       PGNSP PGUID 12 f f t f v 3 20 "25 20 16"        setval_and_iscalled - _null_ ));
 DESCR("set sequence value and iscalled status");
 
-DATA(insert OID = 1579 (  varbit_in                    PGNSP PGUID 12 f f t f i 1 1562 "2275"  varbit_in - _null_ ));
+DATA(insert OID = 1579 (  varbit_in                    PGNSP PGUID 12 f f t f i 1 1562 "2275"  varbit_in - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1580 (  varbit_out           PGNSP PGUID 12 f f t f i 1 2275 "1562"  varbit_out - _null_ ));
+DATA(insert OID = 1580 (  varbit_out           PGNSP PGUID 12 f f t f i 1 2275 "1562"  varbit_out - _null_ ));
 DESCR("(internal)");
 
 DATA(insert OID = 1581 (  biteq                                PGNSP PGUID 12 f f t f i 2 16 "1560 1560"  biteq - _null_ ));
@@ -2030,7 +2030,7 @@ DESCR("compare");
 
 DATA(insert OID = 1598 (  random                       PGNSP PGUID 12 f f t f v 0 701 ""  drandom - _null_ ));
 DESCR("random value");
-DATA(insert OID = 1599 (  setseed                      PGNSP PGUID 12 f f t f v 1  23 "701"    setseed - _null_ ));
+DATA(insert OID = 1599 (  setseed                      PGNSP PGUID 12 f f t f v 1      23 "701"        setseed - _null_ ));
 DESCR("set random seed");
 
 /* OIDS 1600 - 1699 */
@@ -2058,21 +2058,21 @@ DESCR("degrees to radians");
 DATA(insert OID = 1610 (  pi                           PGNSP PGUID 12 f f t f i 0 701 ""  dpi - _null_ ));
 DESCR("PI");
 
-DATA(insert OID = 1618 (  interval_mul         PGNSP PGUID 12 f f t f i 2 1186 "1186 701"  interval_mul - _null_ ));
+DATA(insert OID = 1618 (  interval_mul         PGNSP PGUID 12 f f t f i 2 1186 "1186 701"      interval_mul - _null_ ));
 DESCR("multiply interval");
 DATA(insert OID = 1619 (  varchar                      PGNSP PGUID 12 f f t f i 1 1043 "23"    int4_text - _null_ ));
 DESCR("convert int4 to varchar");
 
-DATA(insert OID = 1620 (  ascii                                PGNSP PGUID 12 f f t f i 1 23 "25"  ascii - _null_ ));
+DATA(insert OID = 1620 (  ascii                                PGNSP PGUID 12 f f t f i 1 23 "25"      ascii - _null_ ));
 DESCR("convert first char to int4");
-DATA(insert OID = 1621 (  chr                          PGNSP PGUID 12 f f t f i 1 25 "23"  chr - _null_ ));
+DATA(insert OID = 1621 (  chr                          PGNSP PGUID 12 f f t f i 1 25 "23"      chr - _null_ ));
 DESCR("convert int4 to char");
 DATA(insert OID = 1622 (  repeat                       PGNSP PGUID 12 f f t f i 2 25 "25 23"  repeat - _null_ ));
 DESCR("replicate string int4 times");
 
 DATA(insert OID = 1623 (  varchar                      PGNSP PGUID 12 f f t f i 1 1043 "20"    int8_text - _null_ ));
 DESCR("convert int8 to varchar");
-DATA(insert OID = 1624 (  mul_d_interval       PGNSP PGUID 12 f f t f i 2 1186 "701 1186"  mul_d_interval - _null_ ));
+DATA(insert OID = 1624 (  mul_d_interval       PGNSP PGUID 12 f f t f i 2 1186 "701 1186"      mul_d_interval - _null_ ));
 
 DATA(insert OID = 1633 (  texticlike           PGNSP PGUID 12 f f t f i 2 16 "25 25" texticlike - _null_ ));
 DESCR("matches LIKE expression, case-insensitive");
@@ -2085,7 +2085,7 @@ DESCR("does not match LIKE expression, case-insensitive");
 DATA(insert OID = 1637 (  like_escape          PGNSP PGUID 12 f f t f i 2 25 "25 25" like_escape - _null_ ));
 DESCR("convert match pattern to use backslash escapes");
 
-DATA(insert OID = 1689 (  update_pg_pwd_and_pg_group  PGNSP PGUID 12 f f t f v 0 2279  ""   update_pg_pwd_and_pg_group - _null_ ));
+DATA(insert OID = 1689 (  update_pg_pwd_and_pg_group  PGNSP PGUID 12 f f t f v 0 2279  ""      update_pg_pwd_and_pg_group - _null_ ));
 DESCR("update pg_pwd and pg_group files");
 
 /* Oracle Compatibility Related Functions - By Edmund Mergl <E.Mergl@bawue.de> */
@@ -2128,23 +2128,23 @@ DATA(insert OID =  936 (  substring    PGNSP PGUID 12 f f t f i 3 25 "25 23 23"
 DESCR("return portion of string");
 DATA(insert OID =  937 (  substring    PGNSP PGUID 12 f f t f i 2 25 "25 23"   text_substr_no_len - _null_ ));
 DESCR("return portion of string");
-DATA(insert OID =  2087 ( replace      PGNSP PGUID 12 f f t f i 3 25 "25 25 25"  replace_text - _null_ ));
+DATA(insert OID =  2087 ( replace         PGNSP PGUID 12 f f t f i 3 25 "25 25 25"  replace_text - _null_ ));
 DESCR("replace all occurrences of old_substr with new_substr in string");
-DATA(insert OID =  2088 ( split        PGNSP PGUID 12 f f t f i 3 25 "25 25 23"  split_text - _null_ ));
+DATA(insert OID =  2088 ( split                   PGNSP PGUID 12 f f t f i 3 25 "25 25 23"  split_text - _null_ ));
 DESCR("split string by field_sep and return field_num");
-DATA(insert OID =  2089 ( to_hex       PGNSP PGUID 12 f f t f i 1 25 "23"  to_hex32 - _null_ ));
+DATA(insert OID =  2089 ( to_hex          PGNSP PGUID 12 f f t f i 1 25 "23"  to_hex32 - _null_ ));
 DESCR("convert int32 number to hex");
-DATA(insert OID =  2090 ( to_hex       PGNSP PGUID 12 f f t f i 1 25 "20"  to_hex64 - _null_ ));
+DATA(insert OID =  2090 ( to_hex          PGNSP PGUID 12 f f t f i 1 25 "20"  to_hex64 - _null_ ));
 DESCR("convert int64 number to hex");
 
 /* for character set encoding support */
 
 /* return database encoding name */
-DATA(insert OID = 1039 (  getdatabaseencoding     PGNSP PGUID 12 f f t f s 0 19 ""     getdatabaseencoding - _null_ ));
+DATA(insert OID = 1039 (  getdatabaseencoding     PGNSP PGUID 12 f f t f s 0 19 "" getdatabaseencoding - _null_ ));
 DESCR("encoding name of current database");
 
 /* return client encoding name i.e. session encoding */
-DATA(insert OID = 810 (  pg_client_encoding    PGNSP PGUID 12 f f t f s 0 19 ""        pg_client_encoding - _null_ ));
+DATA(insert OID = 810 (  pg_client_encoding    PGNSP PGUID 12 f f t f s 0 19 "" pg_client_encoding - _null_ ));
 DESCR("encoding name of current database");
 
 DATA(insert OID = 1717 (  convert                 PGNSP PGUID 12 f f t f s 2 25 "25 19"        pg_convert - _null_ ));
@@ -2153,7 +2153,7 @@ DESCR("convert string with specified destination encoding name");
 DATA(insert OID = 1813 (  convert                 PGNSP PGUID 12 f f t f s 3 25 "25 19 19"  pg_convert2 - _null_ ));
 DESCR("convert string with specified encoding names");
 
-DATA(insert OID = 90 (  convert                   PGNSP PGUID 12 f f t f s 2 25 "25 26"  pg_convert3 - _null_ ));
+DATA(insert OID = 90 ( convert            PGNSP PGUID 12 f f t f s 2 25 "25 26"  pg_convert3 - _null_ ));
 DESCR("convert string with specified conversion oid");
 
 DATA(insert OID = 1264 (  pg_char_to_encoding     PGNSP PGUID 12 f f t f s 1 23 "19"  PG_char_to_encoding - _null_ ));
@@ -2185,25 +2185,25 @@ DESCR("deparse an encoded expression");
 
 
 /* Generic referential integrity constraint triggers */
-DATA(insert OID = 1644 (  RI_FKey_check_ins            PGNSP PGUID 12 f f t f v 0 2279 ""  RI_FKey_check_ins - _null_ ));
+DATA(insert OID = 1644 (  RI_FKey_check_ins            PGNSP PGUID 12 f f t f v 0 2279 ""      RI_FKey_check_ins - _null_ ));
 DESCR("referential integrity FOREIGN KEY ... REFERENCES");
-DATA(insert OID = 1645 (  RI_FKey_check_upd            PGNSP PGUID 12 f f t f v 0 2279 ""  RI_FKey_check_upd - _null_ ));
+DATA(insert OID = 1645 (  RI_FKey_check_upd            PGNSP PGUID 12 f f t f v 0 2279 ""      RI_FKey_check_upd - _null_ ));
 DESCR("referential integrity FOREIGN KEY ... REFERENCES");
-DATA(insert OID = 1646 (  RI_FKey_cascade_del  PGNSP PGUID 12 f f t f v 0 2279 ""  RI_FKey_cascade_del - _null_ ));
+DATA(insert OID = 1646 (  RI_FKey_cascade_del  PGNSP PGUID 12 f f t f v 0 2279 ""      RI_FKey_cascade_del - _null_ ));
 DESCR("referential integrity ON DELETE CASCADE");
-DATA(insert OID = 1647 (  RI_FKey_cascade_upd  PGNSP PGUID 12 f f t f v 0 2279 ""  RI_FKey_cascade_upd - _null_ ));
+DATA(insert OID = 1647 (  RI_FKey_cascade_upd  PGNSP PGUID 12 f f t f v 0 2279 ""      RI_FKey_cascade_upd - _null_ ));
 DESCR("referential integrity ON UPDATE CASCADE");
-DATA(insert OID = 1648 (  RI_FKey_restrict_del PGNSP PGUID 12 f f t f v 0 2279 ""  RI_FKey_restrict_del - _null_ ));
+DATA(insert OID = 1648 (  RI_FKey_restrict_del PGNSP PGUID 12 f f t f v 0 2279 ""      RI_FKey_restrict_del - _null_ ));
 DESCR("referential integrity ON DELETE RESTRICT");
-DATA(insert OID = 1649 (  RI_FKey_restrict_upd PGNSP PGUID 12 f f t f v 0 2279 ""  RI_FKey_restrict_upd - _null_ ));
+DATA(insert OID = 1649 (  RI_FKey_restrict_upd PGNSP PGUID 12 f f t f v 0 2279 ""      RI_FKey_restrict_upd - _null_ ));
 DESCR("referential integrity ON UPDATE RESTRICT");
-DATA(insert OID = 1650 (  RI_FKey_setnull_del  PGNSP PGUID 12 f f t f v 0 2279 ""  RI_FKey_setnull_del - _null_ ));
+DATA(insert OID = 1650 (  RI_FKey_setnull_del  PGNSP PGUID 12 f f t f v 0 2279 ""      RI_FKey_setnull_del - _null_ ));
 DESCR("referential integrity ON DELETE SET NULL");
-DATA(insert OID = 1651 (  RI_FKey_setnull_upd  PGNSP PGUID 12 f f t f v 0 2279 ""  RI_FKey_setnull_upd - _null_ ));
+DATA(insert OID = 1651 (  RI_FKey_setnull_upd  PGNSP PGUID 12 f f t f v 0 2279 ""      RI_FKey_setnull_upd - _null_ ));
 DESCR("referential integrity ON UPDATE SET NULL");
-DATA(insert OID = 1652 (  RI_FKey_setdefault_del PGNSP PGUID 12 f f t f v 0 2279 ""    RI_FKey_setdefault_del - _null_ ));
+DATA(insert OID = 1652 (  RI_FKey_setdefault_del PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_setdefault_del - _null_ ));
 DESCR("referential integrity ON DELETE SET DEFAULT");
-DATA(insert OID = 1653 (  RI_FKey_setdefault_upd PGNSP PGUID 12 f f t f v 0 2279 ""    RI_FKey_setdefault_upd - _null_ ));
+DATA(insert OID = 1653 (  RI_FKey_setdefault_upd PGNSP PGUID 12 f f t f v 0 2279 "" RI_FKey_setdefault_upd - _null_ ));
 DESCR("referential integrity ON UPDATE SET DEFAULT");
 DATA(insert OID = 1654 (  RI_FKey_noaction_del PGNSP PGUID 12 f f t f v 0 2279 ""  RI_FKey_noaction_del - _null_ ));
 DESCR("referential integrity ON DELETE NO ACTION");
@@ -2231,7 +2231,7 @@ DATA(insert OID = 1674 (  bitor                           PGNSP PGUID 12 f f t f i 2 1560 "1560 1560"
 DESCR("bitwise or");
 DATA(insert OID = 1675 (  bitxor                       PGNSP PGUID 12 f f t f i 2 1560 "1560 1560"  bitxor - _null_ ));
 DESCR("bitwise exclusive or");
-DATA(insert OID = 1676 (  bitnot                       PGNSP PGUID 12 f f t f i 1 1560 "1560"  bitnot - _null_ ));
+DATA(insert OID = 1676 (  bitnot                       PGNSP PGUID 12 f f t f i 1 1560 "1560"  bitnot - _null_ ));
 DESCR("bitwise negation");
 DATA(insert OID = 1677 (  bitshiftleft         PGNSP PGUID 12 f f t f i 2 1560 "1560 23"  bitshiftleft - _null_ ));
 DESCR("bitwise left shift");
@@ -2370,27 +2370,27 @@ DESCR("hash");
 /* OID's 1700 - 1799 NUMERIC data type */
 DATA(insert OID = 1701 ( numeric_in                            PGNSP PGUID 12 f f t f i 3 1700 "2275 26 23"  numeric_in - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1702 ( numeric_out                   PGNSP PGUID 12 f f t f i 1 2275 "1700"  numeric_out - _null_ ));
+DATA(insert OID = 1702 ( numeric_out                   PGNSP PGUID 12 f f t f i 1 2275 "1700"  numeric_out - _null_ ));
 DESCR("(internal)");
 DATA(insert OID = 1703 ( numeric                               PGNSP PGUID 12 f f t f i 2 1700 "1700 23"  numeric - _null_ ));
 DESCR("adjust numeric to typmod precision/scale");
-DATA(insert OID = 1704 ( numeric_abs                   PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_abs - _null_ ));
+DATA(insert OID = 1704 ( numeric_abs                   PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_abs - _null_ ));
 DESCR("absolute value");
-DATA(insert OID = 1705 ( abs                                   PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_abs - _null_ ));
+DATA(insert OID = 1705 ( abs                                   PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_abs - _null_ ));
 DESCR("absolute value");
-DATA(insert OID = 1706 ( sign                                  PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_sign - _null_ ));
+DATA(insert OID = 1706 ( sign                                  PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_sign - _null_ ));
 DESCR("sign of value");
 DATA(insert OID = 1707 ( round                                 PGNSP PGUID 12 f f t f i 2 1700 "1700 23"  numeric_round - _null_ ));
 DESCR("value rounded to 'scale'");
-DATA(insert OID = 1708 ( round                                 PGNSP PGUID 14 f f t f i 1 1700 "1700"  "select round($1,0)" - _null_ ));
+DATA(insert OID = 1708 ( round                                 PGNSP PGUID 14 f f t f i 1 1700 "1700"  "select round($1,0)" - _null_ ));
 DESCR("value rounded to 'scale' of zero");
 DATA(insert OID = 1709 ( trunc                                 PGNSP PGUID 12 f f t f i 2 1700 "1700 23"  numeric_trunc - _null_ ));
 DESCR("value truncated to 'scale'");
-DATA(insert OID = 1710 ( trunc                                 PGNSP PGUID 14 f f t f i 1 1700 "1700"  "select trunc($1,0)" - _null_ ));
+DATA(insert OID = 1710 ( trunc                                 PGNSP PGUID 14 f f t f i 1 1700 "1700"  "select trunc($1,0)" - _null_ ));
 DESCR("value truncated to 'scale' of zero");
-DATA(insert OID = 1711 ( ceil                                  PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_ceil - _null_ ));
+DATA(insert OID = 1711 ( ceil                                  PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_ceil - _null_ ));
 DESCR("smallest integer >= value");
-DATA(insert OID = 1712 ( floor                                 PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_floor - _null_ ));
+DATA(insert OID = 1712 ( floor                                 PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_floor - _null_ ));
 DESCR("largest integer <= value");
 DATA(insert OID = 1718 ( numeric_eq                            PGNSP PGUID 12 f f t f i 2 16 "1700 1700"  numeric_eq - _null_ ));
 DESCR("equal");
@@ -2416,17 +2416,17 @@ DATA(insert OID = 1728 ( mod                                    PGNSP PGUID 12 f f t f i 2 1700 "1700 1700"  nu
 DESCR("modulus");
 DATA(insert OID = 1729 ( numeric_mod                   PGNSP PGUID 12 f f t f i 2 1700 "1700 1700"  numeric_mod - _null_ ));
 DESCR("modulus");
-DATA(insert OID = 1730 ( sqrt                                  PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_sqrt - _null_ ));
+DATA(insert OID = 1730 ( sqrt                                  PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_sqrt - _null_ ));
 DESCR("square root");
-DATA(insert OID = 1731 ( numeric_sqrt                  PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_sqrt - _null_ ));
+DATA(insert OID = 1731 ( numeric_sqrt                  PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_sqrt - _null_ ));
 DESCR("square root");
-DATA(insert OID = 1732 ( exp                                   PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_exp - _null_ ));
+DATA(insert OID = 1732 ( exp                                   PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_exp - _null_ ));
 DESCR("e raised to the power of n");
-DATA(insert OID = 1733 ( numeric_exp                   PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_exp - _null_ ));
+DATA(insert OID = 1733 ( numeric_exp                   PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_exp - _null_ ));
 DESCR("e raised to the power of n");
-DATA(insert OID = 1734 ( ln                                            PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_ln - _null_ ));
+DATA(insert OID = 1734 ( ln                                            PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_ln - _null_ ));
 DESCR("natural logarithm of n");
-DATA(insert OID = 1735 ( numeric_ln                            PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_ln - _null_ ));
+DATA(insert OID = 1735 ( numeric_ln                            PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_ln - _null_ ));
 DESCR("natural logarithm of n");
 DATA(insert OID = 1736 ( log                                   PGNSP PGUID 12 f f t f i 2 1700 "1700 1700"  numeric_log - _null_ ));
 DESCR("logarithm base m of n");
@@ -2438,7 +2438,7 @@ DATA(insert OID = 1739 ( numeric_power                    PGNSP PGUID 12 f f t f i 2 1700 "1700 1
 DESCR("m raised to the power of n");
 DATA(insert OID = 1740 ( numeric                               PGNSP PGUID 12 f f t f i 1 1700 "23"    int4_numeric - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1741 ( log                                   PGNSP PGUID 14 f f t f i 1 1700 "1700"  "select log(10, $1)" - _null_ ));
+DATA(insert OID = 1741 ( log                                   PGNSP PGUID 14 f f t f i 1 1700 "1700"  "select log(10, $1)" - _null_ ));
 DESCR("logarithm base 10 of n");
 DATA(insert OID = 1742 ( numeric                               PGNSP PGUID 12 f f t f i 1 1700 "700"  float4_numeric - _null_ ));
 DESCR("(internal)");
@@ -2460,7 +2460,7 @@ DESCR("plus");
 DATA(insert OID = 1750 ( timetz_mi_interval            PGNSP PGUID 12 f f t f i 2 1266 "1266 1186"  timetz_mi_interval - _null_ ));
 DESCR("minus");
 
-DATA(insert OID = 1764 ( numeric_inc                   PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_inc - _null_ ));
+DATA(insert OID = 1764 ( numeric_inc                   PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_inc - _null_ ));
 DESCR("increment by one");
 DATA(insert OID = 1766 ( numeric_smaller               PGNSP PGUID 12 f f t f i 2 1700 "1700 1700"  numeric_smaller - _null_ ));
 DESCR("smaller of two numbers");
@@ -2468,7 +2468,7 @@ DATA(insert OID = 1767 ( numeric_larger                   PGNSP PGUID 12 f f t f i 2 1700 "1700
 DESCR("larger of two numbers");
 DATA(insert OID = 1769 ( numeric_cmp                   PGNSP PGUID 12 f f t f i 2 23 "1700 1700"  numeric_cmp - _null_ ));
 DESCR("compare two numbers");
-DATA(insert OID = 1771 ( numeric_uminus                        PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_uminus - _null_ ));
+DATA(insert OID = 1771 ( numeric_uminus                        PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_uminus - _null_ ));
 DESCR("negate");
 DATA(insert OID = 1779 ( int8                                  PGNSP PGUID 12 f f t f i 1 20 "1700"    numeric_int8 - _null_ ));
 DESCR("(internal)");
@@ -2506,9 +2506,9 @@ DESCR("quote an identifier for usage in a querystring");
 DATA(insert OID =  1283 ( quote_literal    PGNSP PGUID 12 f f t f i 1 25 "25" quote_literal - _null_ ));
 DESCR("quote a literal for usage in a querystring");
 
-DATA(insert OID = 1798 (  oidin                           PGNSP PGUID 12 f f t f i 1 26 "2275" oidin - _null_ ));
+DATA(insert OID = 1798 (  oidin                           PGNSP PGUID 12 f f t f i 1 26 "2275" oidin - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 1799 (  oidout                  PGNSP PGUID 12 f f t f i 1 2275 "26" oidout - _null_ ));
+DATA(insert OID = 1799 (  oidout                  PGNSP PGUID 12 f f t f i 1 2275 "26" oidout - _null_ ));
 DESCR("(internal)");
 
 
@@ -2560,7 +2560,7 @@ DATA(insert OID = 1831 (  float8_variance  PGNSP PGUID 12 f f t f i 1 701 "1022"
 DESCR("VARIANCE aggregate final function");
 DATA(insert OID = 1832 (  float8_stddev    PGNSP PGUID 12 f f t f i 1 701 "1022"       float8_stddev - _null_ ));
 DESCR("STDDEV aggregate final function");
-DATA(insert OID = 1833 (  numeric_accum    PGNSP PGUID 12 f f t f i 2 1231 "1231 1700"  numeric_accum - _null_ ));
+DATA(insert OID = 1833 (  numeric_accum    PGNSP PGUID 12 f f t f i 2 1231 "1231 1700" numeric_accum - _null_ ));
 DESCR("aggregate transition function");
 DATA(insert OID = 1834 (  int2_accum      PGNSP PGUID 12 f f t f i 2 1231 "1231 21"    int2_accum - _null_ ));
 DESCR("aggregate transition function");
@@ -2580,7 +2580,7 @@ DATA(insert OID = 1841 (  int4_sum                   PGNSP PGUID 12 f f f f i 2 20 "20 23"        int
 DESCR("SUM(int4) transition function");
 DATA(insert OID = 1842 (  int8_sum                PGNSP PGUID 12 f f f f i 2 1700 "1700 20"    int8_sum - _null_ ));
 DESCR("SUM(int8) transition function");
-DATA(insert OID = 1843 (  interval_accum   PGNSP PGUID 12 f f t f i 2 1187 "1187 1186"  interval_accum - _null_ ));
+DATA(insert OID = 1843 (  interval_accum   PGNSP PGUID 12 f f t f i 2 1187 "1187 1186" interval_accum - _null_ ));
 DESCR("aggregate transition function");
 DATA(insert OID = 1844 (  interval_avg    PGNSP PGUID 12 f f t f i 1 1186 "1187"  interval_avg - _null_ ));
 DESCR("AVG aggregate final function");
@@ -2667,15 +2667,15 @@ DESCR("binary shift left");
 DATA(insert OID = 1909 (  int8shr                 PGNSP PGUID 12 f f t f i 2 20 "20 23"        int8shr - _null_ ));
 DESCR("binary shift right");
 
-DATA(insert OID = 1910 (  int8up                  PGNSP PGUID 12 f f t f i 1 20        "20"    int8up - _null_ ));
+DATA(insert OID = 1910 (  int8up                  PGNSP PGUID 12 f f t f i 1 20        "20"    int8up - _null_ ));
 DESCR("unary plus");
-DATA(insert OID = 1911 (  int2up                  PGNSP PGUID 12 f f t f i 1 21        "21"    int2up - _null_ ));
+DATA(insert OID = 1911 (  int2up                  PGNSP PGUID 12 f f t f i 1 21        "21"    int2up - _null_ ));
 DESCR("unary plus");
-DATA(insert OID = 1912 (  int4up                  PGNSP PGUID 12 f f t f i 1 23        "23"    int4up - _null_ ));
+DATA(insert OID = 1912 (  int4up                  PGNSP PGUID 12 f f t f i 1 23        "23"    int4up - _null_ ));
 DESCR("unary plus");
-DATA(insert OID = 1913 (  float4up                PGNSP PGUID 12 f f t f i 1 700 "700"         float4up - _null_ ));
+DATA(insert OID = 1913 (  float4up                PGNSP PGUID 12 f f t f i 1 700 "700"         float4up - _null_ ));
 DESCR("unary plus");
-DATA(insert OID = 1914 (  float8up                PGNSP PGUID 12 f f t f i 1 701 "701"         float8up - _null_ ));
+DATA(insert OID = 1914 (  float8up                PGNSP PGUID 12 f f t f i 1 701 "701"         float8up - _null_ ));
 DESCR("unary plus");
 DATA(insert OID = 1915 (  numeric_uplus    PGNSP PGUID 12 f f t f i 1 1700 "1700"  numeric_uplus - _null_ ));
 DESCR("unary plus");
@@ -2694,21 +2694,21 @@ DATA(insert OID = 1927 (  has_table_privilege              PGNSP PGUID 12 f f t f s 2 16
 DESCR("current user privilege on relation by rel oid");
 
 
-DATA(insert OID = 1928 (  pg_stat_get_numscans                 PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_numscans - _null_ ));
+DATA(insert OID = 1928 (  pg_stat_get_numscans                 PGNSP PGUID 12 f f t f s 1 20 "26"      pg_stat_get_numscans - _null_ ));
 DESCR("Statistics: Number of scans done for table/index");
-DATA(insert OID = 1929 (  pg_stat_get_tuples_returned  PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_tuples_returned - _null_ ));
+DATA(insert OID = 1929 (  pg_stat_get_tuples_returned  PGNSP PGUID 12 f f t f s 1 20 "26"      pg_stat_get_tuples_returned - _null_ ));
 DESCR("Statistics: Number of tuples read by seqscan");
-DATA(insert OID = 1930 (  pg_stat_get_tuples_fetched   PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_tuples_fetched - _null_ ));
+DATA(insert OID = 1930 (  pg_stat_get_tuples_fetched   PGNSP PGUID 12 f f t f s 1 20 "26"      pg_stat_get_tuples_fetched - _null_ ));
 DESCR("Statistics: Number of tuples fetched by idxscan");
-DATA(insert OID = 1931 (  pg_stat_get_tuples_inserted  PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_tuples_inserted - _null_ ));
+DATA(insert OID = 1931 (  pg_stat_get_tuples_inserted  PGNSP PGUID 12 f f t f s 1 20 "26"      pg_stat_get_tuples_inserted - _null_ ));
 DESCR("Statistics: Number of tuples inserted");
-DATA(insert OID = 1932 (  pg_stat_get_tuples_updated   PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_tuples_updated - _null_ ));
+DATA(insert OID = 1932 (  pg_stat_get_tuples_updated   PGNSP PGUID 12 f f t f s 1 20 "26"      pg_stat_get_tuples_updated - _null_ ));
 DESCR("Statistics: Number of tuples updated");
-DATA(insert OID = 1933 (  pg_stat_get_tuples_deleted   PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_tuples_deleted - _null_ ));
+DATA(insert OID = 1933 (  pg_stat_get_tuples_deleted   PGNSP PGUID 12 f f t f s 1 20 "26"      pg_stat_get_tuples_deleted - _null_ ));
 DESCR("Statistics: Number of tuples deleted");
-DATA(insert OID = 1934 (  pg_stat_get_blocks_fetched   PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_blocks_fetched - _null_ ));
+DATA(insert OID = 1934 (  pg_stat_get_blocks_fetched   PGNSP PGUID 12 f f t f s 1 20 "26"      pg_stat_get_blocks_fetched - _null_ ));
 DESCR("Statistics: Number of blocks fetched");
-DATA(insert OID = 1935 (  pg_stat_get_blocks_hit               PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_blocks_hit - _null_ ));
+DATA(insert OID = 1935 (  pg_stat_get_blocks_hit               PGNSP PGUID 12 f f t f s 1 20 "26"      pg_stat_get_blocks_hit - _null_ ));
 DESCR("Statistics: Number of blocks found in cache");
 DATA(insert OID = 1936 (  pg_stat_get_backend_idset            PGNSP PGUID 12 f f t t s 0 23 ""        pg_stat_get_backend_idset - _null_ ));
 DESCR("Statistics: Currently active backend IDs");
@@ -2716,23 +2716,23 @@ DATA(insert OID = 2026 (  pg_backend_pid                                PGNSP PGUID 12 f f t f s 0 23 ""        pg_
 DESCR("Statistics: Current backend PID");
 DATA(insert OID = 2274 (  pg_stat_reset                                PGNSP PGUID 12 f f f f v 0 16  ""       pg_stat_reset - _null_ ));
 DESCR("Statistics: Reset collected statistics");
-DATA(insert OID = 1937 (  pg_stat_get_backend_pid              PGNSP PGUID 12 f f t f s 1 23 "23"  pg_stat_get_backend_pid - _null_ ));
+DATA(insert OID = 1937 (  pg_stat_get_backend_pid              PGNSP PGUID 12 f f t f s 1 23 "23"      pg_stat_get_backend_pid - _null_ ));
 DESCR("Statistics: PID of backend");
-DATA(insert OID = 1938 (  pg_stat_get_backend_dbid             PGNSP PGUID 12 f f t f s 1 26 "23"  pg_stat_get_backend_dbid - _null_ ));
+DATA(insert OID = 1938 (  pg_stat_get_backend_dbid             PGNSP PGUID 12 f f t f s 1 26 "23"      pg_stat_get_backend_dbid - _null_ ));
 DESCR("Statistics: Database ID of backend");
-DATA(insert OID = 1939 (  pg_stat_get_backend_userid   PGNSP PGUID 12 f f t f s 1 26 "23"  pg_stat_get_backend_userid - _null_ ));
+DATA(insert OID = 1939 (  pg_stat_get_backend_userid   PGNSP PGUID 12 f f t f s 1 26 "23"      pg_stat_get_backend_userid - _null_ ));
 DESCR("Statistics: User ID of backend");
-DATA(insert OID = 1940 (  pg_stat_get_backend_activity PGNSP PGUID 12 f f t f s 1 25 "23"  pg_stat_get_backend_activity - _null_ ));
+DATA(insert OID = 1940 (  pg_stat_get_backend_activity PGNSP PGUID 12 f f t f s 1 25 "23"      pg_stat_get_backend_activity - _null_ ));
 DESCR("Statistics: Current query of backend");
-DATA(insert OID = 1941 (  pg_stat_get_db_numbackends   PGNSP PGUID 12 f f t f s 1 23 "26"  pg_stat_get_db_numbackends - _null_ ));
+DATA(insert OID = 1941 (  pg_stat_get_db_numbackends   PGNSP PGUID 12 f f t f s 1 23 "26"      pg_stat_get_db_numbackends - _null_ ));
 DESCR("Statistics: Number of backends in database");
-DATA(insert OID = 1942 (  pg_stat_get_db_xact_commit   PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_db_xact_commit - _null_ ));
+DATA(insert OID = 1942 (  pg_stat_get_db_xact_commit   PGNSP PGUID 12 f f t f s 1 20 "26"      pg_stat_get_db_xact_commit - _null_ ));
 DESCR("Statistics: Transactions committed");
-DATA(insert OID = 1943 (  pg_stat_get_db_xact_rollback PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_db_xact_rollback - _null_ ));
+DATA(insert OID = 1943 (  pg_stat_get_db_xact_rollback PGNSP PGUID 12 f f t f s 1 20 "26"      pg_stat_get_db_xact_rollback - _null_ ));
 DESCR("Statistics: Transactions rolled back");
-DATA(insert OID = 1944 (  pg_stat_get_db_blocks_fetched PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_db_blocks_fetched - _null_ ));
+DATA(insert OID = 1944 (  pg_stat_get_db_blocks_fetched PGNSP PGUID 12 f f t f s 1 20 "26"     pg_stat_get_db_blocks_fetched - _null_ ));
 DESCR("Statistics: Blocks fetched for database");
-DATA(insert OID = 1945 (  pg_stat_get_db_blocks_hit            PGNSP PGUID 12 f f t f s 1 20 "26"  pg_stat_get_db_blocks_hit - _null_ ));
+DATA(insert OID = 1945 (  pg_stat_get_db_blocks_hit            PGNSP PGUID 12 f f t f s 1 20 "26"      pg_stat_get_db_blocks_hit - _null_ ));
 DESCR("Statistics: Block found in cache for database");
 
 DATA(insert OID = 1946 (  encode                                               PGNSP PGUID 12 f f t f i 2 25 "17 25"  binary_encode - _null_ ));
@@ -2797,27 +2797,27 @@ DESCR("return position of substring");
 DATA(insert OID = 2015 (  btrim                           PGNSP PGUID 12 f f t f i 2 17 "17 17"        byteatrim - _null_ ));
 DESCR("trim both ends of string");
 
-DATA(insert OID = 2019 (  time                         PGNSP PGUID 12 f f t f s 1 1083 "1184"  timestamptz_time - _null_ ));
+DATA(insert OID = 2019 (  time                         PGNSP PGUID 12 f f t f s 1 1083 "1184"  timestamptz_time - _null_ ));
 DESCR("convert timestamptz to time");
 DATA(insert OID = 2020 (  date_trunc           PGNSP PGUID 12 f f t f i 2 1114 "25 1114"  timestamp_trunc - _null_ ));
 DESCR("truncate timestamp to specified units");
-DATA(insert OID = 2021 (  date_part                    PGNSP PGUID 12 f f t f i 2  701 "25 1114"  timestamp_part - _null_ ));
+DATA(insert OID = 2021 (  date_part                    PGNSP PGUID 12 f f t f i 2      701 "25 1114"  timestamp_part - _null_ ));
 DESCR("extract field from timestamp");
 DATA(insert OID = 2022 (  timestamp                    PGNSP PGUID 12 f f t f s 1 1114 "25"    text_timestamp - _null_ ));
 DESCR("convert text to timestamp");
 DATA(insert OID = 2023 (  timestamp                    PGNSP PGUID 12 f f t f s 1 1114 "702"  abstime_timestamp - _null_ ));
 DESCR("convert abstime to timestamp");
-DATA(insert OID = 2024 (  timestamp                    PGNSP PGUID 12 f f t f i 1 1114 "1082"  date_timestamp - _null_ ));
+DATA(insert OID = 2024 (  timestamp                    PGNSP PGUID 12 f f t f i 1 1114 "1082"  date_timestamp - _null_ ));
 DESCR("convert date to timestamp");
 DATA(insert OID = 2025 (  timestamp                    PGNSP PGUID 12 f f t f i 2 1114 "1082 1083"  datetime_timestamp - _null_ ));
 DESCR("convert date and time to timestamp");
-DATA(insert OID = 2027 (  timestamp                    PGNSP PGUID 12 f f t f s 1 1114 "1184"  timestamptz_timestamp - _null_ ));
+DATA(insert OID = 2027 (  timestamp                    PGNSP PGUID 12 f f t f s 1 1114 "1184"  timestamptz_timestamp - _null_ ));
 DESCR("convert date and time with time zone to timestamp");
-DATA(insert OID = 2028 (  timestamptz          PGNSP PGUID 12 f f t f s 1 1184 "1114"  timestamp_timestamptz - _null_ ));
+DATA(insert OID = 2028 (  timestamptz          PGNSP PGUID 12 f f t f s 1 1184 "1114"  timestamp_timestamptz - _null_ ));
 DESCR("convert date and time with time zone to timestamp");
-DATA(insert OID = 2029 (  date                         PGNSP PGUID 12 f f t f i 1 1082 "1114"  timestamp_date - _null_ ));
+DATA(insert OID = 2029 (  date                         PGNSP PGUID 12 f f t f i 1 1082 "1114"  timestamp_date - _null_ ));
 DESCR("convert timestamp to date");
-DATA(insert OID = 2030 (  abstime                      PGNSP PGUID 12 f f t f s 1  702 "1114"  timestamp_abstime - _null_ ));
+DATA(insert OID = 2030 (  abstime                      PGNSP PGUID 12 f f t f s 1      702 "1114"      timestamp_abstime - _null_ ));
 DESCR("convert timestamp to abstime");
 DATA(insert OID = 2031 (  timestamp_mi         PGNSP PGUID 12 f f t f i 2 1186 "1114 1114"  timestamp_mi - _null_ ));
 DESCR("subtract");
@@ -2825,7 +2825,7 @@ DATA(insert OID = 2032 (  timestamp_pl_span PGNSP PGUID 12 f f t f i 2 1114 "111
 DESCR("plus");
 DATA(insert OID = 2033 (  timestamp_mi_span PGNSP PGUID 12 f f t f i 2 1114 "1114 1186"  timestamp_mi_span - _null_ ));
 DESCR("minus");
-DATA(insert OID = 2034 (  text                         PGNSP PGUID 12 f f t f s 1   25 "1114"  timestamp_text - _null_ ));
+DATA(insert OID = 2034 (  text                         PGNSP PGUID 12 f f t f s 1       25 "1114"      timestamp_text - _null_ ));
 DESCR("convert timestamp to text");
 DATA(insert OID = 2035 (  timestamp_smaller PGNSP PGUID 12 f f t f i 2 1114 "1114 1114"  timestamp_smaller - _null_ ));
 DESCR("smaller of two");
@@ -2845,11 +2845,11 @@ DATA(insert OID = 2044 ( overlaps                       PGNSP PGUID 14 f f f f i 4 16 "1114 1186 111
 DESCR("SQL92 interval comparison");
 DATA(insert OID = 2045 (  timestamp_cmp                PGNSP PGUID 12 f f t f i 2      23 "1114 1114"  timestamp_cmp - _null_ ));
 DESCR("less-equal-greater");
-DATA(insert OID = 2046 (  time                         PGNSP PGUID 12 f f t f i 1 1083 "1266"  timetz_time - _null_ ));
+DATA(insert OID = 2046 (  time                         PGNSP PGUID 12 f f t f i 1 1083 "1266"  timetz_time - _null_ ));
 DESCR("convert time with time zone to time");
-DATA(insert OID = 2047 (  timetz                       PGNSP PGUID 12 f f t f s 1 1266 "1083"  time_timetz - _null_ ));
+DATA(insert OID = 2047 (  timetz                       PGNSP PGUID 12 f f t f s 1 1266 "1083"  time_timetz - _null_ ));
 DESCR("convert time to timetz");
-DATA(insert OID = 2048 (  isfinite                     PGNSP PGUID 12 f f t f i 1   16 "1114"  timestamp_finite - _null_ ));
+DATA(insert OID = 2048 (  isfinite                     PGNSP PGUID 12 f f t f i 1       16 "1114"      timestamp_finite - _null_ ));
 DESCR("boolean test");
 DATA(insert OID = 2049 ( to_char                       PGNSP PGUID 12 f f t f s 2      25 "1114 25"  timestamp_to_char - _null_ ));
 DESCR("format timestamp to text");
@@ -2871,7 +2871,7 @@ DATA(insert OID = 2057 (  timestamp_gt            PGNSP PGUID 12 f f t f i 2 16 "1114 1114
 DESCR("greater-than");
 DATA(insert OID = 2058 (  age                          PGNSP PGUID 12 f f t f i 2 1186 "1114 1114"  timestamp_age - _null_ ));
 DESCR("date difference preserving months and years");
-DATA(insert OID = 2059 (  age                          PGNSP PGUID 14 f f t f s 1 1186 "1114"  "select age(cast(current_date as timestamp without time zone), $1)" - _null_ ));
+DATA(insert OID = 2059 (  age                          PGNSP PGUID 14 f f t f s 1 1186 "1114"  "select age(cast(current_date as timestamp without time zone), $1)" - _null_ ));
 DESCR("date difference from today preserving months and years");
 
 DATA(insert OID = 2069 (  timezone                     PGNSP PGUID 12 f f t f s 2 1184 "25 1114"  timestamp_zone - _null_ ));
@@ -2902,15 +2902,15 @@ DESCR("SHOW ALL as a function");
 DATA(insert OID = 1371 (  pg_lock_status   PGNSP PGUID 12 f f f t v 0 2249 "" pg_lock_status - _null_ ));
 DESCR("view system lock information");
 
-DATA(insert OID = 2079 (  pg_table_is_visible          PGNSP PGUID 12 f f t f s 1 16 "26"  pg_table_is_visible - _null_ ));
+DATA(insert OID = 2079 (  pg_table_is_visible          PGNSP PGUID 12 f f t f s 1 16 "26"      pg_table_is_visible - _null_ ));
 DESCR("is table visible in search path?");
-DATA(insert OID = 2080 (  pg_type_is_visible           PGNSP PGUID 12 f f t f s 1 16 "26"  pg_type_is_visible - _null_ ));
+DATA(insert OID = 2080 (  pg_type_is_visible           PGNSP PGUID 12 f f t f s 1 16 "26"      pg_type_is_visible - _null_ ));
 DESCR("is type visible in search path?");
-DATA(insert OID = 2081 (  pg_function_is_visible       PGNSP PGUID 12 f f t f s 1 16 "26"  pg_function_is_visible - _null_ ));
+DATA(insert OID = 2081 (  pg_function_is_visible       PGNSP PGUID 12 f f t f s 1 16 "26"      pg_function_is_visible - _null_ ));
 DESCR("is function visible in search path?");
-DATA(insert OID = 2082 (  pg_operator_is_visible       PGNSP PGUID 12 f f t f s 1 16 "26"  pg_operator_is_visible - _null_ ));
+DATA(insert OID = 2082 (  pg_operator_is_visible       PGNSP PGUID 12 f f t f s 1 16 "26"      pg_operator_is_visible - _null_ ));
 DESCR("is operator visible in search path?");
-DATA(insert OID = 2083 (  pg_opclass_is_visible                PGNSP PGUID 12 f f t f s 1 16 "26"  pg_opclass_is_visible - _null_ ));
+DATA(insert OID = 2083 (  pg_opclass_is_visible                PGNSP PGUID 12 f f t f s 1 16 "26"      pg_opclass_is_visible - _null_ ));
 DESCR("is opclass visible in search path?");
 
 
@@ -2919,53 +2919,53 @@ DESCR("is opclass visible in search path?");
 DATA(insert OID = 2100 (  avg                          PGNSP PGUID 12 t f f f i 1 1700 "20"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2101 (  avg                          PGNSP PGUID 12 t f f f i 1 1700 "23"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2102 (  avg                          PGNSP PGUID 12 t f f f i 1 1700 "21"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2103 (  avg                          PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2103 (  avg                          PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2104 (  avg                          PGNSP PGUID 12 t f f f i 1 701 "700"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2105 (  avg                          PGNSP PGUID 12 t f f f i 1 701 "701"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2106 (  avg                          PGNSP PGUID 12 t f f f i 1 1186 "1186"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2106 (  avg                          PGNSP PGUID 12 t f f f i 1 1186 "1186"  aggregate_dummy - _null_ ));
 
 DATA(insert OID = 2107 (  sum                          PGNSP PGUID 12 t f f f i 1 1700 "20"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2108 (  sum                          PGNSP PGUID 12 t f f f i 1 20 "23"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2109 (  sum                          PGNSP PGUID 12 t f f f i 1 20 "21"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2108 (  sum                          PGNSP PGUID 12 t f f f i 1 20 "23"      aggregate_dummy - _null_ ));
+DATA(insert OID = 2109 (  sum                          PGNSP PGUID 12 t f f f i 1 20 "21"      aggregate_dummy - _null_ ));
 DATA(insert OID = 2110 (  sum                          PGNSP PGUID 12 t f f f i 1 700 "700"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2111 (  sum                          PGNSP PGUID 12 t f f f i 1 701 "701"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2112 (  sum                          PGNSP PGUID 12 t f f f i 1 790 "790"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2113 (  sum                          PGNSP PGUID 12 t f f f i 1 1186 "1186"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2114 (  sum                          PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2113 (  sum                          PGNSP PGUID 12 t f f f i 1 1186 "1186"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2114 (  sum                          PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
 
-DATA(insert OID = 2115 (  max                          PGNSP PGUID 12 t f f f i 1 20 "20"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2116 (  max                          PGNSP PGUID 12 t f f f i 1 23 "23"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2117 (  max                          PGNSP PGUID 12 t f f f i 1 21 "21"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2118 (  max                          PGNSP PGUID 12 t f f f i 1 26 "26"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2115 (  max                          PGNSP PGUID 12 t f f f i 1 20 "20"      aggregate_dummy - _null_ ));
+DATA(insert OID = 2116 (  max                          PGNSP PGUID 12 t f f f i 1 23 "23"      aggregate_dummy - _null_ ));
+DATA(insert OID = 2117 (  max                          PGNSP PGUID 12 t f f f i 1 21 "21"      aggregate_dummy - _null_ ));
+DATA(insert OID = 2118 (  max                          PGNSP PGUID 12 t f f f i 1 26 "26"      aggregate_dummy - _null_ ));
 DATA(insert OID = 2119 (  max                          PGNSP PGUID 12 t f f f i 1 700 "700"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2120 (  max                          PGNSP PGUID 12 t f f f i 1 701 "701"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2121 (  max                          PGNSP PGUID 12 t f f f i 1 702 "702"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2122 (  max                          PGNSP PGUID 12 t f f f i 1 1082 "1082"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2123 (  max                          PGNSP PGUID 12 t f f f i 1 1083 "1083"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2124 (  max                          PGNSP PGUID 12 t f f f i 1 1266 "1266"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2122 (  max                          PGNSP PGUID 12 t f f f i 1 1082 "1082"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2123 (  max                          PGNSP PGUID 12 t f f f i 1 1083 "1083"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2124 (  max                          PGNSP PGUID 12 t f f f i 1 1266 "1266"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2125 (  max                          PGNSP PGUID 12 t f f f i 1 790 "790"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2126 (  max                          PGNSP PGUID 12 t f f f i 1 1114 "1114"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2127 (  max                          PGNSP PGUID 12 t f f f i 1 1184 "1184"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2128 (  max                          PGNSP PGUID 12 t f f f i 1 1186 "1186"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2129 (  max                          PGNSP PGUID 12 t f f f i 1 25 "25"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2130 (  max                          PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
-
-DATA(insert OID = 2131 (  min                          PGNSP PGUID 12 t f f f i 1 20 "20"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2132 (  min                          PGNSP PGUID 12 t f f f i 1 23 "23"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2133 (  min                          PGNSP PGUID 12 t f f f i 1 21 "21"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2134 (  min                          PGNSP PGUID 12 t f f f i 1 26 "26"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2126 (  max                          PGNSP PGUID 12 t f f f i 1 1114 "1114"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2127 (  max                          PGNSP PGUID 12 t f f f i 1 1184 "1184"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2128 (  max                          PGNSP PGUID 12 t f f f i 1 1186 "1186"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2129 (  max                          PGNSP PGUID 12 t f f f i 1 25 "25"      aggregate_dummy - _null_ ));
+DATA(insert OID = 2130 (  max                          PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
+
+DATA(insert OID = 2131 (  min                          PGNSP PGUID 12 t f f f i 1 20 "20"      aggregate_dummy - _null_ ));
+DATA(insert OID = 2132 (  min                          PGNSP PGUID 12 t f f f i 1 23 "23"      aggregate_dummy - _null_ ));
+DATA(insert OID = 2133 (  min                          PGNSP PGUID 12 t f f f i 1 21 "21"      aggregate_dummy - _null_ ));
+DATA(insert OID = 2134 (  min                          PGNSP PGUID 12 t f f f i 1 26 "26"      aggregate_dummy - _null_ ));
 DATA(insert OID = 2135 (  min                          PGNSP PGUID 12 t f f f i 1 700 "700"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2136 (  min                          PGNSP PGUID 12 t f f f i 1 701 "701"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2137 (  min                          PGNSP PGUID 12 t f f f i 1 702 "702"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2138 (  min                          PGNSP PGUID 12 t f f f i 1 1082 "1082"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2139 (  min                          PGNSP PGUID 12 t f f f i 1 1083 "1083"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2140 (  min                          PGNSP PGUID 12 t f f f i 1 1266 "1266"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2138 (  min                          PGNSP PGUID 12 t f f f i 1 1082 "1082"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2139 (  min                          PGNSP PGUID 12 t f f f i 1 1083 "1083"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2140 (  min                          PGNSP PGUID 12 t f f f i 1 1266 "1266"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2141 (  min                          PGNSP PGUID 12 t f f f i 1 790 "790"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2142 (  min                          PGNSP PGUID 12 t f f f i 1 1114 "1114"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2143 (  min                          PGNSP PGUID 12 t f f f i 1 1184 "1184"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2144 (  min                          PGNSP PGUID 12 t f f f i 1 1186 "1186"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2145 (  min                          PGNSP PGUID 12 t f f f i 1 25 "25"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2146 (  min                          PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2142 (  min                          PGNSP PGUID 12 t f f f i 1 1114 "1114"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2143 (  min                          PGNSP PGUID 12 t f f f i 1 1184 "1184"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2144 (  min                          PGNSP PGUID 12 t f f f i 1 1186 "1186"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2145 (  min                          PGNSP PGUID 12 t f f f i 1 25 "25"      aggregate_dummy - _null_ ));
+DATA(insert OID = 2146 (  min                          PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
 
 DATA(insert OID = 2147 (  count                                PGNSP PGUID 12 t f f f i 1 20 "2276"  aggregate_dummy - _null_ ));
 
@@ -2974,14 +2974,14 @@ DATA(insert OID = 2149 (  variance                      PGNSP PGUID 12 t f f f i 1 1700 "23"  aggre
 DATA(insert OID = 2150 (  variance                     PGNSP PGUID 12 t f f f i 1 1700 "21"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2151 (  variance                     PGNSP PGUID 12 t f f f i 1 701 "700"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2152 (  variance                     PGNSP PGUID 12 t f f f i 1 701 "701"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2153 (  variance                     PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2153 (  variance                     PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
 
 DATA(insert OID = 2154 (  stddev                       PGNSP PGUID 12 t f f f i 1 1700 "20"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2155 (  stddev                       PGNSP PGUID 12 t f f f i 1 1700 "23"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2156 (  stddev                       PGNSP PGUID 12 t f f f i 1 1700 "21"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2157 (  stddev                       PGNSP PGUID 12 t f f f i 1 701 "700"  aggregate_dummy - _null_ ));
 DATA(insert OID = 2158 (  stddev                       PGNSP PGUID 12 t f f f i 1 701 "701"  aggregate_dummy - _null_ ));
-DATA(insert OID = 2159 (  stddev                       PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
+DATA(insert OID = 2159 (  stddev                       PGNSP PGUID 12 t f f f i 1 1700 "1700"  aggregate_dummy - _null_ ));
 
 
 DATA(insert OID = 2212 (  regprocedurein       PGNSP PGUID 12 f f t f s 1 2202 "2275"  regprocedurein - _null_ ));
@@ -3007,9 +3007,9 @@ DESCR("(internal)");
 
 DATA(insert OID = 2246 ( fmgr_internal_validator PGNSP PGUID 12 f f t f s 1 2278 "26" fmgr_internal_validator - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 2247 ( fmgr_c_validator      PGNSP PGUID 12 f f t f s 1   2278 "26"  fmgr_c_validator - _null_ ));
+DATA(insert OID = 2247 ( fmgr_c_validator      PGNSP PGUID 12 f f t f s 1       2278 "26"      fmgr_c_validator - _null_ ));
 DESCR("(internal)");
-DATA(insert OID = 2248 ( fmgr_sql_validator    PGNSP PGUID 12 f f t f s 1   2278 "26"  fmgr_sql_validator - _null_ ));
+DATA(insert OID = 2248 ( fmgr_sql_validator PGNSP PGUID 12 f f t f s 1  2278 "26"      fmgr_sql_validator - _null_ ));
 DESCR("(internal)");
 
 DATA(insert OID = 2250 (  has_database_privilege                  PGNSP PGUID 12 f f t f s 3 16 "19 25 25"  has_database_privilege_name_name - _null_ ));
@@ -3112,9 +3112,9 @@ DESCR("(internal)");
  * must be labeled volatile to ensure they will not get optimized away,
  * even if the actual return value is not changeable.
  */
-#define PROVOLATILE_IMMUTABLE  'i'     /* never changes for given input */
-#define PROVOLATILE_STABLE             's'     /* does not change within a scan */
-#define PROVOLATILE_VOLATILE   'v'     /* can change even within a scan */
+#define PROVOLATILE_IMMUTABLE  'i'             /* never changes for given input */
+#define PROVOLATILE_STABLE             's'             /* does not change within a scan */
+#define PROVOLATILE_VOLATILE   'v'             /* can change even within a scan */
 
 
 /*
index 6352f4b..035cf8e 100644 (file)
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_shadow.h,v 1.22 2002/07/24 19:11:13 petere Exp $
+ * $Id: pg_shadow.h,v 1.23 2002/09/04 20:31:42 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -36,6 +36,7 @@ CATALOG(pg_shadow) BOOTSTRAP BKI_SHARED_RELATION BKI_WITHOUT_OIDS
        bool            usecreatedb;
        bool            usesuper;               /* read this field via superuser() only */
        bool            usecatupd;
+
        /* remaining fields may be null; use heap_getattr to read them! */
        text            passwd;
        int4            valuntil;               /* actually abstime */
index 478a730..8a596d8 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_statistic.h,v 1.17 2002/08/25 17:20:01 tgl Exp $
+ * $Id: pg_statistic.h,v 1.18 2002/09/04 20:31:42 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -43,11 +43,11 @@ CATALOG(pg_statistic) BKI_WITHOUT_OIDS
        /*
         * stawidth is the average width in bytes of non-null entries.  For
         * fixed-width datatypes this is of course the same as the typlen, but
-        * for var-width types it is more useful.  Note that this is the average
-        * width of the data as actually stored, post-TOASTing (eg, for a
-        * moved-out-of-line value, only the size of the pointer object is
-        * counted).  This is the appropriate definition for the primary use
-        * of the statistic, which is to estimate sizes of in-memory hash
+        * for var-width types it is more useful.  Note that this is the
+        * average width of the data as actually stored, post-TOASTing (eg,
+        * for a moved-out-of-line value, only the size of the pointer object
+        * is counted).  This is the appropriate definition for the primary
+        * use of the statistic, which is to estimate sizes of in-memory hash
         * tables of tuples.
         */
        int4            stawidth;
index 5b4e15c..09ebbe5 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_type.h,v 1.132 2002/08/29 04:38:04 tgl Exp $
+ * $Id: pg_type.h,v 1.133 2002/09/04 20:31:42 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -45,8 +45,8 @@ CATALOG(pg_type) BOOTSTRAP
        /*
         * For a fixed-size type, typlen is the number of bytes we use to
         * represent a value of this type, e.g. 4 for an int4.  But for a
-        * variable-length type, typlen is negative.  We use -1 to indicate
-        * "varlena" type (one that has a length word), -2 to indicate a
+        * variable-length type, typlen is negative.  We use -1 to indicate a
+        * "varlena" type (one that has a length word), -2 to indicate a
         * null-terminated C string.
         */
        int2            typlen;
@@ -65,7 +65,8 @@ CATALOG(pg_type) BOOTSTRAP
         * typtype is 'b' for a basic type, 'c' for a complex type (ie a
         * table's rowtype), 'd' for a domain type, or 'p' for a pseudo type.
         *
-        * If typtype is 'c', typrelid is the OID of the class' entry in pg_class.
+        * If typtype is 'c', typrelid is the OID of the class' entry in
+        * pg_class.
         */
        char            typtype;
 
@@ -146,8 +147,8 @@ CATALOG(pg_type) BOOTSTRAP
        bool            typnotnull;
 
        /*
-        * Domains use typbasetype to show the base (or complex) type that
-        * the domain is based on.  Zero if the type is not a domain.
+        * Domains use typbasetype to show the base (or complex) type that the
+        * domain is based on.  Zero if the type is not a domain.
         */
        Oid                     typbasetype;
 
@@ -156,14 +157,14 @@ CATALOG(pg_type) BOOTSTRAP
         * time (for example, the max length of a varchar field).  It is
         * passed to type-specific input and output functions as the third
         * argument. The value will generally be -1 for types that do not need
-        * typmod.  This value is copied to pg_attribute.atttypmod when
+        * typmod.      This value is copied to pg_attribute.atttypmod when
         * creating a column of a domain type.
         */
        int4            typtypmod;
 
        /*
-        * typndims is the declared number of dimensions for a domain type that
-        * is an array (with element type typbasetype).  Otherwise zero.
+        * typndims is the declared number of dimensions for a domain type
+        * that is an array (with element type typbasetype).  Otherwise zero.
         */
        int4            typndims;
 
@@ -177,10 +178,10 @@ CATALOG(pg_type) BOOTSTRAP
        /*
         * typdefault is NULL if the type has no associated default value. If
         * typdefaultbin is not NULL, typdefault must contain a human-readable
-        * version of the default expression represented by typdefaultbin.
-        * If typdefaultbin is NULL and typdefault is not, then typdefault is
-        * the external representation of the type's default value, which may
-        * be fed to the type's input converter to produce a constant.
+        * version of the default expression represented by typdefaultbin. If
+        * typdefaultbin is NULL and typdefault is not, then typdefault is the
+        * external representation of the type's default value, which may be
+        * fed to the type's input converter to produce a constant.
         */
        text            typdefault;             /* VARIABLE LENGTH FIELD */
 
@@ -233,27 +234,27 @@ typedef FormData_pg_type *Form_pg_type;
 */
 
 /* OIDS 1 - 99 */
-DATA(insert OID = 16 ( bool       PGNSP PGUID  1 t b t \054 0   0 boolin boolout c p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 16 ( bool       PGNSP PGUID  1 t b t \054 0   0 boolin boolout c p f 0 -1 0 _null_ _null_ ));
 DESCR("boolean, 'true'/'false'");
 #define BOOLOID                        16
 
-DATA(insert OID = 17 ( bytea      PGNSP PGUID -1 f b t \054 0  0 byteain byteaout i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 17 ( bytea      PGNSP PGUID -1 f b t \054 0  0 byteain byteaout i x f 0 -1 0 _null_ _null_ ));
 DESCR("variable-length string, binary values escaped");
 #define BYTEAOID               17
 
-DATA(insert OID = 18 ( char       PGNSP PGUID  1 t b t \054 0   0 charin charout c p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 18 ( char       PGNSP PGUID  1 t b t \054 0   0 charin charout c p f 0 -1 0 _null_ _null_ ));
 DESCR("single character");
 #define CHAROID                        18
 
-DATA(insert OID = 19 ( name       PGNSP PGUID NAMEDATALEN f b t \054 0 18 namein nameout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 19 ( name       PGNSP PGUID NAMEDATALEN f b t \054 0 18 namein nameout i p f 0 -1 0 _null_ _null_ ));
 DESCR("31-character type for storing system identifiers");
 #define NAMEOID                        19
 
-DATA(insert OID = 20 ( int8       PGNSP PGUID  8 f b t \054 0   0 int8in int8out d p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 20 ( int8       PGNSP PGUID  8 f b t \054 0   0 int8in int8out d p f 0 -1 0 _null_ _null_ ));
 DESCR("~18 digit integer, 8-byte storage");
 #define INT8OID                        20
 
-DATA(insert OID = 21 ( int2       PGNSP PGUID  2 t b t \054 0   0 int2in int2out s p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 21 ( int2       PGNSP PGUID  2 t b t \054 0   0 int2in int2out s p f 0 -1 0 _null_ _null_ ));
 DESCR("-32 thousand to 32 thousand, 2-byte storage");
 #define INT2OID                        21
 
@@ -261,31 +262,31 @@ DATA(insert OID = 22 (    int2vector PGNSP PGUID INDEX_MAX_KEYS*2 f b t \054 0  21
 DESCR("array of INDEX_MAX_KEYS int2 integers, used in system tables");
 #define INT2VECTOROID  22
 
-DATA(insert OID = 23 ( int4       PGNSP PGUID  4 t b t \054 0   0 int4in int4out i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 23 ( int4       PGNSP PGUID  4 t b t \054 0   0 int4in int4out i p f 0 -1 0 _null_ _null_ ));
 DESCR("-2 billion to 2 billion integer, 4-byte storage");
 #define INT4OID                        23
 
-DATA(insert OID = 24 ( regproc    PGNSP PGUID  4 t b t \054 0   0 regprocin regprocout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 24 ( regproc    PGNSP PGUID  4 t b t \054 0   0 regprocin regprocout i p f 0 -1 0 _null_ _null_ ));
 DESCR("registered procedure");
 #define REGPROCOID             24
 
-DATA(insert OID = 25 ( text       PGNSP PGUID -1 f b t \054 0  0 textin textout i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 25 ( text       PGNSP PGUID -1 f b t \054 0  0 textin textout i x f 0 -1 0 _null_ _null_ ));
 DESCR("variable-length string, no limit specified");
 #define TEXTOID                        25
 
-DATA(insert OID = 26 ( oid                PGNSP PGUID  4 t b t \054 0   0 oidin oidout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 26 ( oid                PGNSP PGUID  4 t b t \054 0   0 oidin oidout i p f 0 -1 0 _null_ _null_ ));
 DESCR("object identifier(oid), maximum 4 billion");
 #define OIDOID                 26
 
-DATA(insert OID = 27 ( tid                PGNSP PGUID  6 f b t \054 0   0 tidin tidout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 27 ( tid                PGNSP PGUID  6 f b t \054 0   0 tidin tidout i p f 0 -1 0 _null_ _null_ ));
 DESCR("(Block, offset), physical location of tuple");
 #define TIDOID         27
 
-DATA(insert OID = 28 ( xid                PGNSP PGUID  4 t b t \054 0   0 xidin xidout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 28 ( xid                PGNSP PGUID  4 t b t \054 0   0 xidin xidout i p f 0 -1 0 _null_ _null_ ));
 DESCR("transaction id");
 #define XIDOID 28
 
-DATA(insert OID = 29 ( cid                PGNSP PGUID  4 t b t \054 0   0 cidin cidout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 29 ( cid                PGNSP PGUID  4 t b t \054 0   0 cidin cidout i p f 0 -1 0 _null_ _null_ ));
 DESCR("command identifier type, sequence in transaction id");
 #define CIDOID 29
 
@@ -293,7 +294,7 @@ DATA(insert OID = 30 (      oidvector  PGNSP PGUID INDEX_MAX_KEYS*4 f b t \054 0  26
 DESCR("array of INDEX_MAX_KEYS oids, used in system tables");
 #define OIDVECTOROID   30
 
-DATA(insert OID = 32 ( SET                PGNSP PGUID -1 f b t \054 0   0 unknownin unknownout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 32 ( SET                PGNSP PGUID -1 f b t \054 0   0 unknownin unknownout i p f 0 -1 0 _null_ _null_ ));
 DESCR("set of tuples");
 
 DATA(insert OID = 71 ( pg_type          PGNSP PGUID 4 t c t \054 1247 0 record_in record_out i p f 0 -1 0 _null_ _null_ ));
@@ -330,54 +331,54 @@ DESCR("geometric path '(pt1,...)'");
 DATA(insert OID = 603 (  box      PGNSP PGUID 32 f b t \073 0 600 box_in box_out d p f 0 -1 0 _null_ _null_ ));
 DESCR("geometric box '(lower left,upper right)'");
 #define BOXOID                 603
-DATA(insert OID = 604 (  polygon   PGNSP PGUID -1 f b t \054 0   0 poly_in poly_out d x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 604 (  polygon   PGNSP PGUID -1 f b t \054 0  0 poly_in poly_out d x f 0 -1 0 _null_ _null_ ));
 DESCR("geometric polygon '(pt1,...)'");
 #define POLYGONOID             604
 
 DATA(insert OID = 628 (  line     PGNSP PGUID 32 f b t \054 0 701 line_in line_out d p f 0 -1 0 _null_ _null_ ));
 DESCR("geometric line (not implemented)'");
 #define LINEOID                        628
-DATA(insert OID = 629 (  _line    PGNSP PGUID  -1 f b t \054 0 628 array_in array_out d x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 629 (  _line    PGNSP PGUID  -1 f b t \054 0 628 array_in array_out d x f 0 -1 0 _null_ _null_ ));
 DESCR("");
 
 /* OIDS 700 - 799 */
 
-DATA(insert OID = 700 (  float4    PGNSP PGUID  4 f b t \054 0   0 float4in float4out i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 700 (  float4    PGNSP PGUID 4 f b t \054 0   0 float4in float4out i p f 0 -1 0 _null_ _null_ ));
 DESCR("single-precision floating point number, 4-byte storage");
 #define FLOAT4OID 700
-DATA(insert OID = 701 (  float8    PGNSP PGUID  8 f b t \054 0   0 float8in float8out d p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 701 (  float8    PGNSP PGUID 8 f b t \054 0   0 float8in float8out d p f 0 -1 0 _null_ _null_ ));
 DESCR("double-precision floating point number, 8-byte storage");
 #define FLOAT8OID 701
-DATA(insert OID = 702 (  abstime   PGNSP PGUID  4 t b t \054 0   0 nabstimein nabstimeout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 702 (  abstime   PGNSP PGUID 4 t b t \054 0   0 nabstimein nabstimeout i p f 0 -1 0 _null_ _null_ ));
 DESCR("absolute, limited-range date and time (Unix system time)");
 #define ABSTIMEOID             702
-DATA(insert OID = 703 (  reltime   PGNSP PGUID  4 t b t \054 0   0 reltimein reltimeout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 703 (  reltime   PGNSP PGUID 4 t b t \054 0   0 reltimein reltimeout i p f 0 -1 0 _null_ _null_ ));
 DESCR("relative, limited-range time interval (Unix delta time)");
 #define RELTIMEOID             703
-DATA(insert OID = 704 (  tinterval PGNSP PGUID 12 f b t \054 0   0 tintervalin tintervalout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 704 (  tinterval PGNSP PGUID 12 f b t \054 0  0 tintervalin tintervalout i p f 0 -1 0 _null_ _null_ ));
 DESCR("(abstime,abstime), time interval");
 #define TINTERVALOID   704
-DATA(insert OID = 705 (  unknown   PGNSP PGUID -1 f b t \054 0   0 unknownin unknownout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 705 (  unknown   PGNSP PGUID -1 f b t \054 0  0 unknownin unknownout i p f 0 -1 0 _null_ _null_ ));
 DESCR("");
 #define UNKNOWNOID             705
 
-DATA(insert OID = 718 (  circle    PGNSP PGUID  24 f b t \054 0        0 circle_in circle_out d p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 718 (  circle    PGNSP PGUID 24 f b t \054 0 0 circle_in circle_out d p f 0 -1 0 _null_ _null_ ));
 DESCR("geometric circle '(center,radius)'");
 #define CIRCLEOID              718
-DATA(insert OID = 719 (  _circle   PGNSP PGUID  -1 f b t \054 0  718 array_in array_out d x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 790 (  money    PGNSP PGUID   4 f b t \054 0 0 cash_in cash_out i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 719 (  _circle   PGNSP PGUID -1 f b t \054 0  718 array_in array_out d x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 790 (  money    PGNSP PGUID   4 f b t \054 0 0 cash_in cash_out i p f 0 -1 0 _null_ _null_ ));
 DESCR("$d,ddd.cc, money");
 #define CASHOID 790
-DATA(insert OID = 791 (  _money    PGNSP PGUID  -1 f b t \054 0  790 array_in array_out i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 791 (  _money    PGNSP PGUID -1 f b t \054 0  790 array_in array_out i x f 0 -1 0 _null_ _null_ ));
 
 /* OIDS 800 - 899 */
-DATA(insert OID = 829 ( macaddr    PGNSP PGUID  6 f b t \054 0 0 macaddr_in macaddr_out i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 829 ( macaddr    PGNSP PGUID 6 f b t \054 0 0 macaddr_in macaddr_out i p f 0 -1 0 _null_ _null_ ));
 DESCR("XX:XX:XX:XX:XX:XX, MAC address");
 #define MACADDROID 829
-DATA(insert OID = 869 ( inet      PGNSP PGUID  -1 f b t \054 0 0 inet_in inet_out i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 869 ( inet      PGNSP PGUID  -1 f b t \054 0 0 inet_in inet_out i p f 0 -1 0 _null_ _null_ ));
 DESCR("IP address/netmask, host address, netmask optional");
 #define INETOID 869
-DATA(insert OID = 650 ( cidr      PGNSP PGUID  -1 f b t \054 0 0 cidr_in cidr_out i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 650 ( cidr      PGNSP PGUID  -1 f b t \054 0 0 cidr_in cidr_out i p f 0 -1 0 _null_ _null_ ));
 DESCR("network IP address/netmask, network address");
 #define CIDROID 650
 
@@ -416,8 +417,8 @@ DESCR("access control list");
 #define ACLITEMOID             1033
 DATA(insert OID = 1034 (  _aclitem      PGNSP PGUID -1 f b t \054 0 1033 array_in array_out i x f 0 -1 0 _null_ _null_ ));
 DATA(insert OID = 1040 (  _macaddr      PGNSP PGUID -1 f b t \054 0  829 array_in array_out i x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 1041 (  _inet    PGNSP PGUID -1 f b t \054 0  869 array_in array_out i x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 651  (  _cidr    PGNSP PGUID -1 f b t \054 0  650 array_in array_out i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 1041 (  _inet    PGNSP PGUID -1 f b t \054 0 869 array_in array_out i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 651  (  _cidr    PGNSP PGUID -1 f b t \054 0 650 array_in array_out i x f 0 -1 0 _null_ _null_ ));
 DATA(insert OID = 1042 ( bpchar                 PGNSP PGUID -1 f b t \054 0    0 bpcharin bpcharout i x f 0 -1 0 _null_ _null_ ));
 DESCR("char(length), blank-padded string, fixed storage length");
 #define BPCHAROID              1042
@@ -436,9 +437,9 @@ DESCR("hh:mm:ss, ANSI SQL time");
 DATA(insert OID = 1114 ( timestamp      PGNSP PGUID    8 f b t \054 0  0 timestamp_in timestamp_out d p f 0 -1 0 _null_ _null_ ));
 DESCR("date and time");
 #define TIMESTAMPOID   1114
-DATA(insert OID = 1115 ( _timestamp  PGNSP PGUID       -1 f b t \054 0 1114 array_in array_out d x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 1182 ( _date          PGNSP PGUID    -1 f b t \054 0 1082 array_in array_out i x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 1183 ( _time          PGNSP PGUID    -1 f b t \054 0 1083 array_in array_out d x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 1115 ( _timestamp  PGNSP PGUID       -1 f b t \054 0 1114 array_in array_out d x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 1182 ( _date          PGNSP PGUID    -1 f b t \054 0 1082 array_in array_out i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 1183 ( _time          PGNSP PGUID    -1 f b t \054 0 1083 array_in array_out d x f 0 -1 0 _null_ _null_ ));
 DATA(insert OID = 1184 ( timestamptz PGNSP PGUID       8 f b t \054 0  0 timestamptz_in timestamptz_out d p f 0 -1 0 _null_ _null_ ));
 DESCR("date and time with time zone");
 #define TIMESTAMPTZOID 1184
@@ -446,7 +447,7 @@ DATA(insert OID = 1185 ( _timestamptz PGNSP PGUID -1 f b t \054 0   1184 array_in
 DATA(insert OID = 1186 ( interval       PGNSP PGUID 12 f b t \054 0    0 interval_in interval_out d p f 0 -1 0 _null_ _null_ ));
 DESCR("@ <number> <units>, time interval");
 #define INTERVALOID            1186
-DATA(insert OID = 1187 ( _interval      PGNSP PGUID    -1 f b t \054 0 1186 array_in array_out d x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 1187 ( _interval      PGNSP PGUID    -1 f b t \054 0 1186 array_in array_out d x f 0 -1 0 _null_ _null_ ));
 
 /* OIDS 1200 - 1299 */
 DATA(insert OID = 1231 (  _numeric      PGNSP PGUID -1 f b t \054 0    1700 array_in array_out i x f 0 -1 0 _null_ _null_ ));
@@ -468,45 +469,45 @@ DATA(insert OID = 1563 ( _varbit   PGNSP PGUID -1 f b t \054 0    1562 array_in arra
 /* OIDS 1600 - 1699 */
 
 /* OIDS 1700 - 1799 */
-DATA(insert OID = 1700 ( numeric          PGNSP PGUID -1 f b t \054 0  0 numeric_in numeric_out i m f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 1700 ( numeric          PGNSP PGUID -1 f b t \054 0  0 numeric_in numeric_out i m f 0 -1 0 _null_ _null_ ));
 DESCR("numeric(precision, decimal), arbitrary precision number");
 #define NUMERICOID             1700
 
-DATA(insert OID = 1790 ( refcursor        PGNSP PGUID -1 f b t \054 0  0 textin textout i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 1790 ( refcursor        PGNSP PGUID -1 f b t \054 0  0 textin textout i x f 0 -1 0 _null_ _null_ ));
 DESCR("reference cursor (portal name)");
 #define REFCURSOROID   1790
 
 /* OIDS 2200 - 2299 */
-DATA(insert OID = 2201 ( _refcursor       PGNSP PGUID -1 f b t \054 0 1790 array_in array_out i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2201 ( _refcursor    PGNSP PGUID -1 f b t \054 0 1790 array_in array_out i x f 0 -1 0 _null_ _null_ ));
 
-DATA(insert OID = 2202 ( regprocedure  PGNSP PGUID  4 t b t \054 0   0 regprocedurein regprocedureout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2202 ( regprocedure  PGNSP PGUID     4 t b t \054 0   0 regprocedurein regprocedureout i p f 0 -1 0 _null_ _null_ ));
 DESCR("registered procedure (with args)");
-#define REGPROCEDUREOID        2202
+#define REGPROCEDUREOID 2202
 
-DATA(insert OID = 2203 ( regoper       PGNSP PGUID  4 t b t \054 0   0 regoperin regoperout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2203 ( regoper          PGNSP PGUID  4 t b t \054 0   0 regoperin regoperout i p f 0 -1 0 _null_ _null_ ));
 DESCR("registered operator");
 #define REGOPEROID             2203
 
-DATA(insert OID = 2204 ( regoperator   PGNSP PGUID  4 t b t \054 0   0 regoperatorin regoperatorout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2204 ( regoperator   PGNSP PGUID     4 t b t \054 0   0 regoperatorin regoperatorout i p f 0 -1 0 _null_ _null_ ));
 DESCR("registered operator (with args)");
 #define REGOPERATOROID 2204
 
-DATA(insert OID = 2205 ( regclass      PGNSP PGUID  4 t b t \054 0   0 regclassin regclassout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2205 ( regclass         PGNSP PGUID  4 t b t \054 0   0 regclassin regclassout i p f 0 -1 0 _null_ _null_ ));
 DESCR("registered class");
 #define REGCLASSOID            2205
 
-DATA(insert OID = 2206 ( regtype       PGNSP PGUID  4 t b t \054 0   0 regtypein regtypeout i p f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2206 ( regtype          PGNSP PGUID  4 t b t \054 0   0 regtypein regtypeout i p f 0 -1 0 _null_ _null_ ));
 DESCR("registered type");
 #define REGTYPEOID             2206
 
 DATA(insert OID = 2207 ( _regprocedure PGNSP PGUID -1 f b t \054 0 2202 array_in array_out i x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 2208 ( _regoper      PGNSP PGUID -1 f b t \054 0 2203 array_in array_out i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2208 ( _regoper         PGNSP PGUID -1 f b t \054 0 2203 array_in array_out i x f 0 -1 0 _null_ _null_ ));
 DATA(insert OID = 2209 ( _regoperator  PGNSP PGUID -1 f b t \054 0 2204 array_in array_out i x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 2210 ( _regclass     PGNSP PGUID -1 f b t \054 0 2205 array_in array_out i x f 0 -1 0 _null_ _null_ ));
-DATA(insert OID = 2211 ( _regtype      PGNSP PGUID -1 f b t \054 0 2206 array_in array_out i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2210 ( _regclass        PGNSP PGUID -1 f b t \054 0 2205 array_in array_out i x f 0 -1 0 _null_ _null_ ));
+DATA(insert OID = 2211 ( _regtype         PGNSP PGUID -1 f b t \054 0 2206 array_in array_out i x f 0 -1 0 _null_ _null_ ));
 
 /*
- * pseudo-types 
+ * pseudo-types
  *
  * types with typtype='p' represent various special cases in the type system.
  *
@@ -561,7 +562,7 @@ extern Oid TypeCreate(const char *typeName,
 
 
 extern void TypeRename(const char *oldTypeName, Oid typeNamespace,
-                                          const char *newTypeName);
+                  const char *newTypeName);
 extern char *makeArrayTypeName(const char *typeName);
 
 #endif   /* PG_TYPE_H */
index 87c8c8f..eedc260 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: conversioncmds.h,v 1.2 2002/07/25 10:07:13 ishii Exp $
+ * $Id: conversioncmds.h,v 1.3 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -20,4 +20,4 @@
 extern void CreateConversionCommand(CreateConversionStmt *parsetree);
 extern void DropConversionCommand(List *conversion_name, DropBehavior behavior);
 
-#endif  /* CONVERSIONCMDS_H */
+#endif   /* CONVERSIONCMDS_H */
index c7bc988..dcfce2f 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: copy.h,v 1.19 2002/06/20 20:29:49 momjian Exp $
+ * $Id: copy.h,v 1.20 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,6 +19,6 @@
 
 extern int     copy_lineno;
 
-void DoCopy(const CopyStmt *stmt);
+void           DoCopy(const CopyStmt *stmt);
 
 #endif   /* COPY_H */
index 3de3390..e135d68 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: defrem.h,v 1.44 2002/08/15 16:36:07 momjian Exp $
+ * $Id: defrem.h,v 1.45 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,7 +58,7 @@ extern void RemoveType(List *names, DropBehavior behavior);
 extern void RemoveTypeById(Oid typeOid);
 extern void DefineDomain(CreateDomainStmt *stmt);
 extern void RemoveDomain(List *names, DropBehavior behavior);
-extern Oid DefineCompositeType(const RangeVar *typevar, List *coldeflist);
+extern Oid     DefineCompositeType(const RangeVar *typevar, List *coldeflist);
 
 extern void DefineOpClass(CreateOpClassStmt *stmt);
 extern void RemoveOpClass(RemoveOpClassStmt *stmt);
index 04335c3..d4be4fe 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: lockcmds.h,v 1.1 2002/04/15 05:22:03 tgl Exp $
+ * $Id: lockcmds.h,v 1.2 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,4 +21,4 @@
  */
 extern void LockTableCommand(LockStmt *lockstmt);
 
-#endif  /* LOCKCMDS_H */
+#endif   /* LOCKCMDS_H */
index b62e363..9611cb4 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: portalcmds.h,v 1.1 2002/04/15 05:22:03 tgl Exp $
+ * $Id: portalcmds.h,v 1.2 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,7 +26,7 @@
  *             "ERROR" if portal not found.
  */
 extern void PerformPortalFetch(char *name, bool forward, int count,
-                                                          CommandDest dest, char *completionTag);
+                                  CommandDest dest, char *completionTag);
 
 /*
  * PerformPortalClose
@@ -36,4 +36,4 @@ extern void PerformPortalClose(char *name, CommandDest dest);
 
 extern void PortalCleanup(Portal portal);
 
-#endif  /* PORTALCMDS_H */
+#endif   /* PORTALCMDS_H */
index 6af60fe..884236f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 2002, PostgreSQL Global Development Group
  *
- * $Id: prepare.h,v 1.1 2002/08/27 04:55:11 tgl Exp $
+ * $Id: prepare.h,v 1.2 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,4 +26,4 @@ extern void DeallocateQuery(DeallocateStmt *stmt);
 
 extern List *FetchQueryParams(const char *plan_name);
 
-#endif /* PREPARE_H */
+#endif   /* PREPARE_H */
index 6320550..b7538d0 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: schemacmds.h,v 1.2 2002/07/18 16:47:26 tgl Exp $
+ * $Id: schemacmds.h,v 1.3 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -22,4 +22,4 @@ extern void CreateSchemaCommand(CreateSchemaStmt *parsetree);
 extern void RemoveSchema(List *names, DropBehavior behavior);
 extern void RemoveSchemaById(Oid schemaOid);
 
-#endif  /* SCHEMACMDS_H */
+#endif   /* SCHEMACMDS_H */
index 481a07e..b4bb0f0 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tablecmds.h,v 1.6 2002/08/30 19:23:20 tgl Exp $
+ * $Id: tablecmds.h,v 1.7 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "nodes/parsenodes.h"
 
 extern void AlterTableAddColumn(Oid myrelid, bool recurse, bool recursing,
-                                                               ColumnDef *colDef);
+                                       ColumnDef *colDef);
 
 extern void AlterTableAlterColumnDropNotNull(Oid myrelid, bool recurse,
-                                                                                        const char *colName);
+                                                                const char *colName);
 
 extern void AlterTableAlterColumnSetNotNull(Oid myrelid, bool recurse,
-                                                                                       const char *colName);
+                                                               const char *colName);
 
 extern void AlterTableAlterColumnDefault(Oid myrelid, bool recurse,
-                                                                                const char *colName,
-                                                                                Node *newDefault);
+                                                        const char *colName,
+                                                        Node *newDefault);
 
 extern void AlterTableAlterColumnFlags(Oid myrelid, bool recurse,
-                                                                          const char *colName,
-                                                                          Node *flagValue, const char *flagType);
+                                                  const char *colName,
+                                                  Node *flagValue, const char *flagType);
 
 extern void AlterTableDropColumn(Oid myrelid, bool recurse, bool recursing,
-                                                                const char *colName,
-                                                                DropBehavior behavior);
+                                        const char *colName,
+                                        DropBehavior behavior);
 
 extern void AlterTableAddConstraint(Oid myrelid, bool recurse,
-                                                                       List *newConstraints);
+                                               List *newConstraints);
 
 extern void AlterTableDropConstraint(Oid myrelid, bool recurse,
-                                                                        const char *constrName,
-                                                                        DropBehavior behavior);
+                                                const char *constrName,
+                                                DropBehavior behavior);
 
 extern void AlterTableCreateToastTable(Oid relOid, bool silent);
 
index b9308cd..cf1a6b6 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: trigger.h,v 1.37 2002/07/12 18:43:19 tgl Exp $
+ * $Id: trigger.h,v 1.38 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -77,22 +77,23 @@ typedef struct TriggerData
 
 /*
  * RI trigger function arguments are stored in pg_trigger.tgargs bytea
- * 
- *   constrname\0fkrel\0pkrel\0matchtype\0fkatt\0pkatt\0fkatt\0pkatt\0...
+ *
+ *      constrname\0fkrel\0pkrel\0matchtype\0fkatt\0pkatt\0fkatt\0pkatt\0...
  *
  * There are one or more pairs of fkatt/pkatt names.
  *
  * The relation names are no longer of much use since they are not
  * guaranteed unique; they are present only for backwards compatibility.
  * Use the tgrelid and tgconstrrelid fields to identify the referenced
- * relations, instead.  (But note that which is which will depend on which
+ * relations, instead. (But note that which is which will depend on which
  * trigger you are looking at!)
  */
 #define RI_CONSTRAINT_NAME_ARGNO               0
 #define RI_FK_RELNAME_ARGNO                            1
 #define RI_PK_RELNAME_ARGNO                            2
 #define RI_MATCH_TYPE_ARGNO                            3
-#define RI_FIRST_ATTNAME_ARGNO                 4 /* first attname pair starts here */
+#define RI_FIRST_ATTNAME_ARGNO                 4               /* first attname pair
+                                                                                                * starts here */
 
 #define RI_KEYPAIR_FK_IDX                              0
 #define RI_KEYPAIR_PK_IDX                              1
@@ -104,7 +105,7 @@ typedef struct TriggerData
 extern Oid     CreateTrigger(CreateTrigStmt *stmt, bool forConstraint);
 
 extern void DropTrigger(Oid relid, const char *trigname,
-                                               DropBehavior behavior);
+                       DropBehavior behavior);
 extern void RemoveTriggerById(Oid trigOid);
 
 extern void renametrig(Oid relid, const char *oldname, const char *newname);
index 046e022..37d2c0f 100644 (file)
@@ -3,7 +3,7 @@
  * user.h
  *
  *
- * $Id: user.h,v 1.18 2002/04/04 04:25:53 momjian Exp $
+ * $Id: user.h,v 1.19 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -15,7 +15,7 @@
 
 #define PWD_FILE       "pg_pwd"
 
-#define USER_GROUP_FILE        "pg_group"
+#define USER_GROUP_FILE "pg_group"
 
 
 extern char *group_getfilename(void);
index bdca5c8..7368717 100644 (file)
@@ -2,31 +2,31 @@
  * variable.h
  *             Routines for handling specialized SET variables.
  *
- * $Id: variable.h,v 1.18 2002/05/17 01:19:19 tgl Exp $
+ * $Id: variable.h,v 1.19 2002/09/04 20:31:42 momjian Exp $
  *
  */
 #ifndef VARIABLE_H
 #define VARIABLE_H
 
 extern const char *assign_datestyle(const char *value,
-                                                                       bool doit, bool interactive);
+                                bool doit, bool interactive);
 extern const char *show_datestyle(void);
 extern const char *assign_timezone(const char *value,
-                                                                  bool doit, bool interactive);
+                               bool doit, bool interactive);
 extern const char *show_timezone(void);
 extern const char *assign_XactIsoLevel(const char *value,
-                                                                          bool doit, bool interactive);
+                                       bool doit, bool interactive);
 extern const char *show_XactIsoLevel(void);
 extern bool assign_random_seed(double value,
-                                                          bool doit, bool interactive);
+                                  bool doit, bool interactive);
 extern const char *show_random_seed(void);
 extern const char *assign_client_encoding(const char *value,
-                                                                                 bool doit, bool interactive);
+                                          bool doit, bool interactive);
 extern const char *assign_server_encoding(const char *value,
-                                                                                 bool doit, bool interactive);
+                                          bool doit, bool interactive);
 extern const char *show_server_encoding(void);
 extern const char *assign_session_authorization(const char *value,
-                                                                                               bool doit, bool interactive);
+                                                        bool doit, bool interactive);
 extern const char *show_session_authorization(void);
 
 #endif   /* VARIABLE_H */
index 8654746..363dabe 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: execdesc.h,v 1.19 2002/06/20 20:29:49 momjian Exp $
+ * $Id: execdesc.h,v 1.20 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -39,7 +39,7 @@ typedef struct QueryDesc
 
 /* in pquery.c */
 extern QueryDesc *CreateQueryDesc(Query *parsetree, Plan *plantree,
-                                                                 CommandDest dest, const char *portalName);
+                               CommandDest dest, const char *portalName);
 
 
 #endif   /* EXECDESC_H  */
index f2fa818..a12c31b 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: executor.h,v 1.77 2002/09/02 01:05:06 tgl Exp $
+ * $Id: executor.h,v 1.78 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -50,7 +50,7 @@ extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot);
  */
 extern TupleDesc ExecutorStart(QueryDesc *queryDesc, EState *estate);
 extern TupleTableSlot *ExecutorRun(QueryDesc *queryDesc, EState *estate,
-                                                                  ScanDirection direction, long count);
+                       ScanDirection direction, long count);
 extern void ExecutorEnd(QueryDesc *queryDesc, EState *estate);
 extern void ExecConstraints(const char *caller, ResultRelInfo *resultRelInfo,
                                TupleTableSlot *slot, EState *estate);
@@ -81,9 +81,9 @@ extern Datum ExecMakeFunctionResult(FunctionCachePtr fcache,
                                           bool *isNull,
                                           ExprDoneCond *isDone);
 extern Tuplestorestate *ExecMakeTableFunctionResult(Expr *funcexpr,
-                                                                                                       ExprContext *econtext,
-                                                                                                       TupleDesc expectedDesc,
-                                                                                                       TupleDesc *returnDesc);
+                                                       ExprContext *econtext,
+                                                       TupleDesc expectedDesc,
+                                                       TupleDesc *returnDesc);
 extern Datum ExecEvalExpr(Node *expression, ExprContext *econtext,
                         bool *isNull, ExprDoneCond *isDone);
 extern Datum ExecEvalExprSwitchContext(Node *expression, ExprContext *econtext,
@@ -201,10 +201,10 @@ extern void ExecInsertIndexTuples(TupleTableSlot *slot, ItemPointer tupleid,
                                          EState *estate, bool is_vacuum);
 
 extern void RegisterExprContextCallback(ExprContext *econtext,
-                                                                               ExprContextCallbackFunction function,
-                                                                               Datum arg);
+                                                       ExprContextCallbackFunction function,
+                                                       Datum arg);
 extern void UnregisterExprContextCallback(ExprContext *econtext,
-                                                                                 ExprContextCallbackFunction function,
-                                                                                 Datum arg);
+                                                         ExprContextCallbackFunction function,
+                                                         Datum arg);
 
 #endif   /* EXECUTOR_H  */
index 7b04a1d..a421ba9 100644 (file)
@@ -11,7 +11,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: fmgr.h,v 1.23 2002/08/30 00:28:41 tgl Exp $
+ * $Id: fmgr.h,v 1.24 2002/09/04 20:31:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -134,16 +134,16 @@ extern void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo,
  */
 extern struct varlena *pg_detoast_datum(struct varlena * datum);
 extern struct varlena *pg_detoast_datum_copy(struct varlena * datum);
-extern struct varlena *pg_detoast_datum_slice(struct varlena * datum, 
-                                                                                         int32 first, int32 count); 
+extern struct varlena *pg_detoast_datum_slice(struct varlena * datum,
+                                          int32 first, int32 count);
 
 #define PG_DETOAST_DATUM(datum) \
        pg_detoast_datum((struct varlena *) DatumGetPointer(datum))
 #define PG_DETOAST_DATUM_COPY(datum) \
        pg_detoast_datum_copy((struct varlena *) DatumGetPointer(datum))
 #define PG_DETOAST_DATUM_SLICE(datum,f,c) \
-        pg_detoast_datum_slice((struct varlena *) DatumGetPointer(datum), \
-        (int32) f, (int32) c)
+               pg_detoast_datum_slice((struct varlena *) DatumGetPointer(datum), \
+               (int32) f, (int32) c)
 
 /*
  * Support for cleaning up detoasted copies of inputs. This must only
@@ -192,8 +192,8 @@ extern struct varlena *pg_detoast_datum_slice(struct varlena * datum,
 #define DatumGetBpCharPCopy(X)         ((BpChar *) PG_DETOAST_DATUM_COPY(X))
 #define DatumGetVarCharPCopy(X)                ((VarChar *) PG_DETOAST_DATUM_COPY(X))
 /* Variants which return n bytes starting at pos. m */
-#define DatumGetByteaPSlice(X,m,n)  ((bytea *) PG_DETOAST_DATUM_SLICE(X,m,n))
-#define DatumGetTextPSlice(X,m,n)   ((text *) PG_DETOAST_DATUM_SLICE(X,m,n))
+#define DatumGetByteaPSlice(X,m,n)     ((bytea *) PG_DETOAST_DATUM_SLICE(X,m,n))
+#define DatumGetTextPSlice(X,m,n)      ((text *) PG_DETOAST_DATUM_SLICE(X,m,n))
 #define DatumGetBpCharPSlice(X,m,n) ((BpChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
 #define DatumGetVarCharPSlice(X,m,n) ((VarChar *) PG_DETOAST_DATUM_SLICE(X,m,n))
 /* GETARG macros for varlena types will typically look like this: */
index ba862b6..6430943 100644 (file)
@@ -9,7 +9,7 @@
  *
  * Copyright (c) 2002, PostgreSQL Global Development Group
  *
- * $Id: funcapi.h,v 1.7 2002/08/30 19:56:49 tgl Exp $
+ * $Id: funcapi.h,v 1.8 2002/09/04 20:31:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 typedef struct AttInMetadata
 {
        /* full TupleDesc */
-       TupleDesc          tupdesc;
+       TupleDesc       tupdesc;
 
        /* array of attribute type input function finfo */
-       FmgrInfo           *attinfuncs;
+       FmgrInfo   *attinfuncs;
 
        /* array of attribute type typelem */
-       Oid                        *attelems;
+       Oid                *attelems;
 
        /* array of attribute typmod */
-       int32              *atttypmods;
-}      AttInMetadata;
+       int32      *atttypmods;
+} AttInMetadata;
 
 /*-------------------------------------------------------------------------
  *             Support struct to ease writing Set Returning Functions (SRFs)
  *-------------------------------------------------------------------------
- * 
+ *
  * This struct holds function context for Set Returning Functions.
  * Use fn_extra to hold a pointer to it across calls
  */
@@ -58,59 +58,60 @@ typedef struct FuncCallContext
 {
        /*
         * Number of times we've been called before.
-        * 
+        *
         * call_cntr is initialized to 0 for you by SRF_FIRSTCALL_INIT(), and
         * incremented for you every time SRF_RETURN_NEXT() is called.
         */
-       uint32                  call_cntr;
+       uint32          call_cntr;
 
        /*
         * OPTIONAL maximum number of calls
         *
-        * max_calls is here for convenience ONLY and setting it is OPTIONAL.
-        * If not set, you must provide alternative means to know when the
+        * max_calls is here for convenience ONLY and setting it is OPTIONAL. If
+        * not set, you must provide alternative means to know when the
         * function is done.
         */
-       uint32                  max_calls;
+       uint32          max_calls;
 
        /*
         * OPTIONAL pointer to result slot
-        * 
-        * slot is for use when returning tuples (i.e. composite data types)
-        * and is not needed when returning base (i.e. scalar) data types.
+        *
+        * slot is for use when returning tuples (i.e. composite data types) and
+        * is not needed when returning base (i.e. scalar) data types.
         */
        TupleTableSlot *slot;
 
        /*
         * OPTIONAL pointer to misc user provided context info
-        * 
+        *
         * user_fctx is for use as a pointer to your own struct to retain
         * arbitrary context information between calls for your function.
         */
-       void               *user_fctx;
+       void       *user_fctx;
 
        /*
-        * OPTIONAL pointer to struct containing arrays of attribute type input
-        * metainfo
-        * 
+        * OPTIONAL pointer to struct containing arrays of attribute type
+        * input metainfo
+        *
         * attinmeta is for use when returning tuples (i.e. composite data types)
         * and is not needed when returning base (i.e. scalar) data types. It
-        * is ONLY needed if you intend to use BuildTupleFromCStrings() to create
-        * the return tuple.
+        * is ONLY needed if you intend to use BuildTupleFromCStrings() to
+        * create the return tuple.
         */
-       AttInMetadata      *attinmeta;
+       AttInMetadata *attinmeta;
 
        /*
-        * memory context used for structures which must live for multiple calls
+        * memory context used for structures which must live for multiple
+        * calls
         *
         * multi_call_memory_ctx is set by SRF_FIRSTCALL_INIT() for you, and used
         * by SRF_RETURN_DONE() for cleanup. It is the most appropriate memory
         * context for any memory that is to be re-used across multiple calls
         * of the SRF.
         */
-       MemoryContext   multi_call_memory_ctx;
+       MemoryContext multi_call_memory_ctx;
 
-}      FuncCallContext;
+} FuncCallContext;
 
 /*----------
  *     Support to ease writing Functions returning composite types
@@ -163,39 +164,37 @@ extern HeapTuple BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
  * Datum
  * my_Set_Returning_Function(PG_FUNCTION_ARGS)
  * {
- *     FuncCallContext    *funcctx;
- *     Datum                           result;
- *  MemoryContext              oldcontext;
- *     <user defined declarations>
- * 
- *     if (SRF_IS_FIRSTCALL())
- *     {
- *             funcctx = SRF_FIRSTCALL_INIT();
+ *     FuncCallContext    *funcctx;
+ *     Datum                           result;
+ *     MemoryContext           oldcontext;
+ *     <user defined declarations>
+ *
+ *     if (SRF_IS_FIRSTCALL())
+ *     {
+ *             funcctx = SRF_FIRSTCALL_INIT();
  *             // switch context when allocating stuff to be used in later calls
  *             oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
- *             <user defined code>
- *             <if returning composite>
- *                     <obtain slot>
- *                     funcctx->slot = slot;
- *             <endif returning composite>
- *             <user defined code>
+ *             <user defined code>
+ *             <if returning composite>
+ *                     <obtain slot>
+ *                     funcctx->slot = slot;
+ *             <endif returning composite>
+ *             <user defined code>
  *             // return to original context when allocating transient memory
  *             MemoryContextSwitchTo(oldcontext);
- *  }
- *     <user defined code>
- *     funcctx = SRF_PERCALL_SETUP();
- *     <user defined code>
- * 
- *     if (funcctx->call_cntr < funcctx->max_calls)
- *     {
- *             <user defined code>
- *             <obtain result Datum>
- *             SRF_RETURN_NEXT(funcctx, result);
- *     }
- *     else
- *     {
- *             SRF_RETURN_DONE(funcctx);
- *     }
+ *     }
+ *     <user defined code>
+ *     funcctx = SRF_PERCALL_SETUP();
+ *     <user defined code>
+ *
+ *     if (funcctx->call_cntr < funcctx->max_calls)
+ *     {
+ *             <user defined code>
+ *             <obtain result Datum>
+ *             SRF_RETURN_NEXT(funcctx, result);
+ *     }
+ *     else
+ *             SRF_RETURN_DONE(funcctx);
  * }
  *
  *----------
index d5328c7..246ab0b 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: crypt.h,v 1.21 2002/06/20 20:29:49 momjian Exp $
+ * $Id: crypt.h,v 1.22 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,6 +26,7 @@ extern int md5_crypt_verify(const Port *port, const char *user,
                                 const char *pgpass);
 extern bool md5_hash(const void *buff, size_t len, char *hexsum);
 extern bool CheckMD5Pwd(char *passwd, char *storedpwd, char *seed);
+
 /* Also defined in interfaces/odbc/md5.h */
 extern bool EncryptMD5(const char *passwd, const char *salt,
                   size_t salt_len, char *buf);
index 2bd0d37..4066c23 100644 (file)
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pqcomm.h,v 1.69 2002/08/29 03:22:01 tgl Exp $
+ * $Id: pqcomm.h,v 1.70 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -116,11 +116,11 @@ typedef uint32 PacketLen;
  * actual limits on database & user name will then be NAMEDATALEN, which
  * can be changed without changing the FE/BE protocol. -neilc,2002/08/27
  */
+
 #define SM_DATABASE            64
 #define SM_USER                        32
 /* We append database name if db_user_namespace true. */
-#define SM_DATABASE_USER (SM_DATABASE+SM_USER+1) /* +1 for @ */
+#define SM_DATABASE_USER (SM_DATABASE+SM_USER+1)               /* +1 for @ */
 #define SM_OPTIONS             64
 #define SM_UNUSED              64
 #define SM_TTY                 64
@@ -134,7 +134,7 @@ typedef struct StartupPacket
 {
        ProtocolVersion protoVersion;           /* Protocol version */
        char            database[SM_DATABASE];  /* Database name */
-                               /* Db_user_namespace appends dbname */
+       /* Db_user_namespace appends dbname */
        char            user[SM_USER];  /* User name */
        char            options[SM_OPTIONS];    /* Optional additional args */
        char            unused[SM_UNUSED];              /* Unused */
index 1456490..a73a162 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pg_wchar.h,v 1.43 2002/09/03 21:45:44 petere Exp $ */
+/* $Id: pg_wchar.h,v 1.44 2002/09/04 20:31:42 momjian Exp $ */
 
 #ifndef PG_WCHAR_H
 #define PG_WCHAR_H
@@ -181,8 +181,8 @@ typedef enum pg_enc
        /* followings are for client encoding only */
        PG_SJIS,                                        /* Shift JIS (Winindows-932) */
        PG_BIG5,                                        /* Big5 (Windows-950) */
-       PG_GBK,                                 /* GBK (Windows-936) */
-       PG_UHC,                                 /* UHC (Windows-949) */
+       PG_GBK,                                         /* GBK (Windows-936) */
+       PG_UHC,                                         /* UHC (Windows-949) */
        PG_WIN1250,                                     /* windows-1250 */
        PG_GB18030,                                     /* GB18030 */
        _PG_LAST_ENCODING_                      /* mark only */
@@ -293,7 +293,7 @@ extern int  pg_mbcharcliplen(const unsigned char *mbstr, int len, int imit);
 extern int     pg_encoding_max_length(int encoding);
 extern int     pg_database_encoding_max_length(void);
 
-extern void    SetDefaultClientEncoding(void);
+extern void SetDefaultClientEncoding(void);
 extern int     SetClientEncoding(int encoding, bool doit);
 extern int     pg_get_client_encoding(void);
 extern const char *pg_get_client_encoding_name(void);
@@ -307,8 +307,8 @@ extern int  pg_valid_server_encoding(const char *name);
 
 extern int     pg_utf_mblen(const unsigned char *);
 extern unsigned char *pg_do_encoding_conversion(unsigned char *src, int len,
-                                                                                               int src_encoding,
-                                                                                               int dest_encoding);
+                                                 int src_encoding,
+                                                 int dest_encoding);
 
 extern unsigned char *pg_client_to_server(unsigned char *s, int len);
 extern unsigned char *pg_server_to_client(unsigned char *s, int len);
@@ -317,19 +317,19 @@ extern unsigned short BIG5toCNS(unsigned short big5, unsigned char *lc);
 extern unsigned short CNStoBIG5(unsigned short cns, unsigned char lc);
 
 extern void LocalToUtf(unsigned char *iso, unsigned char *utf,
-                                          pg_local_to_utf *map, int size, int encoding, int len);
+                  pg_local_to_utf *map, int size, int encoding, int len);
 
 extern void UtfToLocal(unsigned char *utf, unsigned char *iso,
-                                          pg_utf_to_local *map, int size, int len);
+                  pg_utf_to_local *map, int size, int len);
 
-extern char       *pg_verifymbstr(const unsigned char *mbstr, int len);
+extern char *pg_verifymbstr(const unsigned char *mbstr, int len);
 
-extern void    pg_ascii2mic(unsigned char *src, unsigned char *dest, int len);
-extern void    pg_mic2ascii(unsigned char *src, unsigned char *dest, int len);
-extern void    pg_print_bogus_char(unsigned char **mic, unsigned char **p);
-extern void    latin2mic(unsigned char *l, unsigned char *p, int len, int lc);
-extern void    mic2latin(unsigned char *mic, unsigned char *p, int len, int lc);
-extern void    latin2mic_with_table(unsigned char *l, unsigned char *p, int len, int lc, unsigned char *tab);
-extern void    mic2latin_with_table(unsigned char *mic, unsigned char *p, int len, int lc, unsigned char *tab);
+extern void pg_ascii2mic(unsigned char *src, unsigned char *dest, int len);
+extern void pg_mic2ascii(unsigned char *src, unsigned char *dest, int len);
+extern void pg_print_bogus_char(unsigned char **mic, unsigned char **p);
+extern void latin2mic(unsigned char *l, unsigned char *p, int len, int lc);
+extern void mic2latin(unsigned char *mic, unsigned char *p, int len, int lc);
+extern void latin2mic_with_table(unsigned char *l, unsigned char *p, int len, int lc, unsigned char *tab);
+extern void mic2latin_with_table(unsigned char *mic, unsigned char *p, int len, int lc, unsigned char *tab);
 
 #endif   /* PG_WCHAR_H */
index 3769a9d..dbce60d 100644 (file)
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: miscadmin.h,v 1.108 2002/09/02 02:47:07 momjian Exp $
+ * $Id: miscadmin.h,v 1.109 2002/09/04 20:31:36 momjian Exp $
  *
  * NOTES
  *       some of the information in this file should be moved to
@@ -293,7 +293,7 @@ extern bool CreateDataDirLockFile(const char *datadir, bool amPostmaster);
 extern bool CreateSocketLockFile(const char *socketfile, bool amPostmaster);
 extern void TouchSocketLockFile(void);
 extern void RecordSharedMemoryInLockFile(unsigned long id1,
-                                                                                unsigned long id2);
+                                                        unsigned long id2);
 
 extern void ValidatePgVersion(const char *path);
 
index 2b18e70..facef90 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: execnodes.h,v 1.74 2002/08/30 23:59:46 tgl Exp $
+ * $Id: execnodes.h,v 1.75 2002/09/04 20:31:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -94,7 +94,7 @@ typedef struct ExprContext_CB
  */
 typedef struct ExprContext
 {
-       NodeTag                 type;
+       NodeTag         type;
 
        /* Tuples that Var nodes in expression may refer to */
        TupleTableSlot *ecxt_scantuple;
@@ -102,16 +102,16 @@ typedef struct ExprContext
        TupleTableSlot *ecxt_outertuple;
 
        /* Memory contexts for expression evaluation --- see notes above */
-       MemoryContext   ecxt_per_query_memory;
-       MemoryContext   ecxt_per_tuple_memory;
+       MemoryContext ecxt_per_query_memory;
+       MemoryContext ecxt_per_tuple_memory;
 
        /* Values to substitute for Param nodes in expression */
-       ParamExecData  *ecxt_param_exec_vals;   /* for PARAM_EXEC params */
-       ParamListInfo   ecxt_param_list_info;   /* for other param types */
+       ParamExecData *ecxt_param_exec_vals;            /* for PARAM_EXEC params */
+       ParamListInfo ecxt_param_list_info; /* for other param types */
 
        /* Values to substitute for Aggref nodes in expression */
-       Datum              *ecxt_aggvalues;     /* precomputed values for Aggref nodes */
-       bool               *ecxt_aggnulls;      /* null flags for Aggref nodes */
+       Datum      *ecxt_aggvalues; /* precomputed values for Aggref nodes */
+       bool       *ecxt_aggnulls;      /* null flags for Aggref nodes */
 
        /* Functions to call back when ExprContext is shut down */
        ExprContext_CB *ecxt_callbacks;
@@ -155,7 +155,7 @@ typedef struct ReturnSetInfo
        SetFunctionReturnMode returnMode;       /* actual return mode */
        ExprDoneCond isDone;            /* status for ValuePerCall mode */
        /* fields filled by function in Materialize return mode: */
-       Tuplestorestate *setResult;     /* holds the complete returned tuple set */
+       Tuplestorestate *setResult; /* holds the complete returned tuple set */
        TupleDesc       setDesc;                /* actual descriptor for returned tuples */
 } ReturnSetInfo;
 
@@ -534,10 +534,10 @@ typedef struct SubqueryScanState
  */
 typedef struct FunctionScanState
 {
-       CommonScanState csstate;                /* its first field is NodeTag */
-       TupleDesc               tupdesc;
+       CommonScanState csstate;        /* its first field is NodeTag */
+       TupleDesc       tupdesc;
        Tuplestorestate *tuplestorestate;
-       Node               *funcexpr;
+       Node       *funcexpr;
 } FunctionScanState;
 
 /* ----------------------------------------------------------------
index 08fcbbd..f4e69d3 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: makefuncs.h,v 1.39 2002/07/18 17:14:20 momjian Exp $
+ * $Id: makefuncs.h,v 1.40 2002/09/04 20:31:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 extern A_Expr *makeA_Expr(int oper, List *name, Node *lexpr, Node *rexpr);
 
 extern A_Expr *makeSimpleA_Expr(int oper, const char *name,
-                                                               Node *lexpr, Node *rexpr);
+                                Node *lexpr, Node *rexpr);
 
 extern Oper *makeOper(Oid opno,
-                                         Oid opid,
-                                         Oid opresulttype,
-                                         bool opretset);
+                Oid opid,
+                Oid opresulttype,
+                bool opretset);
 
 extern Var *makeVar(Index varno,
                AttrNumber varattno,
index be8b7fe..0f703e2 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsenodes.h,v 1.205 2002/09/02 02:13:02 tgl Exp $
+ * $Id: parsenodes.h,v 1.206 2002/09/04 20:31:43 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -41,8 +41,8 @@ typedef struct Query
                                                                 * statement */
 
        int                     resultRelation; /* target relation (index into rtable) */
-       RangeVar   *into;                       /* target relation or portal (cursor) 
-                                                                * for portal just name is meaningful */
+       RangeVar   *into;                       /* target relation or portal (cursor) for
+                                                                * portal just name is meaningful */
        bool            isPortal;               /* is this a retrieve into portal? */
        bool            isBinary;               /* binary portal? */
 
@@ -110,7 +110,7 @@ typedef struct Query
  * actual type OID is given by typeid, otherwise typeid is unused.
  *
  * If pct_type is TRUE, then names is actually a field name and we look up
- * the type of that field.  Otherwise (the normal case), names is a type
+ * the type of that field.     Otherwise (the normal case), names is a type
  * name possibly qualified with schema and database name.
  */
 typedef struct TypeName
@@ -272,7 +272,7 @@ typedef struct ConstraintTest
 {
        NodeTag         type;
        Node       *arg;                        /* input expression */
-       ConstraintTestType testtype; /* test type */
+       ConstraintTestType testtype;    /* test type */
        char       *name;                       /* name of constraint (for error msgs) */
        Node       *check_expr;         /* for CHECK test, a boolean expression */
 } ConstraintTest;
@@ -421,7 +421,7 @@ typedef struct RangeFunction
  *
  * For a plain index, each 'name' is an attribute name in the heap relation;
  * 'funcname' and 'args' are NIL.  For a functional index, only one IndexElem
- * is allowed.  It has name = NULL, funcname = name of function and args =
+ * is allowed. It has name = NULL, funcname = name of function and args =
  * list of attribute names that are the function's arguments.
  */
 typedef struct IndexElem
@@ -524,7 +524,7 @@ typedef struct RangeTblEntry
        /*
         * XXX the fields applicable to only some rte kinds should be merged
         * into a union.  I didn't do this yet because the diffs would impact
-        * a lot of code that is being actively worked on.  FIXME later.
+        * a lot of code that is being actively worked on.      FIXME later.
         */
 
        /*
@@ -550,8 +550,8 @@ typedef struct RangeTblEntry
         * joinaliasvars is a list of Vars or COALESCE expressions corresponding
         * to the columns of the join result.  An alias Var referencing column
         * K of the join result can be replaced by the K'th element of
-        * joinaliasvars --- but to simplify the task of reverse-listing aliases
-        * correctly, we do not do that until planning time.
+        * joinaliasvars --- but to simplify the task of reverse-listing
+        * aliases correctly, we do not do that until planning time.
         */
        JoinType        jointype;               /* type of join */
        List       *joinaliasvars;      /* list of alias-var expansions */
@@ -780,7 +780,7 @@ typedef struct AlterTableStmt
                                                                 *      N = alter column drop not null
                                                                 *      O = alter column set not null
                                                                 *      S = alter column statistics
-                                                                *  M = alter column storage
+                                                                *      M = alter column storage
                                                                 *      D = drop column
                                                                 *      C = add constraint
                                                                 *      c = pre-processed add constraint
@@ -825,7 +825,7 @@ typedef enum GrantObjectType
 #define ACL_EXECUTE            (1<<7)  /* for functions */
 #define ACL_USAGE              (1<<8)  /* for languages and namespaces */
 #define ACL_CREATE             (1<<9)  /* for namespaces and databases */
-#define ACL_CREATE_TEMP        (1<<10) /* for databases */
+#define ACL_CREATE_TEMP (1<<10) /* for databases */
 #define N_ACL_RIGHTS   11              /* 1 plus the last 1<<x */
 #define ACL_ALL_RIGHTS (-1)    /* all-privileges marker in GRANT list */
 #define ACL_NO_RIGHTS  0
@@ -835,8 +835,9 @@ typedef struct GrantStmt
        NodeTag         type;
        bool            is_grant;               /* true = GRANT, false = REVOKE */
        GrantObjectType objtype;        /* kind of object being operated on */
-       List       *objects;            /* list of RangeVar nodes, FuncWithArgs nodes,
-                                                                * or plain names (as Value strings) */
+       List       *objects;            /* list of RangeVar nodes, FuncWithArgs
+                                                                * nodes, or plain names (as Value
+                                                                * strings) */
        List       *privileges;         /* integer list of privilege codes */
        List       *grantees;           /* list of PrivGrantee nodes */
 } GrantStmt;
@@ -881,8 +882,8 @@ typedef struct CopyStmt
 {
        NodeTag         type;
        RangeVar   *relation;           /* the relation to copy */
-       List       *attlist;            /* List of column names (as Strings),
-                                                                * or NIL for all columns */
+       List       *attlist;            /* List of column names (as Strings), or
+                                                                * NIL for all columns */
        bool            is_from;                /* TO or FROM */
        char       *filename;           /* if NULL, use stdin/stdout */
        List       *options;            /* List of DefElem nodes */
@@ -949,7 +950,8 @@ typedef struct Constraint
        char       *name;                       /* name, or NULL if unnamed */
        Node       *raw_expr;           /* expr, as untransformed parse tree */
        char       *cooked_expr;        /* expr, as nodeToString representation */
-       List       *keys;                       /* String nodes naming referenced column(s) */
+       List       *keys;                       /* String nodes naming referenced
+                                                                * column(s) */
 } Constraint;
 
 /* ----------
@@ -962,7 +964,7 @@ typedef struct Constraint
  *
  * If skip_validation is true then we skip checking that the existing rows
  * in the table satisfy the constraint, and just install the catalog entries
- * for the constraint.  This is currently used only during CREATE TABLE
+ * for the constraint. This is currently used only during CREATE TABLE
  * (when we know the table must be empty).
  * ----------
  */
@@ -988,7 +990,7 @@ typedef struct FkConstraint
        char            fk_del_action;  /* ON DELETE action */
        bool            deferrable;             /* DEFERRABLE */
        bool            initdeferred;   /* INITIALLY DEFERRED */
-       bool            skip_validation; /* skip validation of existing rows? */
+       bool            skip_validation;        /* skip validation of existing rows? */
 } FkConstraint;
 
 /* ----------------------
@@ -1028,7 +1030,8 @@ typedef struct CreatePLangStmt
        NodeTag         type;
        char       *plname;                     /* PL name */
        List       *plhandler;          /* PL call handler function (qual. name) */
-       List       *plvalidator;        /* optional validator function (qual. name) */
+       List       *plvalidator;        /* optional validator function (qual.
+                                                                * name) */
        bool            pltrusted;              /* PL is trusted */
 } CreatePLangStmt;
 
@@ -1172,10 +1175,10 @@ typedef struct CreateOpClassItem
 #define DROP_SEQUENCE 2
 #define DROP_VIEW        3
 #define DROP_INDEX       4
-#define DROP_TYPE     5
-#define DROP_DOMAIN      6
-#define DROP_CONVERSION          7
-#define DROP_SCHEMA      8
+#define DROP_TYPE        5
+#define DROP_DOMAIN   6
+#define DROP_CONVERSION   7
+#define DROP_SCHEMA   8
 
 typedef struct DropStmt
 {
@@ -1612,11 +1615,11 @@ typedef struct ReindexStmt
 typedef struct CreateConversionStmt
 {
        NodeTag         type;
-       List            *conversion_name;               /* Name of the conversion */
-       char            *for_encoding_name;             /* source encoding name */
-       char            *to_encoding_name;              /* destiname encoding name */
-       List            *func_name;                             /* qualified conversion function name */
-       bool            def;                            /* is this a default conversion? */
+       List       *conversion_name;    /* Name of the conversion */
+       char       *for_encoding_name;          /* source encoding name */
+       char       *to_encoding_name;           /* destiname encoding name */
+       List       *func_name;          /* qualified conversion function name */
+       bool            def;                    /* is this a default conversion? */
 } CreateConversionStmt;
 
 /* ----------------------
@@ -1651,11 +1654,11 @@ typedef struct DropCastStmt
  */
 typedef struct PrepareStmt
 {
-       NodeTag          type;
-       char            *name;                  /* Name of plan, arbitrary */
-       List            *argtypes;              /* Types of parameters (TypeNames) */
-       List            *argtype_oids;  /* Types of parameters (OIDs) */
-       Query           *query;                 /* The query itself */
+       NodeTag         type;
+       char       *name;                       /* Name of plan, arbitrary */
+       List       *argtypes;           /* Types of parameters (TypeNames) */
+       List       *argtype_oids;       /* Types of parameters (OIDs) */
+       Query      *query;                      /* The query itself */
 } PrepareStmt;
 
 
@@ -1666,10 +1669,10 @@ typedef struct PrepareStmt
 
 typedef struct ExecuteStmt
 {
-       NodeTag          type;
-       char            *name;                  /* The name of the plan to execute */
-       RangeVar        *into;                  /* Optional table to store results in */
-       List            *params;                /* Values to assign to parameters */
+       NodeTag         type;
+       char       *name;                       /* The name of the plan to execute */
+       RangeVar   *into;                       /* Optional table to store results in */
+       List       *params;                     /* Values to assign to parameters */
 } ExecuteStmt;
 
 
index a1d161f..8d26fea 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: plannodes.h,v 1.57 2002/06/20 20:29:51 momjian Exp $
+ * $Id: plannodes.h,v 1.58 2002/09/04 20:31:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -249,7 +249,7 @@ typedef struct SubqueryScan
  */
 typedef struct FunctionScan
 {
-       Scan                            scan;
+       Scan            scan;
        /* no other fields needed at present */
        /* scan.scanstate actually points at a FunctionScanState node */
 } FunctionScan;
index 8fbb944..111ed7f 100644 (file)
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: primnodes.h,v 1.66 2002/08/26 17:54:02 tgl Exp $
+ * $Id: primnodes.h,v 1.67 2002/09/04 20:31:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -127,8 +127,8 @@ typedef struct RangeVar
        char       *catalogname;        /* the catalog (database) name, or NULL */
        char       *schemaname;         /* the schema name, or NULL */
        char       *relname;            /* the relation/sequence name */
-       InhOption       inhOpt;                 /* expand rel by inheritance? 
-                                                                * recursively act on children? */
+       InhOption       inhOpt;                 /* expand rel by inheritance? recursively
+                                                                * act on children? */
        bool            istemp;                 /* is this a temp relation/sequence? */
        Alias      *alias;                      /* table alias & optional column aliases */
 } RangeVar;
@@ -182,7 +182,7 @@ typedef struct Oper
        Oid                     opid;                   /* PG_PROC OID of underlying function */
        Oid                     opresulttype;   /* PG_TYPE OID of result value */
        bool            opretset;               /* true if operator returns set */
-       FunctionCachePtr op_fcache;     /* runtime state, else NULL */
+       FunctionCachePtr op_fcache; /* runtime state, else NULL */
 } Oper;
 
 /*
@@ -192,9 +192,9 @@ typedef struct Func
 {
        NodeTag         type;
        Oid                     funcid;                 /* PG_PROC OID of the function */
-       Oid                     funcresulttype; /* PG_TYPE OID of result value */
+       Oid                     funcresulttype; /* PG_TYPE OID of result value */
        bool            funcretset;             /* true if function returns set */
-       FunctionCachePtr func_fcache; /* runtime state, or NULL */
+       FunctionCachePtr func_fcache;           /* runtime state, or NULL */
 } Func;
 
 /*
@@ -528,7 +528,7 @@ typedef struct RangeTblRef
  * restricts visibility of the tables/columns inside it.
  *
  * During parse analysis, an RTE is created for the Join, and its index
- * is filled into rtindex.  This RTE is present mainly so that Vars can
+ * is filled into rtindex.     This RTE is present mainly so that Vars can
  * be created that refer to the outputs of the join.
  *----------
  */
index bda1102..7ebcef4 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: print.h,v 1.18 2002/06/20 20:29:51 momjian Exp $
+ * $Id: print.h,v 1.19 2002/09/04 20:31:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -23,7 +23,7 @@
 extern void print(void *obj);
 extern void pprint(void *obj);
 extern void elog_node_display(int lev, const char *title,
-                                                         void *obj, bool pretty);
+                                 void *obj, bool pretty);
 extern char *format_node_dump(const char *dump);
 extern char *pretty_format_node_dump(const char *dump);
 extern void print_rt(List *rtable);
index 26c465f..071addb 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: relation.h,v 1.66 2002/08/19 15:08:47 tgl Exp $
+ * $Id: relation.h,v 1.67 2002/09/04 20:31:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,7 +55,7 @@ typedef enum CostSelector
  * single RT indexes; but they are not part of the join tree, and are stored
  * in other_rel_list not base_rel_list.  An otherrel is created for each
  * join RTE as an aid in processing Vars that refer to the join's outputs,
- * but it serves no other purpose in planning.  It is important not to
+ * but it serves no other purpose in planning. It is important not to
  * confuse this otherrel with the joinrel that represents the matching set
  * of base relations.
  *
@@ -71,7 +71,7 @@ typedef enum CostSelector
  * comprising the best plans for the individual child tables.
  *
  * Parts of this data structure are specific to various scan and join
- * mechanisms.  It didn't seem worth creating new node types for them.
+ * mechanisms. It didn't seem worth creating new node types for them.
  *
  *             relids - List of base-relation identifiers; it is a base relation
  *                             if there is just one, a join relation if more than one
@@ -126,7 +126,7 @@ typedef enum CostSelector
  *                                     side of an outer join, the list of all relids
  *                                     participating in the highest such outer join; else NIL.
  *                                     For a join otherrel: the list of all baserel relids
- *                                     syntactically within the join.  Otherwise, unused.
+ *                                     syntactically within the join.  Otherwise, unused.
  *             joininfo  - List of JoinInfo nodes, containing info about each join
  *                                     clause in which this relation participates
  *             innerjoin - List of Path nodes that represent indices that may be used
@@ -571,8 +571,8 @@ typedef struct RestrictInfo
        List       *right_pathkey;      /* canonical pathkey for right side */
 
        /* cache space for mergeclause processing; -1 if not yet set */
-       Selectivity left_mergescansel;  /* fraction of left side to scan */
-       Selectivity right_mergescansel; /* fraction of right side to scan */
+       Selectivity left_mergescansel;          /* fraction of left side to scan */
+       Selectivity right_mergescansel;         /* fraction of right side to scan */
 
        /* valid if clause is hashjoinable, else InvalidOid: */
        Oid                     hashjoinoperator;               /* copy of clause operator */
index e478b77..b3076d7 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: cost.h,v 1.46 2002/07/24 19:11:14 petere Exp $
+ * $Id: cost.h,v 1.47 2002/09/04 20:31:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -54,7 +54,7 @@ extern void cost_index(Path *path, Query *root,
 extern void cost_tidscan(Path *path, Query *root,
                         RelOptInfo *baserel, List *tideval);
 extern void cost_functionscan(Path *path, Query *root,
-                                                         RelOptInfo *baserel);
+                                 RelOptInfo *baserel);
 extern void cost_sort(Path *path, Query *root,
                  List *pathkeys, double tuples, int width);
 extern void cost_nestloop(Path *path, Query *root,
index eb35f6f..6599bf7 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geqo_misc.h,v 1.20 2002/07/20 04:59:10 momjian Exp $
+ * $Id: geqo_misc.h,v 1.21 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,7 +35,6 @@ extern void print_edge_table(FILE *fp, Edge *edge_table, int num_gene);
 extern void geqo_print_rel(Query *root, RelOptInfo *rel);
 extern void geqo_print_path(Query *root, Path *path, int indent);
 extern void geqo_print_joinclauses(Query *root, List *clauses);
+#endif   /* GEQO_DEBUG */
 
-#endif /* GEQO_DEBUG */
-
-#endif /* GEQO_MISC_H */
+#endif   /* GEQO_MISC_H */
index 8fcdd75..d31cee5 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: planmain.h,v 1.59 2002/06/20 20:29:51 momjian Exp $
+ * $Id: planmain.h,v 1.60 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -58,8 +58,8 @@ extern void process_implied_equality(Query *root, Node *item1, Node *item2,
  */
 extern void set_plan_references(Plan *plan, List *rtable);
 extern List *join_references(List *clauses, List *rtable,
-                                                        List *outer_tlist, List *inner_tlist,
-                                                        Index acceptable_rel);
+                               List *outer_tlist, List *inner_tlist,
+                               Index acceptable_rel);
 extern void fix_opids(Node *node);
 
 #endif   /* PLANMAIN_H */
index 6af3baf..97a9109 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: gramparse.h,v 1.24 2002/08/27 04:55:12 tgl Exp $
+ * $Id: gramparse.h,v 1.25 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,6 +34,6 @@ extern void parser_init(void);
 extern int     yyparse(void);
 extern List *SystemFuncName(char *name);
 extern TypeName *SystemTypeName(char *name);
-extern bool    exprIsNullConstant(Node *arg);
+extern bool exprIsNullConstant(Node *arg);
 
 #endif   /* GRAMPARSE_H */
index 328332a..152ade0 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_coerce.h,v 1.45 2002/08/31 22:10:47 tgl Exp $
+ * $Id: parse_coerce.h,v 1.46 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -39,13 +39,13 @@ extern bool IsPreferredType(CATEGORY category, Oid type);
 extern CATEGORY TypeCategory(Oid type);
 
 extern bool can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids,
-                                                       bool isExplicit);
+                               bool isExplicit);
 extern Node *coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
                        Oid targetTypeId, int32 atttypmod, bool isExplicit);
 extern Node *coerce_type_typmod(ParseState *pstate, Node *node,
                                   Oid targetTypeId, int32 atttypmod);
 extern Node *coerce_type_constraints(ParseState *pstate, Node *arg,
-                                                                        Oid typeId, bool applyTypmod);
+                                               Oid typeId, bool applyTypmod);
 
 extern Node *coerce_to_boolean(Node *node, const char *constructName);
 
index c600aa9..6027a22 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_func.h,v 1.42 2002/08/22 00:01:49 tgl Exp $
+ * $Id: parse_func.h,v 1.43 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -50,14 +50,14 @@ extern FuncDetailCode func_get_detail(List *funcname, List *fargs,
 extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId);
 
 extern void func_error(const char *caller, List *funcname,
-                                          int nargs, const Oid *argtypes,
-                                          const char *msg);
+                  int nargs, const Oid *argtypes,
+                  const char *msg);
 
-extern Oid     find_aggregate_func(const char *caller, List *aggname,
-                                                               Oid basetype);
+extern Oid find_aggregate_func(const char *caller, List *aggname,
+                                       Oid basetype);
 
 extern Oid     LookupFuncName(List *funcname, int nargs, const Oid *argtypes);
-extern Oid     LookupFuncNameTypeNames(List *funcname, List *argtypes,
-                                                                       const char *caller);
+extern Oid LookupFuncNameTypeNames(List *funcname, List *argtypes,
+                                               const char *caller);
 
 #endif   /* PARSE_FUNC_H */
index e061aaf..8369689 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_oper.h,v 1.21 2002/06/20 20:29:51 momjian Exp $
+ * $Id: parse_oper.h,v 1.22 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,8 +21,8 @@ typedef HeapTuple Operator;
 
 /* Routines to look up an operator given name and exact input type(s) */
 extern Oid     LookupOperName(List *opername, Oid oprleft, Oid oprright);
-extern Oid     LookupOperNameTypeNames(List *opername, TypeName *oprleft,
-                                                                       TypeName *oprright, const char *caller);
+extern Oid LookupOperNameTypeNames(List *opername, TypeName *oprleft,
+                                               TypeName *oprright, const char *caller);
 
 /* Routines to find operators matching a name and given input types */
 /* NB: the selected operator may require coercion of the input types! */
index 5d40590..2259851 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_relation.h,v 1.38 2002/08/08 01:44:31 tgl Exp $
+ * $Id: parse_relation.h,v 1.39 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -17,9 +17,9 @@
 #include "parser/parse_node.h"
 
 extern RangeTblEntry *refnameRangeTblEntry(ParseState *pstate,
-                                               const char *schemaname,
-                                               const char *refname,
-                                               int *sublevels_up);
+                                        const char *schemaname,
+                                        const char *refname,
+                                        int *sublevels_up);
 extern void checkNameSpaceConflicts(ParseState *pstate, Node *namespace1,
                                                Node *namespace2);
 extern int RTERangeTablePosn(ParseState *pstate,
@@ -27,29 +27,29 @@ extern int RTERangeTablePosn(ParseState *pstate,
                                  int *sublevels_up);
 extern Node *colnameToVar(ParseState *pstate, char *colname);
 extern Node *qualifiedNameToVar(ParseState *pstate,
-                                                               char *schemaname,
-                                                               char *refname,
-                                                               char *colname,
-                                                               bool implicitRTEOK);
+                                  char *schemaname,
+                                  char *refname,
+                                  char *colname,
+                                  bool implicitRTEOK);
 extern RangeTblEntry *addRangeTableEntry(ParseState *pstate,
                                   RangeVar *relation,
                                   Alias *alias,
                                   bool inh,
                                   bool inFromCl);
 extern RangeTblEntry *addRangeTableEntryForRelation(ParseState *pstate,
-                                  Oid relid,
-                                  Alias *alias,
-                                  bool inh,
-                                  bool inFromCl);
+                                                         Oid relid,
+                                                         Alias *alias,
+                                                         bool inh,
+                                                         bool inFromCl);
 extern RangeTblEntry *addRangeTableEntryForSubquery(ParseState *pstate,
                                                          Query *subquery,
                                                          Alias *alias,
                                                          bool inFromCl);
 extern RangeTblEntry *addRangeTableEntryForFunction(ParseState *pstate,
-                                                                                                       char *funcname,
-                                                                                                       Node *funcexpr,
-                                                                                                       RangeFunction *rangefunc,
-                                                                                                       bool inFromCl);
+                                                         char *funcname,
+                                                         Node *funcexpr,
+                                                         RangeFunction *rangefunc,
+                                                         bool inFromCl);
 extern RangeTblEntry *addRangeTableEntryForJoin(ParseState *pstate,
                                                  List *colnames,
                                                  JoinType jointype,
index 8f938bb..acca0f0 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_target.h,v 1.25 2002/06/20 20:29:52 momjian Exp $
+ * $Id: parse_target.h,v 1.26 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -24,8 +24,8 @@ extern void updateTargetListEntry(ParseState *pstate, TargetEntry *tle,
                                          char *colname, int attrno,
                                          List *indirection);
 extern Node *CoerceTargetExpr(ParseState *pstate, Node *expr,
-                                                         Oid type_id, Oid attrtype, int32 attrtypmod,
-                                                         bool isExplicit);
+                                Oid type_id, Oid attrtype, int32 attrtypmod,
+                                bool isExplicit);
 extern List *checkInsertTargets(ParseState *pstate, List *cols,
                                   List **attrnos);
 
index f39080e..170f628 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsetree.h,v 1.18 2002/06/20 20:29:52 momjian Exp $
+ * $Id: parsetree.h,v 1.19 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -57,6 +57,6 @@ extern char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum);
  * type and typemod info for that attribute of that RTE.
  */
 extern void get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
-                                                                  Oid *vartype, int32 *vartypmod);
+                                          Oid *vartype, int32 *vartypmod);
 
 #endif   /* PARSETREE_H */
index 870b12f..e140c3c 100644 (file)
@@ -15,4 +15,5 @@ typedef struct
 #endif
 #ifndef                        BYTE_ORDER
 #define                        BYTE_ORDER              BIG_ENDIAN
+
 #endif
index 04451d7..9f97429 100644 (file)
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1995, Regents of the University of California
  *
- * $Id: postgres.h,v 1.60 2002/08/25 17:20:01 tgl Exp $
+ * $Id: postgres.h,v 1.61 2002/09/04 20:31:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,7 +34,7 @@
  *     in the backend environment, but are of no interest outside the backend.
  *
  *     Simple type definitions live in c.h, where they are shared with
- *     postgres_fe.h.  We do that since those type definitions are needed by
+ *     postgres_fe.h.  We do that since those type definitions are needed by
  *     frontend modules that want to deal with binary data transmission to or
  *     from the backend.  Type definitions in this file should be for
  *     representations that never escape the backend, such as Datum or
index cf20160..e0889a1 100644 (file)
@@ -101,10 +101,10 @@ typedef struct
 
 extern int     pg_regcomp(regex_t *preg, const char *pattern, int cflags);
 extern size_t pg_regerror(int errcode, const regex_t *preg,
-                                                 char *errbuf, size_t errbuf_size);
+                       char *errbuf, size_t errbuf_size);
 extern int pg_regexec(const regex_t *preg, const char *string,
-                                         size_t nmatch,
-                                         regmatch_t *pmatch, int eflags);
+                  size_t nmatch,
+                  regmatch_t *pmatch, int eflags);
 extern void pg_regfree(regex_t *preg);
 
 #endif   /* !_REGEX_H_ */
index 168b27c..0ddd0d0 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rewriteDefine.h,v 1.15 2002/06/20 20:29:52 momjian Exp $
+ * $Id: rewriteDefine.h,v 1.16 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,6 +19,6 @@
 extern void DefineQueryRewrite(RuleStmt *args);
 
 extern void RenameRewriteRule(Oid owningRel, const char *oldName,
-                                                         const char *newName);
+                                 const char *newName);
 
 #endif   /* REWRITEDEFINE_H */
index 6646259..6ccb07a 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rewriteRemove.h,v 1.15 2002/07/12 18:43:19 tgl Exp $
+ * $Id: rewriteRemove.h,v 1.16 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,7 +18,7 @@
 
 
 extern void RemoveRewriteRule(Oid owningRel, const char *ruleName,
-                                                         DropBehavior behavior);
+                                 DropBehavior behavior);
 extern void RemoveRewriteRuleById(Oid ruleOid);
 
 #endif   /* REWRITEREMOVE_H */
index 6f8c4ad..7a0407f 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: buf_internals.h,v 1.58 2002/08/06 02:36:35 tgl Exp $
+ * $Id: buf_internals.h,v 1.59 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -150,12 +150,12 @@ typedef struct _bmtrace
 
 
 /* counters in buf_init.c */
-extern long int        ReadBufferCount;
-extern long int        ReadLocalBufferCount;
-extern long int        BufferHitCount;
-extern long int        LocalBufferHitCount;
-extern long int        BufferFlushCount;
-extern long int        LocalBufferFlushCount;
+extern long int ReadBufferCount;
+extern long int ReadLocalBufferCount;
+extern long int BufferHitCount;
+extern long int LocalBufferHitCount;
+extern long int BufferFlushCount;
+extern long int LocalBufferFlushCount;
 
 
 /*
@@ -185,7 +185,7 @@ extern BufferDesc *LocalBufferDescriptors;
 
 extern BufferDesc *LocalBufferAlloc(Relation reln, BlockNumber blockNum,
                                 bool *foundPtr);
-extern void    WriteLocalBuffer(Buffer buffer, bool release);
+extern void WriteLocalBuffer(Buffer buffer, bool release);
 extern void AtEOXact_LocalBuffers(bool isCommit);
 
 #endif   /* BUFMGR_INTERNALS_H */
index e92cc65..d8271e3 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: bufmgr.h,v 1.63 2002/08/11 21:17:35 tgl Exp $
+ * $Id: bufmgr.h,v 1.64 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -148,8 +148,8 @@ extern long *LocalRefCount;
  */
 extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum);
 extern int     ReleaseBuffer(Buffer buffer);
-extern void    WriteBuffer(Buffer buffer);
-extern void    WriteNoReleaseBuffer(Buffer buffer);
+extern void WriteBuffer(Buffer buffer);
+extern void WriteNoReleaseBuffer(Buffer buffer);
 extern Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation,
                                         BlockNumber blockNum);
 
@@ -166,6 +166,7 @@ extern int  FlushRelationBuffers(Relation rel, BlockNumber firstDelBlock);
 extern void DropRelationBuffers(Relation rel);
 extern void DropRelFileNodeBuffers(RelFileNode rnode, bool istemp);
 extern void DropBuffers(Oid dbid);
+
 #ifdef NOT_USED
 extern void PrintPinnedBufs(void);
 #endif
index 7a6080a..159a82a 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: bufpage.h,v 1.52 2002/09/02 01:05:06 tgl Exp $
+ * $Id: bufpage.h,v 1.53 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -94,10 +94,10 @@ typedef uint16 LocationIndex;
  * disk page organization
  * space management information generic to any page
  *
- *             pd_lower        - offset to start of free space.
- *             pd_upper        - offset to end of free space.
- *             pd_special      - offset to start of special space.
- *             pd_pagesize_version     - size in bytes and page layout version number.
+ *             pd_lower        - offset to start of free space.
+ *             pd_upper        - offset to end of free space.
+ *             pd_special      - offset to start of special space.
+ *             pd_pagesize_version - size in bytes and page layout version number.
  *
  * The page version number and page size are packed together into a single
  * uint16 field.  This is for historical reasons: before PostgreSQL 7.3,
index f33815f..d12ec20 100644 (file)
@@ -4,14 +4,14 @@
  *       POSTGRES inter-process communication definitions.
  *
  * This file is misnamed, as it no longer has much of anything directly
- * to do with IPC.  The functionality here is concerned with managing
+ * to do with IPC.     The functionality here is concerned with managing
  * exit-time cleanup for either a postmaster or a backend.
  *
  *
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: ipc.h,v 1.56 2002/06/20 20:29:52 momjian Exp $
+ * $Id: ipc.h,v 1.57 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,7 +30,7 @@ extern void on_exit_reset(void);
 
 /* ipci.c */
 extern void CreateSharedMemoryAndSemaphores(bool makePrivate,
-                                                                                       int maxBackends,
-                                                                                       int port);
+                                                               int maxBackends,
+                                                               int port);
 
 #endif   /* IPC_H */
index 4c09bdd..744c18d 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: lock.h,v 1.66 2002/08/31 17:14:28 tgl Exp $
+ * $Id: lock.h,v 1.67 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -141,7 +141,8 @@ typedef struct LOCK
        /* data */
        int                     grantMask;              /* bitmask for lock types already granted */
        int                     waitMask;               /* bitmask for lock types awaited */
-       SHM_QUEUE       lockHolders;    /* list of PROCLOCK objects assoc. with lock */
+       SHM_QUEUE       lockHolders;    /* list of PROCLOCK objects assoc. with
+                                                                * lock */
        PROC_QUEUE      waitProcs;              /* list of PGPROC objects waiting on lock */
        int                     requested[MAX_LOCKMODES];               /* counts of requested
                                                                                                 * locks */
@@ -191,7 +192,7 @@ typedef struct PROCLOCKTAG
 typedef struct PROCLOCK
 {
        /* tag */
-       PROCLOCKTAG     tag;                    /* unique identifier of holder object */
+       PROCLOCKTAG tag;                        /* unique identifier of holder object */
 
        /* data */
        int                     holding[MAX_LOCKMODES]; /* count of locks currently held */
@@ -205,7 +206,7 @@ typedef struct PROCLOCK
 
 /*
  * This struct holds information passed from lmgr internals to the lock
- * listing user-level functions (lockfuncs.c).  For each PROCLOCK in the
+ * listing user-level functions (lockfuncs.c). For each PROCLOCK in the
  * system, the SHMEM_OFFSET, PROCLOCK itself, and associated PGPROC and
  * LOCK objects are stored.  (Note there will often be multiple copies
  * of the same PGPROC or LOCK.)  We do not store the SHMEM_OFFSET of the
@@ -213,11 +214,11 @@ typedef struct PROCLOCK
  */
 typedef struct
 {
-       int               nelements;    /* The length of each of the arrays */
+       int                     nelements;              /* The length of each of the arrays */
        SHMEM_OFFSET *holderaddrs;
-       PROCLOCK *holders;
-       PGPROC   *procs;
-       LOCK     *locks;
+       PROCLOCK   *holders;
+       PGPROC     *procs;
+       LOCK       *locks;
 } LockData;
 
 /*
index 8bb023b..e324259 100644 (file)
@@ -6,14 +6,14 @@
  * PostgreSQL requires counting semaphores (the kind that keep track of
  * multiple unlock operations, and will allow an equal number of subsequent
  * lock operations before blocking).  The underlying implementation is
- * not the same on every platform.  This file defines the API that must
+ * not the same on every platform.     This file defines the API that must
  * be provided by each port.
  *
  *
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_sema.h,v 1.2 2002/06/20 20:29:52 momjian Exp $
+ * $Id: pg_sema.h,v 1.3 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -36,7 +36,6 @@
 #include <semaphore.h>
 
 typedef sem_t *PGSemaphoreData;
-
 #endif
 
 #ifdef USE_UNNAMED_POSIX_SEMAPHORES
@@ -44,7 +43,6 @@ typedef sem_t *PGSemaphoreData;
 #include <semaphore.h>
 
 typedef sem_t PGSemaphoreData;
-
 #endif
 
 #ifdef USE_SYSV_SEMAPHORES
@@ -54,7 +52,6 @@ typedef struct PGSemaphoreData
        int                     semId;                  /* semaphore set identifier */
        int                     semNum;                 /* semaphore number within set */
 } PGSemaphoreData;
-
 #endif
 
 typedef PGSemaphoreData *PGSemaphore;
@@ -62,14 +59,19 @@ typedef PGSemaphoreData *PGSemaphore;
 
 /* Module initialization (called during postmaster start or shmem reinit) */
 extern void PGReserveSemaphores(int maxSemas, int port);
+
 /* Initialize a PGSemaphore structure to represent a sema with count 1 */
 extern void PGSemaphoreCreate(PGSemaphore sema);
+
 /* Reset a previously-initialized PGSemaphore to have count 0 */
 extern void PGSemaphoreReset(PGSemaphore sema);
+
 /* Lock a semaphore (decrement count), blocking if count would be < 0 */
 extern void PGSemaphoreLock(PGSemaphore sema, bool interruptOK);
+
 /* Unlock a semaphore (increment count) */
 extern void PGSemaphoreUnlock(PGSemaphore sema);
+
 /* Lock a semaphore only if able to do so without blocking */
 extern bool PGSemaphoreTryLock(PGSemaphore sema);
 
index dcc6b13..c362757 100644 (file)
  *
  * To simplify life for the SysV implementation, the ID is assumed to
  * consist of two unsigned long values (these are key and ID in SysV
- * terms).  Other platforms may ignore the second value if they need
+ * terms).     Other platforms may ignore the second value if they need
  * only one ID number.
  *
  *
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_shmem.h,v 1.3 2002/09/02 02:47:07 momjian Exp $
+ * $Id: pg_shmem.h,v 1.4 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,7 +35,7 @@ typedef struct PGShmemHeader  /* standard header for all Postgres shmem */
 
 
 extern PGShmemHeader *PGSharedMemoryCreate(uint32 size, bool makePrivate,
-                                                                                  int port);
+                                        int port);
 extern bool PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2);
 
 #endif   /* PG_SHMEM_H */
index 4fdb1a8..1139a2c 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pmsignal.h,v 1.3 2002/06/20 20:29:52 momjian Exp $
+ * $Id: pmsignal.h,v 1.4 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -27,7 +27,7 @@ typedef enum
        PMSIGNAL_WAKEN_CHILDREN,        /* send a NOTIFY signal to all backends */
 
        NUM_PMSIGNALS                           /* Must be last value of enum! */
-}      PMSignalReason;
+} PMSignalReason;
 
 /*
  * prototypes for functions in pmsignal.c
index eb63371..de3d1d4 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: proc.h,v 1.59 2002/07/19 00:17:40 momjian Exp $
+ * $Id: proc.h,v 1.60 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -24,7 +24,7 @@
  * Each backend has a PGPROC struct in shared memory.  There is also a list of
  * currently-unused PGPROC structs that will be reallocated to new backends.
  *
- * links: list link for any list the PGPROC is in.  When waiting for a lock,
+ * links: list link for any list the PGPROC is in.     When waiting for a lock,
  * the PGPROC is linked into that lock's waitProcs queue.  A recycled PGPROC
  * is linked into ProcGlobal's freeProcs list.
  */
@@ -61,7 +61,7 @@ struct PGPROC
        /* Info about lock the process is currently waiting for, if any. */
        /* waitLock and waitHolder are NULL if not currently waiting. */
        LOCK       *waitLock;           /* Lock object we're sleeping on ... */
-       PROCLOCK           *waitHolder;         /* Per-holder info for awaited lock */
+       PROCLOCK   *waitHolder;         /* Per-holder info for awaited lock */
        LOCKMODE        waitLockMode;   /* type of lock we're waiting for */
        LOCKMASK        heldLocks;              /* bitmask for lock types already held on
                                                                 * this lock object by this backend */
index 1188c68..6d08574 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: sinval.h,v 1.29 2002/08/29 21:02:12 momjian Exp $
+ * $Id: sinval.h,v 1.30 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -89,6 +89,6 @@ extern int    CountActiveBackends(void);
 /* Use "struct PGPROC", not PGPROC, to avoid including proc.h here */
 extern struct PGPROC *BackendIdGetProc(BackendId procId);
 
-extern int CountEmptyBackendSlots(void);
+extern int     CountEmptyBackendSlots(void);
 
 #endif   /* SINVAL_H */
index ccb3d6f..bbad436 100644 (file)
@@ -44,7 +44,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: dest.h,v 1.31 2002/06/20 20:29:52 momjian Exp $
+ * $Id: dest.h,v 1.32 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -85,10 +85,10 @@ struct _DestReceiver
 {
        /* Called for each tuple to be output: */
        void            (*receiveTuple) (HeapTuple tuple, TupleDesc typeinfo,
-                                                                DestReceiver *self);
+                                                                                        DestReceiver *self);
        /* Initialization and teardown: */
        void            (*setup) (DestReceiver *self, int operation,
-                                                 const char *portalName, TupleDesc typeinfo);
+                                                        const char *portalName, TupleDesc typeinfo);
        void            (*cleanup) (DestReceiver *self);
        /* Private fields might appear beyond this point... */
 };
index c7814a1..a29b185 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pquery.h,v 1.21 2002/06/20 20:29:52 momjian Exp $
+ * $Id: pquery.h,v 1.22 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -19,7 +19,7 @@
 
 
 extern void ProcessQuery(Query *parsetree, Plan *plan, CommandDest dest,
-                                                char *completionTag);
+                        char *completionTag);
 
 extern EState *CreateExecutorState(void);
 
index 91b4287..9cca854 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: utility.h,v 1.15 2002/06/20 20:29:52 momjian Exp $
+ * $Id: utility.h,v 1.16 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -17,6 +17,6 @@
 #include "executor/execdesc.h"
 
 extern void ProcessUtility(Node *parsetree, CommandDest dest,
-                                                  char *completionTag);
+                          char *completionTag);
 
 #endif   /* UTILITY_H */
index fff2c38..e7f609f 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: acl.h,v 1.46 2002/07/29 22:14:11 tgl Exp $
+ * $Id: acl.h,v 1.47 2002/09/04 20:31:45 momjian Exp $
  *
  * NOTES
  *       For backward-compatibility purposes we have to allow there
@@ -177,7 +177,7 @@ typedef enum
  */
 extern Acl *acldefault(GrantObjectType objtype, AclId ownerid);
 extern Acl *aclinsert3(const Acl *old_acl, const AclItem *mod_aip,
-                                          unsigned modechg);
+                  unsigned modechg);
 
 /*
  * SQL functions (from acl.c)
index b0920c7..5c12764 100644 (file)
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: array.h,v 1.33 2002/08/26 17:54:02 tgl Exp $
+ * $Id: array.h,v 1.34 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -105,12 +105,12 @@ extern ArrayType *array_set_slice(ArrayType *array, int nSubscripts,
 extern Datum array_map(FunctionCallInfo fcinfo, Oid inpType, Oid retType);
 
 extern ArrayType *construct_array(Datum *elems, int nelems,
-                                                                 Oid elmtype,
-                                                                 int elmlen, bool elmbyval, char elmalign);
+                               Oid elmtype,
+                               int elmlen, bool elmbyval, char elmalign);
 extern void deconstruct_array(ArrayType *array,
-                                                         Oid elmtype,
-                                                         int elmlen, bool elmbyval, char elmalign,
-                                                         Datum **elemsp, int *nelemsp);
+                                 Oid elmtype,
+                                 int elmlen, bool elmbyval, char elmalign,
+                                 Datum **elemsp, int *nelemsp);
 
 
 /*
index c4cdad1..e979822 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: builtins.h,v 1.198 2002/09/03 21:45:44 petere Exp $
+ * $Id: builtins.h,v 1.199 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -401,14 +401,14 @@ extern char *deparse_expression(Node *expr, List *dpcontext,
                                   bool forceprefix);
 extern List *deparse_context_for(const char *aliasname, Oid relid);
 extern List *deparse_context_for_plan(int outer_varno, Node *outercontext,
-                                                                         int inner_varno, Node *innercontext,
-                                                                         List *rtable);
+                                                int inner_varno, Node *innercontext,
+                                                List *rtable);
 extern Node *deparse_context_for_rte(RangeTblEntry *rte);
 extern Node *deparse_context_for_subplan(const char *name, List *tlist,
-                                                                                List *rtable);
+                                                       List *rtable);
 extern const char *quote_identifier(const char *ident);
 extern char *quote_qualified_identifier(const char *namespace,
-                                                                               const char *ident);
+                                                  const char *ident);
 
 /* tid.c */
 extern void setLastTid(const ItemPointer tid);
@@ -473,7 +473,7 @@ extern Datum text_name(PG_FUNCTION_ARGS);
 extern int     varstr_cmp(char *arg1, int len1, char *arg2, int len2);
 extern List *textToQualifiedNameList(text *textval, const char *caller);
 extern bool SplitIdentifierString(char *rawstring, char separator,
-                                                                 List **namelist);
+                                         List **namelist);
 extern Datum replace_text(PG_FUNCTION_ARGS);
 extern Datum split_text(PG_FUNCTION_ARGS);
 extern Datum to_hex32(PG_FUNCTION_ARGS);
index b45277e..9fe3aa6 100644 (file)
@@ -13,7 +13,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: catcache.h,v 1.44 2002/06/20 20:29:52 momjian Exp $
+ * $Id: catcache.h,v 1.45 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,9 +53,11 @@ typedef struct catcache
        long            cc_hits;                /* # of matches against existing entry */
        long            cc_neg_hits;    /* # of matches against negative entry */
        long            cc_newloads;    /* # of successful loads of new entry */
+
        /*
         * cc_searches - (cc_hits + cc_neg_hits + cc_newloads) is number of
-        * failed searches, each of which will result in loading a negative entry
+        * failed searches, each of which will result in loading a negative
+        * entry
         */
        long            cc_invals;              /* # of entries invalidated from cache */
        long            cc_discards;    /* # of entries discarded due to overflow */
@@ -77,7 +79,7 @@ typedef struct catctup
         * elements in all the caches in LRU order, and the other lists just
         * the elements in one hashbucket of one cache, also in LRU order.
         *
-        * The tuple may also be a member of at most one CatCList.  (If a single
+        * The tuple may also be a member of at most one CatCList.      (If a single
         * catcache is list-searched with varying numbers of keys, we may have
         * to make multiple entries for the same tuple because of this
         * restriction.  Currently, that's not expected to be common, so we
@@ -86,15 +88,16 @@ typedef struct catctup
        Dlelem          lrulist_elem;   /* list member of global LRU list */
        Dlelem          cache_elem;             /* list member of per-bucket list */
        struct catclist *c_list;        /* containing catclist, or NULL if none */
+
        /*
         * A tuple marked "dead" must not be returned by subsequent searches.
         * However, it won't be physically deleted from the cache until its
         * refcount goes to zero.
         *
-        * A negative cache entry is an assertion that there is no tuple
-        * matching a particular key.  This is just as useful as a normal entry
-        * so far as avoiding catalog searches is concerned.  Management of
-        * positive and negative entries is identical.
+        * A negative cache entry is an assertion that there is no tuple matching
+        * a particular key.  This is just as useful as a normal entry so far
+        * as avoiding catalog searches is concerned.  Management of positive
+        * and negative entries is identical.
         */
        int                     refcount;               /* number of active references */
        bool            dead;                   /* dead but not yet removed? */
@@ -114,22 +117,22 @@ typedef struct catclist
         * A CatCList describes the result of a partial search, ie, a search
         * using only the first K key columns of an N-key cache.  We form the
         * keys used into a tuple (with other attributes NULL) to represent
-        * the stored key set.  The CatCList object contains links to cache
+        * the stored key set.  The CatCList object contains links to cache
         * entries for all the table rows satisfying the partial key.  (Note:
         * none of these will be negative cache entries.)
         *
-        * A CatCList is only a member of a per-cache list; we do not do
-        * separate LRU management for CatCLists.  Instead, a CatCList is
-        * dropped from the cache as soon as any one of its member tuples
-        * ages out due to tuple-level LRU management.
+        * A CatCList is only a member of a per-cache list; we do not do separate
+        * LRU management for CatCLists.  Instead, a CatCList is dropped from
+        * the cache as soon as any one of its member tuples ages out due to
+        * tuple-level LRU management.
         *
         * A list marked "dead" must not be returned by subsequent searches.
         * However, it won't be physically deleted from the cache until its
         * refcount goes to zero.  (Its member tuples must have refcounts at
         * least as large, so they won't go away either.)
         *
-        * If "ordered" is true then the member tuples appear in the order of
-        * the cache's underlying index.  This will be true in normal operation,
+        * If "ordered" is true then the member tuples appear in the order of the
+        * cache's underlying index.  This will be true in normal operation,
         * but might not be true during bootstrap or recovery operations.
         * (namespace.c is able to save some cycles when it is true.)
         */
@@ -141,7 +144,7 @@ typedef struct catclist
        uint32          hash_value;             /* hash value for lookup keys */
        HeapTupleData tuple;            /* header for tuple holding keys */
        int                     n_members;              /* number of member tuples */
-       CatCTup    *members[1];         /* members --- VARIABLE LENGTH ARRAY */
+       CatCTup    *members[1];         /* members --- VARIABLE LENGTH ARRAY */
 } CatCList;                                            /* VARIABLE LENGTH STRUCT */
 
 
@@ -171,8 +174,8 @@ extern HeapTuple SearchCatCache(CatCache *cache,
 extern void ReleaseCatCache(HeapTuple tuple);
 
 extern CatCList *SearchCatCacheList(CatCache *cache, int nkeys,
-                          Datum v1, Datum v2,
-                          Datum v3, Datum v4);
+                                  Datum v1, Datum v2,
+                                  Datum v3, Datum v4);
 extern void ReleaseCatCacheList(CatCList *list);
 
 extern void ResetCatalogCaches(void);
@@ -181,6 +184,6 @@ extern void CatalogCacheIdInvalidate(int cacheId, uint32 hashValue,
                                                 ItemPointer pointer);
 extern void PrepareToInvalidateCacheTuple(Relation relation,
                                                          HeapTuple tuple,
-                                               void (*function) (int, uint32, ItemPointer, Oid));
+                                          void (*function) (int, uint32, ItemPointer, Oid));
 
 #endif   /* CATCACHE_H */
index 409b42f..eaaac77 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: date.h,v 1.20 2002/06/20 20:29:52 momjian Exp $
+ * $Id: date.h,v 1.21 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,6 +21,7 @@ typedef int32 DateADT;
 
 #ifdef HAVE_INT64_TIMESTAMP
 typedef int64 TimeADT;
+
 #else
 typedef float8 TimeADT;
 #endif
@@ -28,11 +29,13 @@ typedef float8 TimeADT;
 typedef struct
 {
 #ifdef HAVE_INT64_TIMESTAMP
-       int64           time;   /* all time units other than months and years */
+       int64           time;                   /* all time units other than months and
+                                                                * years */
 #else
-       double          time;   /* all time units other than months and years */
+       double          time;                   /* all time units other than months and
+                                                                * years */
 #endif
-       int32           zone;   /* numeric time zone, in seconds */
+       int32           zone;                   /* numeric time zone, in seconds */
 } TimeTzADT;
 
 #ifdef HAVE_INT64_TIMESTAMP
index 08773fe..be7283b 100644 (file)
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: datetime.h,v 1.32 2002/06/20 20:29:52 momjian Exp $
+ * $Id: datetime.h,v 1.33 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #define ABS_BEFORE             18
 #define ABS_AFTER              19
 /* generic fields to help with parsing */
-#define ISODATE        20
-#define ISOTIME        21
+#define ISODATE 20
+#define ISOTIME 21
 /* reserved for unrecognized string values */
 #define UNKNOWN_FIELD  31
 
@@ -277,8 +277,8 @@ extern int DecodeTimeOnly(char **field, int *ftype,
                           struct tm * tm, fsec_t *fsec, int *tzp);
 
 extern int DecodeInterval(char **field, int *ftype,
-                               int nf, int *dtype,
-                               struct tm * tm, fsec_t *fsec);
+                          int nf, int *dtype,
+                          struct tm * tm, fsec_t *fsec);
 
 extern int     DetermineLocalTimeZone(struct tm * tm);
 
index ba78aa3..b1f431e 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: elog.h,v 1.39 2002/09/02 05:42:54 momjian Exp $
+ * $Id: elog.h,v 1.40 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #define ELOG_H
 
 /* Error level codes */
-#define DEBUG5         10              /* Debugging messages, in categories
-                                                        * of decreasing detail. */
+#define DEBUG5         10                      /* Debugging messages, in categories of
+                                                                * decreasing detail. */
 #define DEBUG4         11
-#define DEBUG3         12                              
-#define DEBUG2         13                              
-#define DEBUG1         14                              
-#define LOG                    15              /* Server operational messages;
-                                                        * sent only to server log by default. */
-#define COMMERROR      16              /* Client communication problems; same as
-                                                        * LOG for server reporting, but never sent
-                                                        * to client. */
-#define INFO           17              /* Informative messages that are always sent to
-                                                        * client;  is not affected by
-                                                        * client_min_messages */
-#define NOTICE         18              /* Helpful messages to users about query
-                                                        * operation;  sent to client
-                                                        * and server log by default. */
-#define WARNING                19              /* Warnings */
-#define ERROR          20              /* user error - abort transaction; return to known
-                                                        * state */
-#define FATAL          21              /* fatal error - abort process */
-#define PANIC          22              /* take down the other backends with me */
+#define DEBUG3         12
+#define DEBUG2         13
+#define DEBUG1         14
+#define LOG                    15                      /* Server operational messages; sent only
+                                                                * to server log by default. */
+#define COMMERROR      16                      /* Client communication problems; same as
+                                                                * LOG for server reporting, but never
+                                                                * sent to client. */
+#define INFO           17                      /* Informative messages that are always
+                                                                * sent to client;      is not affected by
+                                                                * client_min_messages */
+#define NOTICE         18                      /* Helpful messages to users about query
+                                                                * operation;  sent to client and server
+                                                                * log by default. */
+#define WARNING                19                      /* Warnings */
+#define ERROR          20                      /* user error - abort transaction; return
+                                                                * to known state */
+#define FATAL          21                      /* fatal error - abort process */
+#define PANIC          22                      /* take down the other backends with me */
 
-/*#define DEBUG        DEBUG1*/                /* Backward compatibility with pre-7.3 */
+ /*#define DEBUG DEBUG1*/      /* Backward compatibility with pre-7.3 */
 
 /* Configurable parameters */
 #ifdef HAVE_SYSLOG
@@ -53,6 +53,6 @@ elog(int lev, const char *fmt,...)
    the supplied arguments. */
 __attribute__((format(printf, 2, 3)));
 
-extern int  DebugFileOpen(void);
+extern int     DebugFileOpen(void);
 
 #endif   /* ELOG_H */
index 5e63bb5..51b570a 100644 (file)
@@ -4,7 +4,7 @@
  * External declarations pertaining to backend/utils/misc/guc.c and
  * backend/utils/misc/guc-file.l
  *
- * $Id: guc.h,v 1.22 2002/09/02 05:42:54 momjian Exp $
+ * $Id: guc.h,v 1.23 2002/09/04 20:31:45 momjian Exp $
  */
 #ifndef GUC_H
 #define GUC_H
@@ -82,13 +82,13 @@ extern void ResetAllOptions(void);
 extern void AtEOXact_GUC(bool isCommit);
 extern void ParseLongOption(const char *string, char **name, char **value);
 extern bool set_config_option(const char *name, const char *value,
-                                                         GucContext context, GucSource source,
-                                                         bool isLocal, bool DoIt);
+                                 GucContext context, GucSource source,
+                                 bool isLocal, bool DoIt);
 extern void ShowGUCConfigOption(const char *name);
 extern void ShowAllGUCConfig(void);
 extern char *GetConfigOptionByName(const char *name, const char **varname);
 extern char *GetConfigOptionByNum(int varnum, const char **varname, bool *noshow);
-extern int GetNumConfigOptions(void);
+extern int     GetNumConfigOptions(void);
 
 extern void SetPGVariable(const char *name, List *args, bool is_local);
 extern void GetPGVariable(const char *name);
@@ -101,12 +101,12 @@ extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *va
 extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name);
 
 extern const char *assign_min_error_statement(const char *newval, bool doit,
-                       bool interactive);
+                                                  bool interactive);
 
 extern const char *assign_server_min_messages(const char *newval,
-                                              bool doit, bool interactive);
+                                                  bool doit, bool interactive);
 extern const char *assign_client_min_messages(const char *newval,
-                                              bool doit, bool interactive);
+                                                  bool doit, bool interactive);
 extern bool Log_statement;
 extern bool Log_duration;
 extern bool Debug_print_plan;
@@ -132,11 +132,11 @@ extern char *log_min_error_statement_str;
 extern const char log_min_error_statement_str_default[];
 
 extern int     server_min_messages;
-extern char    *server_min_messages_str;
+extern char *server_min_messages_str;
 extern const char server_min_messages_str_default[];
 
-extern int client_min_messages;
-extern char    *client_min_messages_str;
+extern int     client_min_messages;
+extern char *client_min_messages_str;
 
 extern const char client_min_messages_str_default[];
 
index 469e5b0..a2474df 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: inval.h,v 1.26 2002/06/20 20:29:53 momjian Exp $
+ * $Id: inval.h,v 1.27 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,10 +31,10 @@ extern void CacheInvalidateHeapTuple(Relation relation, HeapTuple tuple);
 extern void CacheInvalidateRelcache(Oid relationId);
 
 extern void CacheRegisterSyscacheCallback(int cacheid,
-                                                                                 CacheCallbackFunction func,
-                                                                                 Datum arg);
+                                                         CacheCallbackFunction func,
+                                                         Datum arg);
 
 extern void CacheRegisterRelcacheCallback(CacheCallbackFunction func,
-                                                                                 Datum arg);
+                                                         Datum arg);
 
 #endif   /* INVAL_H */
index 3c442bb..029fdcd 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: lsyscache.h,v 1.61 2002/08/31 22:10:48 tgl Exp $
+ * $Id: lsyscache.h,v 1.62 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -29,7 +29,7 @@ extern char *get_opname(Oid opno);
 extern bool op_mergejoinable(Oid opno, Oid ltype, Oid rtype,
                                 Oid *leftOp, Oid *rightOp);
 extern void op_mergejoin_crossops(Oid opno, Oid *ltop, Oid *gtop,
-                                RegProcedure *ltproc, RegProcedure *gtproc);
+                                         RegProcedure *ltproc, RegProcedure *gtproc);
 extern Oid     op_hashjoinable(Oid opno, Oid ltype, Oid rtype);
 extern char op_volatile(Oid opno);
 extern Oid     get_commutator(Oid opno);
@@ -38,7 +38,7 @@ extern RegProcedure get_oprrest(Oid opno);
 extern RegProcedure get_oprjoin(Oid opno);
 extern char *get_func_name(Oid funcid);
 extern Oid     get_func_rettype(Oid funcid);
-extern bool    get_func_retset(Oid funcid);
+extern bool get_func_retset(Oid funcid);
 extern char func_volatile(Oid funcid);
 extern Oid     get_relname_relid(const char *relname, Oid relnamespace);
 extern Oid     get_system_catalog_relid(const char *catname);
@@ -50,14 +50,14 @@ extern int16 get_typlen(Oid typid);
 extern bool get_typbyval(Oid typid);
 extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval);
 extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval,
-                                                                char *typalign);
+                                        char *typalign);
 extern char get_typstorage(Oid typid);
 extern Node *get_typdefault(Oid typid);
 extern char get_typtype(Oid typid);
 extern void getTypeInputInfo(Oid type, Oid *typInput, Oid *typElem);
 extern bool getTypeOutputInfo(Oid type, Oid *typOutput, Oid *typElem,
-                                                         bool *typIsVarlena);
-extern Oid getBaseType(Oid typid);
+                                 bool *typIsVarlena);
+extern Oid     getBaseType(Oid typid);
 extern int32 getBaseTypeMod(Oid typid, int32 typmod);
 extern int32 get_typavgwidth(Oid typid, int32 typmod);
 extern int32 get_attavgwidth(Oid relid, AttrNumber attnum);
index 771618a..8529f94 100644 (file)
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: memutils.h,v 1.47 2002/08/12 00:36:12 tgl Exp $
+ * $Id: memutils.h,v 1.48 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -84,6 +84,7 @@ extern void MemoryContextDeleteChildren(MemoryContext context);
 extern void MemoryContextResetAndDeleteChildren(MemoryContext context);
 extern Size GetMemoryChunkSpace(void *pointer);
 extern void MemoryContextStats(MemoryContext context);
+
 #ifdef MEMORY_CONTEXT_CHECKING
 extern void MemoryContextCheck(MemoryContext context);
 #endif
index a1ba131..6c7b307 100644 (file)
@@ -2,7 +2,7 @@
  *
  * PostgreSQL locale utilities
  *
- * $Id: pg_locale.h,v 1.13 2002/05/17 01:19:19 tgl Exp $
+ * $Id: pg_locale.h,v 1.14 2002/09/04 20:31:45 momjian Exp $
  *
  * Copyright (c) 2002, PostgreSQL Global Development Group
  *
@@ -20,13 +20,13 @@ extern char *locale_numeric;
 extern char *locale_time;
 
 extern const char *locale_messages_assign(const char *value,
-                                                                                 bool doit, bool interactive);
+                                          bool doit, bool interactive);
 extern const char *locale_monetary_assign(const char *value,
-                                                                                 bool doit, bool interactive);
+                                          bool doit, bool interactive);
 extern const char *locale_numeric_assign(const char *value,
-                                                                                bool doit, bool interactive);
+                                         bool doit, bool interactive);
 extern const char *locale_time_assign(const char *value,
-                                                                         bool doit, bool interactive);
+                                  bool doit, bool interactive);
 
 extern bool lc_collate_is_c(void);
 
index d1b9d5f..ba784fe 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: portal.h,v 1.34 2002/06/20 20:29:53 momjian Exp $
+ * $Id: portal.h,v 1.35 2002/09/04 20:31:45 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -49,7 +49,7 @@ typedef struct PortalData
 #define PortalGetQueryDesc(portal)     ((portal)->queryDesc)
 #define PortalGetTupleDesc(portal)     ((portal)->attinfo)
 #define PortalGetState(portal)         ((portal)->state)
-#define PortalGetHeapMemory(portal)    ((portal)->heap)
+#define PortalGetHeapMemory(portal) ((portal)->heap)
 
 /*
  * estimate of the maximum number of open portals a user would have,
index a0bcd22..ed06e18 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rel.h,v 1.62 2002/08/11 21:17:35 tgl Exp $
+ * $Id: rel.h,v 1.63 2002/09/04 20:31:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -113,6 +113,7 @@ typedef struct RelationData
                                                                 * InvalidBlockNumber */
        int                     rd_refcnt;              /* reference count */
        bool            rd_isnew;               /* rel was created in current xact */
+
        /*
         * NOTE: rd_isnew should be relied on only for optimization purposes;
         * it is possible for new-ness to be "forgotten" (eg, after CLUSTER).
index b85500d..4ed6c17 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: selfuncs.h,v 1.7 2002/09/02 06:22:20 momjian Exp $
+ * $Id: selfuncs.h,v 1.8 2002/09/04 20:31:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -70,8 +70,8 @@ extern Selectivity booltestsel(Query *root, BooleanTest *clause, int varRelid);
 extern Selectivity nulltestsel(Query *root, NullTest *clause, int varRelid);
 
 extern void mergejoinscansel(Query *root, Node *clause,
-                                                        Selectivity *leftscan,
-                                                        Selectivity *rightscan);
+                                Selectivity *leftscan,
+                                Selectivity *rightscan);
 
 extern Datum btcostestimate(PG_FUNCTION_ARGS);
 extern Datum rtcostestimate(PG_FUNCTION_ARGS);
index b9a17c7..def5ed5 100644 (file)
@@ -9,7 +9,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: syscache.h,v 1.52 2002/08/02 18:15:09 tgl Exp $
+ * $Id: syscache.h,v 1.53 2002/09/04 20:31:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -87,7 +87,8 @@ extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
 
 /* list-search interface.  Users of this must import catcache.h too */
 extern struct catclist *SearchSysCacheList(int cacheId, int nkeys,
-                          Datum key1, Datum key2, Datum key3, Datum key4);
-#define ReleaseSysCacheList(x)  ReleaseCatCacheList(x)
+                                  Datum key1, Datum key2, Datum key3, Datum key4);
+
+#define ReleaseSysCacheList(x) ReleaseCatCacheList(x)
 
 #endif   /* SYSCACHE_H */
index b2a7f85..3a15225 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: timestamp.h,v 1.28 2002/08/04 06:42:18 thomas Exp $
+ * $Id: timestamp.h,v 1.29 2002/09/04 20:31:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -36,6 +36,7 @@
 #ifdef HAVE_INT64_TIMESTAMP
 typedef int64 Timestamp;
 typedef int64 TimestampTz;
+
 #else
 typedef double Timestamp;
 typedef double TimestampTz;
@@ -44,11 +45,14 @@ typedef double TimestampTz;
 typedef struct
 {
 #ifdef HAVE_INT64_TIMESTAMP
-       int64           time;   /* all time units other than months and years */
+       int64           time;                   /* all time units other than months and
+                                                                * years */
 #else
-       double          time;   /* all time units other than months and years */
+       double          time;                   /* all time units other than months and
+                                                                * years */
 #endif
-       int32           month;  /* months and years, after time for alignment */
+       int32           month;                  /* months and years, after time for
+                                                                * alignment */
 } Interval;
 
 
@@ -109,8 +113,7 @@ typedef struct
 #define DT_NOBEGIN             (-DBL_MAX)
 #define DT_NOEND               (DBL_MAX)
 #endif
-
-#endif /* HAVE_INT64_TIMESTAMP */
+#endif   /* HAVE_INT64_TIMESTAMP */
 
 
 #define TIMESTAMP_NOBEGIN(j)   do {j = DT_NOBEGIN;} while (0)
@@ -131,7 +134,6 @@ typedef double fsec_t;
 
 #define TIME_PREC_INV 1000000.0
 #define JROUND(j) (rint(((double) (j))*TIME_PREC_INV)/TIME_PREC_INV)
-
 #endif
 
 #define TIMESTAMP_MASK(b) (1 << (b))
index e649a8a..3e3b741 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tqual.h,v 1.42 2002/06/20 20:29:53 momjian Exp $
+ * $Id: tqual.h,v 1.43 2002/09/04 20:31:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -96,8 +96,8 @@ typedef enum
        HEAPTUPLE_DEAD,                         /* tuple is dead and deletable */
        HEAPTUPLE_LIVE,                         /* tuple is live (committed, no deleter) */
        HEAPTUPLE_RECENTLY_DEAD,        /* tuple is dead, but not deletable yet */
-       HEAPTUPLE_INSERT_IN_PROGRESS,   /* inserting xact is still in
-                                                                        * progress */
+       HEAPTUPLE_INSERT_IN_PROGRESS,           /* inserting xact is still in
+                                                                                * progress */
        HEAPTUPLE_DELETE_IN_PROGRESS    /* deleting xact is still in progress */
 } HTSV_Result;
 
@@ -107,8 +107,8 @@ extern bool HeapTupleSatisfiesDirty(HeapTupleHeader tuple);
 extern bool HeapTupleSatisfiesToast(HeapTupleHeader tuple);
 extern bool HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple,
                                                   Snapshot snapshot);
-extern int     HeapTupleSatisfiesUpdate(HeapTuple tuple,
-                                                                        CommandId curcid);
+extern int HeapTupleSatisfiesUpdate(HeapTuple tuple,
+                                                CommandId curcid);
 extern HTSV_Result HeapTupleSatisfiesVacuum(HeapTupleHeader tuple,
                                                 TransactionId OldestXmin);
 
index 9660ce5..75cedda 100644 (file)
@@ -40,7 +40,7 @@
 int                    print_err(SQLSMALLINT handletype, SQLINTEGER handle);
 
 int
-example1(SQLCHAR *server, SQLCHAR *uid, SQLCHAR *authen)
+example1(SQLCHAR * server, SQLCHAR * uid, SQLCHAR * authen)
 {
        SQLHENV         henv;
        SQLHDBC         hdbc;
@@ -135,12 +135,12 @@ example1(SQLCHAR *server, SQLCHAR *uid, SQLCHAR *authen)
        /* this time, explicitly allocate an application row descriptor */
        SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hdesc);
        SQLSetDescRec(hdesc, 1, SQL_INTEGER, 0, 0L, 0, 0,
-                (SQLPOINTER) & id, (SQLINTEGER *) NULL, (SQLSMALLINT *) &idind);
+               (SQLPOINTER) & id, (SQLINTEGER *) NULL, (SQLSMALLINT *) & idind);
 
        SQLSetDescRec(hdesc, 2, SQL_
                                  CHAR, 0, (SQLINTEGER) sizeof(name),
-                                 0, 0, (SQLPOINTER) & name, (SQLINTEGER *) &namelen,
-                                 (SQLSMALLINT *) &nameind);
+                                 0, 0, (SQLPOINTER) & name, (SQLINTEGER *) & namelen,
+                                 (SQLSMALLINT *) & nameind);
        /* associate descriptor with statement handle */
        SQLSetStmtAttr(hstmt, SQL_ATTR_APP_ROW_DESC, &hdesc, 0);
        /* execute the fetch */
index 6a4fb56..9b02e4f 100644 (file)
 #define  max(a,b) (a>b?a:b)
 
 int                    print_err(SQLSMALLINT handletype, SQLINTEGER handle);
-int build_indicator_message(SQLCHAR *errmsg,
+int build_indicator_message(SQLCHAR * errmsg,
                                                SQLPOINTER * data,
                                                SQLINTEGER collen,
-                                               SQLINTEGER *outlen,
+                                               SQLINTEGER * outlen,
                                                SQLSMALLINT colnum);
 
 SQLINTEGER display_length(SQLSMALLINT coltype,
                           SQLINTEGER collen,
-                          SQLCHAR *colname);
+                          SQLCHAR * colname);
 
-example2(SQLCHAR *server, SQLCHAR *uid, SQLCHAR *authen, SQLCHAR *sqlstr)
+example2(SQLCHAR * server, SQLCHAR * uid, SQLCHAR * authen, SQLCHAR * sqlstr)
 {
        int                     i;
        SQLHENV         henv;
@@ -214,7 +214,7 @@ example2(SQLCHAR *server, SQLCHAR *uid, SQLCHAR *authen, SQLCHAR *sqlstr)
 
 SQLINTEGER
 display_length(SQLSMALLINT coltype, SQLINTEGER collen,
-                          SQLCHAR *colname)
+                          SQLCHAR * colname)
 {
        switch (coltype)
        {
@@ -252,8 +252,8 @@ display_length(SQLSMALLINT coltype, SQLINTEGER collen,
 }
 
 int
-build_indicator_message(SQLCHAR *errmsg, SQLPOINTER * data,
-                          SQLINTEGER collen, SQLINTEGER *outlen, SQLSMALLINT colnum)
+build_indicator_message(SQLCHAR * errmsg, SQLPOINTER * data,
+                         SQLINTEGER collen, SQLINTEGER * outlen, SQLSMALLINT colnum)
 {
        if (*outlen == SQL_NULL_DATA)
        {
index 2942abf..a914549 100644 (file)
@@ -473,7 +473,7 @@ SQLRETURN   SQLAllocEnv(SQLHENV * EnvironmentHandle);
 
 SQLRETURN SQLAllocHandle(SQLSMALLINT HandleType,
                           SQLINTEGER InputHandle,
-                          SQLINTEGER *OutputHandle);
+                          SQLINTEGER * OutputHandle);
 
 SQLRETURN SQLAllocStmt(SQLHDBC ConnectionHandle,
                         SQLSTMT * StatementHandle);
@@ -483,7 +483,7 @@ SQLRETURN SQLBindCol(SQLHSTMT StatementHandle,
                   SQLSMALLINT BufferType,
                   SQLPOINTER Data,
                   SQLINTEGER BufferLength,
-                  SQLINTEGER *DataLength);
+                  SQLINTEGER * DataLength);
 
 SQLRETURN SQLBindParam(SQLHSTMT StatementHandle,
                         SQLSMALLINT ParamNumber,
@@ -492,7 +492,7 @@ SQLRETURN SQLBindParam(SQLHSTMT StatementHandle,
                         SQLINTEGER ParamLength,
                         SQLSMALLINT Scale,
                         SQLPOINTER Data,
-                        SQLINTEGER *DataLength);
+                        SQLINTEGER * DataLength);
 
 SQLRETURN      SQLCancel(SQLHSTMT StatementHandle);
 
@@ -501,17 +501,17 @@ SQLRETURN SQLCloseCursor(SQLHSTMT StatementHandle);
 SQLRETURN SQLColAttribute(SQLHSTMT StatementHandle,
                                SQLSMALLINT ColumnNumber,
                                SQLSMALLINT FieldIdentifier,
-                               SQLCHAR *CharacterAttribute,
+                               SQLCHAR * CharacterAttribute,
                                SQLINTEGER BufferLength,
-                               SQLINTEGER *AttributetLength,
-                               SQLINTEGER *NumericAttribute);
+                               SQLINTEGER * AttributetLength,
+                               SQLINTEGER * NumericAttribute);
 
 SQLRETURN SQLConnect(SQLHDBC ConnectionHandle,
-                  SQLCHAR *ServerName,
+                  SQLCHAR * ServerName,
                   SQLSMALLINT NameLength1,
-                  SQLCHAR *UserName,
+                  SQLCHAR * UserName,
                   SQLSMALLINT NameLength2,
-                  SQLCHAR *Authentication,
+                  SQLCHAR * Authentication,
                   SQLSMALLINT NameLength3);
 
 SQLRETURN SQLCopyDesc(SQLHDESC SourceDescHandle,
@@ -519,22 +519,22 @@ SQLRETURN SQLCopyDesc(SQLHDESC SourceDescHandle,
 
 SQLRETURN SQLDataSources(SQLHENV EnvironmentHandle,
                           SQLSMALLINT Direction,
-                          SQLCHAR *ServerName,
+                          SQLCHAR * ServerName,
                           SQLSMALLINT BufferLength1,
-                          SQLSMALLINT *NameLength1,
-                          SQLCHAR *Description,
+                          SQLSMALLINT * NameLength1,
+                          SQLCHAR * Description,
                           SQLSMALLINT BufferLength2,
-                          SQLSMALLINT *NameLength2);
+                          SQLSMALLINT * NameLength2);
 
 SQLRETURN SQLDescribeCol(SQLHSTMT StatementHandle,
                           SQLSMALLINT ColumnNumber,
-                          SQLCHAR *ColumnName,
+                          SQLCHAR * ColumnName,
                           SQLSMALLINT BufferLength,
-                          SQLSMALLINT *ColumnNameLength,
-                          SQLSMALLINT *ColumnType,
-                          SQLINTEGER *ColumnLength,
-                          SQLSMALLINT *ColumnScale,
-                          SQLSMALLINT *Nullable);
+                          SQLSMALLINT * ColumnNameLength,
+                          SQLSMALLINT * ColumnType,
+                          SQLINTEGER * ColumnLength,
+                          SQLSMALLINT * ColumnScale,
+                          SQLSMALLINT * Nullable);
 
 SQLRETURN      SQLDisconnect(SQLHDBC ConnectionHandle);
 
@@ -545,14 +545,14 @@ SQLRETURN SQLEndTran(SQLSMALLINT HandleType,
 SQLRETURN SQLError(SQLHENV EnvironmentHandle,
                 SQLHDBC ConnectionHandle,
                 SQLSTMT StatementHandle,
-                SQLCHAR *Sqlstate,
-                SQLINTEGER *NativeError,
-                SQLCHAR *MessageText,
+                SQLCHAR * Sqlstate,
+                SQLINTEGER * NativeError,
+                SQLCHAR * MessageText,
                 SQLINTEGER BufferLength,
-                SQLINTEGER *TextLength);
+                SQLINTEGER * TextLength);
 
 SQLRETURN SQLExecDirect(SQLHSTMT StatementHandle,
-                         SQLCHAR *StatementText,
+                         SQLCHAR * StatementText,
                          SQLSMALLINT StringLength);
 
 SQLRETURN      SQLExecute(SQLHSTMT StatementHandle);
@@ -576,38 +576,38 @@ SQLRETURN SQLGetConnectAttr(SQLHDBC ConnectionHandle,
                                  SQLINTEGER Attribute,
                                  SQLPOINTER Value,
                                  SQLINTEGER BufferLength,
-                                 SQLINTEGER *StringLength);
+                                 SQLINTEGER * StringLength);
 
 SQLRETURN SQLGetCursorName(SQLHSTMT StatementHandle,
-                                SQLCHAR *CursorName,
+                                SQLCHAR * CursorName,
                                 SQLSMALLINT BufferLength,
-                                SQLSMALLINT *NameLength);
+                                SQLSMALLINT * NameLength);
 
 SQLRETURN SQLGetData(SQLHSTMT StatementHandle,
                   SQLSMALLINT ColumnNumber,
                   SQLSMALLINT TargetType,
                   SQLPOINTER TargetValue,
                   SQLINTEGER BufferLength,
-                  SQLINTEGER *IndicatorValue);
+                  SQLINTEGER * IndicatorValue);
 
 SQLRETURN SQLGetDescField(SQLHDESC DescriptorHandle,
                                SQLSMALLINT RecordNumber,
                                SQLSMALLINT FieldIdentifier,
                                SQLPOINTER Value,
                                SQLINTEGER BufferLength,
-                               SQLINTEGER *StringLength);
+                               SQLINTEGER * StringLength);
 
 SQLRETURN SQLGetDescRec(SQLHDESC DescriptorHandle,
                          SQLSMALLINT RecordNumber,
-                         SQLCHAR *Name,
+                         SQLCHAR * Name,
                          SQLSMALLINT BufferLength,
-                         SQLSMALLINT *StringLength,
-                         SQLSMALLINT *Type,
-                         SQLSMALLINT *SubType,
-                         SQLINTEGER *Length,
-                         SQLSMALLINT *Precision,
-                         SQLSMALLINT *Scale,
-                         SQLSMALLINT *Nullable);
+                         SQLSMALLINT * StringLength,
+                         SQLSMALLINT * Type,
+                         SQLSMALLINT * SubType,
+                         SQLINTEGER * Length,
+                         SQLSMALLINT * Precision,
+                         SQLSMALLINT * Scale,
+                         SQLSMALLINT * Nullable);
 
 SQLRETURN SQLGetDiagField(SQLSMALLINT HandleType,
                                SQLINTEGER Handle,
@@ -615,51 +615,51 @@ SQLRETURN SQLGetDiagField(SQLSMALLINT HandleType,
                                SQLSMALLINT DiagIdentifier,
                                SQLPOINTER DiagInfo,
                                SQLSMALLINT BufferLength,
-                               SQLSMALLINT *StringLength);
+                               SQLSMALLINT * StringLength);
 
 
 SQLRETURN SQLGetDiagRec(SQLSMALLINT HandleType,
                          SQLINTEGER Handle,
                          SQLSMALLINT RecordNumber,
-                         SQLCHAR *Sqlstate,
-                         SQLINTEGER *NativeError,
-                         SQLCHAR *MessageText,
+                         SQLCHAR * Sqlstate,
+                         SQLINTEGER * NativeError,
+                         SQLCHAR * MessageText,
                          SQLSMALLINT BufferLength,
-                         SQLSMALLINT *StringLength);
+                         SQLSMALLINT * StringLength);
 
 SQLRETURN SQLGetEnvAttr(SQLHENV EnvironmentHandle,
                          SQLINTEGER Attribute,
                          SQLPOINTER Value,
                          SQLINTEGER BufferLength,
-                         SQLINTEGER *StringLength);
+                         SQLINTEGER * StringLength);
 
 SQLRETURN SQLGetFunctions(SQLHDBC ConnectionHandle,
                                SQLSMALLINT FunctionId,
-                               SQLSMALLINT *Supported);
+                               SQLSMALLINT * Supported);
 
 SQLRETURN SQLGetInfo(SQLHDBC ConnectionHandle,
                   SQLSMALLINT InfoType,
                   SQLPOINTER InfoValue,
                   SQLSMALLINT BufferLength,
-                  SQLSMALLINT *StringLength);
+                  SQLSMALLINT * StringLength);
 
 SQLRETURN SQLGetStmtAttr(SQLHSTMT StatementHandle,
                           SQLINTEGER Attribute,
                           SQLPOINTER Value,
                           SQLINTEGER BufferLength,
-                          SQLINTEGER *StringLength);
+                          SQLINTEGER * StringLength);
 
 SQLRETURN SQLGetTypeInfo(SQLHSTMT StatementHandle,
                           SQLSMALLINT DataType);
 
 SQLRETURN SQLNumResultCols(SQLHSTMT StatementHandle,
-                                SQLINTEGER *ColumnCount);
+                                SQLINTEGER * ColumnCount);
 
 SQLRETURN SQLParamData(SQLHSTMT StatementHandle,
                         SQLPOINTER * Value);
 
 SQLRETURN SQLPrepare(SQLHSTMT StatementHandle,
-                  SQLCHAR *StatementText,
+                  SQLCHAR * StatementText,
                   SQLSMALLINT StringLength);
 
 
@@ -668,7 +668,7 @@ SQLRETURN SQLPutData(SQLHSTMT StatementHandle,
                   SQLINTEGER StringLength);
 
 SQLRETURN SQLRowCount(SQLHSTMT StatementHandle,
-                       SQLINTEGER *RowCount);
+                       SQLINTEGER * RowCount);
 
 SQLRETURN SQLSetConnectAttr(SQLHDBC ConnectionHandle,
                                  SQLINTEGER AttributeCursorName,
@@ -676,7 +676,7 @@ SQLRETURN SQLSetConnectAttr(SQLHDBC ConnectionHandle,
                                  SQLINTEGER StringLength);
 
 SQLRETURN SQLSetCursorName(SQLHSTMT StatementHandle,
-                                SQLCHAR *CursorName,
+                                SQLCHAR * CursorName,
                                 SQLSMALLINT NameLength);
 
 SQLRETURN SQLSetDescField(SQLHDESC DescriptorHandle,
@@ -692,8 +692,8 @@ SQLRETURN SQLSetDescRec(SQLHDESC DescriptorHandle,
                          SQLSMALLINT Precision,
                          SQLSMALLINT Scale,
                          SQLPOINTER Data,
-                         SQLINTEGER *StringLength,
-                         SQLSMALLINT *Indicator);
+                         SQLINTEGER * StringLength,
+                         SQLSMALLINT * Indicator);
 
 SQLRETURN SQLSetEnvAttr(SQLHENV EnvironmentHandle,
                          SQLINTEGER Attribute,
index 545782e..2106e3d 100644 (file)
   */
 #define ECPG_WARNING_QUERY_IGNORED        -601
  /* WARNING:  PerformPortalClose: portal "*" not found */
-#define ECPG_WARNING_UNKNOWN_PORTAL       -602
+#define ECPG_WARNING_UNKNOWN_PORTAL    -602
  /* WARNING:  BEGIN: already a transaction in progress */
-#define ECPG_WARNING_IN_TRANSACTION       -603
+#define ECPG_WARNING_IN_TRANSACTION    -603
  /* WARNING:  AbortTransaction and not in in-progress state */
  /* WARNING:  COMMIT: no transaction in progress */
-#define ECPG_WARNING_NO_TRANSACTION       -604
+#define ECPG_WARNING_NO_TRANSACTION    -604
  /* WARNING:  BlankPortalAssignName: portal * already exists */
 #define ECPG_WARNING_PORTAL_EXISTS        -605
 
index 5c295d8..f2ca4e5 100644 (file)
@@ -68,8 +68,9 @@ bool          ECPGget_desc_header(int, char *, int *);
 bool           ECPGget_desc(int, char *, int,...);
 
 /* dynamic result allocation */
-       void            ECPGfree_auto_mem(void);
+void           ECPGfree_auto_mem(void);
 
 #ifdef __cplusplus
 }
+
 #endif
index ae53972..6cc1f0c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/connect.c,v 1.18 2002/03/06 06:10:35 momjian Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/connect.c,v 1.19 2002/09/04 20:31:46 momjian Exp $ */
 
 #include "postgres_fe.h"
 
@@ -154,10 +154,10 @@ ECPGnoticeProcessor(void *arg, const char *message)
                message++;
        ECPGlog("WARNING: %s", message);
 
-       /* WARNING:     (transaction aborted): queries ignored until END */
+       /* WARNING: (transaction aborted): queries ignored until END */
 
        /*
-        * WARNING:     current transaction is aborted, queries ignored until end
+        * WARNING: current transaction is aborted, queries ignored until end
         * of transaction block
         */
        if (strstr(message, "queries ignored") && strstr(message, "transaction")
@@ -167,7 +167,7 @@ ECPGnoticeProcessor(void *arg, const char *message)
                return;
        }
 
-       /* WARNING:     PerformPortalClose: portal "*" not found */
+       /* WARNING: PerformPortalClose: portal "*" not found */
        if ((!strncmp(message, "PerformPortalClose: portal", 26)
                 || !strncmp(message, "PerformPortalFetch: portal", 26))
                && strstr(message + 26, "not found"))
@@ -176,16 +176,16 @@ ECPGnoticeProcessor(void *arg, const char *message)
                return;
        }
 
-       /* WARNING:     BEGIN: already a transaction in progress */
+       /* WARNING: BEGIN: already a transaction in progress */
        if (!strncmp(message, "BEGIN: already a transaction in progress", 40))
        {
                ECPGnoticeProcessor_raise(ECPG_WARNING_IN_TRANSACTION, message);
                return;
        }
 
-       /* WARNING:     AbortTransaction and not in in-progress state */
-       /* WARNING:     COMMIT: no transaction in progress */
-       /* WARNING:     ROLLBACK: no transaction in progress */
+       /* WARNING: AbortTransaction and not in in-progress state */
+       /* WARNING: COMMIT: no transaction in progress */
+       /* WARNING: ROLLBACK: no transaction in progress */
        if (!strncmp(message, "AbortTransaction and not in in-progress state", 45)
                || !strncmp(message, "COMMIT: no transaction in progress", 34)
                || !strncmp(message, "ROLLBACK: no transaction in progress", 36))
@@ -194,7 +194,7 @@ ECPGnoticeProcessor(void *arg, const char *message)
                return;
        }
 
-       /* WARNING:     BlankPortalAssignName: portal * already exists */
+       /* WARNING: BlankPortalAssignName: portal * already exists */
        if (!strncmp(message, "BlankPortalAssignName: portal", 29)
                && strstr(message + 29, "already exists"))
        {
@@ -205,54 +205,54 @@ ECPGnoticeProcessor(void *arg, const char *message)
        /* these are harmless - do nothing */
 
        /*
-        * WARNING:     CREATE TABLE / PRIMARY KEY will create implicit index '*'
+        * WARNING: CREATE TABLE / PRIMARY KEY will create implicit index '*'
         * for table '*'
         */
 
        /*
-        * WARNING:     ALTER TABLE ... ADD CONSTRAINT will create implicit
+        * WARNING: ALTER TABLE ... ADD CONSTRAINT will create implicit
         * trigger(s) for FOREIGN KEY check(s)
         */
 
        /*
-        * WARNING:     CREATE TABLE will create implicit sequence '*' for SERIAL
+        * WARNING: CREATE TABLE will create implicit sequence '*' for SERIAL
         * column '*.*'
         */
 
        /*
-        * WARNING:     CREATE TABLE will create implicit trigger(s) for FOREIGN
+        * WARNING: CREATE TABLE will create implicit trigger(s) for FOREIGN
         * KEY check(s)
         */
        if ((!strncmp(message, "CREATE TABLE", 12) || !strncmp(message, "ALTER TABLE", 11))
                && strstr(message + 11, "will create implicit"))
                return;
 
-       /* WARNING:     QUERY PLAN: */
+       /* WARNING: QUERY PLAN: */
        if (!strncmp(message, "QUERY PLAN:", 11))       /* do we really see these? */
                return;
 
        /*
-        * WARNING:     DROP TABLE implicitly drops referential integrity trigger
+        * WARNING: DROP TABLE implicitly drops referential integrity trigger
         * from table "*"
         */
        if (!strncmp(message, "DROP TABLE implicitly drops", 27))
                return;
 
        /*
-        * WARNING:     Caution: DROP INDEX cannot be rolled back, so don't abort
+        * WARNING: Caution: DROP INDEX cannot be rolled back, so don't abort
         * now
         */
        if (strstr(message, "cannot be rolled back"))
                return;
 
        /* these and other unmentioned should set sqlca.sqlwarn[2] */
-       /* WARNING:     The ':' operator is deprecated.  Use exp(x) instead. */
-       /* WARNING:     Rel *: Uninitialized page 0 - fixing */
-       /* WARNING:     PortalHeapMemoryFree: * not in alloc set! */
-       /* WARNING:     Too old parent tuple found - can't continue vc_repair_frag */
-       /* WARNING:     identifier "*" will be truncated to "*" */
-       /* WARNING:     InvalidateSharedInvalid: cache state reset */
-       /* WARNING:     RegisterSharedInvalid: SI buffer overflow */
+       /* WARNING: The ':' operator is deprecated.  Use exp(x) instead. */
+       /* WARNING: Rel *: Uninitialized page 0 - fixing */
+       /* WARNING: PortalHeapMemoryFree: * not in alloc set! */
+       /* WARNING: Too old parent tuple found - can't continue vc_repair_frag */
+       /* WARNING: identifier "*" will be truncated to "*" */
+       /* WARNING: InvalidateSharedInvalid: cache state reset */
+       /* WARNING: RegisterSharedInvalid: SI buffer overflow */
        sqlca.sqlwarn[2] = 'W';
        sqlca.sqlwarn[0] = 'W';
 }
@@ -388,9 +388,7 @@ ECPGconnect(int lineno, const char *name, const char *user, const char *passwd,
 
                }
                else
-               {
                        realname = strdup(dbname);
-               }
        }
        else
                realname = strdup(dbname);
index 743b0d0..bfdbe80 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.23 2002/01/08 23:34:47 tgl Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/data.c,v 1.24 2002/09/04 20:31:46 momjian Exp $ */
 
 #include "postgres_fe.h"
 
@@ -13,9 +13,9 @@
 
 bool
 ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
-                enum ECPGttype type, enum ECPGttype ind_type,
-                char *var, char *ind, long varcharsize, long offset,
-                long ind_offset, bool isarray)
+                        enum ECPGttype type, enum ECPGttype ind_type,
+                        char *var, char *ind, long varcharsize, long offset,
+                        long ind_offset, bool isarray)
 {
        char       *pval = (char *) PQgetvalue(results, act_tuple, act_field);
 
@@ -54,23 +54,23 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                case ECPGt_short:
                case ECPGt_unsigned_short:
 /*                     ((short *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);*/
-                       *((short *) (ind + ind_offset*act_tuple)) = -PQgetisnull(results, act_tuple, act_field);
+                       *((short *) (ind + ind_offset * act_tuple)) = -PQgetisnull(results, act_tuple, act_field);
                        break;
                case ECPGt_int:
                case ECPGt_unsigned_int:
 /*                     ((int *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);*/
-                       *((int *) (ind + ind_offset*act_tuple)) = -PQgetisnull(results, act_tuple, act_field);
+                       *((int *) (ind + ind_offset * act_tuple)) = -PQgetisnull(results, act_tuple, act_field);
                        break;
                case ECPGt_long:
                case ECPGt_unsigned_long:
 /*                     ((long *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);*/
-                       *((long *) (ind + ind_offset*act_tuple)) = -PQgetisnull(results, act_tuple, act_field);
+                       *((long *) (ind + ind_offset * act_tuple)) = -PQgetisnull(results, act_tuple, act_field);
                        break;
 #ifdef HAVE_LONG_LONG_INT_64
                case ECPGt_long_long:
                case ECPGt_unsigned_long_long:
 /*                     ((long long int *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);*/
-                       *((long long int *) (ind + ind_offset*act_tuple)) = -PQgetisnull(results, act_tuple, act_field);
+                       *((long long int *) (ind + ind_offset * act_tuple)) = -PQgetisnull(results, act_tuple, act_field);
                        break;
 /*             case ECPGt_unsigned_long_long:
                        ((unsigned long long int *) ind)[act_tuple] = -PQgetisnull(results, act_tuple, act_field);
@@ -118,15 +118,15 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                {
                                        case ECPGt_short:
 /*                                             ((short *) var)[act_tuple] = (short) res;*/
-                                               *((short *) (var + offset*act_tuple)) = (short) res;
+                                               *((short *) (var + offset * act_tuple)) = (short) res;
                                                break;
                                        case ECPGt_int:
 /*                                             ((int *) var)[act_tuple] = (int) res;*/
-                                               *((int *) (var + offset*act_tuple)) = (int) res;
+                                               *((int *) (var + offset * act_tuple)) = (int) res;
                                                break;
                                        case ECPGt_long:
 /*                                             ((long *) var)[act_tuple] = res;*/
-                                               *((long *) (var + offset*act_tuple)) = (long) res;
+                                               *((long *) (var + offset * act_tuple)) = (long) res;
                                                break;
                                        default:
                                                /* Cannot happen */
@@ -154,15 +154,15 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                {
                                        case ECPGt_unsigned_short:
 /*                                             ((unsigned short *) var)[act_tuple] = (unsigned short) ures;*/
-                                               *((unsigned short *) (var + offset*act_tuple)) = (unsigned short) ures;
+                                               *((unsigned short *) (var + offset * act_tuple)) = (unsigned short) ures;
                                                break;
                                        case ECPGt_unsigned_int:
 /*                                             ((unsigned int *) var)[act_tuple] = (unsigned int) ures;*/
-                                               *((unsigned int *) (var + offset*act_tuple)) = (unsigned int) ures;
+                                               *((unsigned int *) (var + offset * act_tuple)) = (unsigned int) ures;
                                                break;
                                        case ECPGt_unsigned_long:
 /*                                             ((unsigned long *) var)[act_tuple] = ures;*/
-                                               *((unsigned long *) (var + offset*act_tuple)) = (unsigned long) ures;
+                                               *((unsigned long *) (var + offset * act_tuple)) = (unsigned long) ures;
                                                break;
                                        default:
                                                /* Cannot happen */
@@ -176,7 +176,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                if (pval)
                                {
 /*                                     ((long long int *) var)[act_tuple] = strtoll(pval, &scan_length, 10);*/
-                                       *((long long int *) (var + offset*act_tuple)) = strtoll(pval, &scan_length, 10);
+                                       *((long long int *) (var + offset * act_tuple)) = strtoll(pval, &scan_length, 10);
                                        if ((isarray && *scan_length != ',' && *scan_length != '}')
                                                || (!isarray && *scan_length != '\0'))  /* Garbage left */
                                        {
@@ -186,7 +186,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                }
                                else
 /*                                     ((long long int *) var)[act_tuple] = (long long) 0;*/
-                                       *((long long int *) (var + offset*act_tuple)) = (long long) 0;
+                                       *((long long int *) (var + offset * act_tuple)) = (long long) 0;
 
                                break;
 #endif   /* HAVE_STRTOLL */
@@ -195,7 +195,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                if (pval)
                                {
 /*                                     ((unsigned long long int *) var)[act_tuple] = strtoull(pval, &scan_length, 10);*/
-                                       *((unsigned long long int *) (var + offset*act_tuple)) =  strtoull(pval, &scan_length, 10);
+                                       *((unsigned long long int *) (var + offset * act_tuple)) = strtoull(pval, &scan_length, 10);
                                        if ((isarray && *scan_length != ',' && *scan_length != '}')
                                                || (!isarray && *scan_length != '\0'))  /* Garbage left */
                                        {
@@ -205,7 +205,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                }
                                else
 /*                                     ((unsigned long long int *) var)[act_tuple] = (long long) 0;*/
-                                       *((unsigned long long int *) (var + offset*act_tuple)) = (long long) 0;
+                                       *((unsigned long long int *) (var + offset * act_tuple)) = (long long) 0;
 
                                break;
 #endif   /* HAVE_STRTOULL */
@@ -237,11 +237,11 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                {
                                        case ECPGt_float:
 /*                                             ((float *) var)[act_tuple] = dres;*/
-                                               *((float *) (var + offset*act_tuple)) =  dres;
+                                               *((float *) (var + offset * act_tuple)) = dres;
                                                break;
                                        case ECPGt_double:
 /*                                             ((double *) var)[act_tuple] = dres;*/
-                                               *((double *) (var + offset*act_tuple)) =  dres;
+                                               *((double *) (var + offset * act_tuple)) = dres;
                                                break;
                                        default:
                                                /* Cannot happen */
@@ -256,10 +256,10 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                        {
                                                if (offset == sizeof(char))
 /*                                                     ((char *) var)[act_tuple] = false;*/
-                                                       *((char *) (var + offset*act_tuple)) =  false;
+                                                       *((char *) (var + offset * act_tuple)) = false;
                                                else if (offset == sizeof(int))
 /*                                                     ((int *) var)[act_tuple] = false;*/
-                                                       *((int *) (var + offset*act_tuple)) =  false;
+                                                       *((int *) (var + offset * act_tuple)) = false;
                                                else
                                                        ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size");
                                                break;
@@ -268,10 +268,10 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                        {
                                                if (offset == sizeof(char))
 /*                                                     ((char *) var)[act_tuple] = true;*/
-                                                       *((char *) (var + offset*act_tuple)) =  true;
+                                                       *((char *) (var + offset * act_tuple)) = true;
                                                else if (offset == sizeof(int))
 /*                                                     ((int *) var)[act_tuple] = true;*/
-                                                       *((int *) (var + offset*act_tuple)) =  true;
+                                                       *((int *) (var + offset * act_tuple)) = true;
                                                else
                                                        ECPGraise(lineno, ECPG_CONVERT_BOOL, "different size");
                                                break;
@@ -299,22 +299,22 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                        case ECPGt_short:
                                                        case ECPGt_unsigned_short:
 /*                                                             ((short *) ind)[act_tuple] = strlen(pval);*/
-                                                               *((short *) (ind + ind_offset*act_tuple)) = strlen(pval);
+                                                               *((short *) (ind + ind_offset * act_tuple)) = strlen(pval);
                                                                break;
                                                        case ECPGt_int:
                                                        case ECPGt_unsigned_int:
 /*                                                             ((int *) ind)[act_tuple] = strlen(pval);*/
-                                                               *((int *) (ind + ind_offset*act_tuple)) = strlen(pval);
+                                                               *((int *) (ind + ind_offset * act_tuple)) = strlen(pval);
                                                                break;
                                                        case ECPGt_long:
                                                        case ECPGt_unsigned_long:
 /*                                                             ((long *) ind)[act_tuple] = strlen(pval);*/
-                                                               *((long *) (ind + ind_offset*act_tuple)) = strlen(pval);
+                                                               *((long *) (ind + ind_offset * act_tuple)) = strlen(pval);
                                                                break;
 #ifdef HAVE_LONG_LONG_INT_64
                                                        case ECPGt_long_long:
                                                        case ECPGt_unsigned_long_long:
-                                                               *((long long int *) (ind + ind_offset*act_tuple)) = strlen(pval);
+                                                               *((long long int *) (ind + ind_offset * act_tuple)) = strlen(pval);
                                                                break;
 #endif   /* HAVE_LONG_LONG_INT_64 */
                                                        default:
@@ -344,22 +344,22 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                                                        case ECPGt_short:
                                                        case ECPGt_unsigned_short:
 /*                                                             ((short *) ind)[act_tuple] = variable->len;*/
-                                                               *((short *) (ind + offset*act_tuple)) = variable->len;
+                                                               *((short *) (ind + offset * act_tuple)) = variable->len;
                                                                break;
                                                        case ECPGt_int:
                                                        case ECPGt_unsigned_int:
 /*                                                             ((int *) ind)[act_tuple] = variable->len;*/
-                                                               *((int *) (ind + offset*act_tuple)) = variable->len;
+                                                               *((int *) (ind + offset * act_tuple)) = variable->len;
                                                                break;
                                                        case ECPGt_long:
                                                        case ECPGt_unsigned_long:
 /*                                                             ((long *) ind)[act_tuple] = variable->len;*/
-                                                               *((long *) (ind + offset*act_tuple)) = variable->len;
+                                                               *((long *) (ind + offset * act_tuple)) = variable->len;
                                                                break;
 #ifdef HAVE_LONG_LONG_INT_64
                                                        case ECPGt_long_long:
                                                        case ECPGt_unsigned_long_long:
-                                                               *((long long int *) (ind + ind_offset*act_tuple)) = variable->len;
+                                                               *((long long int *) (ind + ind_offset * act_tuple)) = variable->len;
                                                                break;
 #endif   /* HAVE_LONG_LONG_INT_64 */
                                                        default:
index 80180e4..17598fa 100644 (file)
@@ -1,6 +1,6 @@
 /* dynamic SQL support routines
  *
- * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/descriptor.c,v 1.22 2002/01/23 16:34:06 meskes Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/descriptor.c,v 1.23 2002/09/04 20:31:46 momjian Exp $
  */
 
 #include "postgres_fe.h"
@@ -58,7 +58,7 @@ ECPGget_desc_header(int lineno, char *desc_name, int *count)
                return false;
 
        *count = PQnfields(ECPGresult);
-       sqlca.sqlerrd[2]=1;
+       sqlca.sqlerrd[2] = 1;
        ECPGlog("ECPGget_desc_header: found %d attributes.\n", *count);
        return true;
 }
@@ -149,7 +149,7 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
        int                     ntuples,
                                act_tuple;
        struct variable data_var;
-       
+
        va_start(args, index);
        ECPGinit_sqlca();
        ECPGresult = ECPGresultByDescriptor(lineno, desc_name);
@@ -173,11 +173,11 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
        --index;
 
        type = va_arg(args, enum ECPGdtype);
-       
-       memset (&data_var, 0, sizeof data_var);
-       data_var.type=ECPGt_EORT;
-       data_var.ind_type=ECPGt_NO_INDICATOR;
-       
+
+       memset(&data_var, 0, sizeof data_var);
+       data_var.type = ECPGt_EORT;
+       data_var.ind_type = ECPGt_NO_INDICATOR;
+
        while (type != ECPGd_EODT)
        {
                char            type_str[20];
@@ -196,11 +196,11 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
                switch (type)
                {
                        case (ECPGd_indicator):
-                               data_var.ind_type=vartype;
-                               data_var.ind_pointer=var;
-                               data_var.ind_varcharsize=varcharsize;
-                               data_var.ind_arrsize=arrsize;
-                               data_var.ind_offset=offset;
+                               data_var.ind_type = vartype;
+                               data_var.ind_pointer = var;
+                               data_var.ind_varcharsize = varcharsize;
+                               data_var.ind_arrsize = arrsize;
+                               data_var.ind_offset = offset;
                                if (data_var.ind_arrsize == 0 || data_var.ind_varcharsize == 0)
                                        data_var.ind_value = *((void **) (data_var.ind_pointer));
                                else
@@ -208,11 +208,11 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
                                break;
 
                        case ECPGd_data:
-                               data_var.type=vartype;
-                               data_var.pointer=var;
-                               data_var.varcharsize=varcharsize;
-                               data_var.arrsize=arrsize;
-                               data_var.offset=offset;
+                               data_var.type = vartype;
+                               data_var.pointer = var;
+                               data_var.varcharsize = varcharsize;
+                               data_var.arrsize = arrsize;
+                               data_var.offset = offset;
                                if (data_var.arrsize == 0 || data_var.varcharsize == 0)
                                        data_var.value = *((void **) (data_var.pointer));
                                else
@@ -279,7 +279,7 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
 
                                ECPGlog("ECPGget_desc: TYPE = %d\n", ECPGDynamicType_DDT(PQftype(ECPGresult, index)));
                                break;
-                               
+
                        case ECPGd_cardinality:
                                if (!get_int_item(lineno, var, vartype, PQntuples(ECPGresult)))
                                        return (false);
@@ -301,14 +301,15 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
                                        return false;
                                }
                                /* allocate storage if needed */
-                               if (arrsize == 0 && var != NULL && *(void**)var == NULL)
+                               if (arrsize == 0 && var != NULL && *(void **) var == NULL)
                                {
-                                       void *mem = (void *) ECPGalloc(offset * ntuples, lineno);
-                                       *(void **)var = mem;
+                                       void       *mem = (void *) ECPGalloc(offset * ntuples, lineno);
+
+                                       *(void **) var = mem;
                                        ECPGadd_mem(mem, lineno);
                                        var = mem;
                                }
-       
+
                                for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
                                {
                                        if (!get_int_item(lineno, var, vartype, PQgetlength(ECPGresult, act_tuple, index)))
@@ -327,31 +328,31 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
                type = va_arg(args, enum ECPGdtype);
        }
 
-       if (data_var.type!=ECPGt_EORT)
+       if (data_var.type != ECPGt_EORT)
        {
                struct statement stmt;
-               char       *oldlocale;
-               
+               char       *oldlocale;
+
                /* Make sure we do NOT honor the locale for numeric input */
                /* since the database gives the standard decimal point */
                oldlocale = strdup(setlocale(LC_NUMERIC, NULL));
                setlocale(LC_NUMERIC, "C");
-               
-               memset (&stmt, 0, sizeof stmt);
-               stmt.lineno=lineno;
-               
+
+               memset(&stmt, 0, sizeof stmt);
+               stmt.lineno = lineno;
+
                /* desparate try to guess something sensible */
-               stmt.connection=ECPGget_connection(NULL);
+               stmt.connection = ECPGget_connection(NULL);
                ECPGstore_result(ECPGresult, index, &stmt, &data_var);
-               
+
                setlocale(LC_NUMERIC, oldlocale);
                ECPGfree(oldlocale);
        }
-       else if (data_var.ind_type!=ECPGt_NO_INDICATOR)
+       else if (data_var.ind_type != ECPGt_NO_INDICATOR)
        {
                /*
-                * this is like ECPGstore_result
-                * but since we don't have a data variable at hand, we can't call it
+                * this is like ECPGstore_result but since we don't have a data
+                * variable at hand, we can't call it
                 */
                if (data_var.ind_arrsize > 0 && ntuples > data_var.ind_arrsize)
                {
@@ -363,8 +364,9 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
                /* allocate storage if needed */
                if (data_var.ind_arrsize == 0 && data_var.ind_pointer != NULL && data_var.ind_value == NULL)
                {
-                       void *mem = (void *) ECPGalloc(data_var.ind_offset * ntuples, lineno);
-                       *(void **)data_var.ind_pointer = mem;
+                       void       *mem = (void *) ECPGalloc(data_var.ind_offset * ntuples, lineno);
+
+                       *(void **) data_var.ind_pointer = mem;
                        ECPGadd_mem(mem, lineno);
                        data_var.ind_value = mem;
                }
@@ -376,7 +378,7 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
                        ECPGlog("ECPGget_desc: INDICATOR[%d] = %d\n", act_tuple, -PQgetisnull(ECPGresult, act_tuple, index));
                }
        }
-       sqlca.sqlerrd[2]=ntuples;
+       sqlca.sqlerrd[2] = ntuples;
        return (true);
 }
 
@@ -409,16 +411,17 @@ ECPGallocate_desc(int line, const char *name)
 
        ECPGinit_sqlca();
        new = (struct descriptor *) ECPGalloc(sizeof(struct descriptor), line);
-       if (!new) return false;
+       if (!new)
+               return false;
        new->next = all_descriptors;
        new->name = ECPGalloc(strlen(name) + 1, line);
-       if (!new->name) 
+       if (!new->name)
        {
                ECPGfree(new);
                return false;
        }
        new->result = PQmakeEmptyPGresult(NULL, 0);
-       if (!new->result) 
+       if (!new->result)
        {
                ECPGfree(new->name);
                ECPGfree(new);
index ca3e533..526634a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.15 2002/01/07 02:29:15 petere Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/error.c,v 1.16 2002/09/04 20:31:46 momjian Exp $ */
 
 #include "postgres_fe.h"
 
@@ -84,7 +84,7 @@ ECPGraise(int line, int code, const char *str)
 
                case ECPG_ARRAY_INSERT:
                        snprintf(sqlca.sqlerrm.sqlerrmc, sizeof(sqlca.sqlerrm.sqlerrmc),
-                                        "Trying to insert an array of variables in line %d.", line);
+                        "Trying to insert an array of variables in line %d.", line);
                        break;
 
                case ECPG_NO_CONN:
index 2a95319..bad48a7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.38 2002/07/20 08:24:18 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/execute.c,v 1.39 2002/09/04 20:31:46 momjian Exp $ */
 
 /*
  * The aim is to get a simpler inteface to the database routines.
@@ -89,7 +89,7 @@ quote_postgres(char *arg, int lineno)
 
        res[ri++] = '\'';
        res[ri] = '\0';
-       
+
        return res;
 }
 
@@ -168,7 +168,7 @@ create_statement(int lineno, struct connection * connection, struct statement **
                        var->next = NULL;
 
                        if (var->ind_type != ECPGt_NO_INDICATOR
-                                       && (var->ind_arrsize == 0 || var->ind_varcharsize == 0))
+                               && (var->ind_arrsize == 0 || var->ind_varcharsize == 0))
                                var->ind_value = *((char **) (var->ind_pointer));
                        else
                                var->ind_value = var->ind_pointer;
@@ -390,14 +390,12 @@ ECPGstore_result(const PGresult *results, int act_field,
                                {
                                        /* special mode for handling char**foo=0 */
                                        for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
-                                       {
                                                len += strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
-                                       }
                                        len *= var->offset; /* should be 1, but YMNK */
-                                       len += (ntuples+1) * sizeof(char *);
+                                       len += (ntuples + 1) * sizeof(char *);
 
                                        ECPGlog("ECPGstore_result: line %d: allocating %d bytes for %d tuples (char**=0)",
-                                               stmt->lineno,len, ntuples);
+                                                       stmt->lineno, len, ntuples);
                                }
                                else
                                {
@@ -405,7 +403,7 @@ ECPGstore_result(const PGresult *results, int act_field,
                                        /* check strlen for each tuple */
                                        for (act_tuple = 0; act_tuple < ntuples; act_tuple++)
                                        {
-                                               int     len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
+                                               int                     len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
 
                                                if (len > var->varcharsize)
                                                        var->varcharsize = len;
@@ -427,31 +425,34 @@ ECPGstore_result(const PGresult *results, int act_field,
        }
 
        /* allocate indicator variable if needed */
-       if ((var->ind_arrsize == 0 || var->ind_varcharsize == 0) && var->ind_value == NULL && var->ind_pointer!=NULL)
+       if ((var->ind_arrsize == 0 || var->ind_varcharsize == 0) && var->ind_value == NULL && var->ind_pointer != NULL)
        {
-               int     len = var->ind_offset * ntuples;
+               int                     len = var->ind_offset * ntuples;
+
                var->ind_value = (char *) ECPGalloc(len, stmt->lineno);
                *((char **) var->ind_pointer) = var->ind_value;
                ECPGadd_mem(var->ind_value, stmt->lineno);
        }
-       
+
        /* fill the variable with the tuple(s) */
-       if (!var->varcharsize && !var->arrsize && 
-                               (var->type==ECPGt_char || var->type==ECPGt_unsigned_char))
+       if (!var->varcharsize && !var->arrsize &&
+               (var->type == ECPGt_char || var->type == ECPGt_unsigned_char))
        {
                /* special mode for handling char**foo=0 */
-               
+
                /* filling the array of (char*)s */
-               char **current_string = (char**) var->value;
+               char      **current_string = (char **) var->value;
+
                /* storing the data (after the last array element) */
-               char *current_data_location = (char*) &current_string[ntuples+1];
-               
+               char       *current_data_location = (char *) &current_string[ntuples + 1];
+
                for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
                {
-                       int len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
+                       int                     len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1;
+
                        if (!ECPGget_data(results, act_tuple, act_field, stmt->lineno,
-                                                 var->type, var->ind_type, current_data_location,
-                                        var->ind_value, len, 0, 0, isarray))
+                                                var->type, var->ind_type, current_data_location,
+                                                         var->ind_value, len, 0, 0, isarray))
                                status = false;
                        else
                        {
@@ -460,7 +461,7 @@ ECPGstore_result(const PGresult *results, int act_field,
                                current_string++;
                        }
                }
-               
+
                /* terminate the list */
                *current_string = NULL;
        }
@@ -469,8 +470,8 @@ ECPGstore_result(const PGresult *results, int act_field,
                for (act_tuple = 0; act_tuple < ntuples && status; act_tuple++)
                {
                        if (!ECPGget_data(results, act_tuple, act_field, stmt->lineno,
-                                                 var->type, var->ind_type, var->value,
-                                        var->ind_value, var->varcharsize, var->offset, var->ind_offset, isarray))
+                                                         var->type, var->ind_type, var->value,
+                                                         var->ind_value, var->varcharsize, var->offset, var->ind_offset, isarray))
                                status = false;
                }
        }
@@ -484,9 +485,9 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
        char       *mallocedval = NULL;
        char       *newcopy = NULL;
 
-       /* 
-        * arrays are not possible unless the attribute is an array too
-        * FIXME: we do not know if the attribute is an array here
+       /*
+        * arrays are not possible unless the attribute is an array too FIXME:
+        * we do not know if the attribute is an array here
         */
 
 /*      if (var->arrsize > 1 && ...)
@@ -494,7 +495,7 @@ ECPGstore_input(const struct statement * stmt, const struct variable * var,
                ECPGraise(stmt->lineno, ECPG_ARRAY_INSERT, NULL);
                return false;
         }*/
-        
+
        /*
         * Some special treatment is needed for records since we want their
         * contents to arrive in a comma-separated list on insert (I think).
@@ -1116,7 +1117,7 @@ ECPGdo(int lineno, const char *connection_name, char *query,...)
 
        /* initialize auto_mem struct */
        ECPGclear_auto_mem();
-       
+
        status = ECPGexecute(stmt);
        free_statement(stmt);
 
index 3fa935d..24073bb 100644 (file)
@@ -6,7 +6,7 @@
 void           ECPGadd_mem(void *ptr, int lineno);
 
 bool ECPGget_data(const PGresult *, int, int, int, enum ECPGttype type,
-                enum ECPGttype, char *, char *, long, long, long, bool);
+                        enum ECPGttype, char *, char *, long, long, long, bool);
 struct connection *ECPGget_connection(const char *);
 void           ECPGinit_sqlca(void);
 char      *ECPGalloc(long, int);
index 5e85261..2551fda 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/memory.c,v 1.8 2001/12/23 12:17:41 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/memory.c,v 1.9 2002/09/04 20:31:46 momjian Exp $ */
 
 #include "postgres_fe.h"
 
@@ -53,6 +53,7 @@ void
 ECPGadd_mem(void *ptr, int lineno)
 {
        struct auto_mem *am = (struct auto_mem *) ECPGalloc(sizeof(struct auto_mem), lineno);
+
        am->pointer = ptr;
        am->next = auto_allocs;
        auto_allocs = am;
index 4a5573b..7bbd8df 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/misc.c,v 1.12 2002/01/18 15:51:00 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/lib/Attic/misc.c,v 1.13 2002/09/04 20:31:46 momjian Exp $ */
 
 #include "postgres_fe.h"
 
@@ -90,8 +90,10 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
        /* if we have no connection we just simulate the command */
        if (con && con->connection)
        {
-               /* if we are not in autocommit mode, already have committed 
-                * the transaction and get another commit, just ignore it */
+               /*
+                * if we are not in autocommit mode, already have committed the
+                * transaction and get another commit, just ignore it
+                */
                if (!con->committed || con->autocommit)
                {
                        if ((res = PQexec(con->connection, transaction)) == NULL)
index 2f20bd9..8de3819 100644 (file)
@@ -1,4 +1,4 @@
-/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.56 2002/04/28 17:20:03 meskes Exp $ */
+/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.57 2002/09/04 20:31:46 momjian Exp $ */
 
 /* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
 /* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@@ -32,7 +32,7 @@ help(const char *progname)
        /* printf is a macro some places; don't #ifdef inside its arguments */
 #ifdef YYDEBUG
        printf("Usage:\n"
-          "  %s [-d] [-I DIRECTORY] [-o OUTFILE] [-t] [-c] [-D symbol] file1 [file2...]\n\n",
+                  "  %s [-d] [-I DIRECTORY] [-o OUTFILE] [-t] [-c] [-D symbol] file1 [file2...]\n\n",
                   progname);
 #else
        printf("Usage:\n"
@@ -61,7 +61,7 @@ add_include_path(char *path)
        include_paths = mm_alloc(sizeof(struct _include_path));
        include_paths->path = path;
        include_paths->next = ip;
-               
+
 }
 
 static void
index 4ef4f51..9b90899 100644 (file)
@@ -18,7 +18,8 @@ extern char *descriptor_index;
 extern char *descriptor_name;
 extern char *connection;
 extern char *input_filename;
-extern char *yytext, *token_start,
+extern char *yytext,
+                  *token_start,
                        errortext[128];
 
 #ifdef YYDEBUG
index c064f34..4722f21 100644 (file)
@@ -26,7 +26,7 @@ mm_strdup(const char *string)
 
        if (new == NULL)
                mmerror(OUT_OF_MEMORY, ET_FATAL, "Out of memory\n");
-               
+
        return new;
 }
 
@@ -183,7 +183,7 @@ get_type(enum ECPGttype type)
 /* Dump a type.
    The type is dumped as:
    type-tag <comma>                               - enum ECPGttype
-   reference-to-variable <comma>                  - char *
+   reference-to-variable <comma>                  - char *
    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
@@ -208,7 +208,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const char *i
                case ECPGt_array:
                        if (indicator_set && ind_type->type != ECPGt_array)
                                mmerror(INDICATOR_NOT_ARRAY, ET_FATAL, "Indicator for array/pointer has to be array/pointer.\n");
-                       
+
                        switch (type->u.element->type)
                        {
                                case ECPGt_array:
@@ -223,7 +223,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const char *i
                                                yyerror("Internal error: unknown datatype, please inform pgsql-bugs@postgresql.org");
 
                                        ECPGdump_a_simple(o, name, type->u.element->type,
-                                                 type->u.element->size, type->size, NULL, prefix);
+                                               type->u.element->size, type->size, NULL, prefix);
                                        if (ind_type != NULL)
                                        {
                                                if (ind_type->type == ECPGt_NO_INDICATOR)
@@ -325,7 +325,7 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
                                 * we have to use the pointer except for arrays with given
                                 * bounds
                                 */
-                               if (arrsize > 0 && siz== NULL)
+                               if (arrsize > 0 && siz == NULL)
                                        sprintf(variable, "(%s%s)", prefix ? prefix : "", name);
                                else
                                        sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
@@ -376,24 +376,22 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, long arrsiz,
                sprintf(pbuf, "%s%s.", prefix ? prefix : "", name);
        else
                sprintf(pbuf, "%s%s->", prefix ? prefix : "", name);
-               
+
        prefix = pbuf;
 
        if (ind_type == &ecpg_no_indicator)
-       {
                ind_p = &struct_no_indicator;
-       }
        else if (ind_type != NULL)
        {
                if (arrsiz == 1)
                        sprintf(ind_pbuf, "%s%s.", ind_prefix ? ind_prefix : "", ind_name);
                else
                        sprintf(ind_pbuf, "%s%s->", ind_prefix ? ind_prefix : "", ind_name);
-                                       
+
                ind_prefix = ind_pbuf;
                ind_p = ind_type->u.members;
        }
-       
+
        for (p = type->u.members; p; p = p->next)
        {
                ECPGdump_a_type(o, p->name, p->type, (ind_p != NULL) ? ind_p->name : NULL, (ind_p != NULL) ? ind_p->type : NULL, prefix, ind_prefix, arrsiz, type->struct_sizeof, (ind_p != NULL) ? ind_type->struct_sizeof : NULL);
index f73bda5..10d5fc8 100644 (file)
@@ -14,7 +14,8 @@ struct ECPGtype
        long            size;                   /* For array it is the number of elements.
                                                                 * For varchar it is the maxsize of the
                                                                 * area. */
-       char            *struct_sizeof;         /* For a struct this is the sizeof() type as string */
+       char       *struct_sizeof;      /* For a struct this is the sizeof() type
+                                                                * as string */
        union
        {
                struct ECPGtype *element;               /* For an array this is the type
@@ -90,7 +91,7 @@ struct this_type
        char       *type_str;
        int                     type_dimension;
        int                     type_index;
-       char *                  type_sizeof;
+       char       *type_sizeof;
 };
 
 struct _include_path
index fd8b7c9..34504cc 100644 (file)
@@ -242,7 +242,7 @@ dump_variables(struct arguments * list, int mode)
 
        /* Then the current element and its indicator */
        ECPGdump_a_type(yyout, list->variable->name, list->variable->type,
-                          list->indicator->name, list->indicator->type, NULL, NULL, 0, NULL, NULL);
+                                       list->indicator->name, list->indicator->type, NULL, NULL, 0, NULL, NULL);
 
        /* Then release the list element. */
        if (mode != 0)
@@ -318,16 +318,17 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
 
                *dimension = type_dimension;
        }
-       
-       if (pointer_len>2)
-       {       snprintf(errortext, sizeof(errortext), "No multilevel (more than 2) pointer supported %d",pointer_len);
-           mmerror(PARSE_ERROR, ET_FATAL, errortext);
+
+       if (pointer_len > 2)
+       {
+               snprintf(errortext, sizeof(errortext), "No multilevel (more than 2) pointer supported %d", pointer_len);
+               mmerror(PARSE_ERROR, ET_FATAL, errortext);
 /*             mmerror(PARSE_ERROR, ET_FATAL, "No multilevel (more than 2) pointer supported %d",pointer_len);*/
        }
-       if (pointer_len>1 && type_enum!=ECPGt_char && type_enum!=ECPGt_unsigned_char)
+       if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char)
                mmerror(PARSE_ERROR, ET_FATAL, "No pointer to pointer supported for this type");
 
-       if (pointer_len>1 && (*length >= 0 || *dimension >= 0))
+       if (pointer_len > 1 && (*length >= 0 || *dimension >= 0))
                mmerror(PARSE_ERROR, ET_FATAL, "No multi-dimensional array support");
 
        if (*length >= 0 && *dimension >= 0 && pointer_len)
@@ -364,14 +365,14 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
                case ECPGt_char:
                case ECPGt_unsigned_char:
                        /* char ** */
-                       if (pointer_len==2)
+                       if (pointer_len == 2)
                        {
                                *length = *dimension = 0;
                                break;
                        }
-                       
+
                        /* pointer has to get length 0 */
-                       if (pointer_len==1)
+                       if (pointer_len == 1)
                                *length = 0;
 
                        /* one index is the string length */
index e0f6495..60f51b8 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtcl.c,v 1.26 2002/09/02 21:51:47 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtcl.c,v 1.27 2002/09/04 20:31:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -151,7 +151,7 @@ Pgtcl_Init(Tcl_Interp *interp)
                                          "pg_listen",
                                          Pg_listen,
                                          (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
-       
+
        Tcl_CreateCommand(interp,
                                          "pg_on_connection_loss",
                                          Pg_on_connection_loss,
index 28680c9..d04406c 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.67 2002/09/02 23:41:16 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.68 2002/09/04 20:31:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1577,7 +1577,10 @@ Pg_lo_import(ClientData cData, Tcl_Interp *interp, int argc, char *argv[])
        lobjId = lo_import(conn, filename);
        if (lobjId == InvalidOid)
        {
-               /* What is the maximum size of this? FIXME if this is not a good quess */
+               /*
+                * What is the maximum size of this? FIXME if this is not a good
+                * quess
+                */
                snprintf(interp->result, 128, "Pg_lo_import of '%s' failed", filename);
                return TCL_ERROR;
        }
@@ -2040,10 +2043,10 @@ Pg_on_connection_loss(ClientData cData, Tcl_Interp *interp, int argc, char *argv
        if (callback)
        {
                /*
-                * Start the notify event source if it isn't already running.
-                * The notify source will cause Tcl to watch read-ready on the
-                * connection socket, so that we find out quickly if the connection
-                * drops.
+                * Start the notify event source if it isn't already running. The
+                * notify source will cause Tcl to watch read-ready on the
+                * connection socket, so that we find out quickly if the
+                * connection drops.
                 */
                PgStartNotifyEventSource(connid);
        }
index 97b19da..5cc802a 100644 (file)
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pgtclCmds.h,v 1.27 2002/09/02 21:51:47 tgl Exp $
+ * $Id: pgtclCmds.h,v 1.28 2002/09/04 20:31:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -134,6 +134,6 @@ extern int Pg_lo_export(
 extern int Pg_listen(
                  ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
 extern int Pg_on_connection_loss(
-                       ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
+                  ClientData cData, Tcl_Interp *interp, int argc, char *argv[]);
 
 #endif   /* PGTCLCMDS_H */
index 94bacfc..2187503 100644 (file)
@@ -13,7 +13,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.34 2002/09/02 23:41:17 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclId.c,v 1.35 2002/09/04 20:31:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -289,7 +289,7 @@ PgDelConnectionId(DRIVER_DEL_PROTO)
        connid->conn = NULL;
 
        /*
-        * Kill the notifier channel, too.  We must not do this until after
+        * Kill the notifier channel, too.      We must not do this until after
         * we've closed the libpq connection, because Tcl will try to close
         * the socket itself!
         *
@@ -653,8 +653,8 @@ PgNotifyTransferEvents(Pg_ConnectionId * connid)
         * This is also a good place to check for unexpected closure of the
         * connection (ie, backend crash), in which case we must shut down the
         * notify event source to keep Tcl from trying to select() on the now-
-        * closed socket descriptor.  But don't kill on-connection-loss events;
-        * in fact, register one.
+        * closed socket descriptor.  But don't kill on-connection-loss
+        * events; in fact, register one.
         */
        if (PQsocket(connid->conn) < 0)
                PgConnLossTransferEvents(connid);
@@ -678,9 +678,10 @@ PgConnLossTransferEvents(Pg_ConnectionId * connid)
        }
 
        /*
-        * Shut down the notify event source to keep Tcl from trying to select()
-        * on the now-closed socket descriptor.  And zap any unprocessed notify
-        * events ... but not, of course, the connection-loss event.
+        * Shut down the notify event source to keep Tcl from trying to
+        * select() on the now-closed socket descriptor.  And zap any
+        * unprocessed notify events ... but not, of course, the
+        * connection-loss event.
         */
        PgStopNotifyEventSource(connid, false);
 }
@@ -770,8 +771,8 @@ Pg_Notify_FileHandler(ClientData clientData, int mask)
        else
        {
                /*
-                * If there is no input but we have read-ready,
-                * assume this means we lost the connection.
+                * If there is no input but we have read-ready, assume this means
+                * we lost the connection.
                 */
                PgConnLossTransferEvents(connid);
        }
index dbca53c..5a6e492 100644 (file)
@@ -10,7 +10,7 @@
  * exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.70 2002/09/02 06:11:43 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.71 2002/09/04 20:31:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -415,7 +415,7 @@ pg_krb5_sendauth(char *PQerrormsg, int sock,
                        snprintf(PQerrormsg, PQERRORMSG_LENGTH,
                          libpq_gettext("Kerberos 5 authentication rejected: %*s\n"),
                                         err_ret->e_data->length,
-                                        (const char *)err_ret->e_data->data);
+                                        (const char *) err_ret->e_data->data);
 #else
 #error "bogus configuration"
 #endif
@@ -619,7 +619,7 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
                        if (password == NULL || *password == '\0')
                        {
                                (void) snprintf(PQerrormsg, PQERRORMSG_LENGTH,
-                                                          "fe_sendauth: no password supplied\n");
+                                                               "fe_sendauth: no password supplied\n");
                                return STATUS_ERROR;
                        }
                        if (pg_password_sendauth(conn, password, areq) != STATUS_OK)
index f7fd94f..c875ce7 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.200 2002/08/30 05:28:50 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.201 2002/09/04 20:31:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -184,9 +184,9 @@ static char *conninfo_getval(PQconninfoOption *connOptions,
 static void defaultNoticeProcessor(void *arg, const char *message);
 static int parseServiceInfo(PQconninfoOption *options,
                                 PQExpBuffer errorMessage);
-char *pwdfMatchesString(char *buf, char *token);
+char      *pwdfMatchesString(char *buf, char *token);
 char *PasswordFromFile(char *hostname, char *port, char *dbname,
-               char *username, char *pwdfile);
+                                char *username, char *pwdfile);
 
 /*
  *             Connecting to a Database
@@ -396,8 +396,8 @@ PQconndefaults(void)
  *       PGPASSWORD   The user's password.
  *
  *       PGPASSWORDFILE
- *                                A file that contains host:port:database:user:password
- *                                for authentication
+ *                                A file that contains host:port:database:user:password
+ *                                for authentication
  *
  *       PGDATABASE   name of database to which to connect if <pgdatabase>
  *                                argument is NULL or a null string
@@ -497,14 +497,17 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
        else
                conn->dbName = strdup(dbName);
 
-       /* getPasswordFromFile mallocs its result, so we don't need strdup here */
+       /*
+        * getPasswordFromFile mallocs its result, so we don't need strdup
+        * here
+        */
        if (pwd)
                conn->pgpass = strdup(pwd);
        else if ((tmp = getenv("PGPASSWORD")) != NULL)
                conn->pgpass = strdup(tmp);
        else if ((tmp = PasswordFromFile(conn->pghost, conn->pgport,
-                                       conn->dbName, conn->pguser,
-                                       getenv("PGPASSWORDFILE"))) != NULL)
+                                                                        conn->dbName, conn->pguser,
+                                                                        getenv("PGPASSWORDFILE"))) != NULL)
                conn->pgpass = tmp;
        else
                conn->pgpass = strdup(DefaultPassword);
@@ -978,9 +981,7 @@ retry2:
                {
                        if (pqsecure_initialize(conn) == -1 ||
                                pqsecure_open_client(conn) == -1)
-                       {
                                goto connect_errReturn;
-                       }
                        /* SSL connection finished. Continue to send startup packet */
                }
                else if (SSLok == 'E')
@@ -1056,15 +1057,18 @@ connectDBComplete(PGconn *conn)
 {
        PostgresPollingStatusType flag = PGRES_POLLING_WRITING;
 
-    struct timeval remains, *rp = NULL, finish_time, start_time;
+       struct timeval remains,
+                          *rp = NULL,
+                               finish_time,
+                               start_time;
 
        if (conn == NULL || conn->status == CONNECTION_BAD)
                return 0;
 
-    /*
-     * Prepare to time calculations, if connect_timeout isn't zero.
-     */
-    if (conn->connect_timeout != NULL)
+       /*
+        * Prepare to time calculations, if connect_timeout isn't zero.
+        */
+       if (conn->connect_timeout != NULL)
        {
                remains.tv_sec = atoi(conn->connect_timeout);
                if (!remains.tv_sec)
@@ -1137,12 +1141,12 @@ connectDBComplete(PGconn *conn)
                                conn->status = CONNECTION_BAD;
                                return 0;
                        }
-                       if ((finish_time.tv_usec -= start_time.tv_usec) < 0 )
+                       if ((finish_time.tv_usec -= start_time.tv_usec) < 0)
                        {
                                remains.tv_sec++;
                                finish_time.tv_usec += 1000000;
                        }
-                       if ((remains.tv_usec -= finish_time.tv_usec) < 0 )
+                       if ((remains.tv_usec -= finish_time.tv_usec) < 0)
                        {
                                remains.tv_sec--;
                                remains.tv_usec += 1000000;
@@ -1971,8 +1975,8 @@ freePGconn(PGconn *conn)
                free(conn->pguser);
        if (conn->pgpass)
                free(conn->pgpass);
-      if (conn->connect_timeout)
-              free(conn->connect_timeout);
+       if (conn->connect_timeout)
+               free(conn->connect_timeout);
        /* Note that conn->Pfdebug is not ours to close or free */
        if (conn->notifyList)
                DLFreeList(conn->notifyList);
@@ -2866,9 +2870,10 @@ defaultNoticeProcessor(void *arg, const char *message)
 char *
 pwdfMatchesString(char *buf, char *token)
 {
-       char   *tbuf,
-                  *ttok;
-       bool    bslash = false;
+       char       *tbuf,
+                          *ttok;
+       bool            bslash = false;
+
        if (buf == NULL || token == NULL)
                return NULL;
        tbuf = buf;
@@ -2883,7 +2888,7 @@ pwdfMatchesString(char *buf, char *token)
                        bslash = true;
                }
                if (*tbuf == ':' && *ttok == 0 && !bslash)
-                       return tbuf+1;
+                       return tbuf + 1;
                bslash = false;
                if (*ttok == 0)
                        return NULL;
@@ -2901,11 +2906,12 @@ pwdfMatchesString(char *buf, char *token)
 /* get a password from the password file. */
 char *
 PasswordFromFile(char *hostname, char *port, char *dbname,
-               char *username, char *pwdfile)
+                                char *username, char *pwdfile)
 {
-       FILE   *fp;
+       FILE       *fp;
+
 #define LINELEN NAMEDATALEN*5
-       char    buf[LINELEN];
+       char            buf[LINELEN];
        struct stat stat_buf;
 
        if (pwdfile == NULL || strcmp(pwdfile, "") == 0)
@@ -2940,18 +2946,20 @@ PasswordFromFile(char *hostname, char *port, char *dbname,
        if (fp == NULL)
                return NULL;
 
-       while (!feof(fp)) {
-               char *t = buf,
-                    *ret;
+       while (!feof(fp))
+       {
+               char       *t = buf,
+                                  *ret;
+
                fgets(buf, LINELEN - 1, fp);
                if (strlen(buf) == 0)
                        continue;
 
                buf[strlen(buf) - 1] = 0;
                if ((t = pwdfMatchesString(t, hostname)) == NULL ||
-                               (t = pwdfMatchesString(t, port)) == NULL ||
-                               (t = pwdfMatchesString(t, dbname)) == NULL ||
-                               (t = pwdfMatchesString(t, username)) == NULL)
+                       (t = pwdfMatchesString(t, port)) == NULL ||
+                       (t = pwdfMatchesString(t, dbname)) == NULL ||
+                       (t = pwdfMatchesString(t, username)) == NULL)
                        continue;
                ret = strdup(t);
                fclose(fp);
index 0d1b7ad..214f292 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.121 2002/08/24 15:00:47 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.122 2002/09/04 20:31:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -135,7 +135,7 @@ PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen)
        for (i = binlen; i > 0; i--, vp++)
        {
                if (*vp == 0 || *vp >= 0x80)
-                       len += 5;       /* '5' is for '\\ooo' */
+                       len += 5;                       /* '5' is for '\\ooo' */
                else if (*vp == '\'')
                        len += 2;
                else if (*vp == '\\')
@@ -155,7 +155,7 @@ PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen)
        {
                if (*vp == 0 || *vp >= 0x80)
                {
-                       (void)sprintf(rp,"\\\\%03o",*vp);
+                       (void) sprintf(rp, "\\\\%03o", *vp);
                        rp += 5;
                }
                else if (*vp == '\'')
@@ -181,7 +181,7 @@ PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen)
 }
 
 /*
- *             PQunescapeBytea - converts the null terminated string representation
+ *             PQunescapeBytea - converts the null terminated string representation
  *             of a bytea, strtext, into binary, filling a buffer. It returns a
  *             pointer to the buffer which is NULL on error, and the size of the
  *             buffer in retbuflen. The pointer may subsequently be used as an
@@ -204,72 +204,83 @@ PQescapeBytea(unsigned char *bintext, size_t binlen, size_t *bytealen)
 unsigned char *
 PQunescapeBytea(unsigned char *strtext, size_t *retbuflen)
 {
-       size_t buflen;
-       unsigned char *buffer, *sp, *bp;
-       unsigned int state=0;
-
-       if(strtext == NULL)return NULL;
-       buflen = strlen(strtext); /* will shrink, also we discover if strtext */
-       buffer = (unsigned char *) malloc(buflen);   /* isn't NULL terminated */
-       if(buffer == NULL)return NULL;
-       for(bp = buffer, sp = strtext; *sp != '\0'; bp++, sp++)
+       size_t          buflen;
+       unsigned char *buffer,
+                          *sp,
+                          *bp;
+       unsigned int state = 0;
+
+       if (strtext == NULL)
+               return NULL;
+       buflen = strlen(strtext);       /* will shrink, also we discover if
+                                                                * strtext */
+       buffer = (unsigned char *) malloc(buflen);      /* isn't NULL terminated */
+       if (buffer == NULL)
+               return NULL;
+       for (bp = buffer, sp = strtext; *sp != '\0'; bp++, sp++)
        {
-               switch(state)
+               switch (state)
                {
                        case 0:
-                               if(*sp == '\\')state=1;
+                               if (*sp == '\\')
+                                       state = 1;
                                *bp = *sp;
                                break;
                        case 1:
-                               if(*sp == '\'') /* state=5 */
-                               { /* replace \' with 39 */
+                               if (*sp == '\'')        /* state=5 */
+                               {                               /* replace \' with 39 */
                                        bp--;
                                        *bp = '\'';
                                        buflen--;
-                                       state=0;
+                                       state = 0;
                                }
-                               else if(*sp == '\\') /* state=6 */
-                               { /* replace \\ with 92 */
+                               else if (*sp == '\\')   /* state=6 */
+                               {                               /* replace \\ with 92 */
                                        bp--;
                                        *bp = '\\';
                                        buflen--;
-                                       state=0;
+                                       state = 0;
                                }
                                else
                                {
-                                       if(isdigit(*sp))state=2;
-                                       else state=0;
+                                       if (isdigit(*sp))
+                                               state = 2;
+                                       else
+                                               state = 0;
                                        *bp = *sp;
                                }
                                break;
                        case 2:
-                               if(isdigit(*sp))state=3;
-                               else state=0;
+                               if (isdigit(*sp))
+                                       state = 3;
+                               else
+                                       state = 0;
                                *bp = *sp;
                                break;
                        case 3:
-                               if(isdigit(*sp)) /* state=4 */
+                               if (isdigit(*sp))               /* state=4 */
                                {
-                                       int v;
+                                       int                     v;
+
                                        bp -= 3;
-                                       sscanf(sp-2, "%03o", &v);
+                                       sscanf(sp - 2, "%03o", &v);
                                        *bp = v;
                                        buflen -= 3;
-                                       state=0;
+                                       state = 0;
                                }
                                else
                                {
                                        *bp = *sp;
-                                       state=0;
+                                       state = 0;
                                }
                                break;
                }
        }
-       buffer = realloc(buffer,buflen);
+       buffer = realloc(buffer, buflen);
        if (buffer == NULL)
                return NULL;
 
-       *retbuflen=buflen;
+       *retbuflen = buflen;
        return buffer;
 }
 
@@ -894,8 +905,8 @@ parseInput(PGconn *conn)
                        return;
 
                /*
-                * NOTIFY and WARNING messages can happen in any state besides COPY
-                * OUT; always process them right away.
+                * NOTIFY and WARNING messages can happen in any state besides
+                * COPY OUT; always process them right away.
                 *
                 * Most other messages should only be processed while in BUSY state.
                 * (In particular, in READY state we hold off further parsing
@@ -1508,13 +1519,13 @@ getNotify(PGconn *conn)
                return EOF;
 
        /*
-        * Store the relation name right after the PQnotify structure so it can
-        * all be freed at once.  We don't use NAMEDATALEN because we don't
-        * want to tie this interface to a specific server name length.
+        * Store the relation name right after the PQnotify structure so it
+        * can all be freed at once.  We don't use NAMEDATALEN because we
+        * don't want to tie this interface to a specific server name length.
         */
        newNotify = (PGnotify *) malloc(sizeof(PGnotify) +
-                               strlen(conn->workBuffer.data) + 1);
-       newNotify->relname = (char *)newNotify + sizeof(PGnotify);
+                                                                       strlen(conn->workBuffer.data) +1);
+       newNotify->relname = (char *) newNotify + sizeof(PGnotify);
        strcpy(newNotify->relname, conn->workBuffer.data);
        newNotify->be_pid = be_pid;
        DLAddTail(conn->notifyList, DLNewElem(newNotify));
index 8e40a53..794e757 100644 (file)
@@ -25,7 +25,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.78 2002/08/29 07:22:30 ishii Exp $
+ *       $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.79 2002/09/04 20:31:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -104,18 +104,20 @@ pqPutc(char c, PGconn *conn)
 static int
 pqPutBytes(const char *s, size_t nbytes, PGconn *conn)
 {
-       /* Strategy to handle blocking and non-blocking connections: Fill
-        * the output buffer and flush it repeatedly until either all data
-        * has been sent or is at least queued in the buffer.
+       /*
+        * Strategy to handle blocking and non-blocking connections: Fill the
+        * output buffer and flush it repeatedly until either all data has
+        * been sent or is at least queued in the buffer.
         *
-        * For non-blocking connections, grow the buffer if not all data
-        * fits into it and the buffer can't be sent because the socket
-        * would block.
+        * For non-blocking connections, grow the buffer if not all data fits
+        * into it and the buffer can't be sent because the socket would
+        * block.
         */
 
        while (nbytes)
        {
-               size_t avail, remaining;
+               size_t          avail,
+                                       remaining;
 
                /* fill the output buffer */
                avail = Max(conn->outBufSize - conn->outCount, 0);
@@ -125,36 +127,40 @@ pqPutBytes(const char *s, size_t nbytes, PGconn *conn)
                s += remaining;
                nbytes -= remaining;
 
-               /* if the data didn't fit completely into the buffer, try to
-                * flush the buffer */
+               /*
+                * if the data didn't fit completely into the buffer, try to flush
+                * the buffer
+                */
                if (nbytes)
                {
-                       int send_result = pqSendSome(conn);
+                       int                     send_result = pqSendSome(conn);
 
                        /* if there were errors, report them */
                        if (send_result < 0)
                                return EOF;
 
-                       /* if not all data could be sent, increase the output
-                        * buffer, put the rest of s into it and return
-                        * successfully. This case will only happen in a
-                        * non-blocking connection
+                       /*
+                        * if not all data could be sent, increase the output buffer,
+                        * put the rest of s into it and return successfully. This
+                        * case will only happen in a non-blocking connection
                         */
                        if (send_result > 0)
                        {
-                               /* try to grow the buffer.
-                                * FIXME: The new size could be chosen more
-                                * intelligently.
+                               /*
+                                * try to grow the buffer. FIXME: The new size could be
+                                * chosen more intelligently.
                                 */
-                               size_t buflen = conn->outCount + nbytes;
+                               size_t          buflen = conn->outCount + nbytes;
+
                                if (buflen > conn->outBufSize)
                                {
-                                       char * newbuf = realloc(conn->outBuffer, buflen);
+                                       char       *newbuf = realloc(conn->outBuffer, buflen);
+
                                        if (!newbuf)
                                        {
                                                /* realloc failed. Probably out of memory */
                                                printfPQExpBuffer(&conn->errorMessage,
-                                                               "cannot allocate memory for output buffer\n");
+                                                  "cannot allocate memory for output buffer\n");
                                                return EOF;
                                        }
                                        conn->outBuffer = newbuf;
@@ -169,9 +175,11 @@ pqPutBytes(const char *s, size_t nbytes, PGconn *conn)
                        }
                }
 
-               /* pqSendSome was able to send all data. Continue with the next
-                * chunk of s. */
-       } /* while */
+               /*
+                * pqSendSome was able to send all data. Continue with the next
+                * chunk of s.
+                */
+       }                                                       /* while */
 
        return 0;
 }
@@ -484,7 +492,7 @@ pqReadData(PGconn *conn)
        /* OK, try to read some data */
 retry3:
        nread = pqsecure_read(conn, conn->inBuffer + conn->inEnd,
-                                                conn->inBufSize - conn->inEnd);
+                                                 conn->inBufSize - conn->inEnd);
        if (nread < 0)
        {
                if (SOCK_ERRNO == EINTR)
@@ -676,7 +684,7 @@ pqSendSome(PGconn *conn)
                                        printfPQExpBuffer(&conn->errorMessage,
                                                                          libpq_gettext(
                                                        "server closed the connection unexpectedly\n"
-                                  "\tThis probably means the server terminated abnormally\n"
+                                                                                                       "\tThis probably means the server terminated abnormally\n"
                                                 "\tbefore or while processing the request.\n"));
 
                                        /*
@@ -754,9 +762,7 @@ int
 pqFlush(PGconn *conn)
 {
        if (pqSendSome(conn))
-       {
                return EOF;
-       }
        return 0;
 }
 
@@ -773,18 +779,18 @@ pqFlush(PGconn *conn)
 int
 pqWait(int forRead, int forWrite, PGconn *conn)
 {
-      return pqWaitTimed( forRead, forWrite, conn, (const struct timeval *) NULL);
+       return pqWaitTimed(forRead, forWrite, conn, (const struct timeval *) NULL);
 }
 
 int
-pqWaitTimed(int forRead, int forWrite, PGconn *conn, const struct timeval *timeout)
+pqWaitTimed(int forRead, int forWrite, PGconn *conn, const struct timeval * timeout)
 {
        fd_set          input_mask;
        fd_set          output_mask;
        fd_set          except_mask;
 
-      struct timeval  tmp_timeout;
-      struct timeval  *ptmp_timeout = NULL;
+       struct timeval tmp_timeout;
+       struct timeval *ptmp_timeout = NULL;
 
        if (conn->sock < 0)
        {
@@ -814,17 +820,18 @@ retry5:
                        FD_SET(conn->sock, &output_mask);
                FD_SET(conn->sock, &except_mask);
 
-              if (NULL != timeout)
+               if (NULL != timeout)
+               {
+                       /*
+                        * select may modify timeout argument on some platforms use
+                        * copy
+                        */
+                       tmp_timeout = *timeout;
+                       ptmp_timeout = &tmp_timeout;
+               }
+               if (select(conn->sock + 1, &input_mask, &output_mask,
+                                  &except_mask, ptmp_timeout) < 0)
                {
-              /*
-               * select may modify timeout argument on some platforms use copy
-               */
-                      tmp_timeout = *timeout;
-                      ptmp_timeout = &tmp_timeout;
-              }
-              if (select(conn->sock + 1, &input_mask, &output_mask,
-                            &except_mask, ptmp_timeout) < 0)
-              {
                        if (SOCK_ERRNO == EINTR)
                                goto retry5;
                        printfPQExpBuffer(&conn->errorMessage,
@@ -884,4 +891,5 @@ libpq_gettext(const char *msgid)
 
        return dgettext("libpq", msgid);
 }
+
 #endif   /* ENABLE_NLS */
index 1ef5d62..8a17c1a 100644 (file)
@@ -11,8 +11,8 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.10 2002/07/20 05:43:31 momjian Exp $
- *       
+ *       $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.11 2002/09/04 20:31:47 momjian Exp $
+ *
  * NOTES
  *       The client *requires* a valid server certificate.  Since
  *       SSH tunnels provide anonymous confidentiality, the presumption
  *       anonymous connections will use SSH tunnels.
  *
  *       This code verifies the server certificate, to detect simple
- *       "man-in-the-middle" and "impersonation" attacks.  The 
+ *       "man-in-the-middle" and "impersonation" attacks.      The
  *       server certificate, or better yet the CA certificate used
  *       to sign the server certificate, should be present in the
  *       "$HOME/.postgresql/root.crt" file.  If this file isn't
- *       readable, or the server certificate can't be validated, 
+ *       readable, or the server certificate can't be validated,
  *       pqsecure_open_client() will return an error code.
  *
  *       Additionally, the server certificate's "common name" must
  *       resolve to the other end of the socket.  This makes it
  *       substantially harder to pull off a "man-in-the-middle" or
  *       "impersonation" attack even if the server's private key
- *       has been stolen.  This check limits acceptable network
+ *       has been stolen.      This check limits acceptable network
  *       layers to Unix sockets (weird, but legal), TCPv4 and TCPv6.
  *
  *       Unfortunately neither the current front- or back-end handle
  *       failure gracefully, resulting in the backend hiccupping.
  *       This points out problems in each (the frontend shouldn't even
  *       try to do SSL if pqsecure_initialize() fails, and the backend
- *       shouldn't crash/recover if an SSH negotiation fails.  The 
+ *       shouldn't crash/recover if an SSH negotiation fails.  The
  *       backend definitely needs to be fixed, to prevent a "denial
- *       of service" attack, but I don't know enough about how the 
+ *       of service" attack, but I don't know enough about how the
  *       backend works (especially that pre-SSL negotiation) to identify
  *       a fix.
  *
@@ -49,7 +49,7 @@
  *
  *       Unlike the server's static private key, the client's
  *       static private key ($HOME/.postgresql/postgresql.key)
- *       should normally be stored encrypted.  However we still
+ *       should normally be stored encrypted.  However we still
  *       support EPH since it's useful for other reasons.
  *
  *       ...
@@ -61,9 +61,9 @@
  *       keeping it closed to everyone else.
  *
  *       The user's certificate and private key are located in
- *         $HOME/.postgresql/postgresql.crt
+ *             $HOME/.postgresql/postgresql.crt
  *       and
- *         $HOME/.postgresql/postgresql.key
+ *             $HOME/.postgresql/postgresql.key
  *       respectively.
  *
  *       ...
 #ifdef USE_SSL
 #include <openssl/ssl.h>
 #include <openssl/e_os.h>
-#endif /* USE_SSL */
+#endif   /* USE_SSL */
 
 
 #ifdef USE_SSL
-static int verify_cb(int ok, X509_STORE_CTX *ctx);
-static int verify_peer(PGconn *);
-static DH *load_dh_file(int keylength);
-static DH *load_dh_buffer(const char *, size_t);
-static DH *tmp_dh_cb(SSL *s, int is_export, int keylength);
-static int client_cert_cb(SSL *, X509 **, EVP_PKEY **);
-static int initialize_SSL(PGconn *);
+static int     verify_cb(int ok, X509_STORE_CTX *ctx);
+static int     verify_peer(PGconn *);
+static DH  *load_dh_file(int keylength);
+static DH  *load_dh_buffer(const char *, size_t);
+static DH  *tmp_dh_cb(SSL *s, int is_export, int keylength);
+static int     client_cert_cb(SSL *, X509 **, EVP_PKEY **);
+static int     initialize_SSL(PGconn *);
 static void destroy_SSL(void);
-static int open_client_SSL(PGconn *);
+static int     open_client_SSL(PGconn *);
 static void close_SSL(PGconn *);
 static const char *SSLerrmessage(void);
 #endif
@@ -140,7 +140,7 @@ static SSL_CTX *SSL_context = NULL;
 #endif
 
 /* ------------------------------------------------------------ */
-/*                       Hardcoded values                       */
+/*                                              Hardcoded values                                               */
 /* ------------------------------------------------------------ */
 
 /*
@@ -148,7 +148,7 @@ static SSL_CTX *SSL_context = NULL;
  *     As discussed above, EDH protects the confidentiality of
  *     sessions even if the static private key is compromised,
  *     so we are *highly* motivated to ensure that we can use
- *     EDH even if the user... or an attacker... deletes the 
+ *     EDH even if the user... or an attacker... deletes the
  *     $HOME/.postgresql/dh*.pem files.
  *
  *     It's not critical that users have EPH keys, but it doesn't
@@ -193,16 +193,16 @@ KWbuHn491xNO25CQWMtem80uKw+pTnisBRF/454n1Jnhub144YRBoN8CAQI=\n\
 -----END DH PARAMETERS-----\n";
 
 /* ------------------------------------------------------------ */
-/*           Procedures common to all secure sessions           */
+/*                      Procedures common to all secure sessions                       */
 /* ------------------------------------------------------------ */
 
 /*
  *     Initialize global context
  */
 int
-pqsecure_initialize (PGconn *conn)
+pqsecure_initialize(PGconn *conn)
 {
-       int r = 0;
+       int                     r = 0;
 
 #ifdef USE_SSL
        r = initialize_SSL(conn);
@@ -215,7 +215,7 @@ pqsecure_initialize (PGconn *conn)
  *     Destroy global context
  */
 void
-pqsecure_destroy (void)
+pqsecure_destroy(void)
 {
 #ifdef USE_SSL
        destroy_SSL();
@@ -225,10 +225,10 @@ pqsecure_destroy (void)
 /*
  *     Attempt to negotiate secure session.
  */
-int 
-pqsecure_open_client (PGconn *conn)
+int
+pqsecure_open_client(PGconn *conn)
 {
-       int r = 0;
+       int                     r = 0;
 
 #ifdef USE_SSL
        r = open_client_SSL(conn);
@@ -241,7 +241,7 @@ pqsecure_open_client (PGconn *conn)
  *     Close secure session.
  */
 void
-pqsecure_close (PGconn *conn)
+pqsecure_close(PGconn *conn)
 {
 #ifdef USE_SSL
        if (conn->ssl)
@@ -253,9 +253,9 @@ pqsecure_close (PGconn *conn)
  *     Read data from a secure connection.
  */
 ssize_t
-pqsecure_read (PGconn *conn, void *ptr, size_t len)
+pqsecure_read(PGconn *conn, void *ptr, size_t len)
 {
-       ssize_t n;
+       ssize_t         n;
 
 #ifdef USE_SSL
        if (conn->ssl)
@@ -263,30 +263,30 @@ pqsecure_read (PGconn *conn, void *ptr, size_t len)
                n = SSL_read(conn->ssl, ptr, len);
                switch (SSL_get_error(conn->ssl, n))
                {
-               case SSL_ERROR_NONE:
-                       break;
-               case SSL_ERROR_WANT_READ:
-                       break;
-               case SSL_ERROR_SYSCALL:
-                       SOCK_ERRNO = get_last_socket_error();
-                       printfPQExpBuffer(&conn->errorMessage,
-                               libpq_gettext("SSL SYSCALL error: %s\n"), 
-                               SOCK_STRERROR(SOCK_ERRNO));
-                       break;
-               case SSL_ERROR_SSL:
-                       printfPQExpBuffer(&conn->errorMessage,
-                               libpq_gettext("SSL error: %s\n"), SSLerrmessage());
-                       /* fall through */
-               case SSL_ERROR_ZERO_RETURN:
-                       pqsecure_close(conn);
-                       SOCK_ERRNO = ECONNRESET;
-                       n = -1;
-                       break;
+                       case SSL_ERROR_NONE:
+                               break;
+                       case SSL_ERROR_WANT_READ:
+                               break;
+                       case SSL_ERROR_SYSCALL:
+                               SOCK_ERRNO = get_last_socket_error();
+                               printfPQExpBuffer(&conn->errorMessage,
+                                                               libpq_gettext("SSL SYSCALL error: %s\n"),
+                                                                 SOCK_STRERROR(SOCK_ERRNO));
+                               break;
+                       case SSL_ERROR_SSL:
+                               printfPQExpBuffer(&conn->errorMessage,
+                                         libpq_gettext("SSL error: %s\n"), SSLerrmessage());
+                               /* fall through */
+                       case SSL_ERROR_ZERO_RETURN:
+                               pqsecure_close(conn);
+                               SOCK_ERRNO = ECONNRESET;
+                               n = -1;
+                               break;
                }
        }
        else
 #endif
-       n = recv(conn->sock, ptr, len, 0);
+               n = recv(conn->sock, ptr, len, 0);
 
        return n;
 }
@@ -295,12 +295,12 @@ pqsecure_read (PGconn *conn, void *ptr, size_t len)
  *     Write data to a secure connection.
  */
 ssize_t
-pqsecure_write (PGconn *conn, const void *ptr, size_t len)
+pqsecure_write(PGconn *conn, const void *ptr, size_t len)
 {
-       ssize_t n;
+       ssize_t         n;
 
 #ifndef WIN32
-       pqsigfunc oldsighandler = pqsignal(SIGPIPE, SIG_IGN);
+       pqsigfunc       oldsighandler = pqsignal(SIGPIPE, SIG_IGN);
 #endif
 
 #ifdef USE_SSL
@@ -309,30 +309,30 @@ pqsecure_write (PGconn *conn, const void *ptr, size_t len)
                n = SSL_write(conn->ssl, ptr, len);
                switch (SSL_get_error(conn->ssl, n))
                {
-               case SSL_ERROR_NONE:
-                       break;
-               case SSL_ERROR_WANT_WRITE:
-                       break;
-               case SSL_ERROR_SYSCALL:
-                       SOCK_ERRNO = get_last_socket_error();
-                       printfPQExpBuffer(&conn->errorMessage,
-                               libpq_gettext("SSL SYSCALL error: %s\n"),
-                               SOCK_STRERROR(SOCK_ERRNO));
-                       break;
-               case SSL_ERROR_SSL:
-                       printfPQExpBuffer(&conn->errorMessage,
-                               libpq_gettext("SSL error: %s\n"), SSLerrmessage());
-                       /* fall through */
-               case SSL_ERROR_ZERO_RETURN:
-                       pqsecure_close(conn);
-                       SOCK_ERRNO = ECONNRESET;
-                       n = -1;
-                       break;
+                       case SSL_ERROR_NONE:
+                               break;
+                       case SSL_ERROR_WANT_WRITE:
+                               break;
+                       case SSL_ERROR_SYSCALL:
+                               SOCK_ERRNO = get_last_socket_error();
+                               printfPQExpBuffer(&conn->errorMessage,
+                                                               libpq_gettext("SSL SYSCALL error: %s\n"),
+                                                                 SOCK_STRERROR(SOCK_ERRNO));
+                               break;
+                       case SSL_ERROR_SSL:
+                               printfPQExpBuffer(&conn->errorMessage,
+                                         libpq_gettext("SSL error: %s\n"), SSLerrmessage());
+                               /* fall through */
+                       case SSL_ERROR_ZERO_RETURN:
+                               pqsecure_close(conn);
+                               SOCK_ERRNO = ECONNRESET;
+                               n = -1;
+                               break;
                }
        }
        else
 #endif
-       n = send(conn->sock, ptr, len, 0);
+               n = send(conn->sock, ptr, len, 0);
 
 #ifndef WIN32
        pqsignal(SIGPIPE, oldsighandler);
@@ -342,7 +342,7 @@ pqsecure_write (PGconn *conn, const void *ptr, size_t len)
 }
 
 /* ------------------------------------------------------------ */
-/*                        SSL specific code                     */
+/*                                               SSL specific code                                             */
 /* ------------------------------------------------------------ */
 #ifdef USE_SSL
 /*
@@ -357,7 +357,7 @@ pqsecure_write (PGconn *conn, const void *ptr, size_t len)
  *     for now we accept the default checks.
  */
 static int
-verify_cb (int ok, X509_STORE_CTX *ctx)
+verify_cb(int ok, X509_STORE_CTX *ctx)
 {
        return ok;
 }
@@ -367,13 +367,13 @@ verify_cb (int ok, X509_STORE_CTX *ctx)
  *     This function is not thread-safe due to gethostbyname2().
  */
 static int
-verify_peer (PGconn *conn)
+verify_peer(PGconn *conn)
 {
        struct hostent *h = NULL;
        struct sockaddr addr;
        struct sockaddr_in *sin;
-       socklen_t len;
-       char **s;
+       socklen_t       len;
+       char      **s;
        unsigned long l;
 
        /* get the address on the other side of the socket */
@@ -381,8 +381,8 @@ verify_peer (PGconn *conn)
        if (getpeername(conn->sock, &addr, &len) == -1)
        {
                printfPQExpBuffer(&conn->errorMessage,
-                       libpq_gettext("error querying socket: %s\n"), 
-                       SOCK_STRERROR(SOCK_ERRNO));
+                                                 libpq_gettext("error querying socket: %s\n"),
+                                                 SOCK_STRERROR(SOCK_ERRNO));
                return -1;
        }
 
@@ -394,31 +394,33 @@ verify_peer (PGconn *conn)
        if ((h = gethostbyname2(conn->peer_cn, addr.sa_family)) == NULL)
        {
                printfPQExpBuffer(&conn->errorMessage,
-                       libpq_gettext("error getting information about host (%s): %s\n"),
-                       conn->peer_cn, hstrerror(h_errno));
+               libpq_gettext("error getting information about host (%s): %s\n"),
+                                                 conn->peer_cn, hstrerror(h_errno));
                return -1;
        }
 
        /* does the address match? */
        switch (addr.sa_family)
        {
-       case AF_INET:
-               sin = (struct sockaddr_in *) &addr;
-               for (s = h->h_addr_list; *s != NULL; s++)
-               {
-                       if (!memcmp(&sin->sin_addr.s_addr, *s, h->h_length))
-                               return 0;
-               }
-               break;
+               case AF_INET:
+                       sin = (struct sockaddr_in *) & addr;
+                       for (s = h->h_addr_list; *s != NULL; s++)
+                       {
+                               if (!memcmp(&sin->sin_addr.s_addr, *s, h->h_length))
+                                       return 0;
+                       }
+                       break;
 
-       default:
-               printfPQExpBuffer(&conn->errorMessage,
-                       libpq_gettext("sorry, this protocol not yet supported\n"));
-               return -1;
+               default:
+                       printfPQExpBuffer(&conn->errorMessage,
+                         libpq_gettext("sorry, this protocol not yet supported\n"));
+                       return -1;
        }
 
-       /* the prior test should be definitive, but in practice
-        * it sometimes fails.  So we also check the aliases.  */
+       /*
+        * the prior test should be definitive, but in practice it sometimes
+        * fails.  So we also check the aliases.
+        */
        for (s = h->h_aliases; *s != NULL; s++)
        {
                if (strcasecmp(conn->peer_cn, *s) == 0)
@@ -428,20 +430,20 @@ verify_peer (PGconn *conn)
        /* generate protocol-aware error message */
        switch (addr.sa_family)
        {
-       case AF_INET:
-               sin = (struct sockaddr_in *) &addr;
-               l = ntohl(sin->sin_addr.s_addr);
-               printfPQExpBuffer(&conn->errorMessage,
-                       libpq_gettext(
-                               "server common name '%s' does not resolve to %ld.%ld.%ld.%ld\n"),
-                       conn->peer_cn, (l >> 24) % 0x100, (l >> 16) % 0x100,
-                       (l >> 8) % 0x100, l % 0x100);
-               break;
-       default:
-               printfPQExpBuffer(&conn->errorMessage,
-                       libpq_gettext(
-                               "server common name '%s' does not resolve to peer address\n"),
-                       conn->peer_cn);
+               case AF_INET:
+                       sin = (struct sockaddr_in *) & addr;
+                       l = ntohl(sin->sin_addr.s_addr);
+                       printfPQExpBuffer(&conn->errorMessage,
+                                                         libpq_gettext(
+                                                                                       "server common name '%s' does not resolve to %ld.%ld.%ld.%ld\n"),
+                                        conn->peer_cn, (l >> 24) % 0x100, (l >> 16) % 0x100,
+                                                         (l >> 8) % 0x100, l % 0x100);
+                       break;
+               default:
+                       printfPQExpBuffer(&conn->errorMessage,
+                                                         libpq_gettext(
+                       "server common name '%s' does not resolve to peer address\n"),
+                                                         conn->peer_cn);
        }
 
        return -1;
@@ -451,24 +453,24 @@ verify_peer (PGconn *conn)
  *     Load precomputed DH parameters.
  *
  *     To prevent "downgrade" attacks, we perform a number of checks
- *     to verify that the DBA-generated DH parameters file contains 
+ *     to verify that the DBA-generated DH parameters file contains
  *     what we expect it to contain.
  */
-static DH *
-load_dh_file (int keylength)
+static DH  *
+load_dh_file(int keylength)
 {
        struct passwd *pwd;
-       FILE *fp;
-       char fnbuf[2048];
-       DH *dh = NULL;
-       int codes;
+       FILE       *fp;
+       char            fnbuf[2048];
+       DH                 *dh = NULL;
+       int                     codes;
 
        if ((pwd = getpwuid(getuid())) == NULL)
                return NULL;
 
        /* attempt to open file.  It's not an error if it doesn't exist. */
        snprintf(fnbuf, sizeof fnbuf, "%s/.postgresql/dh%d.pem",
-               pwd->pw_dir, keylength);
+                        pwd->pw_dir, keylength);
        if ((fp = fopen(fnbuf, "r")) == NULL)
                return NULL;
 
@@ -478,27 +480,19 @@ load_dh_file (int keylength)
        fclose(fp);
 
        /* is the prime the correct size? */
-       if (dh != NULL && 8*DH_size(dh) < keylength)
-       {
+       if (dh != NULL && 8 * DH_size(dh) < keylength)
                dh = NULL;
-       }
 
        /* make sure the DH parameters are usable */
        if (dh != NULL)
        {
                if (DH_check(dh, &codes))
-               {
                        return NULL;
-               }
                if (codes & DH_CHECK_P_NOT_PRIME)
-               {
                        return NULL;
-               }
-               if ((codes & DH_NOT_SUITABLE_GENERATOR) && 
+               if ((codes & DH_NOT_SUITABLE_GENERATOR) &&
                        (codes & DH_CHECK_P_NOT_SAFE_PRIME))
-               {
                        return NULL;
-               }
        }
 
        return dh;
@@ -510,11 +504,11 @@ load_dh_file (int keylength)
  *     To prevent problems if the DH parameters files don't even
  *     exist, we can load DH parameters hardcoded into this file.
  */
-static DH *
-load_dh_buffer (const char *buffer, size_t len)
+static DH  *
+load_dh_buffer(const char *buffer, size_t len)
 {
-       BIO *bio;
-       DH *dh = NULL;
+       BIO                *bio;
+       DH                 *dh = NULL;
 
        bio = BIO_new_mem_buf((char *) buffer, len);
        if (bio == NULL)
@@ -538,62 +532,60 @@ load_dh_buffer (const char *buffer, size_t len)
  *     the OpenSSL library can efficiently generate random keys from
  *     the information provided.
  */
-static DH *
-tmp_dh_cb (SSL *s, int is_export, int keylength)
+static DH  *
+tmp_dh_cb(SSL *s, int is_export, int keylength)
 {
-       DH *r = NULL;
-       static DH *dh = NULL;
-       static DH *dh512 = NULL;
-       static DH *dh1024 = NULL;
-       static DH *dh2048 = NULL;
-       static DH *dh4096 = NULL;
+       DH                 *r = NULL;
+       static DH  *dh = NULL;
+       static DH  *dh512 = NULL;
+       static DH  *dh1024 = NULL;
+       static DH  *dh2048 = NULL;
+       static DH  *dh4096 = NULL;
 
        switch (keylength)
        {
-       case 512:
-               if (dh512 == NULL)
-                       dh512 = load_dh_file(keylength);
-               if (dh512 == NULL)
-                       dh512 = load_dh_buffer(file_dh512, sizeof file_dh512);
-               r = dh512;
-               break;
-
-       case 1024:
-               if (dh1024 == NULL)
-                       dh1024 = load_dh_file(keylength);
-               if (dh1024 == NULL)
-                       dh1024 = load_dh_buffer(file_dh1024, sizeof file_dh1024);
-               r = dh1024;
-               break;
-
-       case 2048:
-               if (dh2048 == NULL)
-                       dh2048 = load_dh_file(keylength);
-               if (dh2048 == NULL)
-                       dh2048 = load_dh_buffer(file_dh2048, sizeof file_dh2048);
-               r = dh2048;
-               break;
-
-       case 4096:
-               if (dh4096 == NULL)
-                       dh4096 = load_dh_file(keylength);
-               if (dh4096 == NULL)
-                       dh4096 = load_dh_buffer(file_dh4096, sizeof file_dh4096);
-               r = dh4096;
-               break;
-
-       default:
-               if (dh == NULL)
-                       dh = load_dh_file(keylength);
-               r = dh;
+               case 512:
+                       if (dh512 == NULL)
+                               dh512 = load_dh_file(keylength);
+                       if (dh512 == NULL)
+                               dh512 = load_dh_buffer(file_dh512, sizeof file_dh512);
+                       r = dh512;
+                       break;
+
+               case 1024:
+                       if (dh1024 == NULL)
+                               dh1024 = load_dh_file(keylength);
+                       if (dh1024 == NULL)
+                               dh1024 = load_dh_buffer(file_dh1024, sizeof file_dh1024);
+                       r = dh1024;
+                       break;
+
+               case 2048:
+                       if (dh2048 == NULL)
+                               dh2048 = load_dh_file(keylength);
+                       if (dh2048 == NULL)
+                               dh2048 = load_dh_buffer(file_dh2048, sizeof file_dh2048);
+                       r = dh2048;
+                       break;
+
+               case 4096:
+                       if (dh4096 == NULL)
+                               dh4096 = load_dh_file(keylength);
+                       if (dh4096 == NULL)
+                               dh4096 = load_dh_buffer(file_dh4096, sizeof file_dh4096);
+                       r = dh4096;
+                       break;
+
+               default:
+                       if (dh == NULL)
+                               dh = load_dh_file(keylength);
+                       r = dh;
        }
 
        /* this may take a long time, but it may be necessary... */
-       if (r == NULL || 8*DH_size(r) < keylength)
-       {
+       if (r == NULL || 8 * DH_size(r) < keylength)
                r = DH_generate_parameters(keylength, DH_GENERATOR_2, NULL, NULL);
-       }
-       
+
        return r;
 }
 
@@ -605,39 +597,40 @@ tmp_dh_cb (SSL *s, int is_export, int keylength)
  *     Returns 1 on success, 0 on no data, -1 on error.
  */
 static int
-client_cert_cb (SSL *ssl, X509 **x509, EVP_PKEY **pkey)
+client_cert_cb(SSL *ssl, X509 **x509, EVP_PKEY **pkey)
 {
        struct passwd *pwd;
-       struct stat buf, buf2;
-       char fnbuf[2048];
-       FILE *fp;
-       PGconn *conn = (PGconn *) SSL_get_app_data(ssl);
-       int (*cb)() = NULL; /* how to read user password */
+       struct stat buf,
+                               buf2;
+       char            fnbuf[2048];
+       FILE       *fp;
+       PGconn     *conn = (PGconn *) SSL_get_app_data(ssl);
+       int                     (*cb) () = NULL;        /* how to read user password */
 
        if ((pwd = getpwuid(getuid())) == NULL)
        {
-               printfPQExpBuffer(&conn->errorMessage, 
-                       libpq_gettext("unable to get user information\n"));
+               printfPQExpBuffer(&conn->errorMessage,
+                                         libpq_gettext("unable to get user information\n"));
                return -1;
        }
 
        /* read the user certificate */
        snprintf(fnbuf, sizeof fnbuf, "%s/.postgresql/postgresql.crt",
-               pwd->pw_dir);
+                        pwd->pw_dir);
        if (stat(fnbuf, &buf) == -1)
                return 0;
        if ((fp = fopen(fnbuf, "r")) == NULL)
        {
-               printfPQExpBuffer(&conn->errorMessage, 
-                       libpq_gettext("unable to open certificate (%s): %s\n"),
-                       fnbuf, strerror(errno));
+               printfPQExpBuffer(&conn->errorMessage,
+                                 libpq_gettext("unable to open certificate (%s): %s\n"),
+                                                 fnbuf, strerror(errno));
                return -1;
        }
        if (PEM_read_X509(fp, x509, NULL, NULL) == NULL)
        {
-               printfPQExpBuffer(&conn->errorMessage, 
-                       libpq_gettext("unable to read certificate (%s): %s\n"),
-                       fnbuf, SSLerrmessage());
+               printfPQExpBuffer(&conn->errorMessage,
+                                 libpq_gettext("unable to read certificate (%s): %s\n"),
+                                                 fnbuf, SSLerrmessage());
                fclose(fp);
                return -1;
        }
@@ -645,44 +638,44 @@ client_cert_cb (SSL *ssl, X509 **x509, EVP_PKEY **pkey)
 
        /* read the user key */
        snprintf(fnbuf, sizeof fnbuf, "%s/.postgresql/postgresql.key",
-               pwd->pw_dir);
+                        pwd->pw_dir);
        if (stat(fnbuf, &buf) == -1)
        {
-               printfPQExpBuffer(&conn->errorMessage, 
-                       libpq_gettext("certificate present, but not private key (%s)\n"),
-                       fnbuf);
+               printfPQExpBuffer(&conn->errorMessage,
+               libpq_gettext("certificate present, but not private key (%s)\n"),
+                                                 fnbuf);
                X509_free(*x509);
                return 0;
        }
        if (!S_ISREG(buf.st_mode) || (buf.st_mode & 0077) ||
                buf.st_uid != getuid())
        {
-               printfPQExpBuffer(&conn->errorMessage, 
-                       libpq_gettext("private key has bad permissions (%s)\n"), fnbuf);
+               printfPQExpBuffer(&conn->errorMessage,
+                libpq_gettext("private key has bad permissions (%s)\n"), fnbuf);
                X509_free(*x509);
                return -1;
        }
        if ((fp = fopen(fnbuf, "r")) == NULL)
        {
-               printfPQExpBuffer(&conn->errorMessage, 
-                       libpq_gettext("unable to open private key file (%s): %s\n"),
-                       fnbuf, strerror(errno));
+               printfPQExpBuffer(&conn->errorMessage,
+                        libpq_gettext("unable to open private key file (%s): %s\n"),
+                                                 fnbuf, strerror(errno));
                X509_free(*x509);
                return -1;
        }
        if (fstat(fileno(fp), &buf2) == -1 ||
                buf.st_dev != buf2.st_dev || buf.st_ino != buf2.st_ino)
        {
-               printfPQExpBuffer(&conn->errorMessage, 
+               printfPQExpBuffer(&conn->errorMessage,
                        libpq_gettext("private key changed under us (%s)\n"), fnbuf);
                X509_free(*x509);
                return -1;
        }
        if (PEM_read_PrivateKey(fp, pkey, cb, NULL) == NULL)
        {
-               printfPQExpBuffer(&conn->errorMessage, 
-                       libpq_gettext("unable to read private key (%s): %s\n"),
-                       fnbuf, SSLerrmessage());
+               printfPQExpBuffer(&conn->errorMessage,
+                                 libpq_gettext("unable to read private key (%s): %s\n"),
+                                                 fnbuf, SSLerrmessage());
                X509_free(*x509);
                fclose(fp);
                return -1;
@@ -692,9 +685,9 @@ client_cert_cb (SSL *ssl, X509 **x509, EVP_PKEY **pkey)
        /* verify that the cert and key go together */
        if (!X509_check_private_key(*x509, *pkey))
        {
-               printfPQExpBuffer(&conn->errorMessage, 
+               printfPQExpBuffer(&conn->errorMessage,
                        libpq_gettext("certificate/private key mismatch (%s): %s\n"),
-                       fnbuf, SSLerrmessage());
+                                                 fnbuf, SSLerrmessage());
                X509_free(*x509);
                EVP_PKEY_free(*pkey);
                return -1;
@@ -707,11 +700,11 @@ client_cert_cb (SSL *ssl, X509 **x509, EVP_PKEY **pkey)
  *     Initialize global SSL context.
  */
 static int
-initialize_SSL (PGconn *conn)
+initialize_SSL(PGconn *conn)
 {
        struct stat buf;
        struct passwd *pwd;
-       char fnbuf[2048];
+       char            fnbuf[2048];
 
        if (!SSL_context)
        {
@@ -721,7 +714,7 @@ initialize_SSL (PGconn *conn)
                if (!SSL_context)
                {
                        printfPQExpBuffer(&conn->errorMessage,
-                               libpq_gettext("could not create SSL context: %s\n"),
+                                        libpq_gettext("could not create SSL context: %s\n"),
                                                          SSLerrmessage());
                        return -1;
                }
@@ -730,25 +723,25 @@ initialize_SSL (PGconn *conn)
        if ((pwd = getpwuid(getuid())) != NULL)
        {
                snprintf(fnbuf, sizeof fnbuf, "%s/.postgresql/root.crt",
-                       pwd->pw_dir);
+                                pwd->pw_dir);
                if (stat(fnbuf, &buf) == -1)
                {
                        printfPQExpBuffer(&conn->errorMessage,
-                               libpq_gettext("could not read  root cert list(%s): %s"),
-                               fnbuf, strerror(errno));
+                                libpq_gettext("could not read  root cert list(%s): %s"),
+                                                         fnbuf, strerror(errno));
                        return -1;
                }
                if (!SSL_CTX_load_verify_locations(SSL_context, fnbuf, 0))
                {
                        printfPQExpBuffer(&conn->errorMessage,
-                               libpq_gettext("could not read root cert list (%s): %s"),
-                               fnbuf, SSLerrmessage());
+                                libpq_gettext("could not read root cert list (%s): %s"),
+                                                         fnbuf, SSLerrmessage());
                        return -1;
                }
        }
 
-       SSL_CTX_set_verify(SSL_context, 
-               SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, verify_cb);
+       SSL_CTX_set_verify(SSL_context,
+                  SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, verify_cb);
        SSL_CTX_set_verify_depth(SSL_context, 1);
 
        /* set up empheral DH keys */
@@ -765,7 +758,7 @@ initialize_SSL (PGconn *conn)
  *     Destroy global SSL context.
  */
 static void
-destroy_SSL (void)
+destroy_SSL(void)
 {
        if (SSL_context)
        {
@@ -778,9 +771,9 @@ destroy_SSL (void)
  *     Attempt to negotiate SSL connection.
  */
 static int
-open_client_SSL (PGconn *conn)
+open_client_SSL(PGconn *conn)
 {
-       int r;
+       int                     r;
 
        if (!(conn->ssl = SSL_new(SSL_context)) ||
                !SSL_set_app_data(conn->ssl, conn) ||
@@ -788,21 +781,24 @@ open_client_SSL (PGconn *conn)
                SSL_connect(conn->ssl) <= 0)
        {
                printfPQExpBuffer(&conn->errorMessage,
-                       libpq_gettext("could not establish SSL connection: %s\n"),
+                          libpq_gettext("could not establish SSL connection: %s\n"),
                                                  SSLerrmessage());
                close_SSL(conn);
                return -1;
        }
 
        /* check the certificate chain of the server */
-       /* this eliminates simple man-in-the-middle attacks and
-        * simple impersonations */
+
+       /*
+        * this eliminates simple man-in-the-middle attacks and simple
+        * impersonations
+        */
        r = SSL_get_verify_result(conn->ssl);
        if (r != X509_V_OK)
        {
                printfPQExpBuffer(&conn->errorMessage,
-                       libpq_gettext("certificate could not be validated: %s\n"),
-                       X509_verify_cert_error_string(r));
+                          libpq_gettext("certificate could not be validated: %s\n"),
+                                                 X509_verify_cert_error_string(r));
                close_SSL(conn);
                return -1;
        }
@@ -812,24 +808,27 @@ open_client_SSL (PGconn *conn)
        if (conn->peer == NULL)
        {
                printfPQExpBuffer(&conn->errorMessage,
-                       libpq_gettext("certificate could not be obtained: %s\n"),
-                       SSLerrmessage());
+                               libpq_gettext("certificate could not be obtained: %s\n"),
+                                                 SSLerrmessage());
                close_SSL(conn);
                return -1;
        }
 
        X509_NAME_oneline(X509_get_subject_name(conn->peer),
-               conn->peer_dn, sizeof(conn->peer_dn));
-       conn->peer_dn[sizeof(conn->peer_dn)-1] = '\0';
+                                         conn->peer_dn, sizeof(conn->peer_dn));
+       conn->peer_dn[sizeof(conn->peer_dn) - 1] = '\0';
 
        X509_NAME_get_text_by_NID(X509_get_subject_name(conn->peer),
-               NID_commonName, conn->peer_cn, SM_USER);
+                                                         NID_commonName, conn->peer_cn, SM_USER);
        conn->peer_cn[SM_USER] = '\0';
 
        /* verify that the common name resolves to peer */
-       /* this is necessary to eliminate man-in-the-middle attacks
-        * and impersonations where the attacker somehow learned
-        * the server's private key */
+
+       /*
+        * this is necessary to eliminate man-in-the-middle attacks and
+        * impersonations where the attacker somehow learned the server's
+        * private key
+        */
        if (verify_peer(conn) == -1)
        {
                close_SSL(conn);
@@ -843,7 +842,7 @@ open_client_SSL (PGconn *conn)
  *     Close SSL connection.
  */
 static void
-close_SSL (PGconn *conn)
+close_SSL(PGconn *conn)
 {
        if (conn->ssl)
        {
@@ -863,9 +862,9 @@ close_SSL (PGconn *conn)
 static const char *
 SSLerrmessage(void)
 {
-       unsigned long   errcode;
-       const char         *errreason;
-       static char             errbuf[32];
+       unsigned long errcode;
+       const char *errreason;
+       static char errbuf[32];
 
        errcode = ERR_get_error();
        if (errcode == 0)
@@ -888,4 +887,4 @@ PQgetssl(PGconn *conn)
        return conn->ssl;
 }
 
-#endif /* USE_SSL */
+#endif   /* USE_SSL */
index 47606fc..49045d3 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: libpq-fe.h,v 1.85 2002/06/20 20:29:54 momjian Exp $
+ * $Id: libpq-fe.h,v 1.86 2002/09/04 20:31:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -105,7 +105,7 @@ typedef struct pg_result PGresult;
  */
 typedef struct pgNotify
 {
-       char            *relname;               /* name of relation containing data */
+       char       *relname;            /* name of relation containing data */
        int                     be_pid;                 /* process id of backend */
 } PGnotify;
 
@@ -252,7 +252,7 @@ extern size_t PQescapeString(char *to, const char *from, size_t length);
 extern unsigned char *PQescapeBytea(unsigned char *bintext, size_t binlen,
                          size_t *bytealen);
 extern unsigned char *PQunescapeBytea(unsigned char *strtext,
-                         size_t *retbuflen);
+                               size_t *retbuflen);
 
 
 /* Simple synchronous query */
index 83022f7..daf2f9a 100644 (file)
@@ -12,7 +12,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: libpq-int.h,v 1.56 2002/09/03 21:45:44 petere Exp $
+ * $Id: libpq-int.h,v 1.57 2002/09/04 20:31:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -25,8 +25,9 @@
 #include <sys/types.h>
 
 #if defined(WIN32) && (!defined(ssize_t))
-  typedef int ssize_t; /* ssize_t doesn't exist in VC (atleast not VC6) */
-#endif 
+typedef int ssize_t;                   /* ssize_t doesn't exist in VC (atleast
+                                                                * not VC6) */
+#endif
 
 /* We assume libpq-fe.h has already been included. */
 #include "postgres_fe.h"
@@ -278,8 +279,8 @@ struct pg_conn
        bool            require_ssl;    /* Require SSL to make connection */
        SSL                *ssl;                        /* SSL status, if have SSL connection */
        X509       *peer;                       /* X509 cert of server */
-       char            peer_dn[256+1]; /* peer distinguished name */
-       char            peer_cn[SM_USER+1]; /* peer common name */
+       char            peer_dn[256 + 1];               /* peer distinguished name */
+       char            peer_cn[SM_USER + 1];   /* peer common name */
 #endif
 
        /* Buffer for current error message */
@@ -290,7 +291,7 @@ struct pg_conn
 
        int                     client_encoding;        /* encoding id */
 
-      char *connect_timeout;
+       char       *connect_timeout;
 };
 
 /* String descriptions of the ExecStatusTypes.
@@ -337,15 +338,15 @@ extern int        pqReadData(PGconn *conn);
 extern int     pqFlush(PGconn *conn);
 extern int     pqSendSome(PGconn *conn);
 extern int     pqWait(int forRead, int forWrite, PGconn *conn);
-extern int  pqWaitTimed(int forRead, int forWrite, PGconn *conn, const struct timeval* timeout);
+extern int     pqWaitTimed(int forRead, int forWrite, PGconn *conn, const struct timeval * timeout);
 extern int     pqReadReady(PGconn *conn);
 extern int     pqWriteReady(PGconn *conn);
 
 /* === in fe-secure.c === */
 
-extern int pqsecure_initialize(PGconn *);
+extern int     pqsecure_initialize(PGconn *);
 extern void pqsecure_destroy(void);
-extern int pqsecure_open_client(PGconn *);
+extern int     pqsecure_open_client(PGconn *);
 extern void pqsecure_close(PGconn *);
 extern ssize_t pqsecure_read(PGconn *, void *ptr, size_t len);
 extern ssize_t pqsecure_write(PGconn *, const void *ptr, size_t len);
index 4b577e3..17fe9ca 100644 (file)
@@ -9,7 +9,7 @@
  * descriptions. But will/may contain other win32 helper functions
  * for libpq.
  *
- * The error constants are taken from the Frambak Bakfram LGSOCKET 
+ * The error constants are taken from the Frambak Bakfram LGSOCKET
  * library guys who in turn took them from the Winsock FAQ.
  *
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
 #include <stdio.h>
 #include "win32.h"
 
-static struct WSErrorEntry {
-    DWORD       error;
-    const char*  description;
-} WSErrors [] = {
-    {0,                  "No error"},
-    {WSAEINTR,           "Interrupted system call"},
-    {WSAEBADF,           "Bad file number"},
-    {WSAEACCES,          "Permission denied"},
-    {WSAEFAULT,          "Bad address"},
-    {WSAEINVAL,          "Invalid argument"},
-    {WSAEMFILE,          "Too many open sockets"},
-    {WSAEWOULDBLOCK,     "Operation would block"},
-    {WSAEINPROGRESS,     "Operation now in progress"},
-    {WSAEALREADY,        "Operation already in progress"},
-    {WSAENOTSOCK,        "Socket operation on non-socket"},
-    {WSAEDESTADDRREQ,    "Destination address required"},
-    {WSAEMSGSIZE,        "Message too long"},
-    {WSAEPROTOTYPE,      "Protocol wrong type for socket"},
-    {WSAENOPROTOOPT,     "Bad protocol option"},
-    {WSAEPROTONOSUPPORT, "Protocol not supported"},
-    {WSAESOCKTNOSUPPORT, "Socket type not supported"},
-    {WSAEOPNOTSUPP,      "Operation not supported on socket"},
-    {WSAEPFNOSUPPORT,    "Protocol family not supported"},
-    {WSAEAFNOSUPPORT,    "Address family not supported"},
-    {WSAEADDRINUSE,      "Address already in use"},
-    {WSAEADDRNOTAVAIL,   "Can't assign requested address"},
-    {WSAENETDOWN,        "Network is down"},
-    {WSAENETUNREACH,     "Network is unreachable"},
-    {WSAENETRESET,       "Net connection reset"},
-    {WSAECONNABORTED,    "Software caused connection abort"},
-    {WSAECONNRESET,      "Connection reset by peer"},
-    {WSAENOBUFS,         "No buffer space available"},
-    {WSAEISCONN,         "Socket is already connected"},
-    {WSAENOTCONN,        "Socket is not connected"},
-    {WSAESHUTDOWN,       "Can't send after socket shutdown"},
-    {WSAETOOMANYREFS,    "Too many references, can't splice"},
-    {WSAETIMEDOUT,       "Connection timed out"},
-    {WSAECONNREFUSED,    "Connection refused"},
-    {WSAELOOP,           "Too many levels of symbolic links"},
-    {WSAENAMETOOLONG,    "File name too long"},
-    {WSAEHOSTDOWN,       "Host is down"},
-    {WSAEHOSTUNREACH,    "No route to host"},
-    {WSAENOTEMPTY,       "Directory not empty"},
-    {WSAEPROCLIM,        "Too many processes"},
-    {WSAEUSERS,          "Too many users"},
-    {WSAEDQUOT,          "Disc quota exceeded"},
-    {WSAESTALE,          "Stale NFS file handle"},
-    {WSAEREMOTE,         "Too many levels of remote in path"},
-    {WSASYSNOTREADY,     "Network system is unavailable"},
-    {WSAVERNOTSUPPORTED, "Winsock version out of range"},
-    {WSANOTINITIALISED,  "WSAStartup not yet called"},
-    {WSAEDISCON,         "Graceful shutdown in progress"},
-    {WSAHOST_NOT_FOUND,  "Host not found"},
-    {WSATRY_AGAIN,       "NA Host not found / SERVFAIL"},
-    {WSANO_RECOVERY,     "Non recoverable FORMERR||REFUSED||NOTIMP"},
-    {WSANO_DATA,         "No host data of that type was found"},
-    {0,0} /* End of table */
+static struct WSErrorEntry
+{
+       DWORD           error;
+       const char *description;
+}      WSErrors[] =
+
+{
+       {
+               0, "No error"
+       },
+       {
+               WSAEINTR, "Interrupted system call"
+       },
+       {
+               WSAEBADF, "Bad file number"
+       },
+       {
+               WSAEACCES, "Permission denied"
+       },
+       {
+               WSAEFAULT, "Bad address"
+       },
+       {
+               WSAEINVAL, "Invalid argument"
+       },
+       {
+               WSAEMFILE, "Too many open sockets"
+       },
+       {
+               WSAEWOULDBLOCK, "Operation would block"
+       },
+       {
+               WSAEINPROGRESS, "Operation now in progress"
+       },
+       {
+               WSAEALREADY, "Operation already in progress"
+       },
+       {
+               WSAENOTSOCK, "Socket operation on non-socket"
+       },
+       {
+               WSAEDESTADDRREQ, "Destination address required"
+       },
+       {
+               WSAEMSGSIZE, "Message too long"
+       },
+       {
+               WSAEPROTOTYPE, "Protocol wrong type for socket"
+       },
+       {
+               WSAENOPROTOOPT, "Bad protocol option"
+       },
+       {
+               WSAEPROTONOSUPPORT, "Protocol not supported"
+       },
+       {
+               WSAESOCKTNOSUPPORT, "Socket type not supported"
+       },
+       {
+               WSAEOPNOTSUPP, "Operation not supported on socket"
+       },
+       {
+               WSAEPFNOSUPPORT, "Protocol family not supported"
+       },
+       {
+               WSAEAFNOSUPPORT, "Address family not supported"
+       },
+       {
+               WSAEADDRINUSE, "Address already in use"
+       },
+       {
+               WSAEADDRNOTAVAIL, "Can't assign requested address"
+       },
+       {
+               WSAENETDOWN, "Network is down"
+       },
+       {
+               WSAENETUNREACH, "Network is unreachable"
+       },
+       {
+               WSAENETRESET, "Net connection reset"
+       },
+       {
+               WSAECONNABORTED, "Software caused connection abort"
+       },
+       {
+               WSAECONNRESET, "Connection reset by peer"
+       },
+       {
+               WSAENOBUFS, "No buffer space available"
+       },
+       {
+               WSAEISCONN, "Socket is already connected"
+       },
+       {
+               WSAENOTCONN, "Socket is not connected"
+       },
+       {
+               WSAESHUTDOWN, "Can't send after socket shutdown"
+       },
+       {
+               WSAETOOMANYREFS, "Too many references, can't splice"
+       },
+       {
+               WSAETIMEDOUT, "Connection timed out"
+       },
+       {
+               WSAECONNREFUSED, "Connection refused"
+       },
+       {
+               WSAELOOP, "Too many levels of symbolic links"
+       },
+       {
+               WSAENAMETOOLONG, "File name too long"
+       },
+       {
+               WSAEHOSTDOWN, "Host is down"
+       },
+       {
+               WSAEHOSTUNREACH, "No route to host"
+       },
+       {
+               WSAENOTEMPTY, "Directory not empty"
+       },
+       {
+               WSAEPROCLIM, "Too many processes"
+       },
+       {
+               WSAEUSERS, "Too many users"
+       },
+       {
+               WSAEDQUOT, "Disc quota exceeded"
+       },
+       {
+               WSAESTALE, "Stale NFS file handle"
+       },
+       {
+               WSAEREMOTE, "Too many levels of remote in path"
+       },
+       {
+               WSASYSNOTREADY, "Network system is unavailable"
+       },
+       {
+               WSAVERNOTSUPPORTED, "Winsock version out of range"
+       },
+       {
+               WSANOTINITIALISED, "WSAStartup not yet called"
+       },
+       {
+               WSAEDISCON, "Graceful shutdown in progress"
+       },
+       {
+               WSAHOST_NOT_FOUND, "Host not found"
+       },
+       {
+               WSATRY_AGAIN, "NA Host not found / SERVFAIL"
+       },
+       {
+               WSANO_RECOVERY, "Non recoverable FORMERR||REFUSED||NOTIMP"
+       },
+       {
+               WSANO_DATA, "No host data of that type was found"
+       },
+       {
+               0, 0
+       }                                                       /* End of table */
 };
 
 
-/* 
+/*
  * Returns 0 if not found, linear but who cares, at this moment
  * we're already in pain :)
  */
 
-static int LookupWSErrorMessage(DWORD err,char*dest)
-{   
-  struct WSErrorEntry *e;
-  for (e = WSErrors;e->description;e++)
-  {
-    if (e->error == err)
-    {
-      strcpy(dest,e->description);
-      return 1;
-    }
-  }
-  return 0;
+static int
+LookupWSErrorMessage(DWORD err, char *dest)
+{
+       struct WSErrorEntry *e;
+
+       for (e = WSErrors; e->description; e++)
+       {
+               if (e->error == err)
+               {
+                       strcpy(dest, e->description);
+                       return 1;
+               }
+       }
+       return 0;
 }
 
 
-struct MessageDLL{
-    const char *dll_name;
-    void       *handle;
-    int         loaded; /* BOOL */
-}dlls[]={
-  {"netmsg.dll",0,0},
-  {"winsock.dll",0,0},
-  {"wsock32.dll",0,0},
-  {"ws2_32.dll",0,0},
-  {"wsock32n.dll",0,0},
-  {"mswsock.dll",0,0},
-  {"ws2help.dll",0,0},
-  {"ws2thk.dll",0,0},
-  {0,0,1}             /* Last one, no dll, always loaded */
+struct MessageDLL
+{
+       const char *dll_name;
+       void       *handle;
+       int                     loaded;                 /* BOOL */
+}      dlls[] =
+
+{
+       {
+               "netmsg.dll", 0, 0
+       },
+       {
+               "winsock.dll", 0, 0
+       },
+       {
+               "wsock32.dll", 0, 0
+       },
+       {
+               "ws2_32.dll", 0, 0
+       },
+       {
+               "wsock32n.dll", 0, 0
+       },
+       {
+               "mswsock.dll", 0, 0
+       },
+       {
+               "ws2help.dll", 0, 0
+       },
+       {
+               "ws2thk.dll", 0, 0
+       },
+       {
+               0, 0, 1
+       }                                                       /* Last one, no dll, always loaded */
 };
 
 #define DLLS_SIZE (sizeof(dlls)/sizeof(struct MessageDLL))
@@ -132,58 +264,58 @@ struct MessageDLL{
  * Returns a description of the socket error by first trying
  * to find it in the lookup table, and if that fails, tries
  * to load any of the winsock dlls to find that message.
- * The DLL thing works from Nt4 (spX ?) up, but some special 
+ * The DLL thing works from Nt4 (spX ?) up, but some special
  * versions of winsock might have this aswell (seen on Win98 SE
- * special install)            / Magnus Naeslund (mag@fbab.net)
+ * special install)                       / Magnus Naeslund (mag@fbab.net)
  *
  */
 
-const char *winsock_strerror(int err){
-  static char   buf[512]; /* Not threadsafe */
-  unsigned long flags;
-  int           offs,i;
-  int           success = LookupWSErrorMessage(err,buf);
-  
-  for (i=0;!success && i<DLLS_SIZE;i++)
-  {
-      
-      if (!dlls[i].loaded)
-      {
-       dlls[i].loaded = 1; /* Only load once */
-       dlls[i].handle = (void*)LoadLibraryEx(
-                                             dlls[i].dll_name,
-                                             0,
-                                             LOAD_LIBRARY_AS_DATAFILE);
-      }
-      
-      if (dlls[i].dll_name && !dlls[i].handle)
-       continue; /* Didn't load */
-      
-      flags = FORMAT_MESSAGE_FROM_SYSTEM 
-           | FORMAT_MESSAGE_IGNORE_INSERTS
-           | (dlls[i].handle?FORMAT_MESSAGE_FROM_HMODULE:0);
-      
-      success = 0 != FormatMessage( 
-                                  flags,
-                                  dlls[i].handle,err,
-                                  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                                  buf,sizeof(buf)-64,
-                                  0
-                                  );
-  }
-  
-  if (!success)
-  {
-    sprintf(buf,"Unknown socket error (0x%08X/%lu)",err,err);
-  }
-  else
-  {
-    buf[sizeof(buf)-1]='\0';
-    offs = strlen(buf);
-    if (offs>sizeof(buf)-64)
-      offs = sizeof(buf)-64;
-    sprintf(buf+offs," (0x%08X/%lu)",err,err);
-  }
-  return buf;  
-}
+const char *
+winsock_strerror(int err)
+{
+       static char buf[512];           /* Not threadsafe */
+       unsigned long flags;
+       int                     offs,
+                               i;
+       int                     success = LookupWSErrorMessage(err, buf);
+
+       for (i = 0; !success && i < DLLS_SIZE; i++)
+       {
 
+               if (!dlls[i].loaded)
+               {
+                       dlls[i].loaded = 1; /* Only load once */
+                       dlls[i].handle = (void *) LoadLibraryEx(
+                                                                                                       dlls[i].dll_name,
+                                                                                                       0,
+                                                                                          LOAD_LIBRARY_AS_DATAFILE);
+               }
+
+               if (dlls[i].dll_name && !dlls[i].handle)
+                       continue;                       /* Didn't load */
+
+               flags = FORMAT_MESSAGE_FROM_SYSTEM
+                       | FORMAT_MESSAGE_IGNORE_INSERTS
+                       | (dlls[i].handle ? FORMAT_MESSAGE_FROM_HMODULE : 0);
+
+               success = 0 != FormatMessage(
+                                                                        flags,
+                                                                        dlls[i].handle, err,
+                                                          MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                                                                        buf, sizeof(buf) - 64,
+                                                                        0
+                       );
+       }
+
+       if (!success)
+               sprintf(buf, "Unknown socket error (0x%08X/%lu)", err, err);
+       else
+       {
+               buf[sizeof(buf) - 1] = '\0';
+               offs = strlen(buf);
+               if (offs > sizeof(buf) - 64)
+                       offs = sizeof(buf) - 64;
+               sprintf(buf + offs, " (0x%08X/%lu)", err, err);
+       }
+       return buf;
+}
index fcda897..4dd85e0 100644 (file)
@@ -1966,9 +1966,9 @@ pgquery_dictresult(pgqueryobject * self, PyObject * args)
                                                                                                 * one */
                                                                s++;
 
-                                                       for (k = 0; 
-                                                               *s && k < sizeof(cashbuf)/sizeof(cashbuf[0])-1; 
-                                                               s++)
+                                                       for (k = 0;
+                                                                *s && k < sizeof(cashbuf) / sizeof(cashbuf[0]) - 1;
+                                                                s++)
                                                        {
                                                                if (*s != ',')
                                                                        cashbuf[k++] = *s;
index a0da01a..61c18b1 100644 (file)
@@ -45,4 +45,3 @@ elog_ERROR(void)
 {
        return ERROR;
 }
-
index 742b5e6..5452586 100644 (file)
@@ -1,13 +1,12 @@
 
-int    elog_DEBUG(void);
+int                    elog_DEBUG(void);
 
-int    elog_LOG(void);
+int                    elog_LOG(void);
 
-int    elog_INFO(void);
+int                    elog_INFO(void);
 
-int    elog_NOTICE(void);
+int                    elog_NOTICE(void);
 
-int    elog_WARNING(void);
-
-int    elog_ERROR(void);
+int                    elog_WARNING(void);
 
+int                    elog_ERROR(void);
index c617c86..8d94d28 100644 (file)
@@ -33,7 +33,7 @@
  *       ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.32 2002/08/22 00:01:49 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.33 2002/09/04 20:31:47 momjian Exp $
  *
  **********************************************************************/
 
@@ -341,8 +341,8 @@ plperl_create_sub(char *s, bool trusted)
  *
  **********************************************************************/
 
-EXTERN_C void boot_DynaLoader(pTHX_ CV* cv);
-EXTERN_C void boot_SPI(pTHX_ CV* cv);
+EXTERN_C void boot_DynaLoader(pTHX_ CV * cv);
+EXTERN_C void boot_SPI(pTHX_ CV * cv);
 
 static void
 plperl_init_shared_libs(pTHX)
@@ -553,7 +553,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
                 * function's pg_proc entry without changing its OID.
                 ************************************************************/
                uptodate = (prodesc->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) &&
-                                       prodesc->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data));
+                       prodesc->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data));
 
                if (!uptodate)
                {
@@ -628,7 +628,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
                        if (typeStruct->typtype == 'p')
                        {
                                if (procStruct->prorettype == VOIDOID)
-                                       /* okay */;
+                                        /* okay */ ;
                                else if (procStruct->prorettype == TRIGGEROID ||
                                                 procStruct->prorettype == OPAQUEOID)
                                {
index 2ee06ac..c25f964 100644 (file)
@@ -3,7 +3,7 @@
  *                       procedural language
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.50 2002/09/01 16:28:06 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.51 2002/09/04 20:31:47 momjian Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -216,7 +216,7 @@ plpgsql_compile(Oid fn_oid, int functype)
                        {
                                if (procStruct->prorettype == VOIDOID ||
                                        procStruct->prorettype == RECORDOID)
-                                       /* okay */;
+                                        /* okay */ ;
                                else if (procStruct->prorettype == TRIGGEROID ||
                                                 procStruct->prorettype == OPAQUEOID)
                                        elog(ERROR, "plpgsql functions cannot return type %s"
@@ -246,7 +246,7 @@ plpgsql_compile(Oid fn_oid, int functype)
                        {
                                char            buf[32];
 
-                               snprintf(buf, sizeof(buf), "$%d", i + 1);       /* name for variable */
+                               snprintf(buf, sizeof(buf), "$%d", i + 1);               /* name for variable */
 
                                /*
                                 * Get the parameters type
@@ -1138,7 +1138,7 @@ build_rowtype(Oid classOid)
        PLpgSQL_row *row;
        HeapTuple       classtup;
        Form_pg_class classStruct;
-       const char  *relname;
+       const char *relname;
        int                     i;
 
        /*
@@ -1178,7 +1178,7 @@ build_rowtype(Oid classOid)
                Form_pg_attribute attrStruct;
                HeapTuple       typetup;
                Form_pg_type typeStruct;
-               const char         *attname;
+               const char *attname;
                PLpgSQL_var *var;
 
                /*
index 7b7b1c1..37184b8 100644 (file)
@@ -3,7 +3,7 @@
  *                       procedural language
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.62 2002/09/01 16:28:06 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.63 2002/09/04 20:31:47 momjian Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -98,7 +98,7 @@ static int exec_stmt_exit(PLpgSQL_execstate * estate,
 static int exec_stmt_return(PLpgSQL_execstate * estate,
                                 PLpgSQL_stmt_return * stmt);
 static int exec_stmt_return_next(PLpgSQL_execstate * estate,
-                                PLpgSQL_stmt_return_next * stmt);
+                                         PLpgSQL_stmt_return_next * stmt);
 static int exec_stmt_raise(PLpgSQL_execstate * estate,
                                PLpgSQL_stmt_raise * stmt);
 static int exec_stmt_execsql(PLpgSQL_execstate * estate,
@@ -108,9 +108,9 @@ static int exec_stmt_dynexecute(PLpgSQL_execstate * estate,
 static int exec_stmt_dynfors(PLpgSQL_execstate * estate,
                                  PLpgSQL_stmt_dynfors * stmt);
 
-static void plpgsql_estate_setup(PLpgSQL_execstate *estate,
-                                                                PLpgSQL_function *func,
-                                                                ReturnSetInfo *rsi);
+static void plpgsql_estate_setup(PLpgSQL_execstate * estate,
+                                        PLpgSQL_function * func,
+                                        ReturnSetInfo *rsi);
 static void exec_eval_cleanup(PLpgSQL_execstate * estate);
 
 static void exec_prepare_plan(PLpgSQL_execstate * estate,
@@ -144,7 +144,7 @@ static Datum exec_cast_value(Datum value, Oid valtype,
                                Oid reqtypelem,
                                int32 reqtypmod,
                                bool *isnull);
-static void exec_init_tuple_store(PLpgSQL_execstate *estate);
+static void exec_init_tuple_store(PLpgSQL_execstate * estate);
 static bool compatible_tupdesc(TupleDesc td1, TupleDesc td2);
 static void exec_set_found(PLpgSQL_execstate * estate, bool state);
 
@@ -991,7 +991,8 @@ exec_stmt_assign(PLpgSQL_execstate * estate, PLpgSQL_stmt_assign * stmt)
                 * depending on whether at least one row was returned).
                 *
                 * This cannot share code with the assignment case since we do not
-                * wish to constrain the discarded result to be only one row/column.
+                * wish to constrain the discarded result to be only one
+                * row/column.
                 */
                int                     rc;
 
@@ -1248,7 +1249,7 @@ exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt)
                                break;
                }
 
-               found = true;   /* looped at least once */
+               found = true;                   /* looped at least once */
 
                /*
                 * Execute the statements
@@ -1256,7 +1257,7 @@ exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt)
                rc = exec_stmts(estate, stmt->body);
 
                if (rc == PLPGSQL_RC_RETURN)
-                       break;                                          /* return from function */
+                       break;                          /* return from function */
                else if (rc == PLPGSQL_RC_EXIT)
                {
                        if (estate->exitlabel == NULL)
@@ -1271,9 +1272,9 @@ exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt)
                        }
 
                        /*
-                        * otherwise, we processed a labelled exit that does not
-                        * match the current statement's label, if any: return
-                        * RC_EXIT so that the EXIT continues to recurse upward.
+                        * otherwise, we processed a labelled exit that does not match
+                        * the current statement's label, if any: return RC_EXIT so
+                        * that the EXIT continues to recurse upward.
                         */
 
                        break;
@@ -1289,10 +1290,10 @@ exec_stmt_fori(PLpgSQL_execstate * estate, PLpgSQL_stmt_fori * stmt)
        }
 
        /*
-        * Set the FOUND variable to indicate the result of executing the
-        * loop (namely, whether we looped one or more times). This must be
-        * set here so that it does not interfere with the value of the
-        * FOUND variable inside the loop processing itself.
+        * Set the FOUND variable to indicate the result of executing the loop
+        * (namely, whether we looped one or more times). This must be set
+        * here so that it does not interfere with the value of the FOUND
+        * variable inside the loop processing itself.
         */
        exec_set_found(estate, found);
 
@@ -1346,7 +1347,7 @@ exec_stmt_fors(PLpgSQL_execstate * estate, PLpgSQL_stmt_fors * stmt)
        if (n == 0)
                exec_move_row(estate, rec, row, NULL, NULL);
        else
-               found = true;   /* processed at least one tuple */
+               found = true;                   /* processed at least one tuple */
 
        /*
         * Now do the loop
@@ -1388,9 +1389,10 @@ exec_stmt_fors(PLpgSQL_execstate * estate, PLpgSQL_stmt_fors * stmt)
                                        }
 
                                        /*
-                                        * otherwise, we processed a labelled exit that does not
-                                        * match the current statement's label, if any: return
-                                        * RC_EXIT so that the EXIT continues to recurse upward.
+                                        * otherwise, we processed a labelled exit that does
+                                        * not match the current statement's label, if any:
+                                        * return RC_EXIT so that the EXIT continues to
+                                        * recurse upward.
                                         */
                                }
 
@@ -1414,10 +1416,10 @@ exec_stmt_fors(PLpgSQL_execstate * estate, PLpgSQL_stmt_fors * stmt)
        SPI_cursor_close(portal);
 
        /*
-        * Set the FOUND variable to indicate the result of executing the
-        * loop (namely, whether we looped one or more times). This must be
-        * set here so that it does not interfere with the value of the
-        * FOUND variable inside the loop processing itself.
+        * Set the FOUND variable to indicate the result of executing the loop
+        * (namely, whether we looped one or more times). This must be set
+        * here so that it does not interfere with the value of the FOUND
+        * variable inside the loop processing itself.
         */
        exec_set_found(estate, found);
 
@@ -1579,14 +1581,14 @@ exec_stmt_return(PLpgSQL_execstate * estate, PLpgSQL_stmt_return * stmt)
 
 /*
  * Notes:
- *  - the tuple store must be created in a sufficiently long-lived
- *    memory context, as the same store must be used within the executor
- *    after the PL/PgSQL call returns. At present, the code uses
- *    TopTransactionContext.
+ *     - the tuple store must be created in a sufficiently long-lived
+ *       memory context, as the same store must be used within the executor
+ *       after the PL/PgSQL call returns. At present, the code uses
+ *       TopTransactionContext.
  */
 static int
-exec_stmt_return_next(PLpgSQL_execstate *estate,
-                                         PLpgSQL_stmt_return_next *stmt)
+exec_stmt_return_next(PLpgSQL_execstate * estate,
+                                         PLpgSQL_stmt_return_next * stmt)
 {
        TupleDesc       tupdesc;
        int                     natts;
@@ -1601,7 +1603,7 @@ exec_stmt_return_next(PLpgSQL_execstate *estate,
 
        /* rettupdesc will be filled by exec_init_tuple_store */
        tupdesc = estate->rettupdesc;
-       natts   = tupdesc->natts;
+       natts = tupdesc->natts;
 
        if (stmt->rec)
        {
@@ -1613,15 +1615,15 @@ exec_stmt_return_next(PLpgSQL_execstate *estate,
        }
        else if (stmt->row)
        {
-               Datum   *dvalues;
-               char    *nulls;
-               int              i;
+               Datum      *dvalues;
+               char       *nulls;
+               int                     i;
 
                if (natts != stmt->row->nfields)
                        elog(ERROR, "Wrong record type supplied in RETURN NEXT");
 
-               dvalues = (Datum *) palloc(natts * sizeof(Datum));
-               nulls   = (char *) palloc(natts * sizeof(char));
+               dvalues = (Datum *) palloc(natts * sizeof(Datum));
+               nulls = (char *) palloc(natts * sizeof(char));
                MemSet(dvalues, 0, natts * sizeof(Datum));
                MemSet(nulls, 'n', natts);
 
@@ -1645,10 +1647,10 @@ exec_stmt_return_next(PLpgSQL_execstate *estate,
        }
        else if (stmt->expr)
        {
-               Datum   retval;
-               bool    isNull;
-               Oid             rettype;
-               char    nullflag;
+               Datum           retval;
+               bool            isNull;
+               Oid                     rettype;
+               char            nullflag;
 
                if (natts != 1)
                        elog(ERROR, "Wrong result type supplied in RETURN NEXT");
@@ -1661,9 +1663,9 @@ exec_stmt_return_next(PLpgSQL_execstate *estate,
                /* coerce type if needed */
                if (!isNull && rettype != tupdesc->attrs[0]->atttypid)
                {
-                       Oid targType = tupdesc->attrs[0]->atttypid;
-                       Oid typInput;
-                       Oid typElem;
+                       Oid                     targType = tupdesc->attrs[0]->atttypid;
+                       Oid                     typInput;
+                       Oid                     typElem;
                        FmgrInfo        finfo_input;
 
                        getTypeInputInfo(targType, &typInput, &typElem);
@@ -1708,7 +1710,7 @@ exec_stmt_return_next(PLpgSQL_execstate *estate,
 }
 
 static void
-exec_init_tuple_store(PLpgSQL_execstate *estate)
+exec_init_tuple_store(PLpgSQL_execstate * estate)
 {
        ReturnSetInfo *rsi = estate->rsi;
        MemoryContext oldcxt;
@@ -1895,8 +1897,8 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
  * ----------
  */
 static void
-plpgsql_estate_setup(PLpgSQL_execstate *estate,
-                                        PLpgSQL_function *func,
+plpgsql_estate_setup(PLpgSQL_execstate * estate,
+                                        PLpgSQL_function * func,
                                         ReturnSetInfo *rsi)
 {
        estate->retval = (Datum) 0;
@@ -2124,6 +2126,7 @@ exec_stmt_execsql(PLpgSQL_execstate * estate,
                case SPI_OK_INSERT:
                case SPI_OK_DELETE:
                case SPI_OK_UPDATE:
+
                        /*
                         * If the INSERT, DELETE, or UPDATE query affected at least
                         * one tuple, set the magic 'FOUND' variable to true. This
@@ -2228,25 +2231,25 @@ exec_stmt_dynexecute(PLpgSQL_execstate * estate,
                case SPI_OK_SELINTO:
 
                        /*
-                        * We want to disallow SELECT INTO for now, because its behavior
-                        * is not consistent with SELECT INTO in a normal plpgsql
-                        * context. (We need to reimplement EXECUTE to parse the string
-                        * as a plpgsql command, not just feed it to SPI_exec.)
-                        * However, CREATE AS should be allowed ... and since it produces
-                        * the same parsetree as SELECT INTO, there's no way to tell
-                        * the difference except to look at the source text.  Wotta
-                        * kluge!
+                        * We want to disallow SELECT INTO for now, because its
+                        * behavior is not consistent with SELECT INTO in a normal
+                        * plpgsql context. (We need to reimplement EXECUTE to parse
+                        * the string as a plpgsql command, not just feed it to
+                        * SPI_exec.) However, CREATE AS should be allowed ... and
+                        * since it produces the same parsetree as SELECT INTO,
+                        * there's no way to tell the difference except to look at the
+                        * source text.  Wotta kluge!
                         */
-               {
-                       char   *ptr;
+                       {
+                               char       *ptr;
 
-                       for (ptr = querystr; *ptr; ptr++)
-                               if (!isspace((unsigned char) *ptr))
-                                       break;
-                       if (*ptr == 'S' || *ptr == 's')
-                               elog(ERROR, "EXECUTE of SELECT ... INTO is not implemented yet");
-                       break;
-               }
+                               for (ptr = querystr; *ptr; ptr++)
+                                       if (!isspace((unsigned char) *ptr))
+                                               break;
+                               if (*ptr == 'S' || *ptr == 's')
+                                       elog(ERROR, "EXECUTE of SELECT ... INTO is not implemented yet");
+                               break;
+                       }
 
                default:
                        elog(ERROR, "unexpected error %d in EXECUTE of query '%s'",
@@ -2399,9 +2402,10 @@ exec_stmt_dynfors(PLpgSQL_execstate * estate, PLpgSQL_stmt_dynfors * stmt)
                                        }
 
                                        /*
-                                        * otherwise, we processed a labelled exit that does not
-                                        * match the current statement's label, if any: return
-                                        * RC_EXIT so that the EXIT continues to recurse upward.
+                                        * otherwise, we processed a labelled exit that does
+                                        * not match the current statement's label, if any:
+                                        * return RC_EXIT so that the EXIT continues to
+                                        * recurse upward.
                                         */
                                }
 
@@ -2425,10 +2429,10 @@ exec_stmt_dynfors(PLpgSQL_execstate * estate, PLpgSQL_stmt_dynfors * stmt)
        SPI_cursor_close(portal);
 
        /*
-        * Set the FOUND variable to indicate the result of executing the
-        * loop (namely, whether we looped one or more times). This must be
-        * set here so that it does not interfere with the value of the
-        * FOUND variable inside the loop processing itself.
+        * Set the FOUND variable to indicate the result of executing the loop
+        * (namely, whether we looped one or more times). This must be set
+        * here so that it does not interfere with the value of the FOUND
+        * variable inside the loop processing itself.
         */
        exec_set_found(estate, found);
 
index deaa269..7da6444 100644 (file)
@@ -3,7 +3,7 @@
  *                       procedural language
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.21 2002/08/30 00:28:41 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_funcs.c,v 1.22 2002/09/04 20:31:47 momjian Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -88,7 +88,8 @@ plpgsql_dstring_append(PLpgSQL_dstring * ds, char *str)
        if (needed > ds->alloc)
        {
                /* might have to double more than once, if len is large */
-               do {
+               do
+               {
                        ds->alloc *= 2;
                } while (needed > ds->alloc);
                ds->value = repalloc(ds->value, ds->alloc);
@@ -324,9 +325,9 @@ plpgsql_ns_rename(char *oldname, char *newname)
  * truncate to NAMEDATALEN.
  *
  * There may be several identifiers separated by dots and optional
- * whitespace.  Each one is converted to a separate palloc'd string.
+ * whitespace. Each one is converted to a separate palloc'd string.
  * The caller passes the expected number of identifiers, as well as
- * a char* array to hold them.  It is an error if we find the wrong
+ * a char* array to hold them. It is an error if we find the wrong
  * number of identifiers (cf grammar processing of fori_varname).
  *
  * NOTE: the input string has already been accepted by the flex lexer,
@@ -347,7 +348,7 @@ plpgsql_convert_ident(const char *s, char **output, int numidents)
                int                     i;
 
                /* Process current identifier */
-               curident = palloc(strlen(s) + 1); /* surely enough room */
+               curident = palloc(strlen(s) + 1);               /* surely enough room */
                cp = curident;
 
                if (*s == '"')
@@ -392,9 +393,9 @@ plpgsql_convert_ident(const char *s, char **output, int numidents)
 
                if (i >= NAMEDATALEN)
                {
-                       int len;
+                       int                     len;
 
-                       len = pg_mbcliplen(curident, i, NAMEDATALEN-1);
+                       len = pg_mbcliplen(curident, i, NAMEDATALEN - 1);
                        curident[len] = '\0';
                }
 
index c81b0a3..1d5ab78 100644 (file)
@@ -3,7 +3,7 @@
  *                       procedural language
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.26 2002/08/30 00:28:41 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.27 2002/09/04 20:31:47 momjian Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -514,7 +514,7 @@ typedef struct
        char       *exitlabel;
 
        Tuplestorestate *tuple_store;           /* SRFs accumulate results here */
-       MemoryContext   tuple_store_cxt;
+       MemoryContext tuple_store_cxt;
        ReturnSetInfo *rsi;
 
        int                     trig_nargs;
index 986937e..78b23a1 100644 (file)
@@ -29,7 +29,7 @@
  * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *     $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.20 2002/08/22 00:01:50 tgl Exp $
+ *     $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.21 2002/09/04 20:31:48 momjian Exp $
  *
  *********************************************************************
  */
@@ -189,8 +189,8 @@ static void PLy_init_safe_interp(void);
 static void PLy_init_plpy(void);
 
 /* Helper functions used during initialization */
-static int  populate_methods(PyObject *klass, PyMethodDef *methods);
-static PyObject *build_tuple(charstring_list[], int len);
+static int     populate_methods(PyObject * klass, PyMethodDef * methods);
+static PyObject *build_tuple(char *string_list[], int len);
 
 /* error handler.  collects the current Python exception, if any,
  * and appends it to the error and sends it to elog
@@ -250,7 +250,7 @@ static void PLy_input_tuple_funcs(PLyTypeInfo *, TupleDesc);
 
 /* RExec methods
  */
-static PyObject *PLy_r_open(PyObject *self, PyObject* args);
+static PyObject *PLy_r_open(PyObject * self, PyObject * args);
 
 /* conversion functions
  */
@@ -333,9 +333,9 @@ static char *PLy_ok_sys_names_list[] = {
 
 /* Python exceptions
  */
-static PyObject   *PLy_exc_error = NULL;
-static PyObject   *PLy_exc_fatal = NULL;
-static PyObject   *PLy_exc_spi_error = NULL;
+static PyObject *PLy_exc_error = NULL;
+static PyObject *PLy_exc_fatal = NULL;
+static PyObject *PLy_exc_spi_error = NULL;
 
 /* some globals for the python module
  */
@@ -408,9 +408,7 @@ plpython_call_handler(PG_FUNCTION_ARGS)
                else
                        PLy_restart_in_progress += 1;
                if (proc)
-               {
                        Py_DECREF(proc->me);
-               }
                RERAISE_EXC();
        }
 
@@ -1676,6 +1674,7 @@ static PyObject *PLy_plan_status(PyObject *, PyObject *);
 static PyObject *PLy_result_new(void);
 static void PLy_result_dealloc(PyObject *);
 static PyObject *PLy_result_getattr(PyObject *, char *);
+
 #ifdef NOT_USED
 /* Appear to be unused */
 static PyObject *PLy_result_fetch(PyObject *, PyObject *);
@@ -1770,6 +1769,7 @@ static PyTypeObject PLy_ResultType = {
        0,                                                      /* tp_xxx4 */
        PLy_result_doc,                         /* tp_doc */
 };
+
 #ifdef NOT_USED
 /* Appear to be unused */
 static PyMethodDef PLy_result_methods[] = {
@@ -1923,6 +1923,7 @@ PLy_result_getattr(PyObject * self, char *attr)
 {
        return NULL;
 }
+
 #ifdef NOT_USED
 /* Appear to be unused */
 PyObject *
@@ -2043,7 +2044,7 @@ PLy_spi_prepare(PyObject * self, PyObject * args)
                if (!PyErr_Occurred())
                        PyErr_SetString(PLy_exc_spi_error,
                                                        "Unknown error in PLy_spi_prepare.");
-               PLy_elog(WARNING,"in function %s:",PLy_procedure_name(PLy_last_procedure));
+               PLy_elog(WARNING, "in function %s:", PLy_procedure_name(PLy_last_procedure));
                RERAISE_EXC();
        }
 
@@ -2232,7 +2233,7 @@ PLy_spi_execute_plan(PyObject * ob, PyObject * list, int limit)
                if (!PyErr_Occurred())
                        PyErr_SetString(PLy_exc_error,
                                                        "Unknown error in PLy_spi_execute_plan");
-               PLy_elog(WARNING,"in function %s:",PLy_procedure_name(PLy_last_procedure));
+               PLy_elog(WARNING, "in function %s:", PLy_procedure_name(PLy_last_procedure));
                RERAISE_EXC();
        }
 
@@ -2298,7 +2299,7 @@ PLy_spi_execute_query(char *query, int limit)
                if ((!PLy_restart_in_progress) && (!PyErr_Occurred()))
                        PyErr_SetString(PLy_exc_spi_error,
                                                        "Unknown error in PLy_spi_execute_query.");
-               PLy_elog(WARNING,"in function %s:",PLy_procedure_name(PLy_last_procedure));
+               PLy_elog(WARNING, "in function %s:", PLy_procedure_name(PLy_last_procedure));
                RERAISE_EXC();
        }
 
@@ -2496,11 +2497,11 @@ PLy_init_plpy(void)
 }
 
 /*
- *  New RExec methods
+ *     New RExec methods
  */
 
-PyObject*
-PLy_r_open(PyObject *self, PyObject* args)
+PyObject *
+PLy_r_open(PyObject * self, PyObject * args)
 {
        PyErr_SetString(PyExc_IOError, "can't open files in restricted mode");
        return NULL;
@@ -2508,20 +2509,22 @@ PLy_r_open(PyObject *self, PyObject* args)
 
 
 static PyMethodDef PLy_r_exec_methods[] = {
-       {"r_open", (PyCFunction)PLy_r_open, METH_VARARGS, NULL},
+       {"r_open", (PyCFunction) PLy_r_open, METH_VARARGS, NULL},
        {NULL, NULL, 0, NULL}
 };
 
 /*
- *  Init new RExec
+ *     Init new RExec
  */
 
 void
 PLy_init_safe_interp(void)
 {
-       PyObject   *rmod, *rexec, *rexec_dict;
+       PyObject   *rmod,
+                          *rexec,
+                          *rexec_dict;
        char       *rname = "rexec";
-       int         len;
+       int                     len;
 
        enter();
 
@@ -2554,31 +2557,33 @@ PLy_init_safe_interp(void)
                PLy_elog(ERROR, "Unable to get RExec object.");
 
 
-       rexec_dict = ((PyClassObject*)rexec)->cl_dict;
+       rexec_dict = ((PyClassObject *) rexec)->cl_dict;
 
        /*
         * tweak the list of permitted modules, posix and sys functions
         */
        PyDict_SetItemString(rexec_dict, "ok_builtin_modules", PLy_importable_modules);
-       PyDict_SetItemString(rexec_dict, "ok_posix_names",     PLy_ok_posix_names);
-       PyDict_SetItemString(rexec_dict, "ok_sys_names",       PLy_ok_sys_names);
+       PyDict_SetItemString(rexec_dict, "ok_posix_names", PLy_ok_posix_names);
+       PyDict_SetItemString(rexec_dict, "ok_sys_names", PLy_ok_sys_names);
 
        /*
         * change the r_open behavior
         */
-       if( populate_methods(rexec, PLy_r_exec_methods) )
+       if (populate_methods(rexec, PLy_r_exec_methods))
                PLy_elog(ERROR, "Failed to update RExec methods.");
 }
 
 /* Helper function to build tuples from string lists */
 static
-PyObject *build_tuple(char* string_list[], int len)
+PyObject *
+build_tuple(char *string_list[], int len)
 {
-       PyObject *tup = PyTuple_New(len);
-       int i;
+       PyObject   *tup = PyTuple_New(len);
+       int                     i;
+
        for (i = 0; i < len; i++)
        {
-               PyObject *m = PyString_FromString(string_list[i]);
+               PyObject   *m = PyString_FromString(string_list[i]);
 
                PyTuple_SetItem(tup, i, m);
        }
@@ -2587,30 +2592,32 @@ PyObject *build_tuple(char* string_list[], int len)
 
 /* Helper function for populating a class with method wrappers. */
 static int
-populate_methods(PyObject *klass, PyMethodDef *methods)
+populate_methods(PyObject * klass, PyMethodDef * methods)
 {
        if (!klass || !methods)
                return 0;
 
-       for ( ; methods->ml_name; ++methods) {
+       for (; methods->ml_name; ++methods)
+       {
 
                /* get a wrapper for the built-in function */
-               PyObject *func = PyCFunction_New(methods, NULL);
-               PyObject *meth;
-               int status;
+               PyObject   *func = PyCFunction_New(methods, NULL);
+               PyObject   *meth;
+               int                     status;
 
                if (!func)
                        return -1;
 
                /* turn the function into an unbound method */
-               if (!(meth = PyMethod_New(func, NULL, klass))) {
+               if (!(meth = PyMethod_New(func, NULL, klass)))
+               {
                        Py_DECREF(func);
                        return -1;
                }
 
                /* add method to dictionary */
-               status = PyDict_SetItemString( ((PyClassObject*)klass)->cl_dict,
-                                               methods->ml_name, meth);
+               status = PyDict_SetItemString(((PyClassObject *) klass)->cl_dict,
+                                                                         methods->ml_name, meth);
                Py_DECREF(meth);
                Py_DECREF(func);
 
@@ -2746,11 +2753,12 @@ PLy_output(volatile int level, PyObject * self, PyObject * args)
  * another plpython procedure )
  */
 
-char *PLy_procedure_name(PLyProcedure *proc)
+char *
+PLy_procedure_name(PLyProcedure * proc)
 {
-               if ( proc == NULL )
-                       return "<unknown procedure>";
-               return proc->proname;
+       if (proc == NULL)
+               return "<unknown procedure>";
+       return proc->proname;
 }
 
 /* output a python traceback/exception via the postgresql elog
index 477dd52..44ee940 100644 (file)
@@ -31,7 +31,7 @@
  *       ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.60 2002/08/22 00:01:50 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.61 2002/09/04 20:31:48 momjian Exp $
  *
  **********************************************************************/
 
@@ -976,7 +976,7 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger)
                prodesc = (pltcl_proc_desc *) Tcl_GetHashValue(hashent);
 
                uptodate = (prodesc->fn_xmin == HeapTupleHeaderGetXmin(procTup->t_data) &&
-                                       prodesc->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data));
+                       prodesc->fn_cmin == HeapTupleHeaderGetCmin(procTup->t_data));
 
                if (!uptodate)
                {
@@ -1060,7 +1060,7 @@ compile_pltcl_function(Oid fn_oid, bool is_trigger)
                        if (typeStruct->typtype == 'p')
                        {
                                if (procStruct->prorettype == VOIDOID)
-                                       /* okay */;
+                                        /* okay */ ;
                                else if (procStruct->prorettype == TRIGGEROID ||
                                                 procStruct->prorettype == OPAQUEOID)
                                {
index eb20370..542c044 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/port/memcmp.c,v 1.1 2002/07/18 04:13:59 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/port/memcmp.c,v 1.2 2002/09/04 20:31:48 momjian Exp $
  *
  * This file was taken from NetBSD and is used by SunOS because memcmp
  * on that platform does not properly compare negative bytes.
 int
 memcmp(const void *s1, const void *s2, size_t n)
 {
-       if (n != 0) {
-               const unsigned char *p1 = s1, *p2 = s2;
+       if (n != 0)
+       {
+               const unsigned char *p1 = s1,
+                                  *p2 = s2;
 
-               do {
+               do
+               {
                        if (*p1++ != *p2++)
                                return (*--p1 - *--p2);
                } while (--n != 0);
index dbc88fa..4d39cb8 100644 (file)
@@ -1,9 +1,9 @@
 /*
- *  Copied from NetBSD CVS, 2002-07-19, bjm
- *  Add do ... while() macro fix
- *  Remove __inline, _DIAGASSERTs, __P
+ *     Copied from NetBSD CVS, 2002-07-19, bjm
+ *     Add do ... while() macro fix
+ *     Remove __inline, _DIAGASSERTs, __P
  *
- *  $Header: /cvsroot/pgsql/src/port/qsort.c,v 1.2 2002/08/12 15:24:07 tgl Exp $
+ *     $Header: /cvsroot/pgsql/src/port/qsort.c,v 1.3 2002/09/04 20:31:48 momjian Exp $
  */
 
 /*     $NetBSD: qsort.c,v 1.12 1999/09/20 04:39:40 lukem Exp $ */
@@ -46,9 +46,9 @@
 #include <sys/types.h>
 
 
-static char *med3 (char *, char *, char *,
-                                  int (*) (const void *, const void *));
-static void swapfunc (char *, char *, size_t, int);
+static char *med3(char *, char *, char *,
+        int (*) (const void *, const void *));
+static void swapfunc(char *, char *, size_t, int);
 
 #define min(a, b)      ((a) < (b) ? (a) : (b))