1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

Make large objects their own relkind type. Fix dups in pg_class_mb

files.  Fix sequence creation hack for relkind type.
This commit is contained in:
Bruce Momjian
1998-08-06 05:13:14 +00:00
parent 8962ec4bc4
commit af5fde7491
23 changed files with 2904 additions and 3687 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.18 1998/07/26 04:30:18 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootparse.y,v 1.19 1998/08/06 05:12:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -177,10 +177,10 @@ Boot_CreateStmt:
{
Oid id;
TupleDesc tupdesc;
/* extern Oid heap_create_with_catalog();*/
tupdesc = CreateTupleDesc(numattr,attrtypes);
id = heap_create_with_catalog(LexIDStr($3), tupdesc);
id = heap_create_with_catalog(LexIDStr($3),
tupdesc, RELKIND_RELATION);
if (!Quiet)
printf("CREATED relation %s with OID %d\n",
LexIDStr($3), id);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.55 1998/07/27 19:37:46 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.56 1998/08/06 05:12:19 momjian Exp $
*
* INTERFACE ROUTINES
* heap_create() - Create an uncataloged heap relation
@@ -16,7 +16,7 @@
*
* NOTES
* this code taken from access/heap/create.c, which contains
* the old heap_create_with_catalogr, amcreate, and amdestroy.
* the old heap_create_with_catalog, amcreate, and amdestroy.
* those routines will soon call these routines using the function
* manager,
* just like the poorly named "NewXXX" routines do. The
@@ -65,7 +65,8 @@
static void
AddPgRelationTuple(Relation pg_class_desc,
Relation new_rel_desc, Oid new_rel_oid, unsigned natts);
Relation new_rel_desc, Oid new_rel_oid, unsigned natts,
char relkind);
static void AddToTempRelList(Relation r);
static void DeletePgAttributeTuples(Relation rdesc);
static void DeletePgRelationTuple(Relation rdesc);
@@ -345,7 +346,7 @@ heap_create(char *name,
* preforms a scan to ensure that no relation with the
* same name already exists.
*
* 3) heap_create_with_catalogr() is called to create the new relation
* 3) heap_create_with_catalog() is called to create the new relation
* on disk.
*
* 4) TypeDefine() is called to define a new type corresponding
@@ -378,7 +379,7 @@ heap_create(char *name,
* create new relation
* insert new relation into attribute catalog
*
* Should coordinate with heap_create_with_catalogr(). Either
* Should coordinate with heap_create_with_catalog(). Either
* it should not be called or there should be a way to prevent
* the relation from being removed at the end of the
* transaction if it is successful ('u'/'r' may be enough).
@@ -633,14 +634,13 @@ static void
AddPgRelationTuple(Relation pg_class_desc,
Relation new_rel_desc,
Oid new_rel_oid,
unsigned natts)
unsigned natts,
char relkind)
{
Form_pg_class new_rel_reltup;
HeapTuple tup;
Relation idescs[Num_pg_class_indices];
bool isBootstrap;
extern bool ItsSequenceCreation; /* It's hack, I know... - vadim
* 03/28/97 */
/* ----------------
* first we munge some of the information in our
@@ -653,10 +653,7 @@ AddPgRelationTuple(Relation pg_class_desc,
/* new_rel_reltup->reltuples = 1; *//* XXX */
new_rel_reltup->relowner = GetUserId();
if (ItsSequenceCreation)
new_rel_reltup->relkind = RELKIND_SEQUENCE;
else
new_rel_reltup->relkind = RELKIND_RELATION;
new_rel_reltup->relkind = relkind;
new_rel_reltup->relnatts = natts;
/* ----------------
@@ -747,8 +744,9 @@ addNewRelationType(char *typeName, Oid new_rel_oid)
* --------------------------------
*/
Oid
heap_create_with_catalog(char relname[],
TupleDesc tupdesc)
heap_create_with_catalog(char *relname,
TupleDesc tupdesc,
char relkind)
{
Relation pg_class_desc;
Relation new_rel_desc;
@@ -813,7 +811,8 @@ heap_create_with_catalog(char relname[],
AddPgRelationTuple(pg_class_desc,
new_rel_desc,
new_rel_oid,
natts);
natts,
relkind);
StoreConstraints(new_rel_desc);

View File

@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.26 1998/07/27 19:37:50 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.27 1998/08/06 05:12:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -218,7 +218,7 @@ copy_heap(Oid OIDOldHeap)
tupdesc = CreateTupleDescCopy(OldHeapDesc);
OIDNewHeap = heap_create_with_catalog(NewName, tupdesc);
OIDNewHeap = heap_create_with_catalog(NewName, tupdesc, RELKIND_RELATION);
if (!OidIsValid(OIDNewHeap))
elog(ERROR, "clusterheap: cannot create temporary heap relation\n");

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.30 1998/06/15 19:28:14 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.31 1998/08/06 05:12:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@ static void StoreCatalogInheritance(Oid relationId, List *supers);
* ----------------------------------------------------------------
*/
void
DefineRelation(CreateStmt *stmt)
DefineRelation(CreateStmt *stmt, char relkind)
{
char *relname = palloc(NAMEDATALEN);
List *schema = stmt->tableElts;
@@ -137,7 +137,8 @@ DefineRelation(CreateStmt *stmt)
}
}
relationId = heap_create_with_catalog(relname, descriptor);
relationId = heap_create_with_catalog(relname,
descriptor, relkind);
StoreCatalogInheritance(relationId, inheritList);
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.21 1998/06/15 19:28:15 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.22 1998/08/06 05:12:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1032,7 +1032,8 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
tupdesc = rel->rd_att;
relid = heap_create_with_catalog(
child->nodeElem->outTypes->val[0], tupdesc);
child->nodeElem->outTypes->val[0],
tupdesc, RELKIND_RELATION);
}
else
{
@@ -1055,7 +1056,8 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
else
{
relid = heap_create_with_catalog(
child->nodeElem->outTypes->val[0], tupdesc);
child->nodeElem->outTypes->val[0],
tupdesc, RELKIND_RELATION);
}
}
}

