mirror of
https://github.com/postgres/postgres.git
synced 2025-08-30 06:01:21 +03:00
Add TEMP tables/indexes. Add COPY pfree(). Other cleanups.
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.35 1999/01/21 22:48:06 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.36 1999/02/02 03:44:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -219,7 +219,8 @@ copy_heap(Oid OIDOldHeap)
|
||||
|
||||
tupdesc = CreateTupleDescCopy(OldHeapDesc);
|
||||
|
||||
OIDNewHeap = heap_create_with_catalog(NewName, tupdesc, RELKIND_RELATION);
|
||||
OIDNewHeap = heap_create_with_catalog(NewName, tupdesc,
|
||||
RELKIND_RELATION, false);
|
||||
|
||||
if (!OidIsValid(OIDNewHeap))
|
||||
elog(ERROR, "clusterheap: cannot create temporary heap relation\n");
|
||||
|
@@ -6,7 +6,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.69 1999/02/01 20:25:54 wieck Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.70 1999/02/02 03:44:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -646,7 +646,6 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
|
||||
index_nulls[i] = ' ';
|
||||
byval[i] = (bool) IsTypeByVal(attr[i]->atttypid);
|
||||
}
|
||||
values = (Datum *) palloc(sizeof(Datum) * attr_count);
|
||||
|
||||
lineno = 0;
|
||||
while (!done)
|
||||
@@ -873,13 +872,16 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
|
||||
}
|
||||
pfree(values);
|
||||
pfree(nulls);
|
||||
pfree(index_nulls);
|
||||
pfree(idatum);
|
||||
pfree(byval);
|
||||
|
||||
if (!binary)
|
||||
{
|
||||
pfree(in_functions);
|
||||
pfree(elements);
|
||||
pfree(typmod);
|
||||
}
|
||||
pfree(byval);
|
||||
|
||||
/* comments in execUtils.c */
|
||||
if (has_index)
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.37 1998/12/14 05:18:43 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.38 1999/02/02 03:44:19 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -138,8 +138,8 @@ DefineRelation(CreateStmt *stmt, char relkind)
|
||||
}
|
||||
}
|
||||
|
||||
relationId = heap_create_with_catalog(relname,
|
||||
descriptor, relkind);
|
||||
relationId = heap_create_with_catalog(relname, descriptor,
|
||||
relkind, stmt->istemp);
|
||||
|
||||
StoreCatalogInheritance(relationId, inheritList);
|
||||
}
|
||||
@@ -279,7 +279,7 @@ MergeAttributes(List *schema, List *supers, List **supconstr)
|
||||
SearchSysCacheTuple(TYPOID,
|
||||
ObjectIdGetDatum(attribute->atttypid),
|
||||
0, 0, 0);
|
||||
AssertState(HeapTupleIsValid(tuple));
|
||||
Assert(HeapTupleIsValid(tuple));
|
||||
attributeType =
|
||||
(((Form_pg_type) GETSTRUCT(tuple))->typname).data;
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.30 1999/01/21 22:48:06 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.31 1999/02/02 03:44:19 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -98,15 +98,11 @@ DefineIndex(char *heapRelationName,
|
||||
/*
|
||||
* compute heap relation id
|
||||
*/
|
||||
tuple = SearchSysCacheTuple(RELNAME,
|
||||
PointerGetDatum(heapRelationName),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
if ((relationId = RelnameFindRelid(heapRelationName)) == InvalidOid)
|
||||
{
|
||||
elog(ERROR, "DefineIndex: %s relation not found",
|
||||
heapRelationName);
|
||||
}
|
||||
relationId = tuple->t_data->t_oid;
|
||||
|
||||
if (unique && strcmp(accessMethodName, "btree") != 0)
|
||||
elog(ERROR, "DefineIndex: unique indices are only available with the btree access method");
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.26 1998/12/14 05:18:44 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.27 1999/02/02 03:44:20 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1025,7 +1025,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
|
||||
|
||||
relid = heap_create_with_catalog(
|
||||
child->nodeElem->outTypes->val[0],
|
||||
tupdesc, RELKIND_RELATION);
|
||||
tupdesc, RELKIND_RELATION, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1049,7 +1049,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
|
||||
{
|
||||
relid = heap_create_with_catalog(
|
||||
child->nodeElem->outTypes->val[0],
|
||||
tupdesc, RELKIND_RELATION);
|
||||
tupdesc, RELKIND_RELATION, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.19 1998/12/15 12:45:58 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.20 1999/02/02 03:44:20 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <utils/builtins.h>
|
||||
#include <catalog/catname.h>
|
||||
#include <utils/syscache.h>
|
||||
#include <catalog/heap.h>
|
||||
#include <catalog/indexing.h>
|
||||
#include <catalog/catalog.h>
|
||||
#include <commands/copy.h>
|
||||
@@ -106,15 +107,9 @@ renameatt(char *relname,
|
||||
List *child,
|
||||
*children;
|
||||
|
||||
reltup = SearchSysCacheTuple(RELNAME,
|
||||
PointerGetDatum(relname),
|
||||
0, 0, 0);
|
||||
|
||||
if (!HeapTupleIsValid(reltup))
|
||||
if ((myrelid = RelnameFindRelid(relname)) == InvalidOid)
|
||||
elog(ERROR, "renameatt: unknown relation: \"%s\"", relname);
|
||||
|
||||
myrelid = reltup->t_data->t_oid;
|
||||
|
||||
/* this routine is actually in the planner */
|
||||
children = find_all_inheritors(lconsi(myrelid, NIL), NIL);
|
||||
|
||||
@@ -147,14 +142,10 @@ renameatt(char *relname,
|
||||
}
|
||||
}
|
||||
|
||||
reltup = SearchSysCacheTuple(RELNAME,
|
||||
PointerGetDatum(relname),
|
||||
0, 0, 0);
|
||||
if (!HeapTupleIsValid(reltup))
|
||||
|
||||
if ((relid = RelnameFindRelid(relname)) == InvalidOid)
|
||||
elog(ERROR, "renameatt: relation \"%s\" nonexistent", relname);
|
||||
|
||||
relid = reltup->t_data->t_oid;
|
||||
|
||||
oldatttup = SearchSysCacheTupleCopy(ATTNAME,
|
||||
ObjectIdGetDatum(relid),
|
||||
PointerGetDatum(oldattname),
|
||||
@@ -211,8 +202,7 @@ void
|
||||
renamerel(char *oldrelname, char *newrelname)
|
||||
{
|
||||
Relation relrelation; /* for RELATION relation */
|
||||
HeapTuple oldreltup,
|
||||
newreltup;
|
||||
HeapTuple oldreltup;
|
||||
char oldpath[MAXPGPATH],
|
||||
newpath[MAXPGPATH];
|
||||
Relation irelations[Num_pg_class_indices];
|
||||
@@ -231,10 +221,7 @@ renamerel(char *oldrelname, char *newrelname)
|
||||
if (!HeapTupleIsValid(oldreltup))
|
||||
elog(ERROR, "renamerel: relation \"%s\" does not exist", oldrelname);
|
||||
|
||||
newreltup = SearchSysCacheTuple(RELNAME,
|
||||
PointerGetDatum(newrelname),
|
||||
0, 0, 0);
|
||||
if (HeapTupleIsValid(newreltup))
|
||||
if (RelnameFindRelid(newrelname) != InvalidOid)
|
||||
elog(ERROR, "renamerel: relation \"%s\" exists", newrelname);
|
||||
|
||||
/* rename the path first, so if this fails the rename's not done */
|
||||
|
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: view.c,v 1.29 1998/12/14 08:11:01 scrappy Exp $
|
||||
* $Id: view.c,v 1.30 1999/02/02 03:44:20 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -95,6 +95,7 @@ DefineVirtualRelation(char *relname, List *tlist)
|
||||
* nil...
|
||||
*/
|
||||
createStmt.relname = relname;
|
||||
createStmt.istemp = false;
|
||||
createStmt.tableElts = attrList;
|
||||
/* createStmt.tableType = NULL;*/
|
||||
createStmt.inhRelnames = NIL;
|
||||
|
Reference in New Issue
Block a user