mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
Tom Lane wrote:
> There's no longer a separate call to heap_storage_create in that routine > --- the right place to make the test is now in the storage_create > boolean parameter being passed to heap_create. A simple change, but > it passeth patch's understanding ... Thanks. Attached is a patch against cvs tip as of 8:30 PM PST or so. Turned out that even after fixing the failed hunks, there was a new spot in bufmgr.c which needed to be fixed (related to temp relations; RelationUpdateNumberOfBlocks). But thankfully the regression test code caught it :-) Joe Conway
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.162 2002/08/02 18:15:06 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.163 2002/08/15 16:36:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -398,6 +398,9 @@ DoCopy(const CopyStmt *stmt)
|
||||
if (rel->rd_rel->relkind == RELKIND_VIEW)
|
||||
elog(ERROR, "You cannot copy view %s",
|
||||
RelationGetRelationName(rel));
|
||||
else if (rel->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
|
||||
elog(ERROR, "You cannot copy type relation %s",
|
||||
RelationGetRelationName(rel));
|
||||
else if (rel->rd_rel->relkind == RELKIND_SEQUENCE)
|
||||
elog(ERROR, "You cannot change sequence relation %s",
|
||||
RelationGetRelationName(rel));
|
||||
@@ -443,6 +446,9 @@ DoCopy(const CopyStmt *stmt)
|
||||
if (rel->rd_rel->relkind == RELKIND_VIEW)
|
||||
elog(ERROR, "You cannot copy view %s",
|
||||
RelationGetRelationName(rel));
|
||||
else if (rel->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
|
||||
elog(ERROR, "You cannot copy type relation %s",
|
||||
RelationGetRelationName(rel));
|
||||
else if (rel->rd_rel->relkind == RELKIND_SEQUENCE)
|
||||
elog(ERROR, "You cannot copy sequence %s",
|
||||
RelationGetRelationName(rel));
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.28 2002/08/07 21:45:01 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.29 2002/08/15 16:36:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -345,6 +345,10 @@ TruncateRelation(const RangeVar *relation)
|
||||
elog(ERROR, "TRUNCATE cannot be used on views. '%s' is a view",
|
||||
RelationGetRelationName(rel));
|
||||
|
||||
if (rel->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
|
||||
elog(ERROR, "TRUNCATE cannot be used on type relations. '%s' is a type",
|
||||
RelationGetRelationName(rel));
|
||||
|
||||
if (!allowSystemTableMods && IsSystemRelation(rel))
|
||||
elog(ERROR, "TRUNCATE cannot be used on system tables. '%s' is a system table",
|
||||
RelationGetRelationName(rel));
|
||||
@@ -3210,12 +3214,13 @@ CheckTupleType(Form_pg_class tuple_class)
|
||||
case RELKIND_RELATION:
|
||||
case RELKIND_INDEX:
|
||||
case RELKIND_VIEW:
|
||||
case RELKIND_COMPOSITE_TYPE:
|
||||
case RELKIND_SEQUENCE:
|
||||
case RELKIND_TOASTVALUE:
|
||||
/* ok to change owner */
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table, TOAST table, index, view, or sequence",
|
||||
elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table, TOAST table, index, view, type, or sequence",
|
||||
NameStr(tuple_class->relname));
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.8 2002/07/24 19:11:09 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.9 2002/08/15 16:36:02 momjian Exp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The "DefineFoo" routines take the parse tree and pick out the
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "catalog/namespace.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/tablecmds.h"
|
||||
#include "miscadmin.h"
|
||||
#include "parser/parse_func.h"
|
||||
#include "parser/parse_type.h"
|
||||
@@ -50,7 +51,6 @@
|
||||
|
||||
static Oid findTypeIOFunction(List *procname, bool isOutput);
|
||||
|
||||
|
||||
/*
|
||||
* DefineType
|
||||
* Registers a new type.
|
||||
@@ -666,3 +666,42 @@ findTypeIOFunction(List *procname, bool isOutput)
|
||||
|
||||
return procOid;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
* DefineCompositeType
|
||||
*
|
||||
* Create a Composite Type relation.
|
||||
* `DefineRelation' does all the work, we just provide the correct
|
||||
* arguments!
|
||||
*
|
||||
* If the relation already exists, then 'DefineRelation' will abort
|
||||
* the xact...
|
||||
*
|
||||
* DefineCompositeType returns relid for use when creating
|
||||
* an implicit composite type during function creation
|
||||
*-------------------------------------------------------------------
|
||||
*/
|
||||
Oid
|
||||
DefineCompositeType(const RangeVar *typevar, List *coldeflist)
|
||||
{
|
||||
CreateStmt *createStmt = makeNode(CreateStmt);
|
||||
|
||||
if (coldeflist == NIL)
|
||||
elog(ERROR, "attempted to define composite type relation with"
|
||||
" no attrs");
|
||||
|
||||
/*
|
||||
* now create the parameters for keys/inheritance etc. All of them are
|
||||
* nil...
|
||||
*/
|
||||
createStmt->relation = (RangeVar *) typevar;
|
||||
createStmt->tableElts = coldeflist;
|
||||
createStmt->inhRelations = NIL;
|
||||
createStmt->constraints = NIL;
|
||||
createStmt->hasoids = false;
|
||||
|
||||
/*
|
||||
* finally create the relation...
|
||||
*/
|
||||
return DefineRelation(createStmt, RELKIND_COMPOSITE_TYPE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user