summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorBruce Momjian1997-09-08 02:41:22 +0000
committerBruce Momjian1997-09-08 02:41:22 +0000
commit319dbfa7364721d3343af03a7ce063c2a2c9d385 (patch)
treea2146fe02c49ce1e497b7c287dfcaa367a703ae4 /src/backend/commands
parenta90f12fd9d6886da4f0734288496361a304d3882 (diff)
Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/_deadcode/version.c26
-rw-r--r--src/backend/commands/async.c130
-rw-r--r--src/backend/commands/cluster.c80
-rw-r--r--src/backend/commands/command.c60
-rw-r--r--src/backend/commands/copy.c418
-rw-r--r--src/backend/commands/creatinh.c166
-rw-r--r--src/backend/commands/defind.c102
-rw-r--r--src/backend/commands/define.c127
-rw-r--r--src/backend/commands/explain.c150
-rw-r--r--src/backend/commands/purge.c32
-rw-r--r--src/backend/commands/recipe.c674
-rw-r--r--src/backend/commands/remove.c96
-rw-r--r--src/backend/commands/rename.c36
-rw-r--r--src/backend/commands/sequence.c204
-rw-r--r--src/backend/commands/trigger.c170
-rw-r--r--src/backend/commands/vacuum.c540
-rw-r--r--src/backend/commands/view.c50
17 files changed, 1530 insertions, 1531 deletions
diff --git a/src/backend/commands/_deadcode/version.c b/src/backend/commands/_deadcode/version.c
index c3eb6f47797..00594057672 100644
--- a/src/backend/commands/_deadcode/version.c
+++ b/src/backend/commands/_deadcode/version.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.6 1997/09/07 04:41:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.7 1997/09/08 02:22:18 momjian Exp $
*
* NOTES
* At the point the version is defined, 2 physical relations are created
@@ -34,10 +34,10 @@
#define MAX_QUERY_LEN 1024
-char rule_buf[MAX_QUERY_LEN];
+char rule_buf[MAX_QUERY_LEN];
#ifdef NOT_USED
-static char attr_list[MAX_QUERY_LEN];
+static char attr_list[MAX_QUERY_LEN];
#endif
@@ -105,9 +105,9 @@ eval_as_new_xact(char *query)
void
DefineVersion(char *name, char *fromRelname, char *date)
{
- char *bname;
- static char saved_basename[512];
- static char saved_snapshot[512];
+ char *bname;
+ static char saved_basename[512];
+ static char saved_snapshot[512];
if (date == NULL)
{
@@ -148,7 +148,7 @@ DefineVersion(char *name, char *fromRelname, char *date)
void
VersionCreate(char *vname, char *bname)
{
- static char query_buf[MAX_QUERY_LEN];
+ static char query_buf[MAX_QUERY_LEN];
/*
* Creating the dummy version relation for triggering rules.
@@ -184,12 +184,12 @@ VersionCreate(char *vname, char *bname)
static void
setAttrList(char *bname)
{
- Relation rdesc;
- int i = 0;
- int maxattrs = 0;
- char *attrname;
- char temp_buf[512];
- int notfirst = 0;
+ Relation rdesc;
+ int i = 0;
+ int maxattrs = 0;
+ char *attrname;
+ char temp_buf[512];
+ int notfirst = 0;
rdesc = heap_openr(bname);
if (rdesc == NULL)
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c
index 42d440a8676..ee5b9baf553 100644
--- a/src/backend/commands/async.c
+++ b/src/backend/commands/async.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.18 1997/09/07 04:40:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.19 1997/09/08 02:21:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -86,16 +86,16 @@
#include <storage/lmgr.h>
-static int notifyFrontEndPending = 0;
-static int notifyIssued = 0;
-static Dllist *pendingNotifies = NULL;
+static int notifyFrontEndPending = 0;
+static int notifyIssued = 0;
+static Dllist *pendingNotifies = NULL;
-static int AsyncExistsPendingNotify(char *);
-static void ClearPendingNotify(void);
-static void Async_NotifyFrontEnd(void);
-static void Async_Unlisten(char *relname, int pid);
-static void Async_UnlistenOnExit(int code, char *relname);
+static int AsyncExistsPendingNotify(char *);
+static void ClearPendingNotify(void);
+static void Async_NotifyFrontEnd(void);
+static void Async_Unlisten(char *relname, int pid);
+static void Async_UnlistenOnExit(int code, char *relname);
/*
*--------------------------------------------------------------
@@ -169,20 +169,20 @@ void
Async_Notify(char *relname)
{
- HeapTuple lTuple,
- rTuple;
- Relation lRel;
- HeapScanDesc sRel;
- TupleDesc tdesc;
- ScanKeyData key;
- Buffer b;
- Datum d,
- value[3];
- bool isnull;
- char repl[3],
- nulls[3];
-
- char *notifyName;
+ HeapTuple lTuple,
+ rTuple;
+ Relation lRel;
+ HeapScanDesc sRel;
+ TupleDesc tdesc;
+ ScanKeyData key;
+ Buffer b;
+ Datum d,
+ value[3];
+ bool isnull;
+ char repl[3],
+ nulls[3];
+
+ char *notifyName;
#ifdef ASYNC_DEBUG
elog(DEBUG, "Async_Notify: %s", relname);
@@ -256,15 +256,15 @@ Async_Notify(char *relname)
void
Async_NotifyAtCommit()
{
- HeapTuple lTuple;
- Relation lRel;
- HeapScanDesc sRel;
- TupleDesc tdesc;
- ScanKeyData key;
- Datum d;
- int ourpid;
- bool isnull;
- Buffer b;
+ HeapTuple lTuple;
+ Relation lRel;
+ HeapScanDesc sRel;
+ TupleDesc tdesc;
+ ScanKeyData key;
+ Datum d;
+ int ourpid;
+ bool isnull;
+ Buffer b;
extern TransactionState CurrentTransactionState;
if (!pendingNotifies)
@@ -406,21 +406,21 @@ Async_NotifyAtAbort()
void
Async_Listen(char *relname, int pid)
{
- Datum values[Natts_pg_listener];
- char nulls[Natts_pg_listener];
- TupleDesc tdesc;
- HeapScanDesc s;
- HeapTuple htup,
- tup;
- Relation lDesc;
- Buffer b;
- Datum d;
- int i;
- bool isnull;
- int alreadyListener = 0;
- int ourPid = getpid();
- char *relnamei;
- TupleDesc tupDesc;
+ Datum values[Natts_pg_listener];
+ char nulls[Natts_pg_listener];
+ TupleDesc tdesc;
+ HeapScanDesc s;
+ HeapTuple htup,
+ tup;
+ Relation lDesc;
+ Buffer b;
+ Datum d;
+ int i;
+ bool isnull;
+ int alreadyListener = 0;
+ int ourPid = getpid();
+ char *relnamei;
+ TupleDesc tupDesc;
#ifdef ASYNC_DEBUG
elog(DEBUG, "Async_Listen: %s", relname);
@@ -513,8 +513,8 @@ Async_Listen(char *relname, int pid)
static void
Async_Unlisten(char *relname, int pid)
{
- Relation lDesc;
- HeapTuple lTuple;
+ Relation lDesc;
+ HeapTuple lTuple;
lTuple = SearchSysCacheTuple(LISTENREL, PointerGetDatum(relname),
Int32GetDatum(pid),
@@ -560,25 +560,25 @@ Async_UnlistenOnExit(int code, /* from exitpg */
*
* --------------------------------------------------------------
*/
-GlobalMemory notifyContext = NULL;
+GlobalMemory notifyContext = NULL;
static void
Async_NotifyFrontEnd()
{
extern CommandDest whereToSendOutput;
- HeapTuple lTuple,
- rTuple;
- Relation lRel;
- HeapScanDesc sRel;
- TupleDesc tdesc;
- ScanKeyData key[2];
- Datum d,
- value[3];
- char repl[3],
- nulls[3];
- Buffer b;
- int ourpid;
- bool isnull;
+ HeapTuple lTuple,
+ rTuple;
+ Relation lRel;
+ HeapScanDesc sRel;
+ TupleDesc tdesc;
+ ScanKeyData key[2];
+ Datum d,
+ value[3];
+ char repl[3],
+ nulls[3];
+ Buffer b;
+ int ourpid;
+ bool isnull;
notifyFrontEndPending = 0;
@@ -635,7 +635,7 @@ Async_NotifyFrontEnd()
static int
AsyncExistsPendingNotify(char *relname)
{
- Dlelem *p;
+ Dlelem *p;
for (p = DLGetHead(pendingNotifies);
p != NULL;
@@ -652,7 +652,7 @@ AsyncExistsPendingNotify(char *relname)
static void
ClearPendingNotify()
{
- Dlelem *p;
+ Dlelem *p;
while ((p = DLRemHead(pendingNotifies)) != NULL)
free(DLE_VAL(p));
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 2b18cb46df0..9e93388f729 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.14 1997/09/07 04:40:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.15 1997/09/08 02:21:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,8 +50,8 @@
#endif /* !NO_SECURITY */
static Relation copy_heap(Oid OIDOldHeap);
-static void copy_index(Oid OIDOldIndex, Oid OIDNewHeap);
-static void rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex);
+static void copy_index(Oid OIDOldIndex, Oid OIDNewHeap);
+static void rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex);
/*
* cluster
@@ -82,18 +82,18 @@ static void rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex);
void
cluster(char oldrelname[], char oldindexname[])
{
- Oid OIDOldHeap,
- OIDOldIndex,
- OIDNewHeap;
+ Oid OIDOldHeap,
+ OIDOldIndex,
+ OIDNewHeap;
- Relation OldHeap,
- OldIndex;
- Relation NewHeap;
+ Relation OldHeap,
+ OldIndex;
+ Relation NewHeap;
- char NewIndexName[NAMEDATALEN];
- char NewHeapName[NAMEDATALEN];
- char saveoldrelname[NAMEDATALEN];
- char saveoldindexname[NAMEDATALEN];
+ char NewIndexName[NAMEDATALEN];
+ char NewHeapName[NAMEDATALEN];
+ char saveoldrelname[NAMEDATALEN];
+ char saveoldindexname[NAMEDATALEN];
/*
@@ -189,15 +189,15 @@ cluster(char oldrelname[], char oldindexname[])
StartTransactionCommand();
}
-static Relation
+static Relation
copy_heap(Oid OIDOldHeap)
{
- char NewName[NAMEDATALEN];
- TupleDesc OldHeapDesc,
- tupdesc;
- Oid OIDNewHeap;
- Relation NewHeap,
- OldHeap;
+ char NewName[NAMEDATALEN];
+ TupleDesc OldHeapDesc,
+ tupdesc;
+ Oid OIDNewHeap;
+ Relation NewHeap,
+ OldHeap;
/*
* Create a new heap relation with a temporary name, which has the
@@ -235,18 +235,18 @@ copy_heap(Oid OIDOldHeap)
static void
copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
{
- Relation OldIndex,
- NewHeap;
- HeapTuple Old_pg_index_Tuple,
- Old_pg_index_relation_Tuple,
- pg_proc_Tuple;
- IndexTupleForm Old_pg_index_Form;
- Form_pg_class Old_pg_index_relation_Form;
- Form_pg_proc pg_proc_Form;
- char *NewIndexName;
- AttrNumber *attnumP;
- int natts;
- FuncIndexInfo *finfo;
+ Relation OldIndex,
+ NewHeap;
+ HeapTuple Old_pg_index_Tuple,
+ Old_pg_index_relation_Tuple,
+ pg_proc_Tuple;
+ IndexTupleForm Old_pg_index_Form;
+ Form_pg_class Old_pg_index_relation_Form;
+ Form_pg_proc pg_proc_Form;
+ char *NewIndexName;
+ AttrNumber *attnumP;
+ int natts;
+ FuncIndexInfo *finfo;
NewHeap = heap_open(OIDNewHeap);
OldIndex = index_open(OIDOldIndex);
@@ -330,15 +330,15 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
static void
rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
{
- Relation LocalNewHeap,
- LocalOldHeap,
- LocalOldIndex;
- IndexScanDesc ScanDesc;
+ Relation LocalNewHeap,
+ LocalOldHeap,
+ LocalOldIndex;
+ IndexScanDesc ScanDesc;
RetrieveIndexResult ScanResult;
- ItemPointer HeapTid;
- HeapTuple LocalHeapTuple;
- Buffer LocalBuffer;
- Oid OIDNewHeapInsert;
+ ItemPointer HeapTid;
+ HeapTuple LocalHeapTuple;
+ Buffer LocalBuffer;
+ Oid OIDNewHeapInsert;
/*
* Open the relations I need. Scan through the OldHeap on the OldIndex
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c
index 7af9b37c072..0e409396ace 100644
--- a/src/backend/commands/command.c
+++ b/src/backend/commands/command.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.14 1997/09/07 04:40:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.15 1997/09/08 02:22:01 momjian Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
@@ -46,7 +46,7 @@
* This is where the XXXSuperDuperHacky code was. -cim 3/15/90
* ----------------
*/
-MemoryContext PortalExecutorHeapMemory = NULL;
+MemoryContext PortalExecutorHeapMemory = NULL;
/* --------------------------------
* PortalCleanup
@@ -55,7 +55,7 @@ MemoryContext PortalExecutorHeapMemory = NULL;
void
PortalCleanup(Portal portal)
{
- MemoryContext context;
+ MemoryContext context;
/* ----------------
* sanity checks
@@ -97,10 +97,10 @@ PerformPortalFetch(char *name,
char *tag,
CommandDest dest)
{
- Portal portal;
- int feature;
- QueryDesc *queryDesc;
- MemoryContext context;
+ Portal portal;
+ int feature;
+ QueryDesc *queryDesc;
+ MemoryContext context;
/* ----------------
* sanity checks
@@ -151,7 +151,7 @@ PerformPortalFetch(char *name,
BeginCommand(name,
queryDesc->operation,
portal->attinfo, /* QueryDescGetTypeInfo(queryDesc),
- * */
+ * */
false, /* portal fetches don't end up in
* relations */
false, /* this is a portal fetch, not a "retrieve
@@ -190,7 +190,7 @@ PerformPortalFetch(char *name,
void
PerformPortalClose(char *name, CommandDest dest)
{
- Portal portal;
+ Portal portal;
/* ----------------
* sanity checks
@@ -257,22 +257,22 @@ PerformAddAttribute(char *relationName,
bool inherits,
ColumnDef * colDef)
{
- Relation relrdesc,
- attrdesc;
- HeapScanDesc attsdesc;
- HeapTuple reltup;
- HeapTuple attributeTuple;
+ Relation relrdesc,
+ attrdesc;
+ HeapScanDesc attsdesc;
+ HeapTuple reltup;
+ HeapTuple attributeTuple;
AttributeTupleForm attribute;
FormData_pg_attribute attributeD;
- int i;
- int minattnum,
- maxatts;
- HeapTuple tup;
- ScanKeyData key[2];
+ int i;
+ int minattnum,
+ maxatts;
+ HeapTuple tup;
+ ScanKeyData key[2];
ItemPointerData oldTID;
- Relation idescs[Num_pg_attr_indices];
- Relation ridescs[Num_pg_class_indices];
- bool hasindex;
+ Relation idescs[Num_pg_attr_indices];
+ Relation ridescs[Num_pg_class_indices];
+ bool hasindex;
/*
* permissions checking. this would normally be done in utility.c,
@@ -310,10 +310,10 @@ PerformAddAttribute(char *relationName,
{
if (inherits)
{
- Oid myrelid,
- childrelid;
- List *child,
- *children;
+ Oid myrelid,
+ childrelid;
+ List *child,
+ *children;
relrdesc = heap_openr(relationName);
if (!RelationIsValid(relrdesc))
@@ -418,10 +418,10 @@ PerformAddAttribute(char *relationName,
i = 1 + minattnum;
{
- HeapTuple typeTuple;
- TypeTupleForm form;
- char *p;
- int attnelems;
+ HeapTuple typeTuple;
+ TypeTupleForm form;
+ char *p;
+ int attnelems;
/*
* XXX use syscache here as an optimization
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 795e9f5584f..d1e1db0cd43 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.30 1997/09/07 04:40:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.31 1997/09/08 02:22:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,33 +42,33 @@
/* non-export function prototypes */
-static void CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim);
-static void CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim);
-static Oid GetOutputFunction(Oid type);
-static Oid GetTypeElement(Oid type);
-static Oid GetInputFunction(Oid type);
-static Oid IsTypeByVal(Oid type);
+static void CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim);
+static void CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim);
+static Oid GetOutputFunction(Oid type);
+static Oid GetTypeElement(Oid type);
+static Oid GetInputFunction(Oid type);
+static Oid IsTypeByVal(Oid type);
static void
GetIndexRelations(Oid main_relation_oid,
int *n_indices,
Relation ** index_rels);
#ifdef COPY_PATCH
-static void CopyReadNewline(FILE * fp, int *newline);
-static char *CopyReadAttribute(FILE * fp, bool * isnull, char *delim, int *newline);
+static void CopyReadNewline(FILE * fp, int *newline);
+static char *CopyReadAttribute(FILE * fp, bool * isnull, char *delim, int *newline);
#else
-static char *CopyReadAttribute(FILE * fp, bool * isnull, char *delim);
+static char *CopyReadAttribute(FILE * fp, bool * isnull, char *delim);
#endif
-static void CopyAttributeOut(FILE * fp, char *string, char *delim);
-static int CountTuples(Relation relation);
+static void CopyAttributeOut(FILE * fp, char *string, char *delim);
+static int CountTuples(Relation relation);
-extern FILE *Pfout,
- *Pfin;
+extern FILE *Pfout,
+ *Pfin;
#ifdef COPY_DEBUG
-static int lineno;
+static int lineno;
#endif
@@ -107,11 +107,11 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
the class.
----------------------------------------------------------------------------*/
- FILE *fp;
- Relation rel;
- extern char *UserName; /* defined in global.c */
- const AclMode required_access = from ? ACL_WR : ACL_RD;
- int result;
+ FILE *fp;
+ Relation rel;
+ extern char *UserName; /* defined in global.c */
+ const AclMode required_access = from ? ACL_WR : ACL_RD;
+ int result;
rel = heap_openr(relname);
if (rel == NULL)
@@ -169,7 +169,7 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
}
else
{
- mode_t oumask; /* Pre-existing umask value */
+ mode_t oumask; /* Pre-existing umask value */
oumask = umask((mode_t) 0);
fp = AllocateFile(filename, "w");
@@ -199,19 +199,19 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
static void
CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
{
- HeapTuple tuple;
- HeapScanDesc scandesc;
+ HeapTuple tuple;
+ HeapScanDesc scandesc;
- int32 attr_count,
- i;
+ int32 attr_count,
+ i;
AttributeTupleForm *attr;
- func_ptr *out_functions;
- int dummy;
- Oid out_func_oid;
- Oid *elements;
- Datum value;
- bool isnull; /* The attribute we are copying is null */
- char *nulls;
+ func_ptr *out_functions;
+ int dummy;
+ Oid out_func_oid;
+ Oid *elements;
+ Datum value;
+ bool isnull; /* The attribute we are copying is null */
+ char *nulls;
/*
* <nulls> is a (dynamically allocated) array with one character per
@@ -220,9 +220,9 @@ CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
*
* <nulls> is meaningful only if we are doing a binary copy.
*/
- char *string;
- int32 ntuples;
- TupleDesc tupDesc;
+ char *string;
+ int32 ntuples;
+ TupleDesc tupDesc;
scandesc = heap_beginscan(rel, 0, NULL, 0, NULL);
@@ -311,8 +311,8 @@ CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
if (binary)
{
- int32 null_ct = 0,
- length;
+ int32 null_ct = 0,
+ length;
for (i = 0; i < attr_count; i++)
{
@@ -358,54 +358,54 @@ CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
static void
CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
{
- HeapTuple tuple;
- AttrNumber attr_count;
+ HeapTuple tuple;
+ AttrNumber attr_count;
AttributeTupleForm *attr;
- func_ptr *in_functions;
- int i,
- dummy;
- Oid in_func_oid;
- Datum *values;
- char *nulls,
- *index_nulls;
- bool *byval;
- bool isnull;
- bool has_index;
- int done = 0;
- char *string = NULL,
- *ptr;
- Relation *index_rels;
- int32 len,
- null_ct,
- null_id;
- int32 ntuples,
- tuples_read = 0;
- bool reading_to_eof = true;
- Oid *elements;
- FuncIndexInfo *finfo,
- **finfoP = NULL;
- TupleDesc *itupdescArr;
- HeapTuple pgIndexTup;
+ func_ptr *in_functions;
+ int i,
+ dummy;
+ Oid in_func_oid;
+ Datum *values;
+ char *nulls,
+ *index_nulls;
+ bool *byval;
+ bool isnull;
+ bool has_index;
+ int done = 0;
+ char *string = NULL,
+ *ptr;
+ Relation *index_rels;
+ int32 len,
+ null_ct,
+ null_id;
+ int32 ntuples,
+ tuples_read = 0;
+ bool reading_to_eof = true;
+ Oid *elements;
+ FuncIndexInfo *finfo,
+ **finfoP = NULL;
+ TupleDesc *itupdescArr;
+ HeapTuple pgIndexTup;
IndexTupleForm *pgIndexP = NULL;
- int *indexNatts = NULL;
- char *predString;
- Node **indexPred = NULL;
- TupleDesc rtupdesc;
- ExprContext *econtext = NULL;
+ int *indexNatts = NULL;
+ char *predString;
+ Node **indexPred = NULL;
+ TupleDesc rtupdesc;
+ ExprContext *econtext = NULL;
#ifndef OMIT_PARTIAL_INDEX
- TupleTable tupleTable;
+ TupleTable tupleTable;
TupleTableSlot *slot = NULL;
#endif
- int natts;
- AttrNumber *attnumP;
- Datum *idatum;
- int n_indices;
+ int natts;
+ AttrNumber *attnumP;
+ Datum *idatum;
+ int n_indices;
InsertIndexResult indexRes;
- TupleDesc tupDesc;
- Oid loaded_oid;
- bool skip_tuple = false;
+ TupleDesc tupDesc;
+ Oid loaded_oid;
+ bool skip_tuple = false;
tupDesc = RelationGetTupleDescriptor(rel);
attr = tupDesc->attrs;
@@ -541,7 +541,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
if (!binary)
{
#ifdef COPY_PATCH
- int newline = 0;
+ int newline = 0;
#endif
#ifdef COPY_DEBUG
@@ -647,58 +647,58 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
switch (attr[i]->attlen)
{
- case sizeof(char):
- values[i] = (Datum) * (unsigned char *) ptr;
- ptr += sizeof(char);
- break;
- case sizeof(short):
- ptr = (char *) SHORTALIGN(ptr);
- values[i] = (Datum) * (unsigned short *) ptr;
- ptr += sizeof(short);
- break;
- case sizeof(int32):
- ptr = (char *) INTALIGN(ptr);
- values[i] = (Datum) * (uint32 *) ptr;
- ptr += sizeof(int32);
- break;
- default:
- elog(WARN, "COPY BINARY: impossible size!");
- break;
+ case sizeof(char):
+ values[i] = (Datum) * (unsigned char *) ptr;
+ ptr += sizeof(char);
+ break;
+ case sizeof(short):
+ ptr = (char *) SHORTALIGN(ptr);
+ values[i] = (Datum) * (unsigned short *) ptr;
+ ptr += sizeof(short);
+ break;
+ case sizeof(int32):
+ ptr = (char *) INTALIGN(ptr);
+ values[i] = (Datum) * (uint32 *) ptr;
+ ptr += sizeof(int32);
+ break;
+ default:
+ elog(WARN, "COPY BINARY: impossible size!");
+ break;
}
}
else if (nulls[i] != 'n')
{
switch (attr[i]->attlen)
{
- case -1:
- if (attr[i]->attalign == 'd')
- ptr = (char *) DOUBLEALIGN(ptr);
- else
+ case -1:
+ if (attr[i]->attalign == 'd')
+ ptr = (char *) DOUBLEALIGN(ptr);
+ else
+ ptr = (char *) INTALIGN(ptr);
+ values[i] = (Datum) ptr;
+ ptr += *(uint32 *) ptr;
+ break;
+ case sizeof(char):
+ values[i] = (Datum) ptr;
+ ptr += attr[i]->attlen;
+ break;
+ case sizeof(short):
+ ptr = (char *) SHORTALIGN(ptr);
+ values[i] = (Datum) ptr;
+ ptr += attr[i]->attlen;
+ break;
+ case sizeof(int32):
ptr = (char *) INTALIGN(ptr);
- values[i] = (Datum) ptr;
- ptr += *(uint32 *) ptr;
- break;
- case sizeof(char):
- values[i] = (Datum) ptr;
- ptr += attr[i]->attlen;
- break;
- case sizeof(short):
- ptr = (char *) SHORTALIGN(ptr);
- values[i] = (Datum) ptr;
- ptr += attr[i]->attlen;
- break;
- case sizeof(int32):
- ptr = (char *) INTALIGN(ptr);
- values[i] = (Datum) ptr;
- ptr += attr[i]->attlen;
- break;
- default:
- if (attr[i]->attalign == 'd')
- ptr = (char *) DOUBLEALIGN(ptr);
- else
- ptr = (char *) LONGALIGN(ptr);
- values[i] = (Datum) ptr;
- ptr += attr[i]->attlen;
+ values[i] = (Datum) ptr;
+ ptr += attr[i]->attlen;
+ break;
+ default:
+ if (attr[i]->attalign == 'd')
+ ptr = (char *) DOUBLEALIGN(ptr);
+ else
+ ptr = (char *) LONGALIGN(ptr);
+ values[i] = (Datum) ptr;
+ ptr += attr[i]->attlen;
}
}
}
@@ -721,7 +721,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
if (rel->trigdesc &&
rel->trigdesc->n_before_row[TRIGGER_EVENT_INSERT] > 0)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecBRInsertTriggers(rel, tuple);
@@ -743,7 +743,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
if (rel->rd_att->constr)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecConstraints("CopyFrom", rel, tuple);
@@ -826,10 +826,10 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
-static Oid
+static Oid
GetOutputFunction(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -842,10 +842,10 @@ GetOutputFunction(Oid type)
return (InvalidOid);
}
-static Oid
+static Oid
GetTypeElement(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -859,10 +859,10 @@ GetTypeElement(Oid type)
return (InvalidOid);
}
-static Oid
+static Oid
GetInputFunction(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -875,10 +875,10 @@ GetInputFunction(Oid type)
return (InvalidOid);
}
-static Oid
+static Oid
IsTypeByVal(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -902,24 +902,24 @@ IsTypeByVal(Oid type)
typedef struct rel_list
{
- Oid index_rel_oid;
+ Oid index_rel_oid;
struct rel_list *next;
-} RelationList;
+} RelationList;
static void
GetIndexRelations(Oid main_relation_oid,
int *n_indices,
Relation ** index_rels)
{
- RelationList *head,
- *scan;
- Relation pg_index_rel;
- HeapScanDesc scandesc;
- Oid index_relation_oid;
- HeapTuple tuple;
- TupleDesc tupDesc;
- int i;
- bool isnull;
+ RelationList *head,
+ *scan;
+ Relation pg_index_rel;
+ HeapScanDesc scandesc;
+ Oid index_relation_oid;
+ HeapTuple tuple;
+ TupleDesc tupDesc;
+ int i;
+ bool isnull;
pg_index_rel = heap_openr(IndexRelationName);
scandesc = heap_beginscan(pg_index_rel, 0, NULL, 0, NULL);
@@ -978,10 +978,10 @@ GetIndexRelations(Oid main_relation_oid,
/*
returns 1 is c is in s
*/
-static bool
+static bool
inString(char c, char *s)
{
- int i;
+ int i;
if (s)
{
@@ -1026,17 +1026,17 @@ CopyReadNewline(FILE * fp, int *newline)
* can be used as standard input.
*/
-static char *
+static char *
#ifdef COPY_PATCH
CopyReadAttribute(FILE * fp, bool * isnull, char *delim, int *newline)
#else
CopyReadAttribute(FILE * fp, bool * isnull, char *delim)
#endif
{
- static char attribute[EXT_ATTLEN];
- char c;
- int done = 0;
- int i = 0;
+ static char attribute[EXT_ATTLEN];
+ char c;
+ int done = 0;
+ int i = 0;
#ifdef COPY_PATCH
/* if last delimiter was a newline return a NULL attribute */
@@ -1064,26 +1064,33 @@ CopyReadAttribute(FILE * fp, bool * isnull, char *delim)
return (NULL);
switch (c)
{
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- int val;
-
- val = VALUE(c);
- c = getc(fp);
- if (ISOCTAL(c))
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
{
- val = (val << 3) + VALUE(c);
+ int val;
+
+ val = VALUE(c);
c = getc(fp);
if (ISOCTAL(c))
{
val = (val << 3) + VALUE(c);
+ c = getc(fp);
+ if (ISOCTAL(c))
+ {
+ val = (val << 3) + VALUE(c);
+ }
+ else
+ {
+ if (feof(fp))
+ return (NULL);
+ ungetc(c, fp);
+ }
}
else
{
@@ -1091,44 +1098,37 @@ CopyReadAttribute(FILE * fp, bool * isnull, char *delim)
return (NULL);
ungetc(c, fp);
}
+ c = val & 0377;
}
- else
- {
- if (feof(fp))
- return (NULL);
- ungetc(c, fp);
- }
- c = val & 0377;
- }
- break;
- case 'b':
- c = '\b';
- break;
- case 'f':
- c = '\f';
- break;
- case 'n':
- c = '\n';
- break;
- case 'r':
- c = '\r';
- break;
- case 't':
- c = '\t';
- break;
- case 'v':
- c = '\v';
- break;
- case 'N':
- attribute[0] = '\0'; /* just to be safe */
- *isnull = (bool) true;
- break;
- case '.':
- c = getc(fp);
- if (c != '\n')
- elog(WARN, "CopyReadAttribute - end of record marker corrupted");
- return (NULL);
- break;
+ break;
+ case 'b':
+ c = '\b';
+ break;
+ case 'f':
+ c = '\f';
+ break;
+ case 'n':
+ c = '\n';
+ break;
+ case 'r':
+ c = '\r';
+ break;
+ case 't':
+ c = '\t';
+ break;
+ case 'v':
+ c = '\v';
+ break;
+ case 'N':
+ attribute[0] = '\0'; /* just to be safe */
+ *isnull = (bool) true;
+ break;
+ case '.':
+ c = getc(fp);
+ if (c != '\n')
+ elog(WARN, "CopyReadAttribute - end of record marker corrupted");
+ return (NULL);
+ break;
}
}
else if (inString(c, delim) || c == '\n')
@@ -1153,9 +1153,9 @@ CopyReadAttribute(FILE * fp, bool * isnull, char *delim)
static void
CopyAttributeOut(FILE * fp, char *string, char *delim)
{
- char c;
- int is_array = false;
- int len = strlen(string);
+ char c;
+ int is_array = false;
+ int len = strlen(string);
/* XXX - This is a kludge, we should check the data type */
if (len && (string[0] == '{') && (string[len - 1] == '}'))
@@ -1194,10 +1194,10 @@ CopyAttributeOut(FILE * fp, char *string, char *delim)
static int
CountTuples(Relation relation)
{
- HeapScanDesc scandesc;
- HeapTuple tuple;
+ HeapScanDesc scandesc;
+ HeapTuple tuple;
- int i;
+ int i;
scandesc = heap_beginscan(relation, 0, NULL, 0, NULL);
diff --git a/src/backend/commands/creatinh.c b/src/backend/commands/creatinh.c
index 92641ca70d6..e1dac613fe6 100644
--- a/src/backend/commands/creatinh.c
+++ b/src/backend/commands/creatinh.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.15 1997/09/07 04:40:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.16 1997/09/08 02:22:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,8 +36,8 @@
static int
checkAttrExists(char *attributeName,
char *attributeType, List * schema);
-static List *MergeAttributes(List * schema, List * supers, List ** supconstr);
-static void StoreCatalogInheritance(Oid relationId, List * supers);
+static List *MergeAttributes(List * schema, List * supers, List ** supconstr);
+static void StoreCatalogInheritance(Oid relationId, List * supers);
/* ----------------------------------------------------------------
* DefineRelation --
@@ -47,20 +47,20 @@ static void StoreCatalogInheritance(Oid relationId, List * supers);
void
DefineRelation(CreateStmt * stmt)
{
- char *relname = palloc(NAMEDATALEN);
- List *schema = stmt->tableElts;
- int numberOfAttributes;
- Oid relationId;
- char archChar;
- List *inheritList = NULL;
- char *archiveName = NULL;
- TupleDesc descriptor;
- List *constraints;
- int heaploc,
- archloc;
-
- char *typename = NULL; /* the typename of this relation.
- * not useod for now */
+ char *relname = palloc(NAMEDATALEN);
+ List *schema = stmt->tableElts;
+ int numberOfAttributes;
+ Oid relationId;
+ char archChar;
+ List *inheritList = NULL;
+ char *archiveName = NULL;
+ TupleDesc descriptor;
+ List *constraints;
+ int heaploc,
+ archloc;
+
+ char *typename = NULL;/* the typename of this relation. not
+ * useod for now */
if (strlen(stmt->relname) >= NAMEDATALEN)
elog(WARN, "the relation name %s is >= %d characters long", stmt->relname,
@@ -84,19 +84,19 @@ DefineRelation(CreateStmt * stmt)
switch (stmt->archiveType)
{
- case ARCH_NONE:
- archChar = 'n';
- break;
- case ARCH_LIGHT:
- archChar = 'l';
- break;
- case ARCH_HEAVY:
- archChar = 'h';
- break;
- default:
- elog(WARN, "Botched archive mode %d, ignoring",
- stmt->archiveType);
- break;
+ case ARCH_NONE:
+ archChar = 'n';
+ break;
+ case ARCH_LIGHT:
+ archChar = 'l';
+ break;
+ case ARCH_HEAVY:
+ archChar = 'h';
+ break;
+ default:
+ elog(WARN, "Botched archive mode %d, ignoring",
+ stmt->archiveType);
+ break;
}
if (stmt->location == -1)
@@ -145,15 +145,15 @@ DefineRelation(CreateStmt * stmt)
if (constraints != NIL)
{
- List *entry;
- int nconstr = length(constraints);
- ConstrCheck *check = (ConstrCheck *) palloc(nconstr * sizeof(ConstrCheck));
- int ncheck = 0;
- int i;
+ List *entry;
+ int nconstr = length(constraints);
+ ConstrCheck *check = (ConstrCheck *) palloc(nconstr * sizeof(ConstrCheck));
+ int ncheck = 0;
+ int i;
foreach(entry, constraints)
{
- ConstraintDef *cdef = (ConstraintDef *) lfirst(entry);
+ ConstraintDef *cdef = (ConstraintDef *) lfirst(entry);
if (cdef->type == CONSTR_CHECK)
{
@@ -204,7 +204,7 @@ DefineRelation(CreateStmt * stmt)
*/
if (archChar != 'n')
{
- TupleDesc tupdesc;
+ TupleDesc tupdesc;
/*
* Need to create an archive relation for this heap relation. We
@@ -279,12 +279,12 @@ RemoveRelation(char *name)
* \ /
* stud_emp {7:percent}
*/
-static List *
+static List *
MergeAttributes(List * schema, List * supers, List ** supconstr)
{
- List *entry;
- List *inhSchema = NIL;
- List *constraints = NIL;
+ List *entry;
+ List *inhSchema = NIL;
+ List *constraints = NIL;
/*
* Validates that there are no duplications. Validity checking of
@@ -292,8 +292,8 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
*/
foreach(entry, schema)
{
- List *rest;
- ColumnDef *coldef = lfirst(entry);
+ List *rest;
+ ColumnDef *coldef = lfirst(entry);
foreach(rest, lnext(entry))
{
@@ -301,7 +301,7 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
/*
* check for duplicated relation names
*/
- ColumnDef *restdef = lfirst(rest);
+ ColumnDef *restdef = lfirst(rest);
if (!strcmp(coldef->colname, restdef->colname))
{
@@ -312,7 +312,7 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
}
foreach(entry, supers)
{
- List *rest;
+ List *rest;
foreach(rest, lnext(entry))
{
@@ -329,12 +329,12 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
*/
foreach(entry, supers)
{
- char *name = strVal(lfirst(entry));
- Relation relation;
- List *partialResult = NIL;
- AttrNumber attrno;
- TupleDesc tupleDesc;
- TupleConstr *constr;
+ char *name = strVal(lfirst(entry));
+ Relation relation;
+ List *partialResult = NIL;
+ AttrNumber attrno;
+ TupleDesc tupleDesc;
+ TupleConstr *constr;
relation = heap_openr(name);
if (relation == NULL)
@@ -354,11 +354,11 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
for (attrno = relation->rd_rel->relnatts - 1; attrno >= 0; attrno--)
{
AttributeTupleForm attribute = tupleDesc->attrs[attrno];
- char *attributeName;
- char *attributeType;
- HeapTuple tuple;
- ColumnDef *def;
- TypeName *typename;
+ char *attributeName;
+ char *attributeType;
+ HeapTuple tuple;
+ ColumnDef *def;
+ TypeName *typename;
/*
* form name, type and constraints
@@ -398,8 +398,8 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
def->defval = NULL;
if (attribute->atthasdef)
{
- AttrDefault *attrdef = constr->defval;
- int i;
+ AttrDefault *attrdef = constr->defval;
+ int i;
Assert(constr != NULL && constr->num_defval > 0);
@@ -417,12 +417,12 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
if (constr && constr->num_check > 0)
{
- ConstrCheck *check = constr->check;
- int i;
+ ConstrCheck *check = constr->check;
+ int i;
for (i = 0; i < constr->num_check; i++)
{
- ConstraintDef *cdef = (ConstraintDef *) palloc(sizeof(ConstraintDef));
+ ConstraintDef *cdef = (ConstraintDef *) palloc(sizeof(ConstraintDef));
cdef->type = CONSTR_CHECK;
if (check[i].ccname[0] == '$')
@@ -461,12 +461,12 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
static void
StoreCatalogInheritance(Oid relationId, List * supers)
{
- Relation relation;
- TupleDesc desc;
- int16 seqNumber;
- List *entry;
- List *idList;
- HeapTuple tuple;
+ Relation relation;
+ TupleDesc desc;
+ int16 seqNumber;
+ List *entry;
+ List *idList;
+ HeapTuple tuple;
/* ----------------
* sanity checks
@@ -488,8 +488,8 @@ StoreCatalogInheritance(Oid relationId, List * supers)
idList = NIL;
foreach(entry, supers)
{
- Datum datum[Natts_pg_inherits];
- char nullarr[Natts_pg_inherits];
+ Datum datum[Natts_pg_inherits];
+ char nullarr[Natts_pg_inherits];
tuple = SearchSysCacheTuple(RELNAME,
PointerGetDatum(strVal(lfirst(entry))),
@@ -536,11 +536,11 @@ StoreCatalogInheritance(Oid relationId, List * supers)
*/
foreach(entry, idList)
{
- HeapTuple tuple;
- Oid id;
- int16 number;
- List *next;
- List *current;
+ HeapTuple tuple;
+ Oid id;
+ int16 number;
+ List *next;
+ List *current;
id = (Oid) lfirsti(entry);
current = entry;
@@ -572,9 +572,9 @@ StoreCatalogInheritance(Oid relationId, List * supers)
*/
foreach(entry, idList)
{
- Oid name;
- List *rest;
- bool found = false;
+ Oid name;
+ List *rest;
+ bool found = false;
again:
name = lfirsti(entry);
@@ -613,8 +613,8 @@ again:
foreach(entry, idList)
{
- Datum datum[Natts_pg_ipl];
- char nullarr[Natts_pg_ipl];
+ Datum datum[Natts_pg_ipl];
+ char nullarr[Natts_pg_ipl];
datum[0] = ObjectIdGetDatum(relationId); /* iplrel */
datum[1] = ObjectIdGetDatum(lfirsti(entry));
@@ -642,11 +642,11 @@ again:
static int
checkAttrExists(char *attributeName, char *attributeType, List * schema)
{
- List *s;
+ List *s;
foreach(s, schema)
{
- ColumnDef *def = lfirst(s);
+ ColumnDef *def = lfirst(s);
if (!strcmp(attributeName, def->colname))
{
@@ -672,10 +672,10 @@ checkAttrExists(char *attributeName, char *attributeType, List * schema)
* the CALLER is responsible for freeing the memory allocated
*/
-char *
+char *
MakeArchiveName(Oid relationId)
{
- char *arch;
+ char *arch;
/*
* Archive relations are named a,XXXXX where XXXXX == the OID of the
diff --git a/src/backend/commands/defind.c b/src/backend/commands/defind.c
index 9b8c5a0218a..92bb0e7c093 100644
--- a/src/backend/commands/defind.c
+++ b/src/backend/commands/defind.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.13 1997/09/07 04:40:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.14 1997/09/08 02:22:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,19 +39,19 @@
#define IsFuncIndex(ATTR_LIST) (((IndexElem*)lfirst(ATTR_LIST))->args!=NULL)
/* non-export function prototypes */
-static void CheckPredicate(List * predList, List * rangeTable, Oid baseRelOid);
+static void CheckPredicate(List * predList, List * rangeTable, Oid baseRelOid);
static void
CheckPredExpr(Node * predicate, List * rangeTable,
Oid baseRelOid);
static void
- CheckPredClause(Expr * predicate, List * rangeTable, Oid baseRelOid);
+ CheckPredClause(Expr * predicate, List * rangeTable, Oid baseRelOid);
static void
FuncIndexArgs(IndexElem * funcIndex, AttrNumber * attNumP,
Oid * argTypes, Oid * opOidP, Oid relId);
static void
NormIndexAttrs(List * attList, AttrNumber * attNumP,
Oid * opOidP, Oid relId);
-static char *GetDefaultOpClass(Oid atttypid);
+static char *GetDefaultOpClass(Oid atttypid);
/*
* DefineIndex --
@@ -76,18 +76,18 @@ DefineIndex(char *heapRelationName,
Expr * predicate,
List * rangetable)
{
- Oid *classObjectId;
- Oid accessMethodId;
- Oid relationId;
- int numberOfAttributes;
- AttrNumber *attributeNumberA;
- HeapTuple tuple;
- uint16 parameterCount = 0;
- Datum *parameterA = NULL;
- FuncIndexInfo fInfo;
- List *cnfPred = NULL;
- bool lossy = FALSE;
- List *pl;
+ Oid *classObjectId;
+ Oid accessMethodId;
+ Oid relationId;
+ int numberOfAttributes;
+ AttrNumber *attributeNumberA;
+ HeapTuple tuple;
+ uint16 parameterCount = 0;
+ Datum *parameterA = NULL;
+ FuncIndexInfo fInfo;
+ List *cnfPred = NULL;
+ bool lossy = FALSE;
+ List *pl;
/*
* Handle attributes
@@ -138,7 +138,7 @@ DefineIndex(char *heapRelationName,
*/
foreach(pl, parameterList)
{
- ParamString *param = (ParamString *) lfirst(pl);
+ ParamString *param = (ParamString *) lfirst(pl);
if (!strcasecmp(param->name, "islossy"))
lossy = TRUE;
@@ -162,8 +162,8 @@ DefineIndex(char *heapRelationName,
if (IsFuncIndex(attributeList))
{
- IndexElem *funcIndex = lfirst(attributeList);
- int nargs;
+ IndexElem *funcIndex = lfirst(attributeList);
+ int nargs;
nargs = length(funcIndex->args);
if (nargs > INDEX_MAX_KEYS)
@@ -225,23 +225,23 @@ DefineIndex(char *heapRelationName,
void
ExtendIndex(char *indexRelationName, Expr * predicate, List * rangetable)
{
- Oid *classObjectId;
- Oid accessMethodId;
- Oid indexId,
- relationId;
- Oid indproc;
- int numberOfAttributes;
- AttrNumber *attributeNumberA;
- HeapTuple tuple;
- FuncIndexInfo fInfo;
- FuncIndexInfo *funcInfo = NULL;
- IndexTupleForm index;
- Node *oldPred = NULL;
- List *cnfPred = NULL;
- PredInfo *predInfo;
- Relation heapRelation;
- Relation indexRelation;
- int i;
+ Oid *classObjectId;
+ Oid accessMethodId;
+ Oid indexId,
+ relationId;
+ Oid indproc;
+ int numberOfAttributes;
+ AttrNumber *attributeNumberA;
+ HeapTuple tuple;
+ FuncIndexInfo fInfo;
+ FuncIndexInfo *funcInfo = NULL;
+ IndexTupleForm index;
+ Node *oldPred = NULL;
+ List *cnfPred = NULL;
+ PredInfo *predInfo;
+ Relation heapRelation;
+ Relation indexRelation;
+ int i;
/*
* compute index relation id and access method id
@@ -283,7 +283,7 @@ ExtendIndex(char *indexRelationName, Expr * predicate, List * rangetable)
if (VARSIZE(&index->indpred) != 0)
{
- char *predString;
+ char *predString;
predString = fmgr(F_TEXTOUT, &index->indpred);
oldPred = stringToNode(predString);
@@ -366,7 +366,7 @@ ExtendIndex(char *indexRelationName, Expr * predicate, List * rangetable)
static void
CheckPredicate(List * predList, List * rangeTable, Oid baseRelOid)
{
- List *item;
+ List *item;
foreach(item, predList)
{
@@ -377,8 +377,8 @@ CheckPredicate(List * predList, List * rangeTable, Oid baseRelOid)
static void
CheckPredExpr(Node * predicate, List * rangeTable, Oid baseRelOid)
{
- List *clauses = NIL,
- *clause;
+ List *clauses = NIL,
+ *clause;
if (is_opclause(predicate))
{
@@ -401,8 +401,8 @@ CheckPredExpr(Node * predicate, List * rangeTable, Oid baseRelOid)
static void
CheckPredClause(Expr * predicate, List * rangeTable, Oid baseRelOid)
{
- Var *pred_var;
- Const *pred_const;
+ Var *pred_var;
+ Const *pred_const;
pred_var = (Var *) get_leftop(predicate);
pred_const = (Const *) get_rightop(predicate);
@@ -427,8 +427,8 @@ FuncIndexArgs(IndexElem * funcIndex,
Oid * opOidP,
Oid relId)
{
- List *rest;
- HeapTuple tuple;
+ List *rest;
+ HeapTuple tuple;
AttributeTupleForm att;
tuple = SearchSysCacheTuple(CLANAME,
@@ -449,7 +449,7 @@ FuncIndexArgs(IndexElem * funcIndex,
*/
for (rest = funcIndex->args; rest != NIL; rest = lnext(rest))
{
- char *arg;
+ char *arg;
arg = strVal(lfirst(rest));
@@ -475,8 +475,8 @@ NormIndexAttrs(List * attList, /* list of IndexElem's */
Oid * opOidP,
Oid relId)
{
- List *rest;
- HeapTuple tuple;
+ List *rest;
+ HeapTuple tuple;
/*
* process attributeList
@@ -484,7 +484,7 @@ NormIndexAttrs(List * attList, /* list of IndexElem's */
for (rest = attList; rest != NIL; rest = lnext(rest))
{
- IndexElem *attribute;
+ IndexElem *attribute;
AttributeTupleForm attform;
attribute = lfirst(rest);
@@ -531,10 +531,10 @@ NormIndexAttrs(List * attList, /* list of IndexElem's */
}
}
-static char *
+static char *
GetDefaultOpClass(Oid atttypid)
{
- HeapTuple tuple;
+ HeapTuple tuple;
tuple = SearchSysCacheTuple(CLADEFTYPE,
ObjectIdGetDatum(atttypid),
@@ -559,7 +559,7 @@ GetDefaultOpClass(Oid atttypid)
void
RemoveIndex(char *name)
{
- HeapTuple tuple;
+ HeapTuple tuple;
tuple = SearchSysCacheTuple(RELNAME,
PointerGetDatum(name),
diff --git a/src/backend/commands/define.c b/src/backend/commands/define.c
index fb1df213cec..52a0b716f97 100644
--- a/src/backend/commands/define.c
+++ b/src/backend/commands/define.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.14 1997/09/07 04:40:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.15 1997/09/08 02:22:09 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -53,8 +53,8 @@
#include <tcop/dest.h>
#include <catalog/pg_user.h>
-static char *defGetString(DefElem * def);
-static int defGetTypeLength(DefElem * def);
+static char *defGetString(DefElem * def);
+static int defGetTypeLength(DefElem * def);
#define DEFAULT_TYPDELIM ','
@@ -66,7 +66,7 @@ case_translate_language_name(const char *input, char *output)
Translate the input language name to lower case, except if it's C,
translate to upper case.
--------------------------------------------------------------------------*/
- int i;
+ int i;
for (i = 0; i < NAMEDATALEN && input[i] != '\0'; ++i)
output[i] = tolower(input[i]);
@@ -90,7 +90,7 @@ compute_return_type(const Node * returnType,
if (nodeTag(returnType) == T_TypeName)
{
/* a set of values */
- TypeName *setType = (TypeName *) returnType;
+ TypeName *setType = (TypeName *) returnType;
*prorettype_p = setType->name;
*returnsSet_p = true;
@@ -116,7 +116,7 @@ compute_full_attributes(const List * parameters, int32 * byte_pct_p,
These are the full parameters of a C or internal function.
---------------------------------------------------------------------------*/
- List *pl;
+ List *pl;
/* the defaults */
*byte_pct_p = BYTE_PCT;
@@ -126,7 +126,7 @@ compute_full_attributes(const List * parameters, int32 * byte_pct_p,
foreach(pl, (List *) parameters)
{
- ParamString *param = (ParamString *) lfirst(pl);
+ ParamString *param = (ParamString *) lfirst(pl);
if (strcasecmp(param->name, "iscachable") == 0)
{
@@ -153,8 +153,8 @@ compute_full_attributes(const List * parameters, int32 * byte_pct_p,
{
if (sscanf(param->val, "%d", perbyte_cpu_p) == 0)
{
- int count;
- char *ptr;
+ int count;
+ char *ptr;
for (count = 0, ptr = param->val; *ptr != '\0'; ptr++)
if (*ptr == '!')
@@ -166,8 +166,8 @@ compute_full_attributes(const List * parameters, int32 * byte_pct_p,
{
if (sscanf(param->val, "%d", percall_cpu_p) == 0)
{
- int count;
- char *ptr;
+ int count;
+ char *ptr;
for (count = 0, ptr = param->val; *ptr != '\0'; ptr++)
if (*ptr == '!')
@@ -212,16 +212,16 @@ interpret_AS_clause(const char languageName[], const char as[],
void
CreateFunction(ProcedureStmt * stmt, CommandDest dest)
{
- char *probin_str;
+ char *probin_str;
/* pathname of executable file that executes this function, if any */
- char *prosrc_str;
+ char *prosrc_str;
/* SQL that executes this function, if any */
- char *prorettype;
+ char *prorettype;
/* Type of return value (or member of set of values) from function */
- char languageName[NAMEDATALEN];
+ char languageName[NAMEDATALEN];
/*
* name of language of function, with case adjusted: "C", "internal",
@@ -232,12 +232,12 @@ CreateFunction(ProcedureStmt * stmt, CommandDest dest)
* The following are attributes of the function, as expressed in the
* CREATE FUNCTION statement, where applicable.
*/
- int32 byte_pct,
- perbyte_cpu,
- percall_cpu,
- outin_ratio;
- bool canCache;
- bool returnsSet;
+ int32 byte_pct,
+ perbyte_cpu,
+ percall_cpu,
+ outin_ratio;
+ bool canCache;
+ bool returnsSet;
/* The function returns a set of values, as opposed to a singleton. */
@@ -317,30 +317,29 @@ void
DefineOperator(char *oprName,
List * parameters)
{
- uint16 precedence = 0; /* operator precedence */
- bool canHash = false; /* operator hashes */
- bool isLeftAssociative = true; /* operator is left
+ uint16 precedence = 0; /* operator precedence */
+ bool canHash = false;/* operator hashes */
+ bool isLeftAssociative = true; /* operator is left
* associative */
- char *functionName = NULL; /* function for operator */
- char *typeName1 = NULL; /* first type name */
- char *typeName2 = NULL; /* second type name */
- char *commutatorName = NULL; /* optional commutator
- * operator name */
- char *negatorName = NULL; /* optional negator operator name */
- char *restrictionName = NULL; /* optional restrict. sel.
- * procedure */
- char *joinName = NULL; /* optional join sel. procedure
+ char *functionName = NULL; /* function for operator */
+ char *typeName1 = NULL; /* first type name */
+ char *typeName2 = NULL; /* second type name */
+ char *commutatorName = NULL; /* optional commutator operator
* name */
- char *sortName1 = NULL; /* optional first sort operator */
- char *sortName2 = NULL; /* optional second sort operator */
- List *pl;
+ char *negatorName = NULL; /* optional negator operator name */
+ char *restrictionName = NULL; /* optional restrict. sel.
+ * procedure */
+ char *joinName = NULL;/* optional join sel. procedure name */
+ char *sortName1 = NULL; /* optional first sort operator */
+ char *sortName2 = NULL; /* optional second sort operator */
+ List *pl;
/*
* loop over the definition list and extract the information we need.
*/
foreach(pl, parameters)
{
- DefElem *defel = (DefElem *) lfirst(pl);
+ DefElem *defel = (DefElem *) lfirst(pl);
if (!strcasecmp(defel->defname, "leftarg"))
{
@@ -465,19 +464,19 @@ void
DefineAggregate(char *aggName, List * parameters)
{
- char *stepfunc1Name = NULL;
- char *stepfunc2Name = NULL;
- char *finalfuncName = NULL;
- char *baseType = NULL;
- char *stepfunc1Type = NULL;
- char *stepfunc2Type = NULL;
- char *init1 = NULL;
- char *init2 = NULL;
- List *pl;
+ char *stepfunc1Name = NULL;
+ char *stepfunc2Name = NULL;
+ char *finalfuncName = NULL;
+ char *baseType = NULL;
+ char *stepfunc1Type = NULL;
+ char *stepfunc2Type = NULL;
+ char *init1 = NULL;
+ char *init2 = NULL;
+ List *pl;
foreach(pl, parameters)
{
- DefElem *defel = (DefElem *) lfirst(pl);
+ DefElem *defel = (DefElem *) lfirst(pl);
/*
* sfunc1
@@ -573,19 +572,19 @@ DefineAggregate(char *aggName, List * parameters)
void
DefineType(char *typeName, List * parameters)
{
- int16 internalLength = 0; /* int2 */
- int16 externalLength = 0; /* int2 */
- char *elemName = NULL;
- char *inputName = NULL;
- char *outputName = NULL;
- char *sendName = NULL;
- char *receiveName = NULL;
- char *defaultValue = NULL; /* Datum */
- bool byValue = false;
- char delimiter = DEFAULT_TYPDELIM;
- char *shadow_type;
- List *pl;
- char alignment = 'i'; /* default alignment */
+ int16 internalLength = 0; /* int2 */
+ int16 externalLength = 0; /* int2 */
+ char *elemName = NULL;
+ char *inputName = NULL;
+ char *outputName = NULL;
+ char *sendName = NULL;
+ char *receiveName = NULL;
+ char *defaultValue = NULL; /* Datum */
+ bool byValue = false;
+ char delimiter = DEFAULT_TYPDELIM;
+ char *shadow_type;
+ List *pl;
+ char alignment = 'i';/* default alignment */
/*
* Type names can only be 15 characters long, so that the shadow type
@@ -599,7 +598,7 @@ DefineType(char *typeName, List * parameters)
foreach(pl, parameters)
{
- DefElem *defel = (DefElem *) lfirst(pl);
+ DefElem *defel = (DefElem *) lfirst(pl);
if (!strcasecmp(defel->defname, "internallength"))
{
@@ -623,7 +622,7 @@ DefineType(char *typeName, List * parameters)
}
else if (!strcasecmp(defel->defname, "delimiter"))
{
- char *p = defGetString(defel);
+ char *p = defGetString(defel);
delimiter = p[0];
}
@@ -645,7 +644,7 @@ DefineType(char *typeName, List * parameters)
}
else if (!strcasecmp(defel->defname, "alignment"))
{
- char *a = defGetString(defel);
+ char *a = defGetString(defel);
if (!strcasecmp(a, "double"))
{
@@ -720,7 +719,7 @@ DefineType(char *typeName, List * parameters)
pfree(shadow_type);
}
-static char *
+static char *
defGetString(DefElem * def)
{
if (nodeTag(def->arg) != T_String)
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 192076e3911..c1ad092e92f 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.11 1997/09/07 04:40:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.12 1997/09/08 02:22:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,13 +28,13 @@
typedef struct ExplainState
{
/* options */
- bool printCost; /* print cost */
- bool printNodes; /* do nodeToString() instead */
+ bool printCost; /* print cost */
+ bool printNodes; /* do nodeToString() instead */
/* other states */
- List *rtable; /* range table */
-} ExplainState;
+ List *rtable; /* range table */
+} ExplainState;
-static char *Explain_PlanToString(Plan * plan, ExplainState * es);
+static char *Explain_PlanToString(Plan * plan, ExplainState * es);
/*
* ExplainQuery -
@@ -44,15 +44,15 @@ static char *Explain_PlanToString(Plan * plan, ExplainState * es);
void
ExplainQuery(Query * query, bool verbose, CommandDest dest)
{
- char *s = NULL,
- *s2;
- Plan *plan;
- ExplainState *es;
- int len;
+ char *s = NULL,
+ *s2;
+ Plan *plan;
+ ExplainState *es;
+ int len;
if (IsAbortedTransactionBlockState())
{
- char *tag = "*ABORT STATE*";
+ char *tag = "*ABORT STATE*";
EndCommand(tag, dest);
@@ -118,9 +118,9 @@ ExplainQuery(Query * query, bool verbose, CommandDest dest)
static void
explain_outNode(StringInfo str, Plan * plan, int indent, ExplainState * es)
{
- char *pname;
- char buf[1000];
- int i;
+ char *pname;
+ char buf[1000];
+ int i;
if (plan == NULL)
{
@@ -130,51 +130,51 @@ explain_outNode(StringInfo str, Plan * plan, int indent, ExplainState * es)
switch (nodeTag(plan))
{
- case T_Result:
- pname = "Result";
- break;
- case T_Append:
- pname = "Append";
- break;
- case T_NestLoop:
- pname = "Nested Loop";
- break;
- case T_MergeJoin:
- pname = "Merge Join";
- break;
- case T_HashJoin:
- pname = "Hash Join";
- break;
- case T_SeqScan:
- pname = "Seq Scan";
- break;
- case T_IndexScan:
- pname = "Index Scan";
- break;
- case T_Temp:
- pname = "Temp Scan";
- break;
- case T_Sort:
- pname = "Sort";
- break;
- case T_Group:
- pname = "Group";
- break;
- case T_Agg:
- pname = "Aggregate";
- break;
- case T_Unique:
- pname = "Unique";
- break;
- case T_Hash:
- pname = "Hash";
- break;
- case T_Tee:
- pname = "Tee";
- break;
- default:
- pname = "";
- break;
+ case T_Result:
+ pname = "Result";
+ break;
+ case T_Append:
+ pname = "Append";
+ break;
+ case T_NestLoop:
+ pname = "Nested Loop";
+ break;
+ case T_MergeJoin:
+ pname = "Merge Join";
+ break;
+ case T_HashJoin:
+ pname = "Hash Join";
+ break;
+ case T_SeqScan:
+ pname = "Seq Scan";
+ break;
+ case T_IndexScan:
+ pname = "Index Scan";
+ break;
+ case T_Temp:
+ pname = "Temp Scan";
+ break;
+ case T_Sort:
+ pname = "Sort";
+ break;
+ case T_Group:
+ pname = "Group";
+ break;
+ case T_Agg:
+ pname = "Aggregate";
+ break;
+ case T_Unique:
+ pname = "Unique";
+ break;
+ case T_Hash:
+ pname = "Hash";
+ break;
+ case T_Tee:
+ pname = "Tee";
+ break;
+ default:
+ pname = "";
+ break;
}
for (i = 0; i < indent; i++)
@@ -183,18 +183,18 @@ explain_outNode(StringInfo str, Plan * plan, int indent, ExplainState * es)
appendStringInfo(str, pname);
switch (nodeTag(plan))
{
- case T_SeqScan:
- case T_IndexScan:
- if (((Scan *) plan)->scanrelid > 0)
- {
- RangeTblEntry *rte = nth(((Scan *) plan)->scanrelid - 1, es->rtable);
-
- sprintf(buf, " on %s", rte->refname);
- appendStringInfo(str, buf);
- }
- break;
- default:
- break;
+ case T_SeqScan:
+ case T_IndexScan:
+ if (((Scan *) plan)->scanrelid > 0)
+ {
+ RangeTblEntry *rte = nth(((Scan *) plan)->scanrelid - 1, es->rtable);
+
+ sprintf(buf, " on %s", rte->refname);
+ appendStringInfo(str, buf);
+ }
+ break;
+ default:
+ break;
}
if (es->printCost)
{
@@ -224,11 +224,11 @@ explain_outNode(StringInfo str, Plan * plan, int indent, ExplainState * es)
return;
}
-static char *
+static char *
Explain_PlanToString(Plan * plan, ExplainState * es)
{
- StringInfo str;
- char *s;
+ StringInfo str;
+ char *s;
if (plan == NULL)
return "";
diff --git a/src/backend/commands/purge.c b/src/backend/commands/purge.c
index 8000bbc7352..78265c93cc5 100644
--- a/src/backend/commands/purge.c
+++ b/src/backend/commands/purge.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/purge.c,v 1.7 1997/09/07 04:40:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/purge.c,v 1.8 1997/09/08 02:22:11 momjian Exp $
*
* Note:
* XXX There are many instances of int32 instead of ...Time. These
@@ -28,7 +28,7 @@
#include <commands/purge.h>
#include <utils/builtins.h> /* for isreltime() */
-static char cmdname[] = "RelationPurge";
+static char cmdname[] = "RelationPurge";
#define RELATIVE 01
#define ABSOLUTE 02
@@ -38,23 +38,23 @@ RelationPurge(char *relationName,
char *absoluteTimeString,
char *relativeTimeString)
{
- register i;
- AbsoluteTime absoluteTime = INVALID_ABSTIME;
- RelativeTime relativeTime = INVALID_RELTIME;
- bits8 dateTag;
- Relation relation;
- HeapScanDesc scan;
+ register i;
+ AbsoluteTime absoluteTime = INVALID_ABSTIME;
+ RelativeTime relativeTime = INVALID_RELTIME;
+ bits8 dateTag;
+ Relation relation;
+ HeapScanDesc scan;
static ScanKeyData key[1] = {
{0, Anum_pg_class_relname, F_NAMEEQ}
};
- Buffer buffer;
- HeapTuple newTuple,
- oldTuple;
- AbsoluteTime currentTime;
- char *values[Natts_pg_class];
- char nulls[Natts_pg_class];
- char replace[Natts_pg_class];
- Relation idescs[Num_pg_class_indices];
+ Buffer buffer;
+ HeapTuple newTuple,
+ oldTuple;
+ AbsoluteTime currentTime;
+ char *values[Natts_pg_class];
+ char nulls[Natts_pg_class];
+ char replace[Natts_pg_class];
+ Relation idescs[Num_pg_class_indices];
/*
* XXX for some reason getmyrelids (in inval.c) barfs when you
diff --git a/src/backend/commands/recipe.c b/src/backend/commands/recipe.c
index bf05c293d13..7796b164c3a 100644
--- a/src/backend/commands/recipe.c
+++ b/src/backend/commands/recipe.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.7 1997/09/07 04:40:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.8 1997/09/08 02:22:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,26 +50,26 @@ beginRecipe(RecipeStmt * stmt)
/* structure to keep track of the tee node plans */
typedef struct _teePlanInfo
{
- char *tpi_relName;
- Query *tpi_parsetree;
- Plan *tpi_plan;
-} TeePlanInfo;
+ char *tpi_relName;
+ Query *tpi_parsetree;
+ Plan *tpi_plan;
+} TeePlanInfo;
typedef struct _teeInfo
{
- int num;
- TeePlanInfo *val;
-} TeeInfo;
+ int num;
+ TeePlanInfo *val;
+} TeeInfo;
-QueryTreeList *appendQlist(QueryTreeList * q1, QueryTreeList * q2);
-void OffsetVarAttno(Node * node, int varno, int offset);
+QueryTreeList *appendQlist(QueryTreeList * q1, QueryTreeList * q2);
+void OffsetVarAttno(Node * node, int varno, int offset);
static void
appendTeeQuery(TeeInfo * teeInfo,
QueryTreeList * q,
char *teeNodeName);
-static Plan *
+static Plan *
replaceTeeScans(Plan * plan,
Query * parsetree,
TeeInfo * teeInfo);
@@ -83,12 +83,12 @@ static void
tg_rewriteQuery(TgRecipe * r, TgNode * n,
QueryTreeList * q,
QueryTreeList * inputQlist);
-static Node *
+static Node *
tg_replaceNumberedParam(Node * expression,
int pnum,
int rt_ind,
char *teeRelName);
-static Node *
+static Node *
tg_rewriteParamsInExpr(Node * expression,
QueryTreeList * inputQlist);
static QueryTreeList *
@@ -129,18 +129,18 @@ tg_parseTeeNode(TgRecipe * r,
void
beginRecipe(RecipeStmt * stmt)
{
- TgRecipe *r;
- int i;
- QueryTreeList *qList;
- char portalName[1024];
+ TgRecipe *r;
+ int i;
+ QueryTreeList *qList;
+ char portalName[1024];
- Plan *plan;
- TupleDesc attinfo;
- QueryDesc *queryDesc;
- Query *parsetree;
+ Plan *plan;
+ TupleDesc attinfo;
+ QueryDesc *queryDesc;
+ Query *parsetree;
- int numTees;
- TeeInfo *teeInfo;
+ int numTees;
+ TeeInfo *teeInfo;
/*
* retrieveRecipe() reads the recipe from the database and returns a
@@ -177,7 +177,7 @@ beginRecipe(RecipeStmt * stmt)
*/
for (i = 0; i < r->eyes->num; i++)
{
- TgNodePtr e;
+ TgNodePtr e;
e = r->eyes->val[i];
if (e->inNodes->num > 1)
@@ -231,9 +231,9 @@ beginRecipe(RecipeStmt * stmt)
* ---------------------------------------------------------- */
if (teeInfo)
{
- int t;
- Plan *tplan;
- Tee *newplan;
+ int t;
+ Plan *tplan;
+ Tee *newplan;
for (t = 0; t < teeInfo->num; t++)
{
@@ -320,12 +320,12 @@ tg_rewriteQuery(TgRecipe * r,
QueryTreeList * q,
QueryTreeList * inputQlist)
{
- Query *orig;
- Query *inputQ;
- int i;
- List *rtable;
- List *input_rtable;
- int rt_length;
+ Query *orig;
+ Query *inputQ;
+ int i;
+ List *rtable;
+ List *input_rtable;
+ int rt_length;
/* orig is the original parse tree of the node */
orig = q->qtrees[0];
@@ -380,8 +380,8 @@ tg_rewriteQuery(TgRecipe * r,
*/
if (orig->targetList != NIL)
{
- List *tl;
- TargetEntry *tle;
+ List *tl;
+ TargetEntry *tle;
foreach(tl, orig->targetList)
{
@@ -425,134 +425,134 @@ tg_rewriteQuery(TgRecipe * r,
it returns a (possibly modified) Node*.
*/
-static Node *
+static Node *
tg_replaceNumberedParam(Node * expression,
int pnum, /* the number of the parameter */
int rt_ind, /* the range table index */
char *teeRelName) /* the relname of the tee
* table */
{
- TargetEntry *param_tle;
- Param *p;
- Var *newVar,
- *oldVar;
+ TargetEntry *param_tle;
+ Param *p;
+ Var *newVar,
+ *oldVar;
if (expression == NULL)
return NULL;
switch (nodeTag(expression))
{
- case T_Param:
- {
-
- /*
- * the node is a parameter, substitute the entry from the
- * target list of the child that corresponds to the parameter
- * number
- */
- p = (Param *) expression;
-
- /* we only deal with the case of numbered parameters */
- if (p->paramkind == PARAM_NUM && p->paramid == pnum)
+ case T_Param:
{
- if (p->param_tlist)
- {
-
- /*
- * we have a parameter with an attribute like $N.foo
- * so replace it with a new var node
- */
+ /*
+ * the node is a parameter, substitute the entry from the
+ * target list of the child that corresponds to the
+ * parameter number
+ */
+ p = (Param *) expression;
- /* param tlist can only have one entry in them! */
- param_tle = (TargetEntry *) (lfirst(p->param_tlist));
- oldVar = (Var *) param_tle->expr;
- oldVar->varno = rt_ind;
- oldVar->varnoold = rt_ind;
- return (Node *) oldVar;
- }
- else
+ /* we only deal with the case of numbered parameters */
+ if (p->paramkind == PARAM_NUM && p->paramid == pnum)
{
- /* we have $N without the .foo */
- bool defined;
- bool isRel;
-
- /*
- * TODO here, we need to check to see whether the type
- * of the tee is a complex type (relation) or a simple
- * type
- */
- /*
- * if it is a simple type, then we need to get the
- * "result" attribute from the tee relation
- */
-
- isRel = (typeid_get_relid(p->paramtype) != 0);
- if (isRel)
+ if (p->param_tlist)
{
- newVar = makeVar(rt_ind,
- 0, /* the whole tuple */
- TypeGet(teeRelName, &defined),
- rt_ind,
- 0);
- return (Node *) newVar;
+
+ /*
+ * we have a parameter with an attribute like
+ * $N.foo so replace it with a new var node
+ */
+
+ /* param tlist can only have one entry in them! */
+ param_tle = (TargetEntry *) (lfirst(p->param_tlist));
+ oldVar = (Var *) param_tle->expr;
+ oldVar->varno = rt_ind;
+ oldVar->varnoold = rt_ind;
+ return (Node *) oldVar;
}
else
- newVar = makeVar(rt_ind,
- 1, /* just the first field,
+ {
+ /* we have $N without the .foo */
+ bool defined;
+ bool isRel;
+
+ /*
+ * TODO here, we need to check to see whether the
+ * type of the tee is a complex type (relation) or
+ * a simple type
+ */
+
+ /*
+ * if it is a simple type, then we need to get the
+ * "result" attribute from the tee relation
+ */
+
+ isRel = (typeid_get_relid(p->paramtype) != 0);
+ if (isRel)
+ {
+ newVar = makeVar(rt_ind,
+ 0, /* the whole tuple */
+ TypeGet(teeRelName, &defined),
+ rt_ind,
+ 0);
+ return (Node *) newVar;
+ }
+ else
+ newVar = makeVar(rt_ind,
+ 1, /* just the first field,
* which is 'result' */
- TypeGet(teeRelName, &defined),
- rt_ind,
- 0);
- return (Node *) newVar;
+ TypeGet(teeRelName, &defined),
+ rt_ind,
+ 0);
+ return (Node *) newVar;
+ }
+ }
+ else
+ {
+ elog(NOTICE, "tg_replaceNumberedParam: unexpected paramkind value of %d", p->paramkind);
}
}
- else
+ break;
+ case T_Expr:
{
- elog(NOTICE, "tg_replaceNumberedParam: unexpected paramkind value of %d", p->paramkind);
- }
- }
- break;
- case T_Expr:
- {
- /*
- * the node is an expression, we need to recursively call
- * ourselves until we find parameter nodes
- */
- List *l;
- Expr *expr = (Expr *) expression;
- List *newArgs;
+ /*
+ * the node is an expression, we need to recursively call
+ * ourselves until we find parameter nodes
+ */
+ List *l;
+ Expr *expr = (Expr *) expression;
+ List *newArgs;
- /*
- * we have to make a new args lists because Params can be
- * replaced by Var nodes in tg_replaceNumberedParam()
- */
- newArgs = NIL;
+ /*
+ * we have to make a new args lists because Params can be
+ * replaced by Var nodes in tg_replaceNumberedParam()
+ */
+ newArgs = NIL;
- /*
- * we only care about argument to expressions, it doesn't
- * matter when the opType is
- */
- /* recursively rewrite the arguments of this expression */
- foreach(l, expr->args)
+ /*
+ * we only care about argument to expressions, it doesn't
+ * matter when the opType is
+ */
+ /* recursively rewrite the arguments of this expression */
+ foreach(l, expr->args)
+ {
+ newArgs = lappend(newArgs,
+ tg_replaceNumberedParam(lfirst(l),
+ pnum,
+ rt_ind,
+ teeRelName));
+ }
+ /* change the arguments of the expression */
+ expr->args = newArgs;
+ }
+ break;
+ default:
{
- newArgs = lappend(newArgs,
- tg_replaceNumberedParam(lfirst(l),
- pnum,
- rt_ind,
- teeRelName));
+ /* ignore other expr types */
}
- /* change the arguments of the expression */
- expr->args = newArgs;
- }
- break;
- default:
- {
- /* ignore other expr types */
- }
}
return expression;
@@ -572,118 +572,118 @@ tg_replaceNumberedParam(Node * expression,
it returns a (possibly modified) Node*.
*/
-static Node *
+static Node *
tg_rewriteParamsInExpr(Node * expression, QueryTreeList * inputQlist)
{
- List *tl;
- TargetEntry *param_tle,
- *tle;
- Param *p;
- int childno;
- char *resname;
+ List *tl;
+ TargetEntry *param_tle,
+ *tle;
+ Param *p;
+ int childno;
+ char *resname;
if (expression == NULL)
return NULL;
switch (nodeTag(expression))
{
- case T_Param:
- {
-
- /*
- * the node is a parameter, substitute the entry from the
- * target list of the child that corresponds to the parameter
- * number
- */
- p = (Param *) expression;
-
- /* we only deal with the case of numbered parameters */
- if (p->paramkind == PARAM_NUM)
+ case T_Param:
{
- /* paramid's start from 1 */
- childno = p->paramid - 1;
- if (p->param_tlist)
+ /*
+ * the node is a parameter, substitute the entry from the
+ * target list of the child that corresponds to the
+ * parameter number
+ */
+ p = (Param *) expression;
+
+ /* we only deal with the case of numbered parameters */
+ if (p->paramkind == PARAM_NUM)
{
+ /* paramid's start from 1 */
+ childno = p->paramid - 1;
- /*
- * we have a parameter with an attribute like $N.foo
- * so match the resname "foo" against the target list
- * of the (N-1)th inputQlist
- */
+ if (p->param_tlist)
+ {
- /* param tlist can only have one entry in them! */
- param_tle = (TargetEntry *) (lfirst(p->param_tlist));
- resname = param_tle->resdom->resname;
+ /*
+ * we have a parameter with an attribute like
+ * $N.foo so match the resname "foo" against the
+ * target list of the (N-1)th inputQlist
+ */
- if (inputQlist->qtrees[childno])
- {
- foreach(tl, inputQlist->qtrees[childno]->targetList)
+ /* param tlist can only have one entry in them! */
+ param_tle = (TargetEntry *) (lfirst(p->param_tlist));
+ resname = param_tle->resdom->resname;
+
+ if (inputQlist->qtrees[childno])
{
- tle = lfirst(tl);
- if (strcmp(resname, tle->resdom->resname) == 0)
+ foreach(tl, inputQlist->qtrees[childno]->targetList)
{
- return tle->expr;
+ tle = lfirst(tl);
+ if (strcmp(resname, tle->resdom->resname) == 0)
+ {
+ return tle->expr;
+ }
}
}
+ else
+ {
+ elog(WARN, "tg_rewriteParamsInExpr:can't substitute for parameter %d when that input is unconnected", p->paramid);
+ }
+
}
else
{
- elog(WARN, "tg_rewriteParamsInExpr:can't substitute for parameter %d when that input is unconnected", p->paramid);
+ /* we have $N without the .foo */
+ /* use the first resdom in the targetlist of the */
+ /* appropriate child query */
+ tl = inputQlist->qtrees[childno]->targetList;
+ tle = lfirst(tl);
+ return tle->expr;
}
-
}
else
{
- /* we have $N without the .foo */
- /* use the first resdom in the targetlist of the */
- /* appropriate child query */
- tl = inputQlist->qtrees[childno]->targetList;
- tle = lfirst(tl);
- return tle->expr;
+ elog(NOTICE, "tg_rewriteParamsInExpr: unexpected paramkind value of %d", p->paramkind);
}
}
- else
+ break;
+ case T_Expr:
{
- elog(NOTICE, "tg_rewriteParamsInExpr: unexpected paramkind value of %d", p->paramkind);
- }
- }
- break;
- case T_Expr:
- {
- /*
- * the node is an expression, we need to recursively call
- * ourselves until we find parameter nodes
- */
- List *l;
- Expr *expr = (Expr *) expression;
- List *newArgs;
+ /*
+ * the node is an expression, we need to recursively call
+ * ourselves until we find parameter nodes
+ */
+ List *l;
+ Expr *expr = (Expr *) expression;
+ List *newArgs;
- /*
- * we have to make a new args lists because Params can be
- * replaced by Var nodes in tg_rewriteParamsInExpr()
- */
- newArgs = NIL;
+ /*
+ * we have to make a new args lists because Params can be
+ * replaced by Var nodes in tg_rewriteParamsInExpr()
+ */
+ newArgs = NIL;
- /*
- * we only care about argument to expressions, it doesn't
- * matter when the opType is
- */
- /* recursively rewrite the arguments of this expression */
- foreach(l, expr->args)
- {
- newArgs = lappend(newArgs,
+ /*
+ * we only care about argument to expressions, it doesn't
+ * matter when the opType is
+ */
+ /* recursively rewrite the arguments of this expression */
+ foreach(l, expr->args)
+ {
+ newArgs = lappend(newArgs,
tg_rewriteParamsInExpr(lfirst(l), inputQlist));
+ }
+ /* change the arguments of the expression */
+ expr->args = newArgs;
+ }
+ break;
+ default:
+ {
+ /* ignore other expr types */
}
- /* change the arguments of the expression */
- expr->args = newArgs;
- }
- break;
- default:
- {
- /* ignore other expr types */
- }
}
return expression;
@@ -703,12 +703,12 @@ static int
getParamTypes(TgElement * elem, Oid typev[])
{
/* this code is similar to ProcedureDefine() */
- int16 parameterCount;
- bool defined;
- Oid toid;
- char *t;
- int i,
- j;
+ int16 parameterCount;
+ bool defined;
+ Oid toid;
+ char *t;
+ int i,
+ j;
parameterCount = 0;
for (i = 0; i < 8; i++)
@@ -763,10 +763,10 @@ tg_parseTeeNode(TgRecipe * r,
TeeInfo * teeInfo)
{
- QueryTreeList *q;
- char *tt;
- int rt_ind;
- Query *orig;
+ QueryTreeList *q;
+ char *tt;
+ int rt_ind;
+ Query *orig;
/*
* the input Node is a tee node, so we need to do the following: we
@@ -831,21 +831,21 @@ tg_parseTeeNode(TgRecipe * r,
static QueryTreeList *
tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
{
- TgElement *elem;
- char *funcName;
- Oid typev[8]; /* eight arguments maximum */
- int i;
- int parameterCount;
-
- QueryTreeList *qList; /* the parse tree of the nodeElement */
- QueryTreeList *inputQlist; /* the list of parse trees for the inputs
+ TgElement *elem;
+ char *funcName;
+ Oid typev[8]; /* eight arguments maximum */
+ int i;
+ int parameterCount;
+
+ QueryTreeList *qList; /* the parse tree of the nodeElement */
+ QueryTreeList *inputQlist; /* the list of parse trees for the inputs
* to this node */
- QueryTreeList *q;
- Oid relid;
- TgNode *child;
- Relation rel;
- unsigned int len;
- TupleDesc tupdesc;
+ QueryTreeList *q;
+ Oid relid;
+ TgNode *child;
+ Relation rel;
+ unsigned int len;
+ TupleDesc tupdesc;
qList = NULL;
@@ -856,79 +856,79 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
elem = n->nodeElem;
switch (elem->srcLang)
{
- case TG_SQL:
- {
+ case TG_SQL:
+ {
- /*
- * for SQL ingredients, the SQL query is contained in the
- * 'src' field
- */
+ /*
+ * for SQL ingredients, the SQL query is contained in
+ * the 'src' field
+ */
#ifdef DEBUG_RECIPE
- elog(NOTICE, "calling parser with %s", elem->src);
+ elog(NOTICE, "calling parser with %s", elem->src);
#endif /* DEBUG_RECIPE */
- parameterCount = getParamTypes(elem, typev);
+ parameterCount = getParamTypes(elem, typev);
- qList = parser(elem->src, typev, parameterCount);
+ qList = parser(elem->src, typev, parameterCount);
- if (qList->len > 1)
- {
- elog(NOTICE,
- "tg_parseSubQuery: parser produced > 1 query tree");
+ if (qList->len > 1)
+ {
+ elog(NOTICE,
+ "tg_parseSubQuery: parser produced > 1 query tree");
+ }
}
- }
- break;
- case TG_C:
- {
- /* C ingredients are registered functions in postgres */
-
- /*
- * we create a new query string by using the function name
- * (found in the 'src' field) and adding parameters to it
- * so if the function was FOOBAR and took in two
- * arguments, we would create a string select
- * FOOBAR($1,$2)
- */
- char newquery[1000];
+ break;
+ case TG_C:
+ {
+ /* C ingredients are registered functions in postgres */
- funcName = elem->src;
- parameterCount = getParamTypes(elem, typev);
+ /*
+ * we create a new query string by using the function
+ * name (found in the 'src' field) and adding
+ * parameters to it so if the function was FOOBAR and
+ * took in two arguments, we would create a string
+ * select FOOBAR($1,$2)
+ */
+ char newquery[1000];
- if (parameterCount > 0)
- {
- int i;
+ funcName = elem->src;
+ parameterCount = getParamTypes(elem, typev);
- sprintf(newquery, "select %s($1", funcName);
- for (i = 1; i < parameterCount; i++)
+ if (parameterCount > 0)
{
- sprintf(newquery, "%s,$%d", newquery, i);
+ int i;
+
+ sprintf(newquery, "select %s($1", funcName);
+ for (i = 1; i < parameterCount; i++)
+ {
+ sprintf(newquery, "%s,$%d", newquery, i);
+ }
+ sprintf(newquery, "%s)", newquery);
}
- sprintf(newquery, "%s)", newquery);
- }
- else
- sprintf(newquery, "select %s()", funcName);
+ else
+ sprintf(newquery, "select %s()", funcName);
#ifdef DEBUG_RECIPE
- elog(NOTICE, "calling parser with %s", newquery);
+ elog(NOTICE, "calling parser with %s", newquery);
#endif /* DEBUG_RECIPE */
- qList = parser(newquery, typev, parameterCount);
- if (qList->len > 1)
- {
- elog(NOTICE,
- "tg_parseSubQuery: parser produced > 1 query tree");
+ qList = parser(newquery, typev, parameterCount);
+ if (qList->len > 1)
+ {
+ elog(NOTICE,
+ "tg_parseSubQuery: parser produced > 1 query tree");
+ }
}
- }
- break;
- case TG_RECIPE_GRAPH:
- elog(NOTICE, "tg_parseSubQuery: can't parse recipe graph ingredients yet!");
- break;
- case TG_COMPILED:
- elog(NOTICE, "tg_parseSubQuery: can't parse compiled ingredients yet!");
- break;
- default:
- elog(NOTICE, "tg_parseSubQuery: unknown srcLang: %d", elem->srcLang);
+ break;
+ case TG_RECIPE_GRAPH:
+ elog(NOTICE, "tg_parseSubQuery: can't parse recipe graph ingredients yet!");
+ break;
+ case TG_COMPILED:
+ elog(NOTICE, "tg_parseSubQuery: can't parse compiled ingredients yet!");
+ break;
+ default:
+ elog(NOTICE, "tg_parseSubQuery: unknown srcLang: %d", elem->srcLang);
}
/* parse each of the subrecipes that are input to this node */
@@ -1110,41 +1110,41 @@ OffsetVarAttno(Node * node, int varno, int offset)
return;
switch (nodeTag(node))
{
- case T_TargetEntry:
- {
- TargetEntry *tle = (TargetEntry *) node;
-
- OffsetVarAttno(tle->expr, varno, offset);
- }
- break;
- case T_Expr:
- {
- Expr *expr = (Expr *) node;
+ case T_TargetEntry:
+ {
+ TargetEntry *tle = (TargetEntry *) node;
- OffsetVarAttno((Node *) expr->args, varno, offset);
- }
- break;
- case T_Var:
- {
- Var *var = (Var *) node;
+ OffsetVarAttno(tle->expr, varno, offset);
+ }
+ break;
+ case T_Expr:
+ {
+ Expr *expr = (Expr *) node;
- if (var->varno == varno)
- var->varattno += offset;
- }
- break;
- case T_List:
- {
- List *l;
+ OffsetVarAttno((Node *) expr->args, varno, offset);
+ }
+ break;
+ case T_Var:
+ {
+ Var *var = (Var *) node;
- foreach(l, (List *) node)
+ if (var->varno == varno)
+ var->varattno += offset;
+ }
+ break;
+ case T_List:
{
- OffsetVarAttno(lfirst(l), varno, offset);
+ List *l;
+
+ foreach(l, (List *) node)
+ {
+ OffsetVarAttno(lfirst(l), varno, offset);
+ }
}
- }
- break;
- default:
- /* ignore the others */
- break;
+ break;
+ default:
+ /* ignore the others */
+ break;
}
}
@@ -1156,13 +1156,13 @@ OffsetVarAttno(Node * node, int varno, int offset)
* returns a new querytree list
*/
-QueryTreeList *
+QueryTreeList *
appendQlist(QueryTreeList * q1, QueryTreeList * q2)
{
- QueryTreeList *newq;
- int i,
- j;
- int newlen;
+ QueryTreeList *newq;
+ int i,
+ j;
+ int newlen;
if (q1 == NULL)
return q2;
@@ -1191,7 +1191,7 @@ appendQlist(QueryTreeList * q1, QueryTreeList * q2)
static void
appendTeeQuery(TeeInfo * teeInfo, QueryTreeList * q, char *teeNodeName)
{
- int i;
+ int i;
Assert(teeInfo);
@@ -1223,9 +1223,9 @@ static void
replaceSeqScan(Plan * plan, Plan * parent,
int rt_ind, Plan * tplan)
{
- Scan *snode;
- Tee *teePlan;
- Result *newPlan;
+ Scan *snode;
+ Tee *teePlan;
+ Result *newPlan;
if (plan == NULL)
{
@@ -1306,16 +1306,16 @@ replaceSeqScan(Plan * plan, Plan * parent,
* places the sequential scans of the Tee table with
* a connection to the actual tee plan node
*/
-static Plan *
+static Plan *
replaceTeeScans(Plan * plan, Query * parsetree, TeeInfo * teeInfo)
{
- int i;
- List *rtable;
- RangeTblEntry *rte;
- char prefix[5];
- int rt_ind;
- Plan *tplan;
+ int i;
+ List *rtable;
+ RangeTblEntry *rte;
+ char prefix[5];
+ int rt_ind;
+ Plan *tplan;
rtable = parsetree->rtable;
if (rtable == NULL)
diff --git a/src/backend/commands/remove.c b/src/backend/commands/remove.c
index cafe4d09710..5b31866cf24 100644
--- a/src/backend/commands/remove.c
+++ b/src/backend/commands/remove.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.11 1997/09/07 04:40:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.12 1997/09/08 02:22:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,16 +48,16 @@ RemoveOperator(char *operatorName, /* operator name */
char *typeName1, /* first type name */
char *typeName2) /* optional second type name */
{
- Relation relation;
- HeapScanDesc scan;
- HeapTuple tup;
- Oid typeId1 = InvalidOid;
- Oid typeId2 = InvalidOid;
- bool defined;
+ Relation relation;
+ HeapScanDesc scan;
+ HeapTuple tup;
+ Oid typeId1 = InvalidOid;
+ Oid typeId2 = InvalidOid;
+ bool defined;
ItemPointerData itemPointerData;
- Buffer buffer;
- ScanKeyData operatorKey[3];
- char *userName;
+ Buffer buffer;
+ ScanKeyData operatorKey[3];
+ char *userName;
if (typeName1)
{
@@ -148,14 +148,14 @@ RemoveOperator(char *operatorName, /* operator name */
static void
SingleOpOperatorRemove(Oid typeOid)
{
- Relation rdesc;
- ScanKeyData key[3];
- HeapScanDesc sdesc;
- HeapTuple tup;
+ Relation rdesc;
+ ScanKeyData key[3];
+ HeapScanDesc sdesc;
+ HeapTuple tup;
ItemPointerData itemPointerData;
- Buffer buffer;
- static attnums[3] = {7, 8, 9}; /* left, right, return */
- register i;
+ Buffer buffer;
+ static attnums[3] = {7, 8, 9}; /* left, right, return */
+ register i;
ScanKeyEntryInitialize(&key[0],
0, 0, ObjectIdEqualRegProcedure, (Datum) typeOid);
@@ -186,17 +186,17 @@ AttributeAndRelationRemove(Oid typeOid)
{
struct oidlist
{
- Oid reloid;
+ Oid reloid;
struct oidlist *next;
};
struct oidlist *oidptr,
- *optr;
- Relation rdesc;
- ScanKeyData key[1];
- HeapScanDesc sdesc;
- HeapTuple tup;
+ *optr;
+ Relation rdesc;
+ ScanKeyData key[1];
+ HeapScanDesc sdesc;
+ HeapTuple tup;
ItemPointerData itemPointerData;
- Buffer buffer;
+ Buffer buffer;
/*
* Get the oid's of the relations to be removed by scanning the entire
@@ -237,7 +237,7 @@ AttributeAndRelationRemove(Oid typeOid)
tup = heap_getnext(sdesc, 0, &buffer);
if (PointerIsValid(tup))
{
- char *name;
+ char *name;
name = (((Form_pg_class) GETSTRUCT(tup))->relname).data;
heap_destroy(name);
@@ -257,16 +257,16 @@ AttributeAndRelationRemove(Oid typeOid)
void
RemoveType(char *typeName) /* type name to be removed */
{
- Relation relation;
- HeapScanDesc scan;
- HeapTuple tup;
- Oid typeOid;
+ Relation relation;
+ HeapScanDesc scan;
+ HeapTuple tup;
+ Oid typeOid;
ItemPointerData itemPointerData;
static ScanKeyData typeKey[1] = {
{0, Anum_pg_type_typname, NameEqualRegProcedure}
};
- char *shadow_type;
- char *userName;
+ char *shadow_type;
+ char *userName;
#ifndef NO_SECURITY
userName = GetPgUserName();
@@ -332,20 +332,20 @@ RemoveFunction(char *functionName, /* function name to be removed */
int nargs,
List * argNameList /* list of TypeNames */ )
{
- Relation relation;
- HeapScanDesc scan;
- HeapTuple tup;
- Buffer buffer = InvalidBuffer;
- bool bufferUsed = FALSE;
- Oid argList[8];
- Form_pg_proc the_proc = NULL;
+ Relation relation;
+ HeapScanDesc scan;
+ HeapTuple tup;
+ Buffer buffer = InvalidBuffer;
+ bool bufferUsed = FALSE;
+ Oid argList[8];
+ Form_pg_proc the_proc = NULL;
ItemPointerData itemPointerData;
static ScanKeyData key[3] = {
{0, Anum_pg_proc_proname, NameEqualRegProcedure}
};
- char *userName;
- char *typename;
- int i;
+ char *userName;
+ char *typename;
+ int i;
memset(argList, 0, 8 * sizeof(Oid));
for (i = 0; i < nargs; i++)
@@ -431,14 +431,14 @@ RemoveFunction(char *functionName, /* function name to be removed */
void
RemoveAggregate(char *aggName, char *aggType)
{
- Relation relation;
- HeapScanDesc scan;
- HeapTuple tup;
+ Relation relation;
+ HeapScanDesc scan;
+ HeapTuple tup;
ItemPointerData itemPointerData;
- char *userName;
- Oid basetypeID = InvalidOid;
- bool defined;
- ScanKeyData aggregateKey[3];
+ char *userName;
+ Oid basetypeID = InvalidOid;
+ bool defined;
+ ScanKeyData aggregateKey[3];
/*
diff --git a/src/backend/commands/rename.c b/src/backend/commands/rename.c
index 9b8df698346..d96fb762f28 100644
--- a/src/backend/commands/rename.c
+++ b/src/backend/commands/rename.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.8 1997/09/07 04:40:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.9 1997/09/08 02:22:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,13 +66,13 @@ renameatt(char *relname,
char *userName,
int recurse)
{
- Relation relrdesc,
- attrdesc;
- HeapTuple reltup,
- oldatttup,
- newatttup;
+ Relation relrdesc,
+ attrdesc;
+ HeapTuple reltup,
+ oldatttup,
+ newatttup;
ItemPointerData oldTID;
- Relation idescs[Num_pg_attr_indices];
+ Relation idescs[Num_pg_attr_indices];
/*
* permissions checking. this would normally be done in utility.c,
@@ -101,10 +101,10 @@ renameatt(char *relname,
*/
if (recurse)
{
- Oid myrelid,
- childrelid;
- List *child,
- *children;
+ Oid myrelid,
+ childrelid;
+ List *child,
+ *children;
relrdesc = heap_openr(relname);
if (!RelationIsValid(relrdesc))
@@ -126,7 +126,7 @@ renameatt(char *relname,
*/
foreach(child, children)
{
- char *childname;
+ char *childname;
childrelid = lfirsti(child);
if (childrelid == myrelid)
@@ -213,13 +213,13 @@ renameatt(char *relname,
void
renamerel(char oldrelname[], char newrelname[])
{
- Relation relrdesc; /* for RELATION relation */
- HeapTuple oldreltup,
- newreltup;
+ Relation relrdesc; /* for RELATION relation */
+ HeapTuple oldreltup,
+ newreltup;
ItemPointerData oldTID;
- char oldpath[MAXPGPATH],
- newpath[MAXPGPATH];
- Relation idescs[Num_pg_class_indices];
+ char oldpath[MAXPGPATH],
+ newpath[MAXPGPATH];
+ Relation idescs[Num_pg_class_indices];
if (IsSystemRelationName(oldrelname))
{
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index c4bd8c40dcf..3f5bc371636 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -24,37 +24,37 @@
#define SEQ_MAXVALUE ((int4)0x7FFFFFFF)
#define SEQ_MINVALUE -(SEQ_MAXVALUE)
-bool ItsSequenceCreation = false;
+bool ItsSequenceCreation = false;
typedef struct FormData_pg_sequence
{
- NameData sequence_name;
- int4 last_value;
- int4 increment_by;
- int4 max_value;
- int4 min_value;
- int4 cache_value;
- char is_cycled;
- char is_called;
-} FormData_pg_sequence;
+ NameData sequence_name;
+ int4 last_value;
+ int4 increment_by;
+ int4 max_value;
+ int4 min_value;
+ int4 cache_value;
+ char is_cycled;
+ char is_called;
+} FormData_pg_sequence;
typedef FormData_pg_sequence *SequenceTupleForm;
typedef struct sequence_magic
{
- uint32 magic;
-} sequence_magic;
+ uint32 magic;
+} sequence_magic;
typedef struct SeqTableData
{
- char *name;
- Oid relid;
- Relation rel;
- int4 cached;
- int4 last;
- int4 increment;
+ char *name;
+ Oid relid;
+ Relation rel;
+ int4 cached;
+ int4 last;
+ int4 increment;
struct SeqTableData *next;
-} SeqTableData;
+} SeqTableData;
typedef SeqTableData *SeqTable;
@@ -62,8 +62,8 @@ static SeqTable seqtab = NULL;
static SeqTable init_sequence(char *caller, char *name);
static SequenceTupleForm read_info(char *caller, SeqTable elm, Buffer * buf);
-static void init_params(CreateSeqStmt * seq, SequenceTupleForm new);
-static int get_param(DefElem * def);
+static void init_params(CreateSeqStmt * seq, SequenceTupleForm new);
+static int get_param(DefElem * def);
/*
* DefineSequence --
@@ -73,18 +73,18 @@ void
DefineSequence(CreateSeqStmt * seq)
{
FormData_pg_sequence new;
- CreateStmt *stmt = makeNode(CreateStmt);
- ColumnDef *coldef;
- TypeName *typnam;
- Relation rel;
- Buffer buf;
- PageHeader page;
+ CreateStmt *stmt = makeNode(CreateStmt);
+ ColumnDef *coldef;
+ TypeName *typnam;
+ Relation rel;
+ Buffer buf;
+ PageHeader page;
sequence_magic *sm;
- HeapTuple tuple;
- TupleDesc tupDesc;
- Datum value[SEQ_COL_LASTCOL];
- char null[SEQ_COL_LASTCOL];
- int i;
+ HeapTuple tuple;
+ TupleDesc tupDesc;
+ Datum value[SEQ_COL_LASTCOL];
+ char null[SEQ_COL_LASTCOL];
+ int i;
/* Check and set values */
init_params(seq, &new);
@@ -106,46 +106,46 @@ DefineSequence(CreateSeqStmt * seq)
switch (i)
{
- case SEQ_COL_NAME:
- typnam->name = "name";
- coldef->colname = "sequence_name";
- value[i - 1] = PointerGetDatum(seq->seqname);
- break;
- case SEQ_COL_LASTVAL:
- typnam->name = "int4";
- coldef->colname = "last_value";
- value[i - 1] = Int32GetDatum(new.last_value);
- break;
- case SEQ_COL_INCBY:
- typnam->name = "int4";
- coldef->colname = "increment_by";
- value[i - 1] = Int32GetDatum(new.increment_by);
- break;
- case SEQ_COL_MAXVALUE:
- typnam->name = "int4";
- coldef->colname = "max_value";
- value[i - 1] = Int32GetDatum(new.max_value);
- break;
- case SEQ_COL_MINVALUE:
- typnam->name = "int4";
- coldef->colname = "min_value";
- value[i - 1] = Int32GetDatum(new.min_value);
- break;
- case SEQ_COL_CACHE:
- typnam->name = "int4";
- coldef->colname = "cache_value";
- value[i - 1] = Int32GetDatum(new.cache_value);
- break;
- case SEQ_COL_CYCLE:
- typnam->name = "char";
- coldef->colname = "is_cycled";
- value[i - 1] = CharGetDatum(new.is_cycled);
- break;
- case SEQ_COL_CALLED:
- typnam->name = "char";
- coldef->colname = "is_called";
- value[i - 1] = CharGetDatum('f');
- break;
+ case SEQ_COL_NAME:
+ typnam->name = "name";
+ coldef->colname = "sequence_name";
+ value[i - 1] = PointerGetDatum(seq->seqname);
+ break;
+ case SEQ_COL_LASTVAL:
+ typnam->name = "int4";
+ coldef->colname = "last_value";
+ value[i - 1] = Int32GetDatum(new.last_value);
+ break;
+ case SEQ_COL_INCBY:
+ typnam->name = "int4";
+ coldef->colname = "increment_by";
+ value[i - 1] = Int32GetDatum(new.increment_by);
+ break;
+ case SEQ_COL_MAXVALUE:
+ typnam->name = "int4";
+ coldef->colname = "max_value";
+ value[i - 1] = Int32GetDatum(new.max_value);
+ break;
+ case SEQ_COL_MINVALUE:
+ typnam->name = "int4";
+ coldef->colname = "min_value";
+ value[i - 1] = Int32GetDatum(new.min_value);
+ break;
+ case SEQ_COL_CACHE:
+ typnam->name = "int4";
+ coldef->colname = "cache_value";
+ value[i - 1] = Int32GetDatum(new.cache_value);
+ break;
+ case SEQ_COL_CYCLE:
+ typnam->name = "char";
+ coldef->colname = "is_cycled";
+ value[i - 1] = CharGetDatum(new.is_cycled);
+ break;
+ case SEQ_COL_CALLED:
+ typnam->name = "char";
+ coldef->colname = "is_called";
+ value[i - 1] = CharGetDatum('f');
+ break;
}
stmt->tableElts = lappend(stmt->tableElts, coldef);
}
@@ -203,18 +203,18 @@ DefineSequence(CreateSeqStmt * seq)
int4
nextval(struct varlena * seqin)
{
- char *seqname = textout(seqin);
- SeqTable elm;
- Buffer buf;
+ char *seqname = textout(seqin);
+ SeqTable elm;
+ Buffer buf;
SequenceTupleForm seq;
ItemPointerData iptr;
- int4 incby,
- maxv,
- minv,
- cache;
- int4 result,
- next,
- rescnt = 0;
+ int4 incby,
+ maxv,
+ minv,
+ cache;
+ int4 result,
+ next,
+ rescnt = 0;
/* open and WIntentLock sequence */
elm = init_sequence("nextval", seqname);
@@ -303,9 +303,9 @@ nextval(struct varlena * seqin)
int4
currval(struct varlena * seqin)
{
- char *seqname = textout(seqin);
- SeqTable elm;
- int4 result;
+ char *seqname = textout(seqin);
+ SeqTable elm;
+ int4 result;
/* open and WIntentLock sequence */
elm = init_sequence("currval", seqname);
@@ -322,13 +322,13 @@ currval(struct varlena * seqin)
}
-static SequenceTupleForm
+static SequenceTupleForm
read_info(char *caller, SeqTable elm, Buffer * buf)
{
ItemPointerData iptr;
- PageHeader page;
- ItemId lp;
- HeapTuple tuple;
+ PageHeader page;
+ ItemId lp;
+ HeapTuple tuple;
sequence_magic *sm;
SequenceTupleForm seq;
@@ -362,12 +362,12 @@ read_info(char *caller, SeqTable elm, Buffer * buf)
}
-static SeqTable
+static SeqTable
init_sequence(char *caller, char *name)
{
- SeqTable elm,
- priv = (SeqTable) NULL;
- SeqTable temp;
+ SeqTable elm,
+ priv = (SeqTable) NULL;
+ SeqTable temp;
for (elm = seqtab; elm != (SeqTable) NULL;)
{
@@ -436,8 +436,8 @@ init_sequence(char *caller, char *name)
void
CloseSequences(void)
{
- SeqTable elm;
- Relation rel;
+ SeqTable elm;
+ Relation rel;
ItsSequenceCreation = false;
@@ -461,17 +461,17 @@ CloseSequences(void)
static void
init_params(CreateSeqStmt * seq, SequenceTupleForm new)
{
- DefElem *last_value = NULL;
- DefElem *increment_by = NULL;
- DefElem *max_value = NULL;
- DefElem *min_value = NULL;
- DefElem *cache_value = NULL;
- List *option;
+ DefElem *last_value = NULL;
+ DefElem *increment_by = NULL;
+ DefElem *max_value = NULL;
+ DefElem *min_value = NULL;
+ DefElem *cache_value = NULL;
+ List *option;
new->is_cycled = 'f';
foreach(option, seq->options)
{
- DefElem *defel = (DefElem *) lfirst(option);
+ DefElem *defel = (DefElem *) lfirst(option);
if (!strcasecmp(defel->defname, "increment"))
increment_by = defel;
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 53ab1838cfe..e25c955d8d7 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -32,36 +32,36 @@
#include "utils/syscache.h"
#endif
-TriggerData *CurrentTriggerData = NULL;
+TriggerData *CurrentTriggerData = NULL;
-void RelationBuildTriggers(Relation relation);
-void FreeTriggerDesc(Relation relation);
+void RelationBuildTriggers(Relation relation);
+void FreeTriggerDesc(Relation relation);
-static void DescribeTrigger(TriggerDesc * trigdesc, Trigger * trigger);
+static void DescribeTrigger(TriggerDesc * trigdesc, Trigger * trigger);
-extern void fmgr_info(Oid procedureId, func_ptr * function, int *nargs);
+extern void fmgr_info(Oid procedureId, func_ptr * function, int *nargs);
extern GlobalMemory CacheCxt;
void
CreateTrigger(CreateTrigStmt * stmt)
{
- int16 tgtype;
- int16 tgattr[8] = {0};
- Datum values[Natts_pg_trigger];
- char nulls[Natts_pg_trigger];
- Relation rel;
- Relation tgrel;
- HeapScanDesc tgscan;
- ScanKeyData key;
- Relation relrdesc;
- HeapTuple tuple;
+ int16 tgtype;
+ int16 tgattr[8] = {0};
+ Datum values[Natts_pg_trigger];
+ char nulls[Natts_pg_trigger];
+ Relation rel;
+ Relation tgrel;
+ HeapScanDesc tgscan;
+ ScanKeyData key;
+ Relation relrdesc;
+ HeapTuple tuple;
ItemPointerData oldTID;
- Relation idescs[Num_pg_trigger_indices];
- Relation ridescs[Num_pg_class_indices];
- MemoryContext oldcxt;
- Oid fargtypes[8];
- int found = 0;
- int i;
+ Relation idescs[Num_pg_trigger_indices];
+ Relation ridescs[Num_pg_class_indices];
+ MemoryContext oldcxt;
+ Oid fargtypes[8];
+ int found = 0;
+ int i;
if (IsSystemRelationName(stmt->relname))
elog(WARN, "CreateTrigger: can't create trigger for system relation %s", stmt->relname);
@@ -86,24 +86,24 @@ CreateTrigger(CreateTrigStmt * stmt)
{
switch (stmt->actions[i])
{
- case 'i':
- if (TRIGGER_FOR_INSERT(tgtype))
- elog(WARN, "CreateTrigger: double INSERT event specified");
- TRIGGER_SETT_INSERT(tgtype);
- break;
- case 'd':
- if (TRIGGER_FOR_DELETE(tgtype))
- elog(WARN, "CreateTrigger: double DELETE event specified");
- TRIGGER_SETT_DELETE(tgtype);
- break;
- case 'u':
- if (TRIGGER_FOR_UPDATE(tgtype))
- elog(WARN, "CreateTrigger: double UPDATE event specified");
- TRIGGER_SETT_UPDATE(tgtype);
- break;
- default:
- elog(WARN, "CreateTrigger: unknown event specified");
- break;
+ case 'i':
+ if (TRIGGER_FOR_INSERT(tgtype))
+ elog(WARN, "CreateTrigger: double INSERT event specified");
+ TRIGGER_SETT_INSERT(tgtype);
+ break;
+ case 'd':
+ if (TRIGGER_FOR_DELETE(tgtype))
+ elog(WARN, "CreateTrigger: double DELETE event specified");
+ TRIGGER_SETT_DELETE(tgtype);
+ break;
+ case 'u':
+ if (TRIGGER_FOR_UPDATE(tgtype))
+ elog(WARN, "CreateTrigger: double UPDATE event specified");
+ TRIGGER_SETT_UPDATE(tgtype);
+ break;
+ default:
+ elog(WARN, "CreateTrigger: unknown event specified");
+ break;
}
}
@@ -145,14 +145,14 @@ CreateTrigger(CreateTrigStmt * stmt)
values[Anum_pg_trigger_tgtype - 1] = Int16GetDatum(tgtype);
if (stmt->args)
{
- List *le;
- char *args;
- int16 nargs = length(stmt->args);
- int len = 0;
+ List *le;
+ char *args;
+ int16 nargs = length(stmt->args);
+ int len = 0;
foreach(le, stmt->args)
{
- char *ar = (char *) lfirst(le);
+ char *ar = (char *) lfirst(le);
len += strlen(ar) + 4;
}
@@ -213,17 +213,17 @@ CreateTrigger(CreateTrigStmt * stmt)
void
DropTrigger(DropTrigStmt * stmt)
{
- Relation rel;
- Relation tgrel;
- HeapScanDesc tgscan;
- ScanKeyData key;
- Relation relrdesc;
- HeapTuple tuple;
+ Relation rel;
+ Relation tgrel;
+ HeapScanDesc tgscan;
+ ScanKeyData key;
+ Relation relrdesc;
+ HeapTuple tuple;
ItemPointerData oldTID;
- Relation ridescs[Num_pg_class_indices];
- MemoryContext oldcxt;
- int found = 0;
- int tgfound = 0;
+ Relation ridescs[Num_pg_class_indices];
+ MemoryContext oldcxt;
+ int found = 0;
+ int tgfound = 0;
#ifndef NO_SECURITY
if (!pg_ownercheck(GetPgUserName(), stmt->relname, RELNAME))
@@ -295,10 +295,10 @@ DropTrigger(DropTrigStmt * stmt)
void
RelationRemoveTriggers(Relation rel)
{
- Relation tgrel;
- HeapScanDesc tgscan;
- ScanKeyData key;
- HeapTuple tup;
+ Relation tgrel;
+ HeapScanDesc tgscan;
+ ScanKeyData key;
+ HeapTuple tup;
tgrel = heap_openr(TriggerRelationName);
RelationSetLockForWrite(tgrel);
@@ -319,22 +319,22 @@ RelationRemoveTriggers(Relation rel)
void
RelationBuildTriggers(Relation relation)
{
- TriggerDesc *trigdesc = (TriggerDesc *) palloc(sizeof(TriggerDesc));
- int ntrigs = relation->rd_rel->reltriggers;
- Trigger *triggers = NULL;
- Trigger *build;
- Relation tgrel;
+ TriggerDesc *trigdesc = (TriggerDesc *) palloc(sizeof(TriggerDesc));
+ int ntrigs = relation->rd_rel->reltriggers;
+ Trigger *triggers = NULL;
+ Trigger *build;
+ Relation tgrel;
Form_pg_trigger pg_trigger;
- Relation irel;
- ScanKeyData skey;
- HeapTuple tuple;
- IndexScanDesc sd;
+ Relation irel;
+ ScanKeyData skey;
+ HeapTuple tuple;
+ IndexScanDesc sd;
RetrieveIndexResult indexRes;
- Buffer buffer;
- ItemPointer iptr;
+ Buffer buffer;
+ ItemPointer iptr;
struct varlena *val;
- bool isnull;
- int found;
+ bool isnull;
+ int found;
memset(trigdesc, 0, sizeof(TriggerDesc));
@@ -386,8 +386,8 @@ RelationBuildTriggers(Relation relation)
NAMEDATALEN, relation->rd_rel->relname.data);
if (build->tgnargs > 0)
{
- char *p;
- int i;
+ char *p;
+ int i;
val = (struct varlena *) fastgetattr(tuple,
Anum_pg_trigger_tgargs,
@@ -437,10 +437,10 @@ RelationBuildTriggers(Relation relation)
void
FreeTriggerDesc(Relation relation)
{
- TriggerDesc *trigdesc = relation->trigdesc;
- Trigger ***t;
- Trigger *trigger;
- int i;
+ TriggerDesc *trigdesc = relation->trigdesc;
+ Trigger ***t;
+ Trigger *trigger;
+ int i;
if (trigdesc == NULL)
return;
@@ -483,9 +483,9 @@ FreeTriggerDesc(Relation relation)
static void
DescribeTrigger(TriggerDesc * trigdesc, Trigger * trigger)
{
- uint16 *n;
- Trigger ***t,
- ***tp;
+ uint16 *n;
+ Trigger ***t,
+ ***tp;
if (TRIGGER_FOR_ROW(trigger->tgtype)) /* Is ROW/STATEMENT
* trigger */
@@ -557,11 +557,11 @@ DescribeTrigger(TriggerDesc * trigdesc, Trigger * trigger)
HeapTuple
ExecBRInsertTriggers(Relation rel, HeapTuple tuple)
{
- int ntrigs = rel->trigdesc->n_before_row[TRIGGER_EVENT_INSERT];
- Trigger **trigger = rel->trigdesc->tg_before_row[TRIGGER_EVENT_INSERT];
- HeapTuple newtuple = tuple;
- int nargs;
- int i;
+ int ntrigs = rel->trigdesc->n_before_row[TRIGGER_EVENT_INSERT];
+ Trigger **trigger = rel->trigdesc->tg_before_row[TRIGGER_EVENT_INSERT];
+ HeapTuple newtuple = tuple;
+ int nargs;
+ int i;
CurrentTriggerData = (TriggerData *) palloc(sizeof(TriggerData));
CurrentTriggerData->tg_event = TRIGGER_EVENT_INSERT | TRIGGER_EVENT_ROW;
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 30690f0f32b..66fbbd5db2b 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.43 1997/09/07 04:41:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.44 1997/09/08 02:22:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,11 +56,11 @@
#include <port-protos.h>
-bool VacuumRunning = false;
+bool VacuumRunning = false;
-static Portal vc_portal;
+static Portal vc_portal;
-static int MESSAGE_LEVEL; /* message level */
+static int MESSAGE_LEVEL; /* message level */
#define swapLong(a,b) {long tmp; tmp=a; a=b; b=tmp;}
#define swapInt(a,b) {int tmp; tmp=a; a=b; b=tmp;}
@@ -72,46 +72,46 @@ static int MESSAGE_LEVEL; /* message level */
/* non-export function prototypes */
-static void vc_init(void);
-static void vc_shutdown(void);
-static void vc_vacuum(NameData * VacRelP, bool analyze, List * va_cols);
+static void vc_init(void);
+static void vc_shutdown(void);
+static void vc_vacuum(NameData * VacRelP, bool analyze, List * va_cols);
static VRelList vc_getrels(NameData * VacRelP);
-static void vc_vacone(Oid relid, bool analyze, List * va_cols);
-static void vc_scanheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl, VPageList Fvpl);
-static void vc_rpfheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl, VPageList Fvpl, int nindices, Relation * Irel);
-static void vc_vacheap(VRelStats * vacrelstats, Relation onerel, VPageList vpl);
-static void vc_vacpage(Page page, VPageDescr vpd, Relation archrel);
-static void vc_vaconeind(VPageList vpl, Relation indrel, int nhtups);
-static void vc_scanoneind(Relation indrel, int nhtups);
-static void vc_attrstats(Relation onerel, VRelStats * vacrelstats, HeapTuple htup);
-static void vc_bucketcpy(AttributeTupleForm attr, Datum value, Datum * bucket, int16 * bucket_len);
-static void vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrelstats);
-static void vc_delhilowstats(Oid relid, int attcnt, int *attnums);
-static void vc_setpagelock(Relation rel, BlockNumber blkno);
+static void vc_vacone(Oid relid, bool analyze, List * va_cols);
+static void vc_scanheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl, VPageList Fvpl);
+static void vc_rpfheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl, VPageList Fvpl, int nindices, Relation * Irel);
+static void vc_vacheap(VRelStats * vacrelstats, Relation onerel, VPageList vpl);
+static void vc_vacpage(Page page, VPageDescr vpd, Relation archrel);
+static void vc_vaconeind(VPageList vpl, Relation indrel, int nhtups);
+static void vc_scanoneind(Relation indrel, int nhtups);
+static void vc_attrstats(Relation onerel, VRelStats * vacrelstats, HeapTuple htup);
+static void vc_bucketcpy(AttributeTupleForm attr, Datum value, Datum * bucket, int16 * bucket_len);
+static void vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrelstats);
+static void vc_delhilowstats(Oid relid, int attcnt, int *attnums);
+static void vc_setpagelock(Relation rel, BlockNumber blkno);
static VPageDescr vc_tidreapped(ItemPointer itemptr, VPageList vpl);
-static void vc_reappage(VPageList vpl, VPageDescr vpc);
-static void vc_vpinsert(VPageList vpl, VPageDescr vpnew);
-static void vc_free(VRelList vrl);
-static void vc_getindices(Oid relid, int *nindices, Relation ** Irel);
-static void vc_clsindices(int nindices, Relation * Irel);
+static void vc_reappage(VPageList vpl, VPageDescr vpc);
+static void vc_vpinsert(VPageList vpl, VPageDescr vpnew);
+static void vc_free(VRelList vrl);
+static void vc_getindices(Oid relid, int *nindices, Relation ** Irel);
+static void vc_clsindices(int nindices, Relation * Irel);
static Relation vc_getarchrel(Relation heaprel);
-static void vc_archive(Relation archrel, HeapTuple htup);
-static bool vc_isarchrel(char *rname);
-static void vc_mkindesc(Relation onerel, int nindices, Relation * Irel, IndDesc ** Idesc);
-static char *vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, char *));
-static int vc_cmp_blk(char *left, char *right);
-static int vc_cmp_offno(char *left, char *right);
-static bool vc_enough_space(VPageDescr vpd, Size len);
+static void vc_archive(Relation archrel, HeapTuple htup);
+static bool vc_isarchrel(char *rname);
+static void vc_mkindesc(Relation onerel, int nindices, Relation * Irel, IndDesc ** Idesc);
+static char *vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, char *));
+static int vc_cmp_blk(char *left, char *right);
+static int vc_cmp_offno(char *left, char *right);
+static bool vc_enough_space(VPageDescr vpd, Size len);
void
vacuum(char *vacrel, bool verbose, bool analyze, List * va_spec)
{
- char *pname;
- MemoryContext old;
+ char *pname;
+ MemoryContext old;
PortalVariableMemory pmem;
- NameData VacRel;
- List *le;
- List *va_cols = NIL;
+ NameData VacRel;
+ List *le;
+ List *va_cols = NIL;
/*
* Create a portal for safe memory across transctions. We need to
@@ -139,8 +139,8 @@ vacuum(char *vacrel, bool verbose, bool analyze, List * va_spec)
Assert(va_spec == NIL || analyze);
foreach(le, va_spec)
{
- char *col = (char *) lfirst(le);
- char *dest;
+ char *col = (char *) lfirst(le);
+ char *dest;
dest = (char *) palloc(strlen(col) + 1);
strcpy(dest, col);
@@ -183,7 +183,7 @@ vacuum(char *vacrel, bool verbose, bool analyze, List * va_spec)
static void
vc_init()
{
- int fd;
+ int fd;
if ((fd = open("pg_vlock", O_CREAT | O_EXCL, 0600)) < 0)
elog(WARN, "can't create lock file -- another vacuum cleaner running?");
@@ -238,8 +238,8 @@ vc_abort()
static void
vc_vacuum(NameData * VacRelP, bool analyze, List * va_cols)
{
- VRelList vrl,
- cur;
+ VRelList vrl,
+ cur;
/* get list of relations */
vrl = vc_getrels(VacRelP);
@@ -254,25 +254,25 @@ vc_vacuum(NameData * VacRelP, bool analyze, List * va_cols)
vc_free(vrl);
}
-static VRelList
+static VRelList
vc_getrels(NameData * VacRelP)
{
- Relation pgclass;
- TupleDesc pgcdesc;
- HeapScanDesc pgcscan;
- HeapTuple pgctup;
- Buffer buf;
+ Relation pgclass;
+ TupleDesc pgcdesc;
+ HeapScanDesc pgcscan;
+ HeapTuple pgctup;
+ Buffer buf;
PortalVariableMemory portalmem;
- MemoryContext old;
- VRelList vrl,
- cur;
- Datum d;
- char *rname;
- char rkind;
- int16 smgrno;
- bool n;
- ScanKeyData pgckey;
- bool found = false;
+ MemoryContext old;
+ VRelList vrl,
+ cur;
+ Datum d;
+ char *rname;
+ char rkind;
+ int16 smgrno;
+ bool n;
+ ScanKeyData pgckey;
+ bool found = false;
StartTransactionCommand();
@@ -404,23 +404,23 @@ vc_getrels(NameData * VacRelP)
static void
vc_vacone(Oid relid, bool analyze, List * va_cols)
{
- Relation pgclass;
- TupleDesc pgcdesc;
- HeapTuple pgctup,
- pgttup;
- Buffer pgcbuf;
- HeapScanDesc pgcscan;
- Relation onerel;
- ScanKeyData pgckey;
- VPageListData Vvpl; /* List of pages to vacuum and/or clean
+ Relation pgclass;
+ TupleDesc pgcdesc;
+ HeapTuple pgctup,
+ pgttup;
+ Buffer pgcbuf;
+ HeapScanDesc pgcscan;
+ Relation onerel;
+ ScanKeyData pgckey;
+ VPageListData Vvpl; /* List of pages to vacuum and/or clean
* indices */
- VPageListData Fvpl; /* List of pages with space enough for
+ VPageListData Fvpl; /* List of pages with space enough for
* re-using */
- VPageDescr *vpp;
- Relation *Irel;
- int32 nindices,
- i;
- VRelStats *vacrelstats;
+ VPageDescr *vpp;
+ Relation *Irel;
+ int32 nindices,
+ i;
+ VRelStats *vacrelstats;
StartTransactionCommand();
@@ -454,8 +454,8 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
vacrelstats->hasindex = false;
if (analyze && !IsSystemRelationName((RelationGetRelationName(onerel))->data))
{
- int attr_cnt,
- *attnums = NULL;
+ int attr_cnt,
+ *attnums = NULL;
AttributeTupleForm *attr;
attr_cnt = onerel->rd_att->natts;
@@ -463,8 +463,8 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
if (va_cols != NIL)
{
- int tcnt = 0;
- List *le;
+ int tcnt = 0;
+ List *le;
if (length(va_cols) > attr_cnt)
elog(WARN, "vacuum: too many attributes specified for relation %s",
@@ -472,7 +472,7 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
attnums = (int *) palloc(attr_cnt * sizeof(int));
foreach(le, va_cols)
{
- char *col = (char *) lfirst(le);
+ char *col = (char *) lfirst(le);
for (i = 0; i < attr_cnt; i++)
{
@@ -495,9 +495,9 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
for (i = 0; i < attr_cnt; i++)
{
- Operator func_operator;
+ Operator func_operator;
OperatorTupleForm pgopform;
- VacAttrStats *stats;
+ VacAttrStats *stats;
stats = &vacrelstats->vacattrstats[i];
stats->attr = palloc(ATTRIBUTE_TUPLE_SIZE);
@@ -513,7 +513,7 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
func_operator = oper("=", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL)
{
- int nargs;
+ int nargs;
pgopform = (OperatorTupleForm) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmpeq), &nargs);
@@ -524,7 +524,7 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
func_operator = oper("<", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL)
{
- int nargs;
+ int nargs;
pgopform = (OperatorTupleForm) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmplt), &nargs);
@@ -535,7 +535,7 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
func_operator = oper(">", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL)
{
- int nargs;
+ int nargs;
pgopform = (OperatorTupleForm) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmpgt), &nargs);
@@ -642,39 +642,39 @@ static void
vc_scanheap(VRelStats * vacrelstats, Relation onerel,
VPageList Vvpl, VPageList Fvpl)
{
- int nblocks,
- blkno;
- ItemId itemid;
- ItemPointer itemptr;
- HeapTuple htup;
- Buffer buf;
- Page page,
- tempPage = NULL;
- OffsetNumber offnum,
- maxoff;
- bool pgchanged,
- tupgone,
- dobufrel,
- notup;
- char *relname;
- VPageDescr vpc,
- vp;
- uint32 nvac,
- ntups,
- nunused,
- ncrash,
- nempg,
- nnepg,
- nchpg,
- nemend;
- Size frsize,
- frsusf;
- Size min_tlen = MAXTUPLEN;
- Size max_tlen = 0;
- int32 i /* , attr_cnt */ ;
- struct rusage ru0,
- ru1;
- bool do_shrinking = true;
+ int nblocks,
+ blkno;
+ ItemId itemid;
+ ItemPointer itemptr;
+ HeapTuple htup;
+ Buffer buf;
+ Page page,
+ tempPage = NULL;
+ OffsetNumber offnum,
+ maxoff;
+ bool pgchanged,
+ tupgone,
+ dobufrel,
+ notup;
+ char *relname;
+ VPageDescr vpc,
+ vp;
+ uint32 nvac,
+ ntups,
+ nunused,
+ ncrash,
+ nempg,
+ nnepg,
+ nchpg,
+ nemend;
+ Size frsize,
+ frsusf;
+ Size min_tlen = MAXTUPLEN;
+ Size max_tlen = 0;
+ int32 i /* , attr_cnt */ ;
+ struct rusage ru0,
+ ru1;
+ bool do_shrinking = true;
getrusage(RUSAGE_SELF, &ru0);
@@ -844,11 +844,11 @@ DELETE_TRANSACTION_ID_VALID %d, TUPGONE %d.",
if (tupgone)
{
- ItemId lpp;
+ ItemId lpp;
if (tempPage == (Page) NULL)
{
- Size pageSize;
+ Size pageSize;
pageSize = PageGetPageSize(page);
tempPage = (Page) palloc(pageSize);
@@ -927,7 +927,7 @@ DELETE_TRANSACTION_ID_VALID %d, TUPGONE %d.",
*/
if (do_shrinking && Vvpl->vpl_npages - nemend > 0)
{
- int nusf; /* blocks usefull for re-using */
+ int nusf; /* blocks usefull for re-using */
nusf = Vvpl->vpl_npages - nemend;
if ((Vvpl->vpl_pgdesc[nusf - 1])->vpd_blkno == nblocks - nemend - 1)
@@ -972,50 +972,50 @@ static void
vc_rpfheap(VRelStats * vacrelstats, Relation onerel,
VPageList Vvpl, VPageList Fvpl, int nindices, Relation * Irel)
{
- TransactionId myXID;
- CommandId myCID;
- AbsoluteTime myCTM = 0;
- Buffer buf,
- ToBuf;
- int nblocks,
- blkno;
- Page page,
- ToPage = NULL;
- OffsetNumber offnum = 0,
- maxoff = 0,
- newoff,
- moff;
- ItemId itemid,
- newitemid;
- HeapTuple htup,
- newtup;
- TupleDesc tupdesc = NULL;
- Datum *idatum = NULL;
- char *inulls = NULL;
+ TransactionId myXID;
+ CommandId myCID;
+ AbsoluteTime myCTM = 0;
+ Buffer buf,
+ ToBuf;
+ int nblocks,
+ blkno;
+ Page page,
+ ToPage = NULL;
+ OffsetNumber offnum = 0,
+ maxoff = 0,
+ newoff,
+ moff;
+ ItemId itemid,
+ newitemid;
+ HeapTuple htup,
+ newtup;
+ TupleDesc tupdesc = NULL;
+ Datum *idatum = NULL;
+ char *inulls = NULL;
InsertIndexResult iresult;
- VPageListData Nvpl;
- VPageDescr ToVpd = NULL,
- Fvplast,
- Vvplast,
- vpc,
- *vpp;
- int ToVpI = 0;
- IndDesc *Idesc,
- *idcur;
- int Fblklast,
- Vblklast,
- i;
- Size tlen;
- int nmoved,
- Fnpages,
- Vnpages;
- int nchkmvd,
- ntups;
- bool isempty,
- dowrite;
- Relation archrel;
- struct rusage ru0,
- ru1;
+ VPageListData Nvpl;
+ VPageDescr ToVpd = NULL,
+ Fvplast,
+ Vvplast,
+ vpc,
+ *vpp;
+ int ToVpI = 0;
+ IndDesc *Idesc,
+ *idcur;
+ int Fblklast,
+ Vblklast,
+ i;
+ Size tlen;
+ int nmoved,
+ Fnpages,
+ Vnpages;
+ int nchkmvd,
+ ntups;
+ bool isempty,
+ dowrite;
+ Relation archrel;
+ struct rusage ru0,
+ ru1;
getrusage(RUSAGE_SELF, &ru0);
@@ -1342,9 +1342,9 @@ Elapsed %u/%u sec.",
/* vacuum indices again if needed */
if (Irel != (Relation *) NULL)
{
- VPageDescr *vpleft,
- *vpright,
- vpsave;
+ VPageDescr *vpleft,
+ *vpright,
+ vpsave;
/* re-sort Nvpl.vpl_pgdesc */
for (vpleft = Nvpl.vpl_pgdesc,
@@ -1426,12 +1426,12 @@ Elapsed %u/%u sec.",
static void
vc_vacheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl)
{
- Buffer buf;
- Page page;
- VPageDescr *vpp;
- Relation archrel;
- int nblocks;
- int i;
+ Buffer buf;
+ Page page;
+ VPageDescr *vpp;
+ Relation archrel;
+ int nblocks;
+ int i;
nblocks = Vvpl->vpl_npages;
/* if the relation has an archive, open it */
@@ -1486,9 +1486,9 @@ vc_vacheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl)
static void
vc_vacpage(Page page, VPageDescr vpd, Relation archrel)
{
- ItemId itemid;
- HeapTuple htup;
- int i;
+ ItemId itemid;
+ HeapTuple htup;
+ int i;
Assert(vpd->vpd_nusd == 0);
for (i = 0; i < vpd->vpd_noff; i++)
@@ -1513,11 +1513,11 @@ static void
vc_scanoneind(Relation indrel, int nhtups)
{
RetrieveIndexResult res;
- IndexScanDesc iscan;
- int nitups;
- int nipages;
- struct rusage ru0,
- ru1;
+ IndexScanDesc iscan;
+ int nitups;
+ int nipages;
+ struct rusage ru0,
+ ru1;
getrusage(RUSAGE_SELF, &ru0);
@@ -1567,14 +1567,14 @@ static void
vc_vaconeind(VPageList vpl, Relation indrel, int nhtups)
{
RetrieveIndexResult res;
- IndexScanDesc iscan;
- ItemPointer heapptr;
- int nvac;
- int nitups;
- int nipages;
- VPageDescr vp;
- struct rusage ru0,
- ru1;
+ IndexScanDesc iscan;
+ ItemPointer heapptr;
+ int nvac;
+ int nitups;
+ int nipages;
+ VPageDescr vp;
+ struct rusage ru0,
+ ru1;
getrusage(RUSAGE_SELF, &ru0);
@@ -1639,14 +1639,14 @@ vc_vaconeind(VPageList vpl, Relation indrel, int nhtups)
*
* vpl->VPageDescr_array is sorted in right order.
*/
-static VPageDescr
+static VPageDescr
vc_tidreapped(ItemPointer itemptr, VPageList vpl)
{
- OffsetNumber ioffno;
- OffsetNumber *voff;
- VPageDescr vp,
- *vpp;
- VPageDescrData vpd;
+ OffsetNumber ioffno;
+ OffsetNumber *voff;
+ VPageDescr vp,
+ *vpp;
+ VPageDescrData vpd;
vpd.vpd_blkno = ItemPointerGetBlockNumber(itemptr);
ioffno = ItemPointerGetOffsetNumber(itemptr);
@@ -1702,17 +1702,17 @@ vc_tidreapped(ItemPointer itemptr, VPageList vpl)
static void
vc_attrstats(Relation onerel, VRelStats * vacrelstats, HeapTuple htup)
{
- int i,
- attr_cnt = vacrelstats->va_natts;
- VacAttrStats *vacattrstats = vacrelstats->vacattrstats;
- TupleDesc tupDesc = onerel->rd_att;
- Datum value;
- bool isnull;
+ int i,
+ attr_cnt = vacrelstats->va_natts;
+ VacAttrStats *vacattrstats = vacrelstats->vacattrstats;
+ TupleDesc tupDesc = onerel->rd_att;
+ Datum value;
+ bool isnull;
for (i = 0; i < attr_cnt; i++)
{
- VacAttrStats *stats = &vacattrstats[i];
- bool value_hit = true;
+ VacAttrStats *stats = &vacattrstats[i];
+ bool value_hit = true;
value = (Datum) heap_getattr(htup, InvalidBuffer,
stats->attr->attnum, tupDesc, &isnull);
@@ -1806,7 +1806,7 @@ vc_bucketcpy(AttributeTupleForm attr, Datum value, Datum * bucket, int16 * bucke
*bucket = value;
else
{
- int len = (attr->attlen != -1 ? attr->attlen : VARSIZE(value));
+ int len = (attr->attlen != -1 ? attr->attlen : VARSIZE(value));
if (len > *bucket_len)
{
@@ -1833,20 +1833,20 @@ vc_bucketcpy(AttributeTupleForm attr, Datum value, Datum * bucket, int16 * bucke
static void
vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrelstats)
{
- Relation rd,
- ad,
- sd;
- HeapScanDesc rsdesc,
- asdesc;
- TupleDesc sdesc;
- HeapTuple rtup,
- atup,
- stup;
- Buffer rbuf,
- abuf;
- Form_pg_class pgcform;
- ScanKeyData rskey,
- askey;
+ Relation rd,
+ ad,
+ sd;
+ HeapScanDesc rsdesc,
+ asdesc;
+ TupleDesc sdesc;
+ HeapTuple rtup,
+ atup,
+ stup;
+ Buffer rbuf,
+ abuf;
+ Form_pg_class pgcform;
+ ScanKeyData rskey,
+ askey;
AttributeTupleForm attp;
/*
@@ -1872,8 +1872,8 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrels
if (vacrelstats != NULL && vacrelstats->va_natts > 0)
{
- VacAttrStats *vacattrstats = vacrelstats->vacattrstats;
- int natts = vacrelstats->va_natts;
+ VacAttrStats *vacattrstats = vacrelstats->vacattrstats;
+ int natts = vacrelstats->va_natts;
ad = heap_openr(AttributeRelationName);
sd = heap_openr(StatisticRelationName);
@@ -1884,12 +1884,12 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrels
while (HeapTupleIsValid(atup = heap_getnext(asdesc, 0, &abuf)))
{
- int i;
- float32data selratio; /* average ratio of rows selected
+ int i;
+ float32data selratio; /* average ratio of rows selected
* for a random constant */
- VacAttrStats *stats;
- Datum values[Natts_pg_statistic];
- char nulls[Natts_pg_statistic];
+ VacAttrStats *stats;
+ Datum values[Natts_pg_statistic];
+ char nulls[Natts_pg_statistic];
attp = (AttributeTupleForm) GETSTRUCT(atup);
if (attp->attnum <= 0) /* skip system attributes for now, */
@@ -1916,18 +1916,18 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrels
selratio = 0;
else if (VacAttrStatsLtGtValid(stats) && stats->min_cnt + stats->max_cnt == stats->nonnull_cnt)
{
- double min_cnt_d = stats->min_cnt,
- max_cnt_d = stats->max_cnt,
- null_cnt_d = stats->null_cnt,
- nonnullcnt_d = stats->nonnull_cnt; /* prevent overflow */
+ double min_cnt_d = stats->min_cnt,
+ max_cnt_d = stats->max_cnt,
+ null_cnt_d = stats->null_cnt,
+ nonnullcnt_d = stats->nonnull_cnt; /* prevent overflow */
selratio = (min_cnt_d * min_cnt_d + max_cnt_d * max_cnt_d + null_cnt_d * null_cnt_d) /
(nonnullcnt_d + null_cnt_d) / (nonnullcnt_d + null_cnt_d);
}
else
{
- double most = (double) (stats->best_cnt > stats->null_cnt ? stats->best_cnt : stats->null_cnt);
- double total = ((double) stats->nonnull_cnt) + ((double) stats->null_cnt);
+ double most = (double) (stats->best_cnt > stats->null_cnt ? stats->best_cnt : stats->null_cnt);
+ double total = ((double) stats->nonnull_cnt) + ((double) stats->null_cnt);
/*
* we assume count of other values are 20% of best
@@ -1948,12 +1948,12 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrels
*/
if (VacAttrStatsLtGtValid(stats) && stats->initialized /* &&
* !IsSystemRelationName(
- * pgcform->relname.data)
- */ )
+ *
+ pgcform->relname.data) */ )
{
- func_ptr out_function;
- char *out_string;
- int dummy;
+ func_ptr out_function;
+ char *out_string;
+ int dummy;
for (i = 0; i < Natts_pg_statistic; ++i)
nulls[i] = ' ';
@@ -2016,10 +2016,10 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrels
static void
vc_delhilowstats(Oid relid, int attcnt, int *attnums)
{
- Relation pgstatistic;
- HeapScanDesc pgsscan;
- HeapTuple pgstup;
- ScanKeyData pgskey;
+ Relation pgstatistic;
+ HeapScanDesc pgsscan;
+ HeapTuple pgstup;
+ ScanKeyData pgskey;
pgstatistic = heap_openr(StatisticRelationName);
@@ -2038,7 +2038,7 @@ vc_delhilowstats(Oid relid, int attcnt, int *attnums)
if (attcnt > 0)
{
Form_pg_statistic pgs = (Form_pg_statistic) GETSTRUCT(pgstup);
- int i;
+ int i;
for (i = 0; i < attcnt; i++)
{
@@ -2075,7 +2075,7 @@ vc_setpagelock(Relation rel, BlockNumber blkno)
static void
vc_reappage(VPageList vpl, VPageDescr vpc)
{
- VPageDescr newvpd;
+ VPageDescr newvpd;
/* allocate a VPageDescrData entry */
newvpd = (VPageDescr) palloc(sizeof(VPageDescrData) + vpc->vpd_noff * sizeof(OffsetNumber));
@@ -2110,8 +2110,8 @@ vc_vpinsert(VPageList vpl, VPageDescr vpnew)
static void
vc_free(VRelList vrl)
{
- VRelList p_vrl;
- MemoryContext old;
+ VRelList p_vrl;
+ MemoryContext old;
PortalVariableMemory pmem;
pmem = PortalGetVariableMemory(vc_portal);
@@ -2138,11 +2138,11 @@ vc_free(VRelList vrl)
#define ARCHIVE_PREFIX "a,"
-static Relation
+static Relation
vc_getarchrel(Relation heaprel)
{
- Relation archrel;
- char *archrelname;
+ Relation archrel;
+ char *archrelname;
archrelname = palloc(sizeof(ARCHIVE_PREFIX) + NAMEDATALEN); /* bogus */
sprintf(archrelname, "%s%d", ARCHIVE_PREFIX, heaprel->rd_id);
@@ -2165,7 +2165,7 @@ vc_archive(Relation archrel, HeapTuple htup)
doinsert(archrel, htup);
}
-static bool
+static bool
vc_isarchrel(char *rname)
{
if (strncmp(ARCHIVE_PREFIX, rname, strlen(ARCHIVE_PREFIX)) == 0)
@@ -2174,14 +2174,14 @@ vc_isarchrel(char *rname)
return (false);
}
-static char *
+static char *
vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, char *))
{
- int res;
- int last = nelem - 1;
- int celm = nelem / 2;
- bool last_move,
- first_move;
+ int res;
+ int last = nelem - 1;
+ int celm = nelem / 2;
+ bool last_move,
+ first_move;
last_move = first_move = true;
for (;;)
@@ -2231,8 +2231,8 @@ vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, cha
static int
vc_cmp_blk(char *left, char *right)
{
- BlockNumber lblk,
- rblk;
+ BlockNumber lblk,
+ rblk;
lblk = (*((VPageDescr *) left))->vpd_blkno;
rblk = (*((VPageDescr *) right))->vpd_blkno;
@@ -2261,17 +2261,17 @@ vc_cmp_offno(char *left, char *right)
static void
vc_getindices(Oid relid, int *nindices, Relation ** Irel)
{
- Relation pgindex;
- Relation irel;
- TupleDesc pgidesc;
- HeapTuple pgitup;
- HeapScanDesc pgiscan;
- Datum d;
- int i,
- k;
- bool n;
- ScanKeyData pgikey;
- Oid *ioid;
+ Relation pgindex;
+ Relation irel;
+ TupleDesc pgidesc;
+ HeapTuple pgitup;
+ HeapScanDesc pgiscan;
+ Datum d;
+ int i,
+ k;
+ bool n;
+ ScanKeyData pgikey;
+ Oid *ioid;
*nindices = i = 0;
@@ -2354,11 +2354,11 @@ vc_clsindices(int nindices, Relation * Irel)
static void
vc_mkindesc(Relation onerel, int nindices, Relation * Irel, IndDesc ** Idesc)
{
- IndDesc *idcur;
- HeapTuple pgIndexTup;
- AttrNumber *attnumP;
- int natts;
- int i;
+ IndDesc *idcur;
+ HeapTuple pgIndexTup;
+ AttrNumber *attnumP;
+ int natts;
+ int i;
*Idesc = (IndDesc *) palloc(nindices * sizeof(IndDesc));
@@ -2390,7 +2390,7 @@ vc_mkindesc(Relation onerel, int nindices, Relation * Irel, IndDesc ** Idesc)
} /* vc_mkindesc */
-static bool
+static bool
vc_enough_space(VPageDescr vpd, Size len)
{
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index 99439de9ce3..c4f411021ad 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.9 1997/09/07 04:41:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.10 1997/09/08 02:22:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,13 +44,13 @@
static void
DefineVirtualRelation(char *relname, List * tlist)
{
- CreateStmt createStmt;
- List *attrList,
- *t;
- TargetEntry *entry;
- Resdom *res;
- char *resname;
- char *restypename;
+ CreateStmt createStmt;
+ List *attrList,
+ *t;
+ TargetEntry *entry;
+ Resdom *res;
+ char *resname;
+ char *restypename;
/*
* create a list with one entry per attribute of this relation. Each
@@ -63,8 +63,8 @@ DefineVirtualRelation(char *relname, List * tlist)
{
foreach(t, tlist)
{
- ColumnDef *def = makeNode(ColumnDef);
- TypeName *typename;
+ ColumnDef *def = makeNode(ColumnDef);
+ TypeName *typename;
/*
* find the names of the attribute & its type
@@ -123,7 +123,7 @@ DefineVirtualRelation(char *relname, List * tlist)
* XXX it also means viewName cannot be 16 chars long! - ay 11/94
*------------------------------------------------------------------
*/
-char *
+char *
MakeRetrieveViewRuleName(char *viewName)
{
/*
@@ -135,7 +135,7 @@ MakeRetrieveViewRuleName(char *viewName)
namestrcpy(rule_name, buf);
*/
- char *buf;
+ char *buf;
buf = palloc(strlen(viewName) + 5);
sprintf(buf, "_RET%s", viewName);
@@ -145,9 +145,9 @@ MakeRetrieveViewRuleName(char *viewName)
static RuleStmt *
FormViewRetrieveRule(char *viewName, Query * viewParse)
{
- RuleStmt *rule;
- char *rname;
- Attr *attr;
+ RuleStmt *rule;
+ char *rname;
+ Attr *attr;
/*
* Create a RuleStmt that corresponds to the suitable rewrite rule
@@ -172,12 +172,12 @@ FormViewRetrieveRule(char *viewName, Query * viewParse)
static void
DefineViewRules(char *viewName, Query * viewParse)
{
- RuleStmt *retrieve_rule = NULL;
+ RuleStmt *retrieve_rule = NULL;
#ifdef NOTYET
- RuleStmt *replace_rule = NULL;
- RuleStmt *append_rule = NULL;
- RuleStmt *delete_rule = NULL;
+ RuleStmt *replace_rule = NULL;
+ RuleStmt *append_rule = NULL;
+ RuleStmt *delete_rule = NULL;
#endif
@@ -226,10 +226,10 @@ DefineViewRules(char *viewName, Query * viewParse)
static void
UpdateRangeTableOfViewParse(char *viewName, Query * viewParse)
{
- List *old_rt;
- List *new_rt;
- RangeTblEntry *rt_entry1,
- *rt_entry2;
+ List *old_rt;
+ List *new_rt;
+ RangeTblEntry *rt_entry1,
+ *rt_entry2;
/*
* first offset all var nodes by 2
@@ -277,7 +277,7 @@ UpdateRangeTableOfViewParse(char *viewName, Query * viewParse)
void
DefineView(char *viewName, Query * viewParse)
{
- List *viewTlist;
+ List *viewTlist;
viewTlist = viewParse->targetList;
@@ -313,7 +313,7 @@ DefineView(char *viewName, Query * viewParse)
void
RemoveView(char *viewName)
{
- char *rname;
+ char *rname;
/*
* first remove all the "view" rules... Currently we only have one!