mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +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:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.220 2002/08/11 21:17:34 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.221 2002/08/15 16:36:00 momjian Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@@ -357,9 +357,10 @@ CheckAttributeNames(TupleDesc tupdesc, bool relhasoids, char relkind)
|
||||
/*
|
||||
* first check for collision with system attribute names
|
||||
*
|
||||
* Skip this for a view, since it doesn't have system attributes.
|
||||
* Skip this for a view and type relation, since it doesn't have system
|
||||
* attributes.
|
||||
*/
|
||||
if (relkind != RELKIND_VIEW)
|
||||
if (relkind != RELKIND_VIEW && relkind != RELKIND_COMPOSITE_TYPE)
|
||||
{
|
||||
for (i = 0; i < natts; i++)
|
||||
{
|
||||
@@ -473,10 +474,10 @@ AddNewAttributeTuples(Oid new_rel_oid,
|
||||
|
||||
/*
|
||||
* Next we add the system attributes. Skip OID if rel has no OIDs.
|
||||
* Skip all for a view. We don't bother with making datatype
|
||||
* dependencies here, since presumably all these types are pinned.
|
||||
* Skip all for a view or type relation. We don't bother with making
|
||||
* datatype dependencies here, since presumably all these types are pinned.
|
||||
*/
|
||||
if (relkind != RELKIND_VIEW)
|
||||
if (relkind != RELKIND_VIEW && relkind != RELKIND_COMPOSITE_TYPE)
|
||||
{
|
||||
dpp = SysAtt;
|
||||
for (i = 0; i < -1 - FirstLowInvalidHeapAttributeNumber; i++)
|
||||
@@ -689,13 +690,14 @@ heap_create_with_catalog(const char *relname,
|
||||
* physical disk file. (If we fail further down, it's the smgr's
|
||||
* responsibility to remove the disk file again.)
|
||||
*
|
||||
* NB: create a physical file only if it's not a view.
|
||||
* NB: create a physical file only if it's not a view or type relation.
|
||||
*/
|
||||
new_rel_desc = heap_create(relname,
|
||||
relnamespace,
|
||||
tupdesc,
|
||||
shared_relation,
|
||||
(relkind != RELKIND_VIEW),
|
||||
(relkind != RELKIND_VIEW &&
|
||||
relkind != RELKIND_COMPOSITE_TYPE),
|
||||
allow_system_table_mods);
|
||||
|
||||
/* Fetch the relation OID assigned by heap_create */
|
||||
@@ -1131,7 +1133,8 @@ heap_drop_with_catalog(Oid rid)
|
||||
/*
|
||||
* unlink the relation's physical file and finish up.
|
||||
*/
|
||||
if (rel->rd_rel->relkind != RELKIND_VIEW)
|
||||
if (rel->rd_rel->relkind != RELKIND_VIEW &&
|
||||
rel->rd_rel->relkind != RELKIND_COMPOSITE_TYPE)
|
||||
smgrunlink(DEFAULT_SMGR, rel);
|
||||
|
||||
/*
|
||||
|
@@ -13,7 +13,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.30 2002/08/09 16:45:14 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/namespace.c,v 1.31 2002/08/15 16:36:01 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1585,6 +1585,7 @@ RemoveTempRelations(Oid tempNamespaceId)
|
||||
case RELKIND_RELATION:
|
||||
case RELKIND_SEQUENCE:
|
||||
case RELKIND_VIEW:
|
||||
case RELKIND_COMPOSITE_TYPE:
|
||||
AssertTupleDescHasOid(pgclass->rd_att);
|
||||
object.classId = RelOid_pg_class;
|
||||
object.objectId = HeapTupleGetOid(tuple);
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.77 2002/08/05 03:29:16 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.78 2002/08/15 16:36:01 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -311,15 +311,28 @@ TypeCreate(const char *typeName,
|
||||
|
||||
/*
|
||||
* If the type is a rowtype for a relation, mark it as internally
|
||||
* dependent on the relation. This allows it to be auto-dropped
|
||||
* when the relation is, and not otherwise.
|
||||
* dependent on the relation, *unless* it is a stand-alone composite
|
||||
* type relation. For the latter case, we have to reverse the
|
||||
* dependency.
|
||||
*
|
||||
* In the former case, this allows the type to be auto-dropped
|
||||
* when the relation is, and not otherwise. And in the latter,
|
||||
* of course we get the opposite effect.
|
||||
*/
|
||||
if (OidIsValid(relationOid))
|
||||
{
|
||||
Relation rel = relation_open(relationOid, AccessShareLock);
|
||||
char relkind = rel->rd_rel->relkind;
|
||||
relation_close(rel, AccessShareLock);
|
||||
|
||||
referenced.classId = RelOid_pg_class;
|
||||
referenced.objectId = relationOid;
|
||||
referenced.objectSubId = 0;
|
||||
recordDependencyOn(&myself, &referenced, DEPENDENCY_INTERNAL);
|
||||
|
||||
if (relkind != RELKIND_COMPOSITE_TYPE)
|
||||
recordDependencyOn(&myself, &referenced, DEPENDENCY_INTERNAL);
|
||||
else
|
||||
recordDependencyOn(&referenced, &myself, DEPENDENCY_INTERNAL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.173 2002/08/07 21:45:02 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.174 2002/08/15 16:36:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -786,6 +786,10 @@ initResultRelInfo(ResultRelInfo *resultRelInfo,
|
||||
elog(ERROR, "You can't change view relation %s",
|
||||
RelationGetRelationName(resultRelationDesc));
|
||||
break;
|
||||
case RELKIND_COMPOSITE_TYPE:
|
||||
elog(ERROR, "You can't change type relation %s",
|
||||
RelationGetRelationName(resultRelationDesc));
|
||||
break;
|
||||
}
|
||||
|
||||
MemSet(resultRelInfo, 0, sizeof(ResultRelInfo));
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.200 2002/08/04 19:48:09 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.201 2002/08/15 16:36:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -2233,6 +2233,17 @@ _copyTransactionStmt(TransactionStmt *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static CompositeTypeStmt *
|
||||
_copyCompositeTypeStmt(CompositeTypeStmt *from)
|
||||
{
|
||||
CompositeTypeStmt *newnode = makeNode(CompositeTypeStmt);
|
||||
|
||||
Node_Copy(from, newnode, typevar);
|
||||
Node_Copy(from, newnode, coldeflist);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static ViewStmt *
|
||||
_copyViewStmt(ViewStmt *from)
|
||||
{
|
||||
@@ -2939,6 +2950,9 @@ copyObject(void *from)
|
||||
case T_TransactionStmt:
|
||||
retval = _copyTransactionStmt(from);
|
||||
break;
|
||||
case T_CompositeTypeStmt:
|
||||
retval = _copyCompositeTypeStmt(from);
|
||||
break;
|
||||
case T_ViewStmt:
|
||||
retval = _copyViewStmt(from);
|
||||
break;
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.149 2002/08/04 23:49:59 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.150 2002/08/15 16:36:03 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1061,6 +1061,17 @@ _equalTransactionStmt(TransactionStmt *a, TransactionStmt *b)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalCompositeTypeStmt(CompositeTypeStmt *a, CompositeTypeStmt *b)
|
||||
{
|
||||
if (!equal(a->typevar, b->typevar))
|
||||
return false;
|
||||
if (!equal(a->coldeflist, b->coldeflist))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalViewStmt(ViewStmt *a, ViewStmt *b)
|
||||
{
|
||||
@@ -2111,6 +2122,9 @@ equal(void *a, void *b)
|
||||
case T_TransactionStmt:
|
||||
retval = _equalTransactionStmt(a, b);
|
||||
break;
|
||||
case T_CompositeTypeStmt:
|
||||
retval = _equalCompositeTypeStmt(a, b);
|
||||
break;
|
||||
case T_ViewStmt:
|
||||
retval = _equalViewStmt(a, b);
|
||||
break;
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.358 2002/08/10 19:01:53 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.359 2002/08/15 16:36:03 momjian Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -205,7 +205,7 @@ static void doNegateFloat(Value *v);
|
||||
|
||||
%type <list> stmtblock, stmtmulti,
|
||||
OptTableElementList, TableElementList, OptInherit, definition,
|
||||
opt_distinct, opt_definition, func_args,
|
||||
opt_distinct, opt_definition, func_args, rowdefinition
|
||||
func_args_list, func_as, createfunc_opt_list
|
||||
oper_argtypes, RuleActionList, RuleActionMulti,
|
||||
opt_column_list, columnList, opt_name_list,
|
||||
@@ -2233,6 +2233,39 @@ DefineStmt:
|
||||
n->definition = $4;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| CREATE TYPE_P any_name AS rowdefinition
|
||||
{
|
||||
CompositeTypeStmt *n = makeNode(CompositeTypeStmt);
|
||||
RangeVar *r = makeNode(RangeVar);
|
||||
|
||||
switch (length($3))
|
||||
{
|
||||
case 1:
|
||||
r->catalogname = NULL;
|
||||
r->schemaname = NULL;
|
||||
r->relname = strVal(lfirst($3));
|
||||
break;
|
||||
case 2:
|
||||
r->catalogname = NULL;
|
||||
r->schemaname = strVal(lfirst($3));
|
||||
r->relname = strVal(lsecond($3));
|
||||
break;
|
||||
case 3:
|
||||
r->catalogname = strVal(lfirst($3));
|
||||
r->schemaname = strVal(lsecond($3));
|
||||
r->relname = strVal(lfirst(lnext(lnext($3))));
|
||||
break;
|
||||
default:
|
||||
elog(ERROR,
|
||||
"Improper qualified name "
|
||||
"(too many dotted names): %s",
|
||||
NameListToString($3));
|
||||
break;
|
||||
}
|
||||
n->typevar = r;
|
||||
n->coldeflist = $5;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
| CREATE CHARACTER SET opt_as any_name GET definition opt_collate
|
||||
{
|
||||
DefineStmt *n = makeNode(DefineStmt);
|
||||
@@ -2243,6 +2276,9 @@ DefineStmt:
|
||||
}
|
||||
;
|
||||
|
||||
rowdefinition: '(' TableFuncElementList ')' { $$ = $2; }
|
||||
;
|
||||
|
||||
definition: '(' def_list ')' { $$ = $2; }
|
||||
;
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.129 2002/08/11 21:17:34 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.130 2002/08/15 16:36:04 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1051,6 +1051,8 @@ RelationGetNumberOfBlocks(Relation relation)
|
||||
*/
|
||||
if (relation->rd_rel->relkind == RELKIND_VIEW)
|
||||
relation->rd_nblocks = 0;
|
||||
else if (relation->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
|
||||
relation->rd_nblocks = 0;
|
||||
else if (!relation->rd_isnew && !relation->rd_istemp)
|
||||
relation->rd_nblocks = smgrnblocks(DEFAULT_SMGR, relation);
|
||||
return relation->rd_nblocks;
|
||||
@@ -1069,6 +1071,8 @@ RelationUpdateNumberOfBlocks(Relation relation)
|
||||
{
|
||||
if (relation->rd_rel->relkind == RELKIND_VIEW)
|
||||
relation->rd_nblocks = 0;
|
||||
else if (relation->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
|
||||
relation->rd_nblocks = 0;
|
||||
else
|
||||
relation->rd_nblocks = smgrnblocks(DEFAULT_SMGR, relation);
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.58 2002/08/06 02:36:34 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.59 2002/08/15 16:36:04 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -263,6 +263,8 @@ smgropen(int16 which, Relation reln, bool failOK)
|
||||
|
||||
if (reln->rd_rel->relkind == RELKIND_VIEW)
|
||||
return -1;
|
||||
if (reln->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
|
||||
return -1;
|
||||
if ((fd = (*(smgrsw[which].smgr_open)) (reln)) < 0)
|
||||
if (!failOK)
|
||||
elog(ERROR, "cannot open %s: %m", RelationGetRelationName(reln));
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.281 2002/08/10 20:29:18 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.282 2002/08/15 16:36:05 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@@ -1674,7 +1674,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
puts("\nPOSTGRES backend interactive interface ");
|
||||
puts("$Revision: 1.281 $ $Date: 2002/08/10 20:29:18 $\n");
|
||||
puts("$Revision: 1.282 $ $Date: 2002/08/15 16:36:05 $\n");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2233,6 +2233,10 @@ CreateCommandTag(Node *parsetree)
|
||||
}
|
||||
break;
|
||||
|
||||
case T_CompositeTypeStmt:
|
||||
tag = "CREATE TYPE";
|
||||
break;
|
||||
|
||||
case T_ViewStmt:
|
||||
tag = "CREATE VIEW";
|
||||
break;
|
||||
|
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.169 2002/08/07 21:45:02 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.170 2002/08/15 16:36:05 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -70,6 +70,7 @@ static struct kindstrings kindstringarray[] = {
|
||||
{RELKIND_SEQUENCE, "a", "sequence", "SEQUENCE"},
|
||||
{RELKIND_VIEW, "a", "view", "VIEW"},
|
||||
{RELKIND_INDEX, "an", "index", "INDEX"},
|
||||
{RELKIND_COMPOSITE_TYPE, "a", "type", "TYPE"},
|
||||
{'\0', "a", "???", "???"}
|
||||
};
|
||||
|
||||
@@ -573,6 +574,19 @@ ProcessUtility(Node *parsetree,
|
||||
}
|
||||
break;
|
||||
|
||||
case T_CompositeTypeStmt: /* CREATE TYPE (composite) */
|
||||
{
|
||||
Oid relid;
|
||||
CompositeTypeStmt *stmt = (CompositeTypeStmt *) parsetree;
|
||||
|
||||
/*
|
||||
* DefineCompositeType returns relid for use when creating
|
||||
* an implicit composite type during function creation
|
||||
*/
|
||||
relid = DefineCompositeType(stmt->typevar, stmt->coldeflist);
|
||||
}
|
||||
break;
|
||||
|
||||
case T_ViewStmt: /* CREATE VIEW */
|
||||
{
|
||||
ViewStmt *stmt = (ViewStmt *) parsetree;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.32 2002/07/16 17:55:25 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/tid.c,v 1.33 2002/08/15 16:36:05 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* input routine largely stolen from boxin().
|
||||
@@ -226,6 +226,9 @@ currtid_byreloid(PG_FUNCTION_ARGS)
|
||||
if (rel->rd_rel->relkind == RELKIND_VIEW)
|
||||
return currtid_for_view(rel, tid);
|
||||
|
||||
if (rel->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
|
||||
elog(ERROR, "currtid can't handle type relations");
|
||||
|
||||
ItemPointerCopy(tid, result);
|
||||
heap_get_latest_tid(rel, SnapshotNow, result);
|
||||
|
||||
@@ -249,6 +252,9 @@ currtid_byrelname(PG_FUNCTION_ARGS)
|
||||
if (rel->rd_rel->relkind == RELKIND_VIEW)
|
||||
return currtid_for_view(rel, tid);
|
||||
|
||||
if (rel->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
|
||||
elog(ERROR, "currtid can't handle type relations");
|
||||
|
||||
result = (ItemPointer) palloc(sizeof(ItemPointerData));
|
||||
ItemPointerCopy(tid, result);
|
||||
|
||||
|
Reference in New Issue
Block a user