View File

@@ -24,8 +24,6 @@
#define SEQ_MAXVALUE ((int4)0x7FFFFFFF)
#define SEQ_MINVALUE -(SEQ_MAXVALUE)
bool ItsSequenceCreation = false;
typedef struct FormData_pg_sequence
{
NameData sequence_name;
@@ -157,15 +155,7 @@ DefineSequence(CreateSeqStmt *seq)
stmt->inhRelnames = NIL;
stmt->constraints = NIL;
ItsSequenceCreation = true; /* hack */
DefineRelation(stmt);
/*
* Xact abort calls CloseSequences, which turns ItsSequenceCreation
* off
*/
ItsSequenceCreation = false;/* hack */
DefineRelation(stmt, RELKIND_SEQUENCE);
rel = heap_openr(seq->seqname);
Assert(RelationIsValid(rel));
@@ -438,8 +428,6 @@ CloseSequences(void)
SeqTable elm;
Relation rel;
ItsSequenceCreation = false;
for (elm = seqtab; elm != (SeqTable) NULL;)
{
if (elm->rel != (Relation) NULL) /* opened in current xact */

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.23 1998/07/19 05:49:12 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.24 1998/08/06 05:12:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -105,7 +105,7 @@ DefineVirtualRelation(char *relname, List *tlist)
/*
* finally create the relation...
*/
DefineRelation(&createStmt);
DefineRelation(&createStmt, RELKIND_RELATION);
}
/*------------------------------------------------------------------

View File

@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.51 1998/07/27 19:37:55 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.52 1998/08/06 05:12:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -587,7 +587,8 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
*/
tupdesc = CreateTupleDescCopy(tupType);
intoRelationId = heap_create_with_catalog(intoName, tupdesc);
intoRelationId = heap_create_with_catalog(intoName,
tupdesc, RELKIND_RELATION);
FreeTupleDesc(tupdesc);

View File

@@ -15,7 +15,7 @@
* ExecEndTee
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.19 1998/07/27 19:37:57 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.20 1998/08/06 05:12:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -168,7 +168,8 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent)
bufferRel = heap_openr(teeState->tee_bufferRelname);
else
bufferRel = heap_open(
heap_create_with_catalog(teeState->tee_bufferRelname, tupType));
heap_create_with_catalog(teeState->tee_bufferRelname,
tupType, RELKIND_RELATION));
}
else
{
@@ -177,7 +178,8 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent)
newoid());
/* bufferRel = ExecCreatR(len, tupType, _TEMP_RELATION_ID); */
bufferRel = heap_open(
heap_create_with_catalog(teeState->tee_bufferRelname, tupType));
heap_create_with_catalog(teeState->tee_bufferRelname,
tupType, RELKIND_RELATION));
}
teeState->tee_bufferRel = bufferRel;

File diff suppressed because it is too large Load Diff

View File

@@ -16,6 +16,7 @@ typedef union
DefElem *defelt;
ParamString *param;
SortGroupBy *sortgroupby;
JoinUsing *joinusing;
IndexElem *ielem;
RangeVar *range;
RelExpr *relexp;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.32 1998/07/27 19:38:11 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.33 1998/08/06 05:12:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -153,7 +153,7 @@ inv_create(int flags)
* be located on whatever storage manager the user requested.
*/
heap_create_with_catalog(objname, tupdesc);
heap_create_with_catalog(objname, tupdesc, RELKIND_LOBJECT);
/* make the relation visible in this transaction */
CommandCounterIncrement();

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.44 1998/07/26 04:30:48 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.45 1998/08/06 05:12:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -173,7 +173,7 @@ ProcessUtility(Node *parsetree,
*ps_status = commandTag = "CREATE";
CHECK_IF_ABORTED();
DefineRelation((CreateStmt *) parsetree);
DefineRelation((CreateStmt *) parsetree, RELKIND_RELATION);
break;
case T_DestroyStmt: