Commit 0686d49d authored by Bruce Momjian's avatar Bruce Momjian

Remove dashes in comments that don't need them, rewrap with pgindent.

parent 9e155260
/* -------------------------------------------------------------------------
* pg_dumplo
*
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_export.c,v 1.6 2001/03/22 03:59:10 momjian Exp $
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_export.c,v 1.7 2001/03/22 06:16:06 momjian Exp $
*
* Karel Zak 1999-2000
* -------------------------------------------------------------------------
......@@ -32,7 +32,7 @@ load_lolist(LODumpMaster * pgLO)
int i;
int n;
/* ----------
/*
* Now find any candidate tables who have columns of type oid.
*
* NOTE: System tables including pg_largeobject will be ignored.
......@@ -40,7 +40,6 @@ load_lolist(LODumpMaster * pgLO)
*
* NOTE: the system oid column is ignored, as it has attnum < 1.
* This shouldn't matter for correctness, but it saves time.
* ----------
*/
pgLO->res = PQexec(pgLO->conn,
"SELECT c.relname, a.attname "
......@@ -109,9 +108,8 @@ pglo_export(LODumpMaster * pgLO)
for (ll = pgLO->lolist; ll->lo_table != NULL; ll++)
{
/* ----------
/*
* Query: find the LOs referenced by this column
* ----------
*/
sprintf(Qbuff, "SELECT DISTINCT l.loid FROM \"%s\" x, pg_largeobject l WHERE x.\"%s\" = l.loid",
ll->lo_table, ll->lo_attr);
......@@ -137,9 +135,8 @@ pglo_export(LODumpMaster * pgLO)
int t;
char *val;
/* ----------
/*
* Create DIR/FILE
* ----------
*/
if (pgLO->action != ACTION_SHOW)
{
......
/* -------------------------------------------------------------------------
* pg_dumplo
*
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_import.c,v 1.4 2001/03/22 03:59:10 momjian Exp $
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/lo_import.c,v 1.5 2001/03/22 06:16:06 momjian Exp $
*
* Karel Zak 1999-2000
* -------------------------------------------------------------------------
......@@ -50,9 +50,8 @@ pglo_import(LODumpMaster * pgLO)
sprintf(lo_path, "%s/%s", pgLO->space, path);
/* ----------
/*
* Import LO
* ----------
*/
if ((new_oid = lo_import(pgLO->conn, lo_path)) == 0)
{
......@@ -79,9 +78,8 @@ pglo_import(LODumpMaster * pgLO)
pgLO->counter++;
/* ----------
/*
* UPDATE oid in tab
* ----------
*/
sprintf(Qbuff, "UPDATE \"%s\" SET \"%s\"=%u WHERE \"%s\"=%u",
loa.lo_table, loa.lo_attr, new_oid, loa.lo_attr, loa.lo_oid);
......
/* -------------------------------------------------------------------------
* pg_dumplo
*
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.7 2001/03/22 03:59:10 momjian Exp $
* $Header: /cvsroot/pgsql/contrib/pg_dumplo/Attic/main.c,v 1.8 2001/03/22 06:16:06 momjian Exp $
*
* Karel Zak 1999-2000
* -------------------------------------------------------------------------
......@@ -65,9 +65,8 @@ main(int argc, char **argv)
progname = argv[0];
/* ----------
/*
* Parse ARGV
* ----------
*/
if (argc > 1)
{
......@@ -153,9 +152,8 @@ main(int argc, char **argv)
exit(RE_ERROR);
}
/* ----------
/*
* Check space
* ----------
*/
if (!pgLO->space && !pgLO->action == ACTION_SHOW)
{
......@@ -172,9 +170,8 @@ main(int argc, char **argv)
exit(RE_ERROR);
}
/* ----------
/*
* Make connection
* ----------
*/
pgLO->conn = PQsetdbLogin(pgLO->host, NULL, NULL, NULL, pgLO->db,
pgLO->user, pwd);
......@@ -189,9 +186,8 @@ main(int argc, char **argv)
pgLO->user = PQuser(pgLO->conn);
/* ----------
/*
* Init index file
* ----------
*/
if (pgLO->action != ACTION_SHOW)
index_file(pgLO);
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.70 2001/03/22 03:59:11 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.71 2001/03/22 06:16:06 momjian Exp $
*
* NOTES
* The old interface functions have been converted to macros
......@@ -246,9 +246,8 @@ nocachegetattr(HeapTuple tuple,
* there's a null somewhere in the tuple
*/
/* ----------------
* check to see if desired att is null
* ----------------
/*
* check to see if desired att is null
*/
#ifdef IN_MACRO
......@@ -261,9 +260,8 @@ nocachegetattr(HeapTuple tuple,
}
#endif
/* ----------------
* Now check to see if any preceding bits are null...
* ----------------
/*
* Now check to see if any preceding bits are null...
*/
{
int byte = attnum >> 3;
......@@ -658,9 +656,8 @@ heap_modifytuple(HeapTuple tuple,
HeapTuple newTuple;
uint8 infomask;
/* ----------------
* sanity checks
* ----------------
/*
* sanity checks
*/
Assert(HeapTupleIsValid(tuple));
Assert(RelationIsValid(relation));
......@@ -670,10 +667,9 @@ heap_modifytuple(HeapTuple tuple,
numberOfAttributes = RelationGetForm(relation)->relnatts;
/* ----------------
* allocate and fill *value and *nulls arrays from either
* the tuple or the repl information, as appropriate.
* ----------------
/*
* allocate and fill *value and *nulls arrays from either the tuple or
* the repl information, as appropriate.
*/
value = (Datum *) palloc(numberOfAttributes * sizeof *value);
nulls = (char *) palloc(numberOfAttributes * sizeof *nulls);
......@@ -701,17 +697,16 @@ heap_modifytuple(HeapTuple tuple,
}
}
/* ----------------
* create a new tuple from the *values and *nulls arrays
* ----------------
/*
* create a new tuple from the *values and *nulls arrays
*/
newTuple = heap_formtuple(RelationGetDescr(relation),
value,
nulls);
/* ----------------
* copy the header except for t_len, t_natts, t_hoff, t_bits, t_infomask
* ----------------
/*
* copy the header except for t_len, t_natts, t_hoff, t_bits,
* t_infomask
*/
infomask = newTuple->t_data->t_infomask;
memmove((char *) &newTuple->t_data->t_oid, /* XXX */
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.53 2001/03/22 03:59:11 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.54 2001/03/22 06:16:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -165,9 +165,8 @@ index_formtuple(TupleDesc tupleDescriptor,
infomask |= size;
/* ----------------
/*
* initialize metadata
* ----------------
*/
tuple->t_info = infomask;
return tuple;
......@@ -205,9 +204,9 @@ nocache_index_getattr(IndexTuple tup,
int data_off; /* tuple data offset */
(void) isnull; /* not used */
/* ----------------
* sanity checks
* ----------------
/*
* sanity checks
*/
/* ----------------
......@@ -246,9 +245,9 @@ nocache_index_getattr(IndexTuple tup,
}
else
{ /* there's a null somewhere in the tuple */
/* ----------------
* check to see if desired att is null
* ----------------
/*
* check to see if desired att is null
*/
/* XXX "knows" t_bits are just after fixed tuple header! */
......@@ -264,9 +263,8 @@ nocache_index_getattr(IndexTuple tup,
}
#endif
/* ----------------
* Now check to see if any preceding bits are null...
* ----------------
/*
* Now check to see if any preceding bits are null...
*/
{
int byte = attnum >> 3;
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.58 2001/03/22 03:59:11 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.59 2001/03/22 06:16:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -155,16 +155,14 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
if (myState->attrinfo != typeinfo || myState->nattrs != natts)
printtup_prepare_info(myState, typeinfo, natts);
/* ----------------
* tell the frontend to expect new tuple data (in ASCII style)
* ----------------
/*
* tell the frontend to expect new tuple data (in ASCII style)
*/
pq_beginmessage(&buf);
pq_sendbyte(&buf, 'D');
/* ----------------
* send a bitmap of which attributes are not null
* ----------------
/*
* send a bitmap of which attributes are not null
*/
j = 0;
k = 1 << 7;
......@@ -183,9 +181,8 @@ printtup(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
if (k != (1 << 7)) /* flush last partial byte */
pq_sendint(&buf, j, 1);
/* ----------------
* send the attributes of this tuple
* ----------------
/*
* send the attributes of this tuple
*/
for (i = 0; i < natts; ++i)
{
......@@ -357,16 +354,14 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
if (myState->attrinfo != typeinfo || myState->nattrs != natts)
printtup_prepare_info(myState, typeinfo, natts);
/* ----------------
* tell the frontend to expect new tuple data (in binary style)
* ----------------
/*
* tell the frontend to expect new tuple data (in binary style)
*/
pq_beginmessage(&buf);
pq_sendbyte(&buf, 'B');
/* ----------------
* send a bitmap of which attributes are not null
* ----------------
/*
* send a bitmap of which attributes are not null
*/
j = 0;
k = 1 << 7;
......@@ -385,9 +380,8 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo, DestReceiver *self)
if (k != (1 << 7)) /* flush last partial byte */
pq_sendint(&buf, j, 1);
/* ----------------
* send the attributes of this tuple
* ----------------
/*
* send the attributes of this tuple
*/
#ifdef IPORTAL_DEBUG
fprintf(stderr, "sending tuple with %d atts\n", natts);
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.72 2001/03/22 03:59:11 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.73 2001/03/22 06:16:06 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
......@@ -37,17 +37,15 @@ CreateTemplateTupleDesc(int natts)
uint32 size;
TupleDesc desc;
/* ----------------
* sanity checks
* ----------------
/*
* sanity checks
*/
AssertArg(natts >= 1);
/* ----------------
* allocate enough memory for the tuple descriptor and
* zero it as TupleDescInitEntry assumes that the descriptor
* is filled with NULL pointers.
* ----------------
/*
* allocate enough memory for the tuple descriptor and zero it as
* TupleDescInitEntry assumes that the descriptor is filled with NULL
* pointers.
*/
size = natts * sizeof(Form_pg_attribute);
desc = (TupleDesc) palloc(sizeof(struct tupleDesc));
......@@ -71,9 +69,8 @@ CreateTupleDesc(int natts, Form_pg_attribute *attrs)
{
TupleDesc desc;
/* ----------------
* sanity checks
* ----------------
/*
* sanity checks
*/
AssertArg(natts >= 1);
......@@ -337,9 +334,8 @@ TupleDescInitEntry(TupleDesc desc,
Form_pg_type typeForm;
Form_pg_attribute att;
/* ----------------
* sanity checks
* ----------------
/*
* sanity checks
*/
AssertArg(PointerIsValid(desc));
AssertArg(attributeNumber >= 1);
......@@ -352,17 +348,15 @@ TupleDescInitEntry(TupleDesc desc,
AssertArg(!PointerIsValid(desc->attrs[attributeNumber - 1]));
/* ----------------
* allocate storage for this attribute
* ----------------
/*
* allocate storage for this attribute
*/
att = (Form_pg_attribute) palloc(ATTRIBUTE_TUPLE_SIZE);
desc->attrs[attributeNumber - 1] = att;
/* ----------------
* initialize the attribute fields
* ----------------
/*
* initialize the attribute fields
*/
att->attrelid = 0; /* dummy value */
......@@ -404,10 +398,10 @@ TupleDescInitEntry(TupleDesc desc,
0, 0, 0);
if (!HeapTupleIsValid(tuple))
{
/* ----------------
* here type info does not exist yet so we just fill
* the attribute with dummy information and return false.
* ----------------
/*
* here type info does not exist yet so we just fill the attribute
* with dummy information and return false.
*/
att->atttypid = InvalidOid;
att->attlen = (int16) 0;
......@@ -417,32 +411,30 @@ TupleDescInitEntry(TupleDesc desc,
return false;
}
/* ----------------
* type info exists so we initialize our attribute
* information from the type tuple we found..
* ----------------
/*
* type info exists so we initialize our attribute information from
* the type tuple we found..
*/
typeForm = (Form_pg_type) GETSTRUCT(tuple);
att->atttypid = tuple->t_data->t_oid;
/*------------------------
/*
* There are a couple of cases where we must override the information
* stored in pg_type.
*
* First: if this attribute is a set, what is really stored in the
* attribute is the OID of a tuple in the pg_proc catalog.
* The pg_proc tuple contains the query string which defines
* this set - i.e., the query to run to get the set.
* So the atttypid (just assigned above) refers to the type returned
* by this query, but the actual length of this attribute is the
* length (size) of an OID.
* attribute is the OID of a tuple in the pg_proc catalog. The pg_proc
* tuple contains the query string which defines this set - i.e., the
* query to run to get the set. So the atttypid (just assigned above)
* refers to the type returned by this query, but the actual length of
* this attribute is the length (size) of an OID.
*
* (Why not just make the atttypid point to the OID type, instead
* of the type the query returns? Because the executor uses the atttypid
* to tell the front end what type will be returned (in BeginCommand),
* and in the end the type returned will be the result of the query, not
* an OID.)
* (Why not just make the atttypid point to the OID type, instead of the
* type the query returns? Because the executor uses the atttypid to
* tell the front end what type will be returned (in BeginCommand),
* and in the end the type returned will be the result of the query,
* not an OID.)
*
* (Why not wait until the return type of the set is known (i.e., the
* recursive call to the executor to execute the set has returned)
......@@ -460,7 +452,6 @@ TupleDescInitEntry(TupleDesc desc,
*
* A set of complex type is first and foremost a set, so its
* representation is Oid not pointer. So, test that case first.
*-----------------------------------------
*/
if (attisset)
{
......@@ -550,9 +541,8 @@ BuildDescForRelation(List *schema, char *relname)
int ndef = 0;
bool attisset;
/* ----------------
* allocate a new tuple descriptor
* ----------------
/*
* allocate a new tuple descriptor
*/
natts = length(schema);
desc = CreateTemplateTupleDesc(natts);
......@@ -565,11 +555,10 @@ BuildDescForRelation(List *schema, char *relname)
ColumnDef *entry = lfirst(p);
List *arry;
/* ----------------
* for each entry in the list, get the name and type
* information from the list and have TupleDescInitEntry
* fill in the attribute information we need.
* ----------------
/*
* for each entry in the list, get the name and type information
* from the list and have TupleDescInitEntry fill in the attribute
* information we need.
*/
attnum++;
......@@ -595,12 +584,12 @@ BuildDescForRelation(List *schema, char *relname)
typenameTypeId(typename),
atttypmod, attdim, attisset))
{
/* ----------------
* if TupleDescInitEntry() fails, it means there is
* no type in the system catalogs. So now we check if
* the type name equals the relation name. If so we
* have a self reference, otherwise it's an error.
* ----------------
/*
* if TupleDescInitEntry() fails, it means there is no type in
* the system catalogs. So now we check if the type name
* equals the relation name. If so we have a self reference,
* otherwise it's an error.
*/
if (strcmp(typename, relname) == 0)
TupleDescMakeSelfReference(desc, attnum, relname);
......
This diff is collapsed.
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Id: hio.c,v 1.36 2001/03/22 03:59:13 momjian Exp $
* $Id: hio.c,v 1.37 2001/03/22 06:16:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -37,9 +37,8 @@ RelationPutHeapTuple(Relation relation,
ItemId itemId;
Item item;
/* ----------------
* increment access statistics
* ----------------
/*
* increment access statistics
*/
IncrHeapAccessStat(local_RelationPutHeapTuple);
IncrHeapAccessStat(global_RelationPutHeapTuple);
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/Attic/stats.c,v 1.23 2001/01/24 19:42:48 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/Attic/stats.c,v 1.24 2001/03/22 06:16:07 momjian Exp $
*
* NOTES
* initam should be moved someplace else.
......@@ -37,25 +37,22 @@ InitHeapAccessStatistics()
MemoryContext oldContext;
HeapAccessStatistics stats;
/* ----------------
* make sure we don't initialize things twice
* ----------------
/*
* make sure we don't initialize things twice
*/
if (heap_access_stats != NULL)
return;
/* ----------------
* allocate statistics structure from the top memory context
* ----------------
/*
* allocate statistics structure from the top memory context
*/
oldContext = MemoryContextSwitchTo(TopMemoryContext);
stats = (HeapAccessStatistics)
palloc(sizeof(HeapAccessStatisticsData));
/* ----------------
* initialize fields to default values
* ----------------
/*
* initialize fields to default values
*/
stats->global_open = 0;
stats->global_openr = 0;
......@@ -103,17 +100,15 @@ InitHeapAccessStatistics()
stats->local_RelationNameGetRelation = 0;
stats->global_RelationNameGetRelation = 0;
/* ----------------
* record init times
* ----------------
/*
* record init times
*/
time(&stats->init_global_timestamp);
time(&stats->local_reset_timestamp);
time(&stats->last_request_timestamp);
/* ----------------
* return to old memory context
* ----------------
/*
* return to old memory context
*/
MemoryContextSwitchTo(oldContext);
......@@ -130,18 +125,16 @@ ResetHeapAccessStatistics()
{
HeapAccessStatistics stats;
/* ----------------
* do nothing if stats aren't initialized
* ----------------
/*
* do nothing if stats aren't initialized
*/
if (heap_access_stats == NULL)
return;
stats = heap_access_stats;
/* ----------------
* reset local counts
* ----------------
/*
* reset local counts
*/
stats->local_open = 0;
stats->local_openr = 0;
......@@ -165,9 +158,8 @@ ResetHeapAccessStatistics()
stats->local_RelationPutHeapTuple = 0;
stats->local_RelationPutLongHeapTuple = 0;
/* ----------------
* reset local timestamps
* ----------------
/*
* reset local timestamps
*/
time(&stats->local_reset_timestamp);
time(&stats->last_request_timestamp);
......@@ -185,22 +177,19 @@ GetHeapAccessStatistics()
{
HeapAccessStatistics stats;
/* ----------------
* return nothing if stats aren't initialized
* ----------------
/*
* return nothing if stats aren't initialized
*/
if (heap_access_stats == NULL)
return NULL;
/* ----------------
* record the current request time
* ----------------
/*
* record the current request time
*/
time(&heap_access_stats->last_request_timestamp);
/* ----------------
* allocate a copy of the stats and return it to the caller.
* ----------------
/*
* allocate a copy of the stats and return it to the caller.
*/
stats = (HeapAccessStatistics)
palloc(sizeof(HeapAccessStatisticsData));
......@@ -222,9 +211,9 @@ GetHeapAccessStatistics()
void
PrintHeapAccessStatistics(HeapAccessStatistics stats)
{
/* ----------------
* return nothing if stats aren't valid
* ----------------
/*
* return nothing if stats aren't valid
*/
if (stats == NULL)
return;
......@@ -342,9 +331,9 @@ PrintAndFreeHeapAccessStatistics(HeapAccessStatistics stats)
void
initam(void)
{
/* ----------------
* initialize heap statistics.
* ----------------
/*
* initialize heap statistics.
*/
InitHeapAccessStatistics();
}
This diff is collapsed.
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.47 2001/01/24 19:42:48 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.48 2001/03/22 06:16:07 momjian Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relationId
......@@ -190,9 +190,8 @@ index_insert(Relation relation,
RELATION_CHECKS;
GET_REL_PROCEDURE(insert, aminsert);
/* ----------------
* have the am's insert proc do all the work.
* ----------------
/*
* have the am's insert proc do all the work.
*/
specificResult = (InsertIndexResult)
DatumGetPointer(OidFunctionCall5(procedure,
......@@ -241,13 +240,12 @@ index_beginscan(Relation relation,
RelationIncrementReferenceCount(relation);
/* ----------------
* Acquire AccessShareLock for the duration of the scan
/*
* Acquire AccessShareLock for the duration of the scan
*
* Note: we could get an SI inval message here and consequently have
* to rebuild the relcache entry. The refcount increment above
* ensures that we will rebuild it and not just flush it...
* ----------------
* Note: we could get an SI inval message here and consequently have to
* rebuild the relcache entry. The refcount increment above ensures
* that we will rebuild it and not just flush it...
*/
LockRelation(relation, AccessShareLock);
......@@ -347,9 +345,8 @@ index_getnext(IndexScanDesc scan,
SCAN_CHECKS;
/* ----------------
* Look up the access procedure only once per scan.
* ----------------
/*
* Look up the access procedure only once per scan.
*/
if (scan->fn_getnext.fn_oid == InvalidOid)
{
......@@ -359,9 +356,8 @@ index_getnext(IndexScanDesc scan,
fmgr_info(procedure, &scan->fn_getnext);
}
/* ----------------
* have the am's gettuple proc do all the work.
* ----------------
/*
* have the am's gettuple proc do all the work.
*/
result = (RetrieveIndexResult)
DatumGetPointer(FunctionCall2(&scan->fn_getnext,
......
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.64 2001/03/22 03:59:15 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.65 2001/03/22 06:16:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -238,21 +238,19 @@ _bt_binsrch(Relation rel,
high = mid;
}
/*--------------------
/*
* At this point we have high == low, but be careful: they could point
* past the last slot on the page.
*
* On a leaf page, we always return the first key >= scan key
* (which could be the last slot + 1).
*--------------------
* On a leaf page, we always return the first key >= scan key (which
* could be the last slot + 1).
*/
if (P_ISLEAF(opaque))
return low;
/*--------------------
* On a non-leaf page, return the last key < scan key.
* There must be one if _bt_compare() is playing by the rules.
*--------------------
/*
* On a non-leaf page, return the last key < scan key. There must be
* one if _bt_compare() is playing by the rules.
*/
Assert(low > P_FIRSTDATAKEY(opaque));
......@@ -584,21 +582,20 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
ItemPointerSet(current, blkno, offnum);
/*----------
* At this point we are positioned at the first item >= scan key,
* or possibly at the end of a page on which all the existing items
* are < scan key and we know that everything on later pages is
* >= scan key. We could step forward in the latter case, but that'd
* be a waste of time if we want to scan backwards. So, it's now time to
* examine the scan strategy to find the exact place to start the scan.
/*
* At this point we are positioned at the first item >= scan key, or
* possibly at the end of a page on which all the existing items are <
* scan key and we know that everything on later pages is >= scan key.
* We could step forward in the latter case, but that'd be a waste of
* time if we want to scan backwards. So, it's now time to examine
* the scan strategy to find the exact place to start the scan.
*
* Note: if _bt_step fails (meaning we fell off the end of the index
* in one direction or the other), we either return NULL (no matches) or
* call _bt_endpoint() to set up a scan starting at that index endpoint,
* as appropriate for the desired scan type.
* Note: if _bt_step fails (meaning we fell off the end of the index in
* one direction or the other), we either return NULL (no matches) or
* call _bt_endpoint() to set up a scan starting at that index
* endpoint, as appropriate for the desired scan type.
*
* it's yet other place to add some code later for is(not)null ...
*----------
*/
switch (strat_total)
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.42 2001/03/22 03:59:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.43 2001/03/22 06:16:10 momjian Exp $
*
* NOTES
* This file contains the high level access-method interface to the
......@@ -124,30 +124,25 @@ TransactionLogTest(TransactionId transactionId, /* transaction id to test */
XidStatus xidstatus; /* recorded status of xid */
bool fail = false; /* success/failure */
/* ----------------
* during initialization consider all transactions
* as having been committed
* ----------------
/*
* during initialization consider all transactions as having been
* committed
*/
if (!RelationIsValid(LogRelation))
return (bool) (status == XID_COMMIT);
/* ----------------
* before going to the buffer manager, check our single
* item cache to see if we didn't just check the transaction
* status a moment ago.
* ----------------
/*
* before going to the buffer manager, check our single item cache to
* see if we didn't just check the transaction status a moment ago.
*/
if (TransactionIdEquals(transactionId, cachedTestXid))
return (bool)
(status == cachedTestXidStatus);
/* ----------------
* compute the item pointer corresponding to the
* page containing our transaction id. We save the item in
* our cache to speed up things if we happen to ask for the
* same xid's status more than once.
* ----------------
/*
* compute the item pointer corresponding to the page containing our
* transaction id. We save the item in our cache to speed up things
* if we happen to ask for the same xid's status more than once.
*/
TransComputeBlockNumber(LogRelation, transactionId, &blockNumber);
xidstatus = TransBlockNumberGetXidStatus(LogRelation,
......@@ -169,9 +164,8 @@ TransactionLogTest(TransactionId transactionId, /* transaction id to test */
return (bool) (status == xidstatus);
}
/* ----------------
* here the block didn't contain the information we wanted
* ----------------
/*
* here the block didn't contain the information we wanted
*/
elog(ERROR, "TransactionLogTest: failed to get xidstatus");
......@@ -192,16 +186,14 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */
BlockNumber blockNumber;
bool fail = false; /* success/failure */
/* ----------------
* during initialization we don't record any updates.
* ----------------
/*
* during initialization we don't record any updates.
*/
if (!RelationIsValid(LogRelation))
return;
/* ----------------
* update the log relation
* ----------------
/*
* update the log relation
*/
TransComputeBlockNumber(LogRelation, transactionId, &blockNumber);
TransBlockNumberSetXidStatus(LogRelation,
......@@ -292,43 +284,38 @@ static void
TransRecover(Relation logRelation)
{
#ifdef NOT_USED
/* ----------------
* first get the last recorded transaction in the log.
* ----------------
/*
* first get the last recorded transaction in the log.
*/
TransGetLastRecordedTransaction(logRelation, logLastXid, &fail);
if (fail == true)
elog(ERROR, "TransRecover: failed TransGetLastRecordedTransaction");
/* ----------------
* next get the "last" and "next" variables
* ----------------
/*
* next get the "last" and "next" variables
*/
VariableRelationGetLastXid(&varLastXid);
VariableRelationGetNextXid(&varNextXid);
/* ----------------
* intregity test (1)
* ----------------
/*
* intregity test (1)
*/
if (TransactionIdIsLessThan(varNextXid, logLastXid))
elog(ERROR, "TransRecover: varNextXid < logLastXid");
/* ----------------
* intregity test (2)
* ----------------
/*
* intregity test (2)
*/
/* ----------------
* intregity test (3)
* ----------------
/*
* intregity test (3)
*/
/* ----------------
* here we have a valid "
/*
* here we have a valid "
*
* **** RESUME HERE ****
* ----------------
**** RESUME HERE ****
*/
varNextXid = TransactionIdDup(varLastXid);
TransactionIdIncrement(&varNextXid);
......@@ -375,51 +362,45 @@ InitializeTransactionLog(void)
Relation logRelation;
MemoryContext oldContext;
/* ----------------
* don't do anything during bootstrapping
* ----------------
/*
* don't do anything during bootstrapping
*/
if (AMI_OVERRIDE)
return;
/* ----------------
* disable the transaction system so the access methods
* don't interfere during initialization.
* ----------------
/*
* disable the transaction system so the access methods don't
* interfere during initialization.
*/
OverrideTransactionSystem(true);
/* ----------------
* make sure allocations occur within the top memory context
* so that our log management structures are protected from
* garbage collection at the end of every transaction.
* ----------------
/*
* make sure allocations occur within the top memory context so that
* our log management structures are protected from garbage collection
* at the end of every transaction.
*/
oldContext = MemoryContextSwitchTo(TopMemoryContext);
/* ----------------
* first open the log and time relations
* (these are created by amiint so they are guaranteed to exist)
* ----------------
/*
* first open the log and time relations (these are created by amiint
* so they are guaranteed to exist)
*/
logRelation = heap_openr(LogRelationName, NoLock);
VariableRelation = heap_openr(VariableRelationName, NoLock);
/* ----------------
* XXX TransactionLogUpdate requires that LogRelation
* is valid so we temporarily set it so we can initialize
* things properly. This could be done cleaner.
* ----------------
/*
* XXX TransactionLogUpdate requires that LogRelation is valid so we
* temporarily set it so we can initialize things properly. This could
* be done cleaner.
*/
LogRelation = logRelation;
/* ----------------
* if we have a virgin database, we initialize the log
* relation by committing the AmiTransactionId (id 512) and we
* initialize the variable relation by setting the next available
* transaction id to FirstTransactionId (id 514). OID initialization
* happens as a side effect of bootstrapping in varsup.c.
* ----------------
/*
* if we have a virgin database, we initialize the log relation by
* committing the AmiTransactionId (id 512) and we initialize the
* variable relation by setting the next available transaction id to
* FirstTransactionId (id 514). OID initialization happens as a side
* effect of bootstrapping in varsup.c.
*/
SpinAcquire(OidGenLockId);
if (!TransactionIdDidCommit(AmiTransactionId))
......@@ -433,33 +414,30 @@ InitializeTransactionLog(void)
}
else if (RecoveryCheckingEnabled())
{
/* ----------------
* if we have a pre-initialized database and if the
* perform recovery checking flag was passed then we
* do our database integrity checking.
* ----------------
/*
* if we have a pre-initialized database and if the perform
* recovery checking flag was passed then we do our database
* integrity checking.
*/
TransRecover(logRelation);
}
LogRelation = (Relation) NULL;
SpinRelease(OidGenLockId);
/* ----------------
* now re-enable the transaction system
* ----------------
/*
* now re-enable the transaction system
*/
OverrideTransactionSystem(false);
/* ----------------
* instantiate the global variables
* ----------------
/*
* instantiate the global variables
*/
LogRelation = logRelation;
/* ----------------
* restore the memory context to the previous context
* before we return from initialization.
* ----------------
/*
* restore the memory context to the previous context before we return
* from initialization.
*/
MemoryContextSwitchTo(oldContext);
}
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.29 2001/03/22 03:59:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.30 2001/03/22 06:16:10 momjian Exp $
*
* NOTES
* This file contains support functions for the high
......@@ -56,11 +56,9 @@ TransComputeBlockNumber(Relation relation, /* relation to test */
{
long itemsPerBlock = 0;
/* ----------------
* we calculate the block number of our transaction
* by dividing the transaction id by the number of
* transaction things per block.
* ----------------
/*
* we calculate the block number of our transaction by dividing the
* transaction id by the number of transaction things per block.
*/
if (relation == LogRelation)
itemsPerBlock = TP_NumXidStatusPerBlock;
......@@ -109,18 +107,16 @@ TransBlockGetLastTransactionIdStatus(Block tblock,
BitIndex offset;
XidStatus xstatus;
/* ----------------
* sanity check
* ----------------
/*
* sanity check
*/
Assert((tblock != NULL));
/* ----------------
* search downward from the top of the block data, looking
* for the first Non-in progress transaction status. Since we
* are scanning backward, this will be last recorded transaction
* status on the block.
* ----------------
/*
* search downward from the top of the block data, looking for the
* first Non-in progress transaction status. Since we are scanning
* backward, this will be last recorded transaction status on the
* block.
*/
maxIndex = TP_NumXidStatusPerBlock;
for (index = maxIndex; index > 0; index--)
......@@ -131,11 +127,10 @@ TransBlockGetLastTransactionIdStatus(Block tblock,
xstatus = (bit1 | bit2);
/* ----------------
* here we have the status of some transaction, so test
* if the status is recorded as "in progress". If so, then
* we save the transaction id in the place specified by the caller.
* ----------------
/*
* here we have the status of some transaction, so test if the
* status is recorded as "in progress". If so, then we save the
* transaction id in the place specified by the caller.
*/
if (xstatus != XID_INPROGRESS)
{
......@@ -148,12 +143,11 @@ TransBlockGetLastTransactionIdStatus(Block tblock,
}
}
/* ----------------
* if we get here and index is 0 it means we couldn't find
* a non-inprogress transaction on the block. For now we just
* return this info to the user. They can check if the return
* status is "in progress" to know this condition has arisen.
* ----------------
/*
* if we get here and index is 0 it means we couldn't find a
* non-inprogress transaction on the block. For now we just return
* this info to the user. They can check if the return status is "in
* progress" to know this condition has arisen.
*/
if (index == 0)
{
......@@ -161,9 +155,8 @@ TransBlockGetLastTransactionIdStatus(Block tblock,
TransactionIdStore(baseXid, returnXidP);
}
/* ----------------
* return the status to the user
* ----------------
/*
* return the status to the user
*/
return xstatus;
}
......@@ -200,17 +193,15 @@ TransBlockGetXidStatus(Block tblock,
*/
index = transactionId % TP_NumXidStatusPerBlock;
/* ----------------
* get the data at the specified index
* ----------------
/*
* get the data at the specified index
*/
offset = BitIndexOf(index);
bit1 = ((bits8) BitArrayBitIsSet((BitArray) tblock, offset++)) << 1;
bit2 = (bits8) BitArrayBitIsSet((BitArray) tblock, offset);
/* ----------------
* return the transaction status to the caller
* ----------------
/*
* return the transaction status to the caller
*/
return (XidStatus) (bit1 | bit2);
}
......@@ -245,9 +236,8 @@ TransBlockSetXidStatus(Block tblock,
offset = BitIndexOf(index);
/* ----------------
* store the transaction value at the specified offset
* ----------------
/*
* store the transaction value at the specified offset
*/
switch (xstatus)
{
......@@ -291,18 +281,16 @@ TransBlockNumberGetXidStatus(Relation relation,
XidStatus xstatus; /* recorded status of xid */
bool localfail; /* bool used if failP = NULL */
/* ----------------
* get the page containing the transaction information
* ----------------
/*
* get the page containing the transaction information
*/
buffer = ReadBuffer(relation, blockNumber);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
block = BufferGetBlock(buffer);
/* ----------------
* get the status from the block. note, for now we always
* return false in failP.
* ----------------
/*
* get the status from the block. note, for now we always return
* false in failP.
*/
if (failP == NULL)
failP = &localfail;
......@@ -310,9 +298,8 @@ TransBlockNumberGetXidStatus(Relation relation,
xstatus = TransBlockGetXidStatus(block, xid);
/* ----------------
* release the buffer and return the status
* ----------------
/*
* release the buffer and return the status
*/
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
ReleaseBuffer(buffer);
......@@ -335,19 +322,17 @@ TransBlockNumberSetXidStatus(Relation relation,
Block block; /* block containing xstatus */
bool localfail; /* bool used if failP = NULL */
/* ----------------
* get the block containing the transaction status
* ----------------
/*
* get the block containing the transaction status
*/
buffer = ReadBuffer(relation, blockNumber);
LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE);
block = BufferGetBlock(buffer);
/* ----------------
* attempt to update the status of the transaction on the block.
* if we are successful, write the block. otherwise release the buffer.
* note, for now we always return false in failP.
* ----------------
/*
* attempt to update the status of the transaction on the block. if we
* are successful, write the block. otherwise release the buffer.
* note, for now we always return false in failP.
*/
if (failP == NULL)
failP = &localfail;
......@@ -381,22 +366,20 @@ TransGetLastRecordedTransaction(Relation relation,
(*failP) = false;
/* ----------------
* SOMEDAY gain exclusive access to the log relation
/*
* SOMEDAY gain exclusive access to the log relation
*
* That someday is today 5 Aug. 1991 -mer
* It looks to me like we only need to set a read lock here, despite
* the above comment about exclusive access. The block is never
* actually written into, we only check status bits.
* ----------------
* That someday is today 5 Aug. 1991 -mer It looks to me like we only
* need to set a read lock here, despite the above comment about
* exclusive access. The block is never actually written into, we
* only check status bits.
*/
RelationSetLockForRead(relation);
/* ----------------
* we assume the last block of the log contains the last
* recorded transaction. If the relation is empty we return
* failure to the user.
* ----------------
/*
* we assume the last block of the log contains the last recorded
* transaction. If the relation is empty we return failure to the
* user.
*/
n = RelationGetNumberOfBlocks(relation);
if (n == 0)
......@@ -405,17 +388,15 @@ TransGetLastRecordedTransaction(Relation relation,
return;
}
/* ----------------
* get the block containing the transaction information
* ----------------
/*
* get the block containing the transaction information
*/
blockNumber = n - 1;
buffer = ReadBuffer(relation, blockNumber);
block = BufferGetBlock(buffer);
/* ----------------
* get the last xid on the block
* ----------------
/*
* get the last xid on the block
*/
baseXid = blockNumber * TP_NumXidStatusPerBlock;
......@@ -424,9 +405,8 @@ TransGetLastRecordedTransaction(Relation relation,
ReleaseBuffer(buffer);
/* ----------------
* SOMEDAY release our lock on the log relation
* ----------------
/*
* SOMEDAY release our lock on the log relation
*/
RelationUnsetLockForRead(relation);
}
......
This diff is collapsed.
......@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.105 2001/03/13 01:17:05 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.106 2001/03/22 06:16:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -141,7 +141,7 @@ int numattr; /* number of attributes for cur. rel */
int DebugMode;
static MemoryContext nogc = NULL; /* special no-gc mem context */
static MemoryContext nogc = NULL; /* special no-gc mem context */
extern int optind;
extern char *optarg;
......@@ -216,11 +216,10 @@ BootstrapMain(int argc, char *argv[])
char *dbName;
int flag;
int xlogop = BS_XLOG_NOP;
char *potential_DataDir = NULL;
char *potential_DataDir = NULL;
/* --------------------
* initialize globals
* -------------------
/*
* initialize globals
*/
MyProcPid = getpid();
......@@ -236,9 +235,8 @@ BootstrapMain(int argc, char *argv[])
MemoryContextInit();
}
/* ----------------
* process command arguments
* ----------------
/*
* process command arguments
*/
/* Set defaults, to be overriden by explicit options below */
......@@ -248,7 +246,8 @@ BootstrapMain(int argc, char *argv[])
if (!IsUnderPostmaster)
{
ResetAllOptions();
potential_DataDir = getenv("PGDATA"); /* Null if no PGDATA variable */
potential_DataDir = getenv("PGDATA"); /* Null if no PGDATA
* variable */
}
while ((flag = getopt(argc, argv, "D:dCQx:pB:F")) != EOF)
......@@ -307,9 +306,9 @@ BootstrapMain(int argc, char *argv[])
if (!potential_DataDir)
{
fprintf(stderr, "%s does not know where to find the database system "
"data. You must specify the directory that contains the "
"database system either by specifying the -D invocation "
"option or by setting the PGDATA environment variable.\n\n",
"data. You must specify the directory that contains the "
"database system either by specifying the -D invocation "
"option or by setting the PGDATA environment variable.\n\n",
argv[0]);
proc_exit(1);
}
......@@ -319,15 +318,17 @@ BootstrapMain(int argc, char *argv[])
if (IsUnderPostmaster)
{
/*
* Properly accept or ignore signals the postmaster might send us
*/
pqsignal(SIGHUP, SIG_IGN);
pqsignal(SIGINT, SIG_IGN); /* ignore query-cancel */
pqsignal(SIGINT, SIG_IGN); /* ignore query-cancel */
pqsignal(SIGTERM, die);
pqsignal(SIGQUIT, quickdie);
pqsignal(SIGUSR1, SIG_IGN);
pqsignal(SIGUSR2, SIG_IGN);
/*
* Reset some signals that are accepted by postmaster but not here
*/
......@@ -336,8 +337,10 @@ BootstrapMain(int argc, char *argv[])
pqsignal(SIGTTOU, SIG_DFL);
pqsignal(SIGCONT, SIG_DFL);
pqsignal(SIGWINCH, SIG_DFL);
/*
* Unblock signals (they were blocked when the postmaster forked us)
* Unblock signals (they were blocked when the postmaster forked
* us)
*/
PG_SETMASK(&UnBlockSig);
}
......@@ -352,7 +355,7 @@ BootstrapMain(int argc, char *argv[])
/*
* Create lockfile for data directory.
*/
if (! CreateDataDirLockFile(DataDir, false))
if (!CreateDataDirLockFile(DataDir, false))
proc_exit(1);
}
......@@ -408,9 +411,8 @@ BootstrapMain(int argc, char *argv[])
for (i = 0; i < HASHTABLESIZE; ++i)
hashtable[i] = NULL;
/* ----------------
* abort processing resumes here
* ----------------
/*
* abort processing resumes here
*/
if (sigsetjmp(Warn_restart, 1) != 0)
{
......@@ -418,9 +420,8 @@ BootstrapMain(int argc, char *argv[])
AbortCurrentTransaction();
}
/* ----------------
* process input.
* ----------------
/*
* process input.
*/
/*
......@@ -720,9 +721,9 @@ InsertOneValue(Oid objectid, char *value, int i)
ObjectIdGetDatum(ap->am_typ.typelem),
Int32GetDatum(-1));
prt = DatumGetCString(OidFunctionCall3(ap->am_typ.typoutput,
values[i],
ObjectIdGetDatum(ap->am_typ.typelem),
Int32GetDatum(-1)));
values[i],
ObjectIdGetDatum(ap->am_typ.typelem),
Int32GetDatum(-1)));
if (!Quiet)
printf("%s ", prt);
pfree(prt);
......@@ -740,12 +741,12 @@ InsertOneValue(Oid objectid, char *value, int i)
printf("Typ == NULL, typeindex = %u idx = %d\n", typeindex, i);
values[i] = OidFunctionCall3(Procid[typeindex].inproc,
CStringGetDatum(value),
ObjectIdGetDatum(Procid[typeindex].elem),
ObjectIdGetDatum(Procid[typeindex].elem),
Int32GetDatum(-1));
prt = DatumGetCString(OidFunctionCall3(Procid[typeindex].outproc,
values[i],
ObjectIdGetDatum(Procid[typeindex].elem),
Int32GetDatum(-1)));
values[i],
ObjectIdGetDatum(Procid[typeindex].elem),
Int32GetDatum(-1)));
if (!Quiet)
printf("%s ", prt);
pfree(prt);
......
This diff is collapsed.
This diff is collapsed.
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.56 2001/03/22 03:59:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.57 2001/03/22 06:16:10 momjian Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
......@@ -102,17 +102,15 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
opKey[1].sk_nargs = opKey[1].sk_func.fn_nargs;
opKey[2].sk_nargs = opKey[2].sk_func.fn_nargs;
/* ----------------
* form scan key
* ----------------
/*
* form scan key
*/
opKey[0].sk_argument = PointerGetDatum(operatorName);
opKey[1].sk_argument = ObjectIdGetDatum(leftObjectId);
opKey[2].sk_argument = ObjectIdGetDatum(rightObjectId);
/* ----------------
* begin the scan
* ----------------
/*
* begin the scan
*/
pg_operator_scan = heap_beginscan(pg_operator_desc,
0,
......@@ -120,10 +118,9 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
3,
opKey);
/* ----------------
* fetch the operator tuple, if it exists, and determine
* the proper return oid value.
* ----------------
/*
* fetch the operator tuple, if it exists, and determine the proper
* return oid value.
*/
tup = heap_getnext(pg_operator_scan, 0);
......@@ -140,9 +137,8 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
*defined = false;
}
/* ----------------
* close the scan and return the oid.
* ----------------
/*
* close the scan and return the oid.
*/
heap_endscan(pg_operator_scan);
......@@ -170,11 +166,10 @@ OperatorGet(char *operatorName,
bool leftDefined = false;
bool rightDefined = false;
/* ----------------
* look up the operator data types.
/*
* look up the operator data types.
*
* Note: types must be defined before operators
* ----------------
* Note: types must be defined before operators
*/
if (leftTypeName)
{
......@@ -198,16 +193,14 @@ OperatorGet(char *operatorName,
(OidIsValid(rightObjectId) && rightDefined)))
elog(ERROR, "OperatorGet: must have at least one argument type");
/* ----------------
* open the pg_operator relation
* ----------------
/*
* open the pg_operator relation
*/
pg_operator_desc = heap_openr(OperatorRelationName, AccessShareLock);
/* ----------------
* get the oid for the operator with the appropriate name
* and left/right types.
* ----------------
/*
* get the oid for the operator with the appropriate name and
* left/right types.
*/
operatorObjectId = OperatorGetWithOpenRelation(pg_operator_desc,
operatorName,
......@@ -215,9 +208,8 @@ OperatorGet(char *operatorName,
rightObjectId,
defined);
/* ----------------
* close the relation and return the operator oid.
* ----------------
/*
* close the relation and return the operator oid.
*/
heap_close(pg_operator_desc, AccessShareLock);
......@@ -243,9 +235,8 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
NameData oname;
TupleDesc tupDesc;
/* ----------------
* initialize our *nulls and *values arrays
* ----------------
/*
* initialize our *nulls and *values arrays
*/
for (i = 0; i < Natts_pg_operator; ++i)
{
......@@ -253,10 +244,9 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
values[i] = (Datum) NULL; /* redundant, but safe */
}
/* ----------------
* initialize *values with the operator name and input data types.
* Note that oprcode is set to InvalidOid, indicating it's a shell.
* ----------------
/*
* initialize *values with the operator name and input data types.
* Note that oprcode is set to InvalidOid, indicating it's a shell.
*/
i = 0;
namestrcpy(&oname, operatorName);
......@@ -277,9 +267,8 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
values[i++] = ObjectIdGetDatum(InvalidOid);
values[i++] = ObjectIdGetDatum(InvalidOid);
/* ----------------
* create a new operator tuple
* ----------------
/*
* create a new operator tuple
*/
tupDesc = pg_operator_desc->rd_att;
......@@ -287,10 +276,8 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
values,
nulls);
/* ----------------
* insert our "shell" operator tuple and
* close the relation
* ----------------
/*
* insert our "shell" operator tuple and close the relation
*/
heap_insert(pg_operator_desc, tup);
operatorObjectId = tup->t_data->t_oid;
......@@ -304,9 +291,8 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
CatalogCloseIndices(Num_pg_operator_indices, idescs);
}
/* ----------------
* free the tuple and return the operator oid
* ----------------
/*
* free the tuple and return the operator oid
*/
heap_freetuple(tup);
......@@ -335,9 +321,8 @@ OperatorShellMake(char *operatorName,
bool leftDefined = false;
bool rightDefined = false;
/* ----------------
* get the left and right type oid's for this operator
* ----------------
/*
* get the left and right type oid's for this operator
*/
if (leftTypeName)
leftObjectId = TypeGet(leftTypeName, &leftDefined);
......@@ -349,24 +334,22 @@ OperatorShellMake(char *operatorName,
(OidIsValid(rightObjectId) && rightDefined)))
elog(ERROR, "OperatorShellMake: no valid argument types??");
/* ----------------
* open pg_operator
* ----------------
/*
* open pg_operator
*/
pg_operator_desc = heap_openr(OperatorRelationName, RowExclusiveLock);
/* ----------------
* add a "shell" operator tuple to the operator relation
* and recover the shell tuple's oid.
* ----------------
/*
* add a "shell" operator tuple to the operator relation and recover
* the shell tuple's oid.
*/
operatorObjectId = OperatorShellMakeWithOpenRelation(pg_operator_desc,
operatorName,
leftObjectId,
rightObjectId);
/* ----------------
* close the operator relation and return the oid.
* ----------------
/*
* close the operator relation and return the oid.
*/
heap_close(pg_operator_desc, RowExclusiveLock);
......@@ -516,11 +499,10 @@ OperatorDef(char *operatorName,
* filling in a previously-created shell.
*/
/* ----------------
* look up the operator data types.
/*
* look up the operator data types.
*
* Note: types must be defined before operators
* ----------------
* Note: types must be defined before operators
*/
if (leftTypeName)
{
......@@ -551,12 +533,10 @@ OperatorDef(char *operatorName,
nulls[i] = ' ';
}
/* ----------------
* Look up registered procedures -- find the return type
* of procedureName to place in "result" field.
* Do this before shells are created so we don't
* have to worry about deleting them later.
* ----------------
/*
* Look up registered procedures -- find the return type of
* procedureName to place in "result" field. Do this before shells are
* created so we don't have to worry about deleting them later.
*/
MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid));
if (!leftTypeName)
......@@ -589,9 +569,8 @@ OperatorDef(char *operatorName,
ReleaseSysCache(tup);
/* ----------------
* find restriction
* ----------------
/*
* find restriction
*/
if (restrictionName)
{ /* optional */
......@@ -617,9 +596,8 @@ OperatorDef(char *operatorName,
else
values[Anum_pg_operator_oprrest - 1] = ObjectIdGetDatum(InvalidOid);
/* ----------------
* find join - only valid for binary operators
* ----------------
/*
* find join - only valid for binary operators
*/
if (joinName)
{ /* optional */
......@@ -645,9 +623,8 @@ OperatorDef(char *operatorName,
else
values[Anum_pg_operator_oprjoin - 1] = ObjectIdGetDatum(InvalidOid);
/* ----------------
/*
* set up values in the operator tuple
* ----------------
*/
i = 0;
namestrcpy(&oname, operatorName);
......@@ -1077,11 +1054,10 @@ OperatorCreate(char *operatorName,
elog(ERROR, "OperatorCreate: only binary operators can have sort links");
}
/* ----------------
* Use OperatorDef() to define the specified operator and
* also create shells for the operator's associated operators
* if they don't already exist.
* ----------------
/*
* Use OperatorDef() to define the specified operator and also create
* shells for the operator's associated operators if they don't
* already exist.
*/
OperatorDef(operatorName,
leftTypeName,
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.54 2001/03/22 03:59:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.55 2001/03/22 06:16:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -73,9 +73,8 @@ ProcedureCreate(char *procedureName,
TupleDesc tupDesc;
Oid retval;
/* ----------------
* sanity checks
* ----------------
/*
* sanity checks
*/
Assert(PointerIsValid(prosrc));
Assert(PointerIsValid(probin));
......@@ -142,16 +141,16 @@ ProcedureCreate(char *procedureName,
if (strcmp(procedureName, GENERICSETNAME) == 0)
{
#ifdef SETS_FIXED
/* ----------
* The code below doesn't work any more because the
* PROSRC system cache and the pg_proc_prosrc_index
* have been removed. Instead a sequential heap scan
* or something better must get implemented. The reason
* for removing is that nbtree index crashes if sources
* exceed 2K --- what's likely for procedural languages.
/*
* The code below doesn't work any more because the PROSRC
* system cache and the pg_proc_prosrc_index have been
* removed. Instead a sequential heap scan or something better
* must get implemented. The reason for removing is that
* nbtree index crashes if sources exceed 2K --- what's likely
* for procedural languages.
*
* 1999/09/30 Jan
* ----------
*/
text *prosrctext;
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.60 2001/03/22 03:59:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.61 2001/03/22 06:16:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -48,9 +48,8 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
Oid typoid;
ScanKeyData typeKey[1];
/* ----------------
* initialize the scan key and begin a scan of pg_type
* ----------------
/*
* initialize the scan key and begin a scan of pg_type
*/
ScanKeyEntryInitialize(typeKey,
0,
......@@ -64,16 +63,14 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
1,
typeKey);
/* ----------------
* get the type tuple, if it exists.
* ----------------
/*
* get the type tuple, if it exists.
*/
tup = heap_getnext(scan, 0);
/* ----------------
* if no type tuple exists for the given type name, then
* end the scan and return appropriate information.
* ----------------
/*
* if no type tuple exists for the given type name, then end the scan
* and return appropriate information.
*/
if (!HeapTupleIsValid(tup))
{
......@@ -82,11 +79,10 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
return InvalidOid;
}
/* ----------------
* here, the type tuple does exist so we pull information from
* the typisdefined field of the tuple and return the tuple's
* oid, which is the oid of the type.
* ----------------
/*
* here, the type tuple does exist so we pull information from the
* typisdefined field of the tuple and return the tuple's oid, which
* is the oid of the type.
*/
*defined = (bool) ((Form_pg_type) GETSTRUCT(tup))->typisdefined;
typoid = tup->t_data->t_oid;
......@@ -116,23 +112,20 @@ TypeGet(char *typeName, /* name of type to be fetched */
Relation pg_type_desc;
Oid typeoid;
/* ----------------
* open the pg_type relation
* ----------------
/*
* open the pg_type relation
*/
pg_type_desc = heap_openr(TypeRelationName, AccessShareLock);
/* ----------------
* scan the type relation for the information we want
* ----------------
/*
* scan the type relation for the information we want
*/
typeoid = TypeGetWithOpenRelation(pg_type_desc,
typeName,
defined);
/* ----------------
* close the type relation and return the type oid.
* ----------------
/*
* close the type relation and return the type oid.
*/
heap_close(pg_type_desc, AccessShareLock);
......@@ -155,9 +148,8 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
NameData name;
TupleDesc tupDesc;
/* ----------------
* initialize our *nulls and *values arrays
* ----------------
/*
* initialize our *nulls and *values arrays
*/
for (i = 0; i < Natts_pg_type; ++i)
{
......@@ -165,9 +157,8 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
values[i] = (Datum) NULL; /* redundant, but safe */
}
/* ----------------
* initialize *values with the type name and dummy values
* ----------------
/*
* initialize *values with the type name and dummy values
*/
i = 0;
namestrcpy(&name, typeName);
......@@ -190,17 +181,15 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
values[i++] = DirectFunctionCall1(textin,
CStringGetDatum(typeName)); /* 17 */
/* ----------------
* create a new type tuple with FormHeapTuple
* ----------------
/*
* create a new type tuple with FormHeapTuple
*/
tupDesc = pg_type_desc->rd_att;
tup = heap_formtuple(tupDesc, values, nulls);
/* ----------------
* insert the tuple in the relation and get the tuple's oid.
* ----------------
/*
* insert the tuple in the relation and get the tuple's oid.
*/
heap_insert(pg_type_desc, tup);
typoid = tup->t_data->t_oid;
......@@ -213,9 +202,9 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
CatalogIndexInsert(idescs, Num_pg_type_indices, pg_type_desc, tup);
CatalogCloseIndices(Num_pg_type_indices, idescs);
}
/* ----------------
* free the tuple and return the type-oid
* ----------------
/*
* free the tuple and return the type-oid
*/
heap_freetuple(tup);
......@@ -243,21 +232,18 @@ TypeShellMake(char *typeName)
Assert(PointerIsValid(typeName));
/* ----------------
* open pg_type
* ----------------
/*
* open pg_type
*/
pg_type_desc = heap_openr(TypeRelationName, RowExclusiveLock);
/* ----------------
* insert the shell tuple
* ----------------
/*
* insert the shell tuple
*/
typoid = TypeShellMakeWithOpenRelation(pg_type_desc, typeName);
/* ----------------
* close pg_type and return the tuple's oid.
* ----------------
/*
* close pg_type and return the tuple's oid.
*/
heap_close(pg_type_desc, RowExclusiveLock);
......@@ -311,20 +297,18 @@ TypeCreate(char *typeName,
Oid argList[FUNC_MAX_ARGS];
ScanKeyData typeKey[1];
/* ----------------
* check that the type is not already defined. It might exist as
* a shell type, however (but only if assignedTypeOid is not given).
* ----------------
/*
* check that the type is not already defined. It might exist as a
* shell type, however (but only if assignedTypeOid is not given).
*/
typeObjectId = TypeGet(typeName, &defined);
if (OidIsValid(typeObjectId) &&
(defined || assignedTypeOid != InvalidOid))
elog(ERROR, "TypeCreate: type %s already defined", typeName);
/* ----------------
* if this type has an associated elementType, then we check that
* it is defined.
* ----------------
/*
* if this type has an associated elementType, then we check that it
* is defined.
*/
if (elementTypeName)
{
......@@ -333,16 +317,14 @@ TypeCreate(char *typeName,
elog(ERROR, "TypeCreate: type %s is not defined", elementTypeName);
}
/* ----------------
* XXX comment me
* ----------------
/*
* XXX comment me
*/
if (externalSize == 0)
externalSize = -1; /* variable length */
/* ----------------
* initialize arrays needed by FormHeapTuple
* ----------------
/*
* initialize arrays needed by FormHeapTuple
*/
for (i = 0; i < Natts_pg_type; ++i)
{
......@@ -362,9 +344,8 @@ TypeCreate(char *typeName,
if (internalSize == 0)
internalSize = -1;
/* ----------------
* initialize the *values information
* ----------------
/*
* initialize the *values information
*/
i = 0;
namestrcpy(&name, typeName);
......@@ -441,28 +422,24 @@ TypeCreate(char *typeName,
values[i++] = ObjectIdGetDatum(procOid); /* 11 - 14 */
}
/* ----------------
/*
* set default alignment
* ----------------
*/
values[i++] = CharGetDatum(alignment); /* 15 */
/* ----------------
* set default storage for TOAST
* ----------------
/*
* set default storage for TOAST
*/
values[i++] = CharGetDatum(storage); /* 16 */
/* ----------------
* initialize the default value for this type.
* ----------------
/*
* initialize the default value for this type.
*/
values[i] = DirectFunctionCall1(textin, /* 17 */
CStringGetDatum(defaultTypeValue ? defaultTypeValue : "-"));
/* ----------------
* open pg_type and begin a scan for the type name.
* ----------------
/*
* open pg_type and begin a scan for the type name.
*/
pg_type_desc = heap_openr(TypeRelationName, RowExclusiveLock);
......@@ -478,11 +455,9 @@ TypeCreate(char *typeName,
1,
typeKey);
/* ----------------
* define the type either by adding a tuple to the type
* relation, or by updating the fields of the "shell" tuple
* already there.
* ----------------
/*
* define the type either by adding a tuple to the type relation, or
* by updating the fields of the "shell" tuple already there.
*/
tup = heap_getnext(pg_type_scan, 0);
if (HeapTupleIsValid(tup))
......@@ -517,9 +492,8 @@ TypeCreate(char *typeName,
typeObjectId = tup->t_data->t_oid;
}
/* ----------------
* finish up
* ----------------
/*
* finish up
*/
heap_endscan(pg_type_scan);
......
This diff is collapsed.
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.15 2001/03/22 03:59:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.16 2001/03/22 06:16:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -582,9 +582,8 @@ update_attstats(Oid relid, int natts, VacAttrStats *vacattrstats)
for (i = 0; i < Natts_pg_statistic; ++i)
nulls[i] = ' ';
/* ----------------
* initialize values[]
* ----------------
/*
* initialize values[]
*/
i = 0;
values[i++] = ObjectIdGetDatum(relid); /* starelid */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: stringinfo.c,v 1.27 2001/01/24 19:42:55 momjian Exp $
* $Id: stringinfo.c,v 1.28 2001/03/22 06:16:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -106,11 +106,11 @@ appendStringInfo(StringInfo str, const char *fmt,...)
for (;;)
{
/*----------
* Try to format the given string into the available space;
* but if there's hardly any space, don't bother trying,
* just fall through to enlarge the buffer first.
*----------
/*
* Try to format the given string into the available space; but if
* there's hardly any space, don't bother trying, just fall
* through to enlarge the buffer first.
*/
avail = str->maxlen - str->len - 1;
if (avail > 16)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment