mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
Remove archive stuff.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.16 1997/11/20 23:20:58 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.17 1997/11/21 18:09:46 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -215,11 +215,7 @@ copy_heap(Oid OIDOldHeap)
|
||||
|
||||
tupdesc = CreateTupleDescCopy(OldHeapDesc);
|
||||
|
||||
OIDNewHeap = heap_create(NewName,
|
||||
NULL,
|
||||
OldHeap->rd_rel->relarch,
|
||||
OldHeap->rd_rel->relsmgr,
|
||||
tupdesc);
|
||||
OIDNewHeap = heap_create(NewName, tupdesc);
|
||||
|
||||
if (!OidIsValid(OIDNewHeap))
|
||||
elog(WARN, "clusterheap: cannot create temporary heap relation\n");
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.18 1997/10/25 01:08:51 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.19 1997/11/21 18:09:49 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -51,16 +51,9 @@ DefineRelation(CreateStmt *stmt)
|
||||
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,
|
||||
@@ -75,53 +68,6 @@ DefineRelation(CreateStmt *stmt)
|
||||
*/
|
||||
inheritList = stmt->inhRelnames;
|
||||
|
||||
/* ----------------
|
||||
* determine archive mode
|
||||
* XXX use symbolic constants...
|
||||
* ----------------
|
||||
*/
|
||||
archChar = 'n';
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (stmt->location == -1)
|
||||
heaploc = 0;
|
||||
else
|
||||
heaploc = stmt->location;
|
||||
|
||||
/*
|
||||
* For now, any user-defined relation defaults to the magnetic disk
|
||||
* storgage manager. --mao 2 july 91
|
||||
*/
|
||||
if (stmt->archiveLoc == -1)
|
||||
{
|
||||
archloc = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (archChar == 'n')
|
||||
{
|
||||
elog(WARN, "Set archive location, but not mode, for %s",
|
||||
relname);
|
||||
}
|
||||
archloc = stmt->archiveLoc;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* generate relation schema, including inherited attributes.
|
||||
* ----------------
|
||||
@@ -191,42 +137,9 @@ DefineRelation(CreateStmt *stmt)
|
||||
}
|
||||
}
|
||||
|
||||
relationId = heap_create(relname,
|
||||
typename,
|
||||
archChar,
|
||||
heaploc,
|
||||
descriptor);
|
||||
relationId = heap_create(relname, descriptor);
|
||||
|
||||
StoreCatalogInheritance(relationId, inheritList);
|
||||
|
||||
/*
|
||||
* create an archive relation if necessary
|
||||
*/
|
||||
if (archChar != 'n')
|
||||
{
|
||||
TupleDesc tupdesc;
|
||||
|
||||
/*
|
||||
* Need to create an archive relation for this heap relation. We
|
||||
* cobble up the command by hand, and increment the command
|
||||
* counter ourselves.
|
||||
*/
|
||||
|
||||
CommandCounterIncrement();
|
||||
archiveName = MakeArchiveName(relationId);
|
||||
|
||||
tupdesc = CreateTupleDescCopy(descriptor); /* get rid of
|
||||
* constraints */
|
||||
(void) heap_create(archiveName,
|
||||
typename,
|
||||
'n', /* archive isn't archived */
|
||||
archloc,
|
||||
tupdesc);
|
||||
|
||||
FreeTupleDesc(tupdesc);
|
||||
FreeTupleDesc(descriptor);
|
||||
pfree(archiveName);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -664,26 +577,3 @@ checkAttrExists(char *attributeName, char *attributeType, List *schema)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* MakeArchiveName
|
||||
* make an archive rel name out of a regular rel name
|
||||
*
|
||||
* the CALLER is responsible for freeing the memory allocated
|
||||
*/
|
||||
|
||||
char *
|
||||
MakeArchiveName(Oid relationId)
|
||||
{
|
||||
char *arch;
|
||||
|
||||
/*
|
||||
* Archive relations are named a,XXXXX where XXXXX == the OID of the
|
||||
* relation they archive. Create a string containing this name and
|
||||
* find the reldesc for the archive relation.
|
||||
*/
|
||||
arch = palloc(NAMEDATALEN);
|
||||
sprintf(arch, "a,%d", relationId);
|
||||
|
||||
return arch;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.11 1997/11/20 23:21:10 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.12 1997/11/21 18:09:51 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1047,11 +1047,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
|
||||
len = length(q->qtrees[0]->targetList);
|
||||
tupdesc = rel->rd_att;
|
||||
|
||||
relid = heap_create(child->nodeElem->outTypes->val[0],
|
||||
NULL, /* XXX */
|
||||
'n',
|
||||
DEFAULT_SMGR,
|
||||
tupdesc);
|
||||
relid = heap_create(child->nodeElem->outTypes->val[0], tupdesc);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1076,9 +1072,6 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
|
||||
else
|
||||
{
|
||||
relid = heap_create(child->nodeElem->outTypes->val[0],
|
||||
NULL, /* XXX */
|
||||
'n',
|
||||
DEFAULT_SMGR,
|
||||
tupdesc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,8 +151,6 @@ DefineSequence(CreateSeqStmt *seq)
|
||||
}
|
||||
|
||||
stmt->relname = seq->seqname;
|
||||
stmt->archiveLoc = -1; /* default */
|
||||
stmt->archiveType = ARCH_NONE;
|
||||
stmt->inhRelnames = NIL;
|
||||
stmt->constraints = NIL;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.50 1997/11/20 23:21:16 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.51 1997/11/21 18:09:54 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -82,7 +82,7 @@ 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_vacpage(Page page, VPageDescr vpd);
|
||||
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);
|
||||
@@ -96,9 +96,6 @@ 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);
|
||||
@@ -271,7 +268,6 @@ vc_getrels(NameData *VacRelP)
|
||||
Datum d;
|
||||
char *rname;
|
||||
char rkind;
|
||||
int16 smgrno;
|
||||
bool n;
|
||||
ScanKeyData pgckey;
|
||||
bool found = false;
|
||||
@@ -303,23 +299,9 @@ vc_getrels(NameData *VacRelP)
|
||||
|
||||
found = true;
|
||||
|
||||
/*
|
||||
* We have to be careful not to vacuum the archive (since it
|
||||
* already contains vacuumed tuples), and not to vacuum relations
|
||||
* on write-once storage managers like the Sony jukebox at
|
||||
* Berkeley.
|
||||
*/
|
||||
|
||||
d = heap_getattr(pgctup, buf, Anum_pg_class_relname, pgcdesc, &n);
|
||||
rname = (char *) d;
|
||||
|
||||
/* skip archive relations */
|
||||
if (vc_isarchrel(rname))
|
||||
{
|
||||
ReleaseBuffer(buf);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* don't vacuum large objects for now - something breaks when we
|
||||
* do
|
||||
@@ -335,16 +317,6 @@ vc_getrels(NameData *VacRelP)
|
||||
continue;
|
||||
}
|
||||
|
||||
d = heap_getattr(pgctup, buf, Anum_pg_class_relsmgr, pgcdesc, &n);
|
||||
smgrno = DatumGetInt16(d);
|
||||
|
||||
/* skip write-once storage managers */
|
||||
if (smgriswo(smgrno))
|
||||
{
|
||||
ReleaseBuffer(buf);
|
||||
continue;
|
||||
}
|
||||
|
||||
d = heap_getattr(pgctup, buf, Anum_pg_class_relkind, pgcdesc, &n);
|
||||
|
||||
rkind = DatumGetChar(d);
|
||||
@@ -1005,7 +977,6 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
|
||||
ntups;
|
||||
bool isempty,
|
||||
dowrite;
|
||||
Relation archrel;
|
||||
struct rusage ru0,
|
||||
ru1;
|
||||
|
||||
@@ -1022,27 +993,6 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
|
||||
inulls = (char *) palloc(INDEX_MAX_KEYS * sizeof(*inulls));
|
||||
}
|
||||
|
||||
/* if the relation has an archive, open it */
|
||||
if (onerel->rd_rel->relarch != 'n')
|
||||
{
|
||||
archrel = vc_getarchrel(onerel);
|
||||
/* Archive tuples from "empty" end-pages */
|
||||
for (vpp = Vvpl->vpl_pgdesc + Vvpl->vpl_npages - 1,
|
||||
i = Vvpl->vpl_nemend; i > 0; i--, vpp--)
|
||||
{
|
||||
if ((*vpp)->vpd_noff > 0)
|
||||
{
|
||||
buf = ReadBuffer(onerel, (*vpp)->vpd_blkno);
|
||||
page = BufferGetPage(buf);
|
||||
Assert(!PageIsEmpty(page));
|
||||
vc_vacpage(page, *vpp, archrel);
|
||||
WriteBuffer(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
archrel = (Relation) NULL;
|
||||
|
||||
Nvpl.vpl_npages = 0;
|
||||
Fnpages = Fvpl->vpl_npages;
|
||||
Fvplast = Fvpl->vpl_pgdesc[Fnpages - 1];
|
||||
@@ -1078,7 +1028,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
|
||||
if (Vvplast->vpd_noff > 0) /* there are dead tuples */
|
||||
{ /* on this page - clean */
|
||||
Assert(!isempty);
|
||||
vc_vacpage(page, Vvplast, archrel);
|
||||
vc_vacpage(page, Vvplast);
|
||||
dowrite = true;
|
||||
}
|
||||
else
|
||||
@@ -1169,7 +1119,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
|
||||
ToPage = BufferGetPage(ToBuf);
|
||||
/* if this page was not used before - clean it */
|
||||
if (!PageIsEmpty(ToPage) && ToVpd->vpd_nusd == 0)
|
||||
vc_vacpage(ToPage, ToVpd, archrel);
|
||||
vc_vacpage(ToPage, ToVpd);
|
||||
}
|
||||
|
||||
/* copy tuple */
|
||||
@@ -1292,7 +1242,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
|
||||
* re-used
|
||||
*/
|
||||
Assert((*vpp)->vpd_noff > 0);
|
||||
vc_vacpage(page, *vpp, archrel);
|
||||
vc_vacpage(page, *vpp);
|
||||
}
|
||||
else
|
||||
/* this page was used */
|
||||
@@ -1392,14 +1342,11 @@ Elapsed %u/%u sec.",
|
||||
i = BlowawayRelationBuffers(onerel, blkno);
|
||||
if (i < 0)
|
||||
elog (FATAL, "VACUUM (vc_rpfheap): BlowawayRelationBuffers returned %d", i);
|
||||
blkno = smgrtruncate(onerel->rd_rel->relsmgr, onerel, blkno);
|
||||
blkno = smgrtruncate(DEFAULT_SMGR, onerel, blkno);
|
||||
Assert(blkno >= 0);
|
||||
vacrelstats->npages = blkno; /* set new number of blocks */
|
||||
}
|
||||
|
||||
if (archrel != (Relation) NULL)
|
||||
heap_close(archrel);
|
||||
|
||||
if (Irel != (Relation *) NULL) /* pfree index' allocations */
|
||||
{
|
||||
pfree(Idesc);
|
||||
@@ -1424,19 +1371,11 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList Vvpl)
|
||||
Buffer buf;
|
||||
Page page;
|
||||
VPageDescr *vpp;
|
||||
Relation archrel;
|
||||
int nblocks;
|
||||
int i;
|
||||
|
||||
nblocks = Vvpl->vpl_npages;
|
||||
/* if the relation has an archive, open it */
|
||||
if (onerel->rd_rel->relarch != 'n')
|
||||
archrel = vc_getarchrel(onerel);
|
||||
else
|
||||
{
|
||||
archrel = (Relation) NULL;
|
||||
nblocks -= Vvpl->vpl_nemend; /* nothing to do with them */
|
||||
}
|
||||
nblocks -= Vvpl->vpl_nemend; /* nothing to do with them */
|
||||
|
||||
for (i = 0, vpp = Vvpl->vpl_pgdesc; i < nblocks; i++, vpp++)
|
||||
{
|
||||
@@ -1444,7 +1383,7 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList Vvpl)
|
||||
{
|
||||
buf = ReadBuffer(onerel, (*vpp)->vpd_blkno);
|
||||
page = BufferGetPage(buf);
|
||||
vc_vacpage(page, *vpp, archrel);
|
||||
vc_vacpage(page, *vpp);
|
||||
WriteBuffer(buf);
|
||||
}
|
||||
}
|
||||
@@ -1468,22 +1407,19 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList Vvpl)
|
||||
if (i < 0)
|
||||
elog (FATAL, "VACUUM (vc_vacheap): BlowawayRelationBuffers returned %d", i);
|
||||
|
||||
nblocks = smgrtruncate(onerel->rd_rel->relsmgr, onerel, nblocks);
|
||||
nblocks = smgrtruncate(DEFAULT_SMGR, onerel, nblocks);
|
||||
Assert(nblocks >= 0);
|
||||
vacrelstats->npages = nblocks; /* set new number of blocks */
|
||||
}
|
||||
|
||||
if (archrel != (Relation) NULL)
|
||||
heap_close(archrel);
|
||||
|
||||
} /* vc_vacheap */
|
||||
|
||||
/*
|
||||
* vc_vacpage() -- free (and archive if needed) dead tuples on a page
|
||||
* vc_vacpage() -- free dead tuples on a page
|
||||
* and repaire its fragmentation.
|
||||
*/
|
||||
static void
|
||||
vc_vacpage(Page page, VPageDescr vpd, Relation archrel)
|
||||
vc_vacpage(Page page, VPageDescr vpd)
|
||||
{
|
||||
ItemId itemid;
|
||||
HeapTuple htup;
|
||||
@@ -1493,11 +1429,6 @@ vc_vacpage(Page page, VPageDescr vpd, Relation archrel)
|
||||
for (i = 0; i < vpd->vpd_noff; i++)
|
||||
{
|
||||
itemid = &(((PageHeader) page)->pd_linp[vpd->vpd_voff[i] - 1]);
|
||||
if (archrel != (Relation) NULL && ItemIdIsUsed(itemid))
|
||||
{
|
||||
htup = (HeapTuple) PageGetItem(page, itemid);
|
||||
vc_archive(archrel, htup);
|
||||
}
|
||||
itemid->lp_flags &= ~LP_USED;
|
||||
}
|
||||
PageRepairFragmentation(page);
|
||||
@@ -2128,51 +2059,6 @@ vc_free(VRelList vrl)
|
||||
MemoryContextSwitchTo(old);
|
||||
}
|
||||
|
||||
/*
|
||||
* vc_getarchrel() -- open the archive relation for a heap relation
|
||||
*
|
||||
* The archive relation is named 'a,XXXXX' for the heap relation
|
||||
* whose relid is XXXXX.
|
||||
*/
|
||||
|
||||
#define ARCHIVE_PREFIX "a,"
|
||||
|
||||
static Relation
|
||||
vc_getarchrel(Relation heaprel)
|
||||
{
|
||||
Relation archrel;
|
||||
char *archrelname;
|
||||
|
||||
archrelname = palloc(sizeof(ARCHIVE_PREFIX) + NAMEDATALEN); /* bogus */
|
||||
sprintf(archrelname, "%s%d", ARCHIVE_PREFIX, heaprel->rd_id);
|
||||
|
||||
archrel = heap_openr(archrelname);
|
||||
|
||||
pfree(archrelname);
|
||||
return (archrel);
|
||||
}
|
||||
|
||||
/*
|
||||
* vc_archive() -- write a tuple to an archive relation
|
||||
*
|
||||
* In the future, this will invoke the archived accessd method. For
|
||||
* now, archive relations are on mag disk.
|
||||
*/
|
||||
static void
|
||||
vc_archive(Relation archrel, HeapTuple htup)
|
||||
{
|
||||
doinsert(archrel, htup);
|
||||
}
|
||||
|
||||
static bool
|
||||
vc_isarchrel(char *rname)
|
||||
{
|
||||
if (strncmp(ARCHIVE_PREFIX, rname, strlen(ARCHIVE_PREFIX)) == 0)
|
||||
return (true);
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
static char *
|
||||
vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, char *))
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.14 1997/11/20 23:21:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.15 1997/11/21 18:09:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -100,9 +100,6 @@ DefineVirtualRelation(char *relname, List *tlist)
|
||||
createStmt.tableElts = attrList;
|
||||
/* createStmt.tableType = NULL;*/
|
||||
createStmt.inhRelnames = NIL;
|
||||
createStmt.archiveType = ARCH_NONE;
|
||||
createStmt.location = -1;
|
||||
createStmt.archiveLoc = -1;
|
||||
createStmt.constraints = NIL;
|
||||
|
||||
/*
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.31 1997/11/20 23:21:24 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.32 1997/11/21 18:10:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -546,7 +546,6 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
if (operation == CMD_SELECT)
|
||||
{
|
||||
char *intoName;
|
||||
char archiveMode;
|
||||
Oid intoRelationId;
|
||||
TupleDesc tupdesc;
|
||||
|
||||
@@ -560,14 +559,9 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
{
|
||||
/* ----------------
|
||||
* create the "into" relation
|
||||
*
|
||||
* note: there is currently no way for the user to
|
||||
* specify the desired archive mode of the
|
||||
* "into" relation...
|
||||
* ----------------
|
||||
*/
|
||||
intoName = parseTree->into;
|
||||
archiveMode = 'n';
|
||||
|
||||
/*
|
||||
* have to copy tupType to get rid of constraints
|
||||
@@ -577,11 +571,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
/* fixup to prevent zero-length columns in create */
|
||||
setVarAttrLenForCreateTable(tupdesc, targetList, rangeTable);
|
||||
|
||||
intoRelationId = heap_create(intoName,
|
||||
intoName, /* not used */
|
||||
archiveMode,
|
||||
DEFAULT_SMGR,
|
||||
tupdesc);
|
||||
intoRelationId = heap_create(intoName, tupdesc);
|
||||
#ifdef NOT_USED /* it's copy ... */
|
||||
resetVarAttrLenForCreateTable(tupdesc);
|
||||
#endif
|
||||
@@ -1334,7 +1324,6 @@ ExecRelCheck(Relation rel, HeapTuple tuple)
|
||||
rte->refname = rte->relname;
|
||||
rte->relid = rel->rd_id;
|
||||
rte->inh = false;
|
||||
rte->archive = false;
|
||||
rte->inFromCl = true;
|
||||
rtlist = lcons(rte, NIL);
|
||||
econtext->ecxt_scantuple = slot; /* scan tuple slot */
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* ExecEndTee
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.10 1997/11/20 23:21:35 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.11 1997/11/21 18:10:08 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -168,9 +168,6 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent)
|
||||
bufferRel = heap_openr(teeState->tee_bufferRelname);
|
||||
else
|
||||
bufferRel = heap_open(heap_create(teeState->tee_bufferRelname,
|
||||
/* FIX */ NULL,
|
||||
'n',
|
||||
DEFAULT_SMGR,
|
||||
tupType));
|
||||
}
|
||||
else
|
||||
@@ -180,9 +177,6 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent)
|
||||
newoid());
|
||||
/* bufferRel = ExecCreatR(len, tupType, _TEMP_RELATION_ID); */
|
||||
bufferRel = heap_open(heap_create(teeState->tee_bufferRelname,
|
||||
NULL, /* XXX */
|
||||
'n',
|
||||
DEFAULT_SMGR,
|
||||
tupType));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.29 1997/11/19 18:28:59 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.30 1997/11/21 18:10:15 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h> /* for ttyname() */
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.9 1997/09/08 21:45:27 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.10 1997/11/21 18:10:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -92,17 +92,6 @@ planner(Query *parse)
|
||||
INHERITS_FLAG);
|
||||
}
|
||||
|
||||
/*
|
||||
* plan archive queries
|
||||
*/
|
||||
rt_index = first_matching_rt_entry(rangetable, ARCHIVE_FLAG);
|
||||
if (rt_index != -1)
|
||||
{
|
||||
special_plans = (Plan *) plan_union_queries((Index) rt_index,
|
||||
parse,
|
||||
ARCHIVE_FLAG);
|
||||
}
|
||||
|
||||
if (special_plans)
|
||||
result_plan = special_plans;
|
||||
else
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Makefile for optimizer/prep
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/backend/optimizer/prep/Makefile,v 1.3 1996/11/09 06:18:23 momjian Exp $
|
||||
# $Header: /cvsroot/pgsql/src/backend/optimizer/prep/Makefile,v 1.4 1997/11/21 18:10:39 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@@ -17,7 +17,7 @@ INCLUDE_OPT = -I../.. \
|
||||
|
||||
CFLAGS+=$(INCLUDE_OPT)
|
||||
|
||||
OBJS = archive.o prepqual.o preptlist.o prepunion.o
|
||||
OBJS = prepqual.o preptlist.o prepunion.o
|
||||
|
||||
# not ready yet: predmig.o xfunc.o
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* prepunion.c--
|
||||
* Routines to plan archive, inheritance, union, and version queries
|
||||
* Routines to plan inheritance, union, and version queries
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.7 1997/11/20 23:21:57 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.8 1997/11/21 18:10:44 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -118,10 +118,6 @@ first_matching_rt_entry(List *rangetable, UnionFlag flag)
|
||||
if (rt_entry->inh)
|
||||
return count + 1;
|
||||
break;
|
||||
case ARCHIVE_FLAG:
|
||||
if (rt_entry->archive)
|
||||
return count + 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -192,9 +188,6 @@ plan_union_queries(Index rt_index,
|
||||
case INHERITS_FLAG:
|
||||
rt_fetch(rt_index, rangetable)->inh = false;
|
||||
break;
|
||||
case ARCHIVE_FLAG:
|
||||
rt_fetch(rt_index, rangetable)->archive = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -249,22 +242,10 @@ plan_union_query(List *relids,
|
||||
/* new_root->uniqueFlag = false; */
|
||||
new_root->uniqueFlag = NULL;
|
||||
new_root->sortClause = NULL;
|
||||
if (flag == ARCHIVE_FLAG)
|
||||
{
|
||||
|
||||
/*
|
||||
* the entire union query uses the same (most recent) schema.
|
||||
* to do otherwise would require either ragged tuples or
|
||||
* careful archiving and interpretation of pg_attribute...
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
fix_parsetree_attnums(rt_index,
|
||||
rt_entry->relid,
|
||||
relid,
|
||||
new_root);
|
||||
}
|
||||
fix_parsetree_attnums(rt_index,
|
||||
rt_entry->relid,
|
||||
relid,
|
||||
new_root);
|
||||
|
||||
union_plans = lappend(union_plans, planner(new_root));
|
||||
union_rtentries = lappend(union_rtentries, new_rt_entry);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.69 1997/11/20 23:22:19 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.70 1997/11/21 18:10:49 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -41,7 +41,6 @@
|
||||
#include "parser/gramparse.h"
|
||||
#include "parser/catalog_utils.h"
|
||||
#include "parser/parse_query.h"
|
||||
#include "storage/smgr.h"
|
||||
#include "utils/acl.h"
|
||||
#include "catalog/catname.h"
|
||||
#include "utils/elog.h"
|
||||
@@ -101,7 +100,6 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
|
||||
|
||||
VersionStmt *vstmt;
|
||||
DefineStmt *dstmt;
|
||||
PurgeStmt *pstmt;
|
||||
RuleStmt *rstmt;
|
||||
AppendStmt *astmt;
|
||||
}
|
||||
@@ -112,8 +110,8 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
|
||||
ExtendStmt, FetchStmt, GrantStmt, CreateTrigStmt, DropTrigStmt,
|
||||
CreatePLangStmt, DropPLangStmt,
|
||||
IndexStmt, ListenStmt, OptimizableStmt,
|
||||
ProcedureStmt, PurgeStmt,
|
||||
RecipeStmt, RemoveAggrStmt, RemoveOperStmt, RemoveFuncStmt, RemoveStmt,
|
||||
ProcedureStmt, RecipeStmt, RemoveAggrStmt, RemoveOperStmt,
|
||||
RemoveFuncStmt, RemoveStmt,
|
||||
RenameStmt, RevokeStmt, RuleStmt, TransactionStmt, ViewStmt, LoadStmt,
|
||||
CreatedbStmt, DestroydbStmt, VacuumStmt, RetrieveStmt, CursorStmt,
|
||||
ReplaceStmt, AppendStmt, NotifyStmt, DeleteStmt, ClusterStmt,
|
||||
@@ -132,7 +130,7 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
|
||||
class, index_name, name, file_name, recipe_name, aggr_argtype
|
||||
|
||||
%type <str> opt_id, opt_portal_name,
|
||||
before_clause, after_clause, all_Op, MathOp, opt_name, opt_unique,
|
||||
all_Op, MathOp, opt_name, opt_unique,
|
||||
result, OptUseOp, opt_class, SpecialRuleRelation
|
||||
|
||||
%type <str> privileges, operation_commalist, grantee
|
||||
@@ -163,16 +161,15 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
|
||||
%type <boolean> opt_inh_star, opt_binary, opt_instead, opt_with_copy,
|
||||
index_opt_unique, opt_verbose, opt_analyze
|
||||
|
||||
%type <ival> copy_dirn, archive_type, OptArchiveType, OptArchiveLocation,
|
||||
def_type, opt_direction, remove_type, opt_column, event
|
||||
%type <ival> copy_dirn, def_type, opt_direction, remove_type,
|
||||
opt_column, event
|
||||
|
||||
%type <ival> OptLocation, fetch_how_many
|
||||
%type <ival> fetch_how_many
|
||||
|
||||
%type <list> OptSeqList
|
||||
%type <defelt> OptSeqElem
|
||||
|
||||
%type <dstmt> def_rest
|
||||
%type <pstmt> purge_quals
|
||||
%type <astmt> insert_rest
|
||||
|
||||
%type <coldef> columnDef, alter_clause
|
||||
@@ -257,15 +254,14 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
|
||||
|
||||
/* Keywords for Postgres support (not in SQL92 reserved words) */
|
||||
%token ABORT_TRANS, ACL, AFTER, AGGREGATE, ANALYZE,
|
||||
APPEND, ARCHIVE, ARCH_STORE,
|
||||
BACKWARD, BEFORE, BINARY, CHANGE, CLUSTER, COPY,
|
||||
APPEND, BACKWARD, BEFORE, BINARY, CHANGE, CLUSTER, COPY,
|
||||
DATABASE, DELIMITERS, DO, EXPLAIN, EXTEND,
|
||||
FORWARD, FUNCTION, HANDLER, HEAVY,
|
||||
FORWARD, FUNCTION, HANDLER,
|
||||
INDEX, INHERITS, INSTEAD, ISNULL,
|
||||
LANCOMPILER, LIGHT, LISTEN, LOAD, LOCATION, MERGE, MOVE,
|
||||
NEW, NONE, NOTHING, OIDS, OPERATOR, PROCEDURAL, PURGE,
|
||||
LANCOMPILER, LISTEN, LOAD, LOCATION, MERGE, MOVE,
|
||||
NEW, NONE, NOTHING, OIDS, OPERATOR, PROCEDURAL,
|
||||
RECIPE, RENAME, REPLACE, RESET, RETRIEVE, RETURNS, RULE,
|
||||
SEQUENCE, SETOF, SHOW, STDIN, STDOUT, STORE, TRUSTED,
|
||||
SEQUENCE, SETOF, SHOW, STDIN, STDOUT, TRUSTED,
|
||||
VACUUM, VERBOSE, VERSION
|
||||
|
||||
/* Special keywords, not in the query language - see the "lex" file */
|
||||
@@ -336,7 +332,6 @@ stmt : AddAttrStmt
|
||||
| IndexStmt
|
||||
| ListenStmt
|
||||
| ProcedureStmt
|
||||
| PurgeStmt
|
||||
| RecipeStmt
|
||||
| RemoveAggrStmt
|
||||
| RemoveOperStmt
|
||||
@@ -664,17 +659,13 @@ copy_delimiter: USING DELIMITERS Sconst { $$ = $3;}
|
||||
*****************************************************************************/
|
||||
|
||||
CreateStmt: CREATE TABLE relation_name '(' OptTableElementList ')'
|
||||
OptInherit OptConstraint OptArchiveType OptLocation
|
||||
OptArchiveLocation
|
||||
OptInherit OptConstraint OptArchiveType
|
||||
{
|
||||
CreateStmt *n = makeNode(CreateStmt);
|
||||
n->relname = $3;
|
||||
n->tableElts = $5;
|
||||
n->inhRelnames = $7;
|
||||
n->constraints = $8;
|
||||
n->archiveType = $9;
|
||||
n->location = $10;
|
||||
n->archiveLoc = $11;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
;
|
||||
@@ -690,26 +681,12 @@ tableElementList :
|
||||
{ $$ = lcons($1, NIL); }
|
||||
;
|
||||
|
||||
|
||||
OptArchiveType: ARCHIVE '=' archive_type { $$ = $3; }
|
||||
| /*EMPTY*/ { $$ = ARCH_NONE; }
|
||||
;
|
||||
|
||||
archive_type: HEAVY { $$ = ARCH_HEAVY; }
|
||||
| LIGHT { $$ = ARCH_LIGHT; }
|
||||
| NONE { $$ = ARCH_NONE; }
|
||||
;
|
||||
|
||||
OptLocation: STORE '=' Sconst
|
||||
{ $$ = smgrin($3); }
|
||||
| /*EMPTY*/
|
||||
{ $$ = -1; }
|
||||
;
|
||||
|
||||
OptArchiveLocation: ARCH_STORE '=' Sconst
|
||||
{ $$ = smgrin($3); }
|
||||
| /*EMPTY*/
|
||||
{ $$ = -1; }
|
||||
/*
|
||||
* This was removed in 6.3, but we keep it so people can upgrade
|
||||
* with old pg_dump scripts.
|
||||
*/
|
||||
OptArchiveType: ARCHIVE '=' NONE { }
|
||||
| /*EMPTY*/ { }
|
||||
;
|
||||
|
||||
OptInherit: INHERITS '(' relation_name_list ')' { $$ = $3; }
|
||||
@@ -1254,7 +1231,7 @@ RevokeStmt: REVOKE privileges ON relation_name_list FROM grantee
|
||||
/*****************************************************************************
|
||||
*
|
||||
* QUERY:
|
||||
* define [archive] index <indexname> on <relname>
|
||||
* create index <indexname> on <relname>
|
||||
* using <access> "(" (<col> with <op>)+ ")" [with
|
||||
* <target_list>]
|
||||
*
|
||||
@@ -1407,59 +1384,6 @@ def_args: '(' def_name_list ')' { $$ = $2; }
|
||||
|
||||
def_name_list: name_list;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* QUERY:
|
||||
* purge <relname> [before <date>] [after <date>]
|
||||
* or
|
||||
* purge <relname> [after <date>] [before <date>]
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
PurgeStmt: PURGE relation_name purge_quals
|
||||
{
|
||||
$3->relname = $2;
|
||||
$$ = (Node *)$3;
|
||||
}
|
||||
;
|
||||
|
||||
purge_quals: before_clause
|
||||
{
|
||||
$$ = makeNode(PurgeStmt);
|
||||
$$->beforeDate = $1;
|
||||
$$->afterDate = NULL;
|
||||
}
|
||||
| after_clause
|
||||
{
|
||||
$$ = makeNode(PurgeStmt);
|
||||
$$->beforeDate = NULL;
|
||||
$$->afterDate = $1;
|
||||
}
|
||||
| before_clause after_clause
|
||||
{
|
||||
$$ = makeNode(PurgeStmt);
|
||||
$$->beforeDate = $1;
|
||||
$$->afterDate = $2;
|
||||
}
|
||||
| after_clause before_clause
|
||||
{
|
||||
$$ = makeNode(PurgeStmt);
|
||||
$$->beforeDate = $2;
|
||||
$$->afterDate = $1;
|
||||
}
|
||||
| /*EMPTY*/
|
||||
{
|
||||
$$ = makeNode(PurgeStmt);
|
||||
$$->beforeDate = NULL;
|
||||
$$->afterDate = NULL;
|
||||
}
|
||||
;
|
||||
|
||||
before_clause: BEFORE date { $$ = $2; }
|
||||
after_clause: AFTER date { $$ = $2; }
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* QUERY:
|
||||
@@ -2122,7 +2046,7 @@ SubSelect: SELECT opt_unique res_target_list2
|
||||
;
|
||||
|
||||
result: INTO TABLE relation_name
|
||||
{ $$= $3; /* should check for archive level */ }
|
||||
{ $$= $3; }
|
||||
| /*EMPTY*/
|
||||
{ $$ = NULL; }
|
||||
;
|
||||
@@ -3446,7 +3370,6 @@ ColId: Id { $$ = $1; }
|
||||
| INDEX { $$ = "index"; }
|
||||
| KEY { $$ = "key"; }
|
||||
| LANGUAGE { $$ = "language"; }
|
||||
| LIGHT { $$ = "light"; }
|
||||
| LOCATION { $$ = "location"; }
|
||||
| MATCH { $$ = "match"; }
|
||||
| OPERATOR { $$ = "operator"; }
|
||||
@@ -3481,7 +3404,6 @@ ColLabel: ColId { $$ = $1; }
|
||||
| ORDER { $$ = "order"; }
|
||||
| POSITION { $$ = "position"; }
|
||||
| PRECISION { $$ = "precision"; }
|
||||
| STORE { $$ = "store"; }
|
||||
| TABLE { $$ = "table"; }
|
||||
| TRANSACTION { $$ = "transaction"; }
|
||||
| TRUE_P { $$ = "true"; }
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.22 1997/11/07 07:02:10 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.23 1997/11/21 18:10:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -42,9 +42,7 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"analyze", ANALYZE},
|
||||
{"and", AND},
|
||||
{"append", APPEND},
|
||||
{"archIve", ARCHIVE}, /* XXX crooked: I < _ */
|
||||
{"arch_store", ARCH_STORE},
|
||||
{"archive", ARCHIVE}, /* XXX crooked: i > _ */
|
||||
{"archive", ARCHIVE},
|
||||
{"as", AS},
|
||||
{"asc", ASC},
|
||||
{"backward", BACKWARD},
|
||||
@@ -106,7 +104,6 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"group", GROUP},
|
||||
{"handler", HANDLER},
|
||||
{"having", HAVING},
|
||||
{"heavy", HEAVY},
|
||||
{"hour", HOUR_P},
|
||||
{"in", IN},
|
||||
{"index", INDEX},
|
||||
@@ -124,7 +121,6 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"language", LANGUAGE},
|
||||
{"leading", LEADING},
|
||||
{"left", LEFT},
|
||||
{"light", LIGHT},
|
||||
{"like", LIKE},
|
||||
{"listen", LISTEN},
|
||||
{"load", LOAD},
|
||||
@@ -162,7 +158,6 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"procedural", PROCEDURAL},
|
||||
{"procedure", PROCEDURE},
|
||||
{"public", PUBLIC},
|
||||
{"purge", PURGE},
|
||||
{"recipe", RECIPE},
|
||||
{"references", REFERENCES},
|
||||
{"rename", RENAME},
|
||||
@@ -182,7 +177,6 @@ static ScanKeyword ScanKeywords[] = {
|
||||
{"show", SHOW},
|
||||
{"stdin", STDIN},
|
||||
{"stdout", STDOUT},
|
||||
{"store", STORE},
|
||||
{"substring", SUBSTRING},
|
||||
{"table", TABLE},
|
||||
{"time", TIME},
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.23 1997/11/20 23:22:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.24 1997/11/21 18:10:55 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -148,7 +148,7 @@ addRangeTableEntry(ParseState *pstate,
|
||||
}
|
||||
|
||||
/*
|
||||
* Flags - zero or more from archive,inheritance,union,version or
|
||||
* Flags - zero or more from inheritance,union,version or
|
||||
* recursive (transitive closure) [we don't support them all -- ay
|
||||
* 9/94 ]
|
||||
*/
|
||||
@@ -157,8 +157,6 @@ addRangeTableEntry(ParseState *pstate,
|
||||
/* RelOID */
|
||||
rte->relid = RelationGetRelationId(relation);
|
||||
|
||||
rte->archive = false;
|
||||
|
||||
rte->inFromCl = inFromCl;
|
||||
|
||||
/*
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.28 1997/10/22 19:04:43 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.29 1997/11/21 18:11:04 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -275,7 +275,7 @@ ReadBufferWithBufferLock(Relation reln,
|
||||
{
|
||||
/* new buffers are zero-filled */
|
||||
MemSet((char *) MAKE_PTR(bufHdr->data), 0, BLCKSZ);
|
||||
smgrextend(bufHdr->bufsmgr, reln,
|
||||
smgrextend(DEFAULT_SMGR, reln,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
}
|
||||
return (BufferDescriptorGetBuffer(bufHdr));
|
||||
@@ -290,12 +290,12 @@ ReadBufferWithBufferLock(Relation reln,
|
||||
{
|
||||
/* new buffers are zero-filled */
|
||||
MemSet((char *) MAKE_PTR(bufHdr->data), 0, BLCKSZ);
|
||||
status = smgrextend(bufHdr->bufsmgr, reln,
|
||||
status = smgrextend(DEFAULT_SMGR, reln,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
}
|
||||
else
|
||||
{
|
||||
status = smgrread(bufHdr->bufsmgr, reln, blockNum,
|
||||
status = smgrread(DEFAULT_SMGR, reln, blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ BufferAlloc(Relation reln,
|
||||
if (blockNum == P_NEW)
|
||||
{
|
||||
newblock = TRUE;
|
||||
blockNum = smgrnblocks(reln->rd_rel->relsmgr, reln);
|
||||
blockNum = smgrnblocks(DEFAULT_SMGR, reln);
|
||||
}
|
||||
|
||||
INIT_BUFFERTAG(&newTag, reln, blockNum);
|
||||
@@ -645,9 +645,6 @@ BufferAlloc(Relation reln,
|
||||
strcpy(buf->sb_relname, reln->rd_rel->relname.data);
|
||||
strcpy(buf->sb_dbname, GetDatabaseName());
|
||||
|
||||
/* remember which storage manager is responsible for it */
|
||||
buf->bufsmgr = reln->rd_rel->relsmgr;
|
||||
|
||||
INIT_BUFFERTAG(&(buf->tag), reln, blockNum);
|
||||
if (!BufTableInsert(buf))
|
||||
{
|
||||
@@ -830,7 +827,7 @@ FlushBuffer(Buffer buffer, bool release)
|
||||
bufHdr->flags &= ~BM_JUST_DIRTIED;
|
||||
SpinRelease(BufMgrLock);
|
||||
|
||||
status = smgrflush(bufHdr->bufsmgr, bufrel, bufHdr->tag.blockNum,
|
||||
status = smgrflush(DEFAULT_SMGR, bufrel, bufHdr->tag.blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
|
||||
RelationDecrementReferenceCount(bufrel);
|
||||
@@ -1038,14 +1035,14 @@ BufferSync()
|
||||
#endif /* OPTIMIZE_SINGLE */
|
||||
if (reln == (Relation) NULL)
|
||||
{
|
||||
status = smgrblindwrt(bufHdr->bufsmgr, bufHdr->sb_dbname,
|
||||
status = smgrblindwrt(DEFAULT_SMGR, bufHdr->sb_dbname,
|
||||
bufHdr->sb_relname, bufdb, bufrel,
|
||||
bufHdr->tag.blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
}
|
||||
else
|
||||
{
|
||||
status = smgrwrite(bufHdr->bufsmgr, reln,
|
||||
status = smgrwrite(DEFAULT_SMGR, reln,
|
||||
bufHdr->tag.blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
}
|
||||
@@ -1375,14 +1372,14 @@ BufferReplace(BufferDesc *bufHdr, bool bufferLockHeld)
|
||||
|
||||
if (reln != (Relation) NULL)
|
||||
{
|
||||
status = smgrflush(bufHdr->bufsmgr, reln, bufHdr->tag.blockNum,
|
||||
status = smgrflush(DEFAULT_SMGR, reln, bufHdr->tag.blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* blind write always flushes */
|
||||
status = smgrblindwrt(bufHdr->bufsmgr, bufHdr->sb_dbname,
|
||||
status = smgrblindwrt(DEFAULT_SMGR, bufHdr->sb_dbname,
|
||||
bufHdr->sb_relname, bufdb, bufrel,
|
||||
bufHdr->tag.blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
@@ -1413,7 +1410,7 @@ RelationGetNumberOfBlocks(Relation relation)
|
||||
{
|
||||
return
|
||||
((relation->rd_islocal) ? relation->rd_nblocks :
|
||||
smgrnblocks(relation->rd_rel->relsmgr, relation));
|
||||
smgrnblocks(DEFAULT_SMGR, relation));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.13 1997/10/12 07:12:03 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/localbuf.c,v 1.14 1997/11/21 18:11:07 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -124,7 +124,7 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
|
||||
Assert(bufrel != NULL);
|
||||
|
||||
/* flush this page */
|
||||
smgrwrite(bufrel->rd_rel->relsmgr, bufrel, bufHdr->tag.blockNum,
|
||||
smgrwrite(DEFAULT_SMGR, bufrel, bufHdr->tag.blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
LocalBufferFlushCount++;
|
||||
RelationDecrementReferenceCount(bufrel);
|
||||
@@ -202,7 +202,7 @@ FlushLocalBuffer(Buffer buffer, bool release)
|
||||
bufrel = RelationIdCacheGetRelation(bufHdr->tag.relId.relId);
|
||||
|
||||
Assert(bufrel != NULL);
|
||||
smgrflush(bufrel->rd_rel->relsmgr, bufrel, bufHdr->tag.blockNum,
|
||||
smgrflush(DEFAULT_SMGR, bufrel, bufHdr->tag.blockNum,
|
||||
(char *) MAKE_PTR(bufHdr->data));
|
||||
LocalBufferFlushCount++;
|
||||
RelationDecrementReferenceCount(bufrel);
|
||||
@@ -276,7 +276,7 @@ LocalBufferSync(void)
|
||||
|
||||
Assert(bufrel != NULL);
|
||||
|
||||
smgrwrite(bufrel->rd_rel->relsmgr, bufrel, buf->tag.blockNum,
|
||||
smgrwrite(DEFAULT_SMGR, bufrel, buf->tag.blockNum,
|
||||
(char *) MAKE_PTR(buf->data));
|
||||
LocalBufferFlushCount++;
|
||||
RelationDecrementReferenceCount(bufrel);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.20 1997/11/20 23:22:46 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.21 1997/11/21 18:11:12 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -148,10 +148,7 @@ inv_create(int flags)
|
||||
* be located on whatever storage manager the user requested.
|
||||
*/
|
||||
|
||||
heap_create(objname,
|
||||
objname,
|
||||
(int) archchar, smgr,
|
||||
tupdesc);
|
||||
heap_create(objname, tupdesc);
|
||||
|
||||
/* make the relation visible in this transaction */
|
||||
CommandCounterIncrement();
|
||||
@@ -160,7 +157,7 @@ inv_create(int flags)
|
||||
if (!RelationIsValid(r))
|
||||
{
|
||||
elog(WARN, "cannot create large object on %s under inversion",
|
||||
smgrout(smgr));
|
||||
smgrout(DEFAULT_SMGR));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -185,7 +182,7 @@ inv_create(int flags)
|
||||
if (!RelationIsValid(indr))
|
||||
{
|
||||
elog(WARN, "cannot create index for large obj on %s under inversion",
|
||||
smgrout(smgr));
|
||||
smgrout(DEFAULT_SMGR));
|
||||
}
|
||||
|
||||
retval = (LargeObjectDesc *) palloc(sizeof(LargeObjectDesc));
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.28 1997/11/07 06:38:51 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.29 1997/11/21 18:11:16 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "commands/creatinh.h"
|
||||
#include "commands/sequence.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/purge.h"
|
||||
#include "commands/rename.h"
|
||||
#include "commands/view.h"
|
||||
#include "commands/version.h"
|
||||
@@ -210,19 +209,6 @@ ProcessUtility(Node * parsetree,
|
||||
}
|
||||
break;
|
||||
|
||||
case T_PurgeStmt:
|
||||
{
|
||||
PurgeStmt *stmt = (PurgeStmt *) parsetree;
|
||||
|
||||
commandTag = "PURGE";
|
||||
CHECK_IF_ABORTED();
|
||||
|
||||
RelationPurge(stmt->relname,
|
||||
stmt->beforeDate, /* absolute time string */
|
||||
stmt->afterDate); /* relative time string */
|
||||
}
|
||||
break;
|
||||
|
||||
case T_CopyStmt:
|
||||
{
|
||||
CopyStmt *stmt = (CopyStmt *) parsetree;
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
* Routines for handling of 'SET var TO',
|
||||
* 'SHOW var' and 'RESET var' statements.
|
||||
*
|
||||
* $Id: variable.c,v 1.22 1997/11/14 15:34:09 thomas Exp $
|
||||
* $Id: variable.c,v 1.23 1997/11/21 18:11:20 momjian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include "postgres.h"
|
||||
#include "miscadmin.h"
|
||||
#include "tcop/variable.h"
|
||||
|
||||
15
src/backend/utils/cache/relcache.c
vendored
15
src/backend/utils/cache/relcache.c
vendored
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.29 1997/11/20 23:23:11 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.30 1997/11/21 18:11:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -952,7 +952,7 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo)
|
||||
* by the storage manager code to rd_fd.
|
||||
* ----------------
|
||||
*/
|
||||
fd = smgropen(relp->relsmgr, relation);
|
||||
fd = smgropen(DEFAULT_SMGR, relation);
|
||||
|
||||
Assert(fd >= -1);
|
||||
if (fd == -1)
|
||||
@@ -1091,7 +1091,6 @@ formrdesc(char *relationName,
|
||||
relation->rd_rel->relpages = 1; /* XXX */
|
||||
relation->rd_rel->reltuples = 1; /* XXX */
|
||||
relation->rd_rel->relkind = RELKIND_RELATION;
|
||||
relation->rd_rel->relarch = 'n';
|
||||
relation->rd_rel->relnatts = (uint16) natts;
|
||||
relation->rd_isnailed = true;
|
||||
|
||||
@@ -1157,7 +1156,7 @@ RelationIdCacheGetRelation(Oid relationId)
|
||||
{
|
||||
if (rd->rd_fd == -1)
|
||||
{
|
||||
rd->rd_fd = smgropen(rd->rd_rel->relsmgr, rd);
|
||||
rd->rd_fd = smgropen(DEFAULT_SMGR, rd);
|
||||
Assert(rd->rd_fd != -1);
|
||||
}
|
||||
|
||||
@@ -1190,7 +1189,7 @@ RelationNameCacheGetRelation(char *relationName)
|
||||
{
|
||||
if (rd->rd_fd == -1)
|
||||
{
|
||||
rd->rd_fd = smgropen(rd->rd_rel->relsmgr, rd);
|
||||
rd->rd_fd = smgropen(DEFAULT_SMGR, rd);
|
||||
Assert(rd->rd_fd != -1);
|
||||
}
|
||||
|
||||
@@ -1594,13 +1593,13 @@ RelationPurgeLocalRelation(bool xactCommitted)
|
||||
{
|
||||
if (!(reln->rd_tmpunlinked))
|
||||
{
|
||||
smgrunlink(reln->rd_rel->relsmgr, reln);
|
||||
smgrunlink(DEFAULT_SMGR, reln);
|
||||
reln->rd_tmpunlinked = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
smgrunlink(reln->rd_rel->relsmgr, reln);
|
||||
smgrunlink(DEFAULT_SMGR, reln);
|
||||
}
|
||||
}
|
||||
else if (!IsBootstrapProcessingMode() && !(reln->rd_istemp))
|
||||
@@ -1613,7 +1612,7 @@ RelationPurgeLocalRelation(bool xactCommitted)
|
||||
* heap_destroyr and we skip smgrclose for them. -
|
||||
* vadim 05/22/97
|
||||
*/
|
||||
smgrclose(reln->rd_rel->relsmgr, reln);
|
||||
smgrclose(DEFAULT_SMGR, reln);
|
||||
|
||||
reln->rd_islocal = FALSE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user