mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
Code review for standalone composite types, query-specified composite
types, SRFs. Not happy with memory management yet, but I'll commit these other changes.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.57 2002/08/22 00:01:41 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/comment.c,v 1.58 2002/08/29 00:17:03 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -362,7 +362,7 @@ CommentAttribute(List *qualname, char *comment)
|
||||
|
||||
/* Open the containing relation to ensure it won't go away meanwhile */
|
||||
rel = makeRangeVarFromNameList(relname);
|
||||
relation = heap_openrv(rel, AccessShareLock);
|
||||
relation = relation_openrv(rel, AccessShareLock);
|
||||
|
||||
/* Check object security */
|
||||
|
||||
@@ -383,7 +383,7 @@ CommentAttribute(List *qualname, char *comment)
|
||||
|
||||
/* Done, but hold lock until commit */
|
||||
|
||||
heap_close(relation, NoLock);
|
||||
relation_close(relation, NoLock);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.167 2002/08/24 15:00:46 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.168 2002/08/29 00:17:03 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -399,9 +399,6 @@ 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));
|
||||
@@ -447,9 +444,6 @@ 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));
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994-5, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.84 2002/07/20 15:12:55 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.85 2002/08/29 00:17:03 tgl Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -79,7 +79,7 @@ ExplainQuery(ExplainStmt *stmt, CommandDest dest)
|
||||
if (query->commandType == CMD_UTILITY)
|
||||
{
|
||||
/* rewriter will not cope with utility statements */
|
||||
PROJECT_LINE_OF_TEXT(tstate, "Utility statements have no plan structure");
|
||||
do_text_output_oneline(tstate, "Utility statements have no plan structure");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -89,7 +89,7 @@ ExplainQuery(ExplainStmt *stmt, CommandDest dest)
|
||||
if (rewritten == NIL)
|
||||
{
|
||||
/* In the case of an INSTEAD NOTHING, tell at least that */
|
||||
PROJECT_LINE_OF_TEXT(tstate, "Query rewrites to nothing");
|
||||
do_text_output_oneline(tstate, "Query rewrites to nothing");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -99,7 +99,7 @@ ExplainQuery(ExplainStmt *stmt, CommandDest dest)
|
||||
ExplainOneQuery(lfirst(l), stmt, tstate);
|
||||
/* put a blank line between plans */
|
||||
if (lnext(l) != NIL)
|
||||
PROJECT_LINE_OF_TEXT(tstate, "");
|
||||
do_text_output_oneline(tstate, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,9 +122,9 @@ ExplainOneQuery(Query *query, ExplainStmt *stmt, TupOutputState *tstate)
|
||||
if (query->commandType == CMD_UTILITY)
|
||||
{
|
||||
if (query->utilityStmt && IsA(query->utilityStmt, NotifyStmt))
|
||||
PROJECT_LINE_OF_TEXT(tstate, "NOTIFY");
|
||||
do_text_output_oneline(tstate, "NOTIFY");
|
||||
else
|
||||
PROJECT_LINE_OF_TEXT(tstate, "UTILITY");
|
||||
do_text_output_oneline(tstate, "UTILITY");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ ExplainOneQuery(Query *query, ExplainStmt *stmt, TupOutputState *tstate)
|
||||
do_text_output_multiline(tstate, f);
|
||||
pfree(f);
|
||||
if (es->printCost)
|
||||
PROJECT_LINE_OF_TEXT(tstate, ""); /* separator line */
|
||||
do_text_output_oneline(tstate, ""); /* separator line */
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.35 2002/08/28 20:18:29 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.36 2002/08/29 00:17:03 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -228,7 +228,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
|
||||
* see the new rel anyway until we commit), but it keeps the lock
|
||||
* manager from complaining about deadlock risks.
|
||||
*/
|
||||
rel = heap_open(relationId, AccessExclusiveLock);
|
||||
rel = relation_open(relationId, AccessExclusiveLock);
|
||||
|
||||
/*
|
||||
* Now add any newly specified column default values and CHECK
|
||||
@@ -293,7 +293,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
|
||||
* Clean up. We keep lock on new relation (although it shouldn't be
|
||||
* visible to anyone else anyway, until commit).
|
||||
*/
|
||||
heap_close(rel, NoLock);
|
||||
relation_close(rel, NoLock);
|
||||
|
||||
return relationId;
|
||||
}
|
||||
@@ -1064,7 +1064,7 @@ renameatt(Oid relid,
|
||||
* Grab an exclusive lock on the target table, which we will NOT
|
||||
* release until end of transaction.
|
||||
*/
|
||||
targetrelation = heap_open(relid, AccessExclusiveLock);
|
||||
targetrelation = relation_open(relid, AccessExclusiveLock);
|
||||
|
||||
/*
|
||||
* permissions checking. this would normally be done in utility.c,
|
||||
@@ -1210,7 +1210,7 @@ renameatt(Oid relid,
|
||||
true, false);
|
||||
}
|
||||
|
||||
heap_close(targetrelation, NoLock); /* close rel but keep lock! */
|
||||
relation_close(targetrelation, NoLock); /* close rel but keep lock! */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3247,13 +3247,12 @@ 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, type, or sequence",
|
||||
elog(ERROR, "ALTER TABLE: relation \"%s\" is not a table, TOAST table, index, view, or sequence",
|
||||
NameStr(tuple_class->relname));
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.11 2002/08/23 16:41:37 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.12 2002/08/29 00:17:03 tgl Exp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The "DefineFoo" routines take the parse tree and pick out the
|
||||
@@ -233,6 +233,7 @@ DefineType(List *names, List *parameters)
|
||||
typeNamespace, /* namespace */
|
||||
InvalidOid, /* preassigned type oid (not done here) */
|
||||
InvalidOid, /* relation oid (n/a here) */
|
||||
0, /* relation kind (ditto) */
|
||||
internalLength, /* internal size */
|
||||
'b', /* type-type (base type) */
|
||||
delimiter, /* array element delimiter */
|
||||
@@ -262,6 +263,7 @@ DefineType(List *names, List *parameters)
|
||||
typeNamespace, /* namespace */
|
||||
InvalidOid, /* preassigned type oid (not done here) */
|
||||
InvalidOid, /* relation oid (n/a here) */
|
||||
0, /* relation kind (ditto) */
|
||||
-1, /* internal size */
|
||||
'b', /* type-type (base type) */
|
||||
DEFAULT_TYPDELIM, /* array element delimiter */
|
||||
@@ -562,6 +564,7 @@ DefineDomain(CreateDomainStmt *stmt)
|
||||
domainNamespace, /* namespace */
|
||||
InvalidOid, /* preassigned type oid (none here) */
|
||||
InvalidOid, /* relation oid (n/a here) */
|
||||
0, /* relation kind (ditto) */
|
||||
internalLength, /* internal size */
|
||||
'd', /* type-type (domain type) */
|
||||
delimiter, /* array element delimiter */
|
||||
|
Reference in New Issue
Block a user