mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-30 19:00:29 +08:00
Call DefineSequence () for T_CreateSeqStmt node.
This commit is contained in:
parent
41aeed4334
commit
a15158bb55
@ -9,13 +9,14 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.12 1997/03/12 20:48:27 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.13 1997/04/02 04:06:32 vadim Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
#include "parser/dbcommands.h"
|
#include "parser/dbcommands.h"
|
||||||
#include "access/xact.h"
|
#include "access/xact.h"
|
||||||
|
#include "access/heapam.h"
|
||||||
#include "catalog/catalog.h"
|
#include "catalog/catalog.h"
|
||||||
#include "catalog/pg_type.h"
|
#include "catalog/pg_type.h"
|
||||||
|
|
||||||
@ -24,6 +25,7 @@
|
|||||||
#include "commands/command.h"
|
#include "commands/command.h"
|
||||||
#include "commands/copy.h"
|
#include "commands/copy.h"
|
||||||
#include "commands/creatinh.h"
|
#include "commands/creatinh.h"
|
||||||
|
#include "commands/sequence.h"
|
||||||
#include "commands/defrem.h"
|
#include "commands/defrem.h"
|
||||||
#include "commands/purge.h"
|
#include "commands/purge.h"
|
||||||
#include "commands/rename.h"
|
#include "commands/rename.h"
|
||||||
@ -159,6 +161,7 @@ ProcessUtility(Node *parsetree,
|
|||||||
DestroyStmt *stmt = (DestroyStmt *)parsetree;
|
DestroyStmt *stmt = (DestroyStmt *)parsetree;
|
||||||
List *arg;
|
List *arg;
|
||||||
List *args = stmt->relNames;
|
List *args = stmt->relNames;
|
||||||
|
Relation rel;
|
||||||
|
|
||||||
commandTag = "DROP";
|
commandTag = "DROP";
|
||||||
CHECK_IF_ABORTED();
|
CHECK_IF_ABORTED();
|
||||||
@ -168,6 +171,19 @@ ProcessUtility(Node *parsetree,
|
|||||||
if (IsSystemRelationName(relname))
|
if (IsSystemRelationName(relname))
|
||||||
elog(WARN, "class \"%-.*s\" is a system catalog",
|
elog(WARN, "class \"%-.*s\" is a system catalog",
|
||||||
NAMEDATALEN, relname);
|
NAMEDATALEN, relname);
|
||||||
|
rel = heap_openr (relname);
|
||||||
|
if ( RelationIsValid (rel) )
|
||||||
|
{
|
||||||
|
if ( stmt->sequence &&
|
||||||
|
rel->rd_rel->relkind != RELKIND_SEQUENCE )
|
||||||
|
elog (WARN, "Use DROP TABLE to drop table '%s'",
|
||||||
|
relname);
|
||||||
|
if ( !(stmt->sequence) &&
|
||||||
|
rel->rd_rel->relkind == RELKIND_SEQUENCE )
|
||||||
|
elog (WARN, "Use DROP SEQUENCE to drop sequence '%s'",
|
||||||
|
relname);
|
||||||
|
heap_close (rel);
|
||||||
|
}
|
||||||
#ifndef NO_SECURITY
|
#ifndef NO_SECURITY
|
||||||
if (!pg_ownercheck(userName, relname, RELNAME))
|
if (!pg_ownercheck(userName, relname, RELNAME))
|
||||||
elog(WARN, "you do not own class \"%-.*s\"",
|
elog(WARN, "you do not own class \"%-.*s\"",
|
||||||
@ -395,6 +411,13 @@ ProcessUtility(Node *parsetree,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case T_CreateSeqStmt:
|
||||||
|
commandTag = "CREATE";
|
||||||
|
CHECK_IF_ABORTED();
|
||||||
|
|
||||||
|
DefineSequence((CreateSeqStmt *)parsetree);
|
||||||
|
break;
|
||||||
|
|
||||||
case T_ExtendStmt:
|
case T_ExtendStmt:
|
||||||
{
|
{
|
||||||
ExtendStmt *stmt = (ExtendStmt *)parsetree;
|
ExtendStmt *stmt = (ExtendStmt *)parsetree;
|
||||||
@ -426,7 +449,7 @@ ProcessUtility(Node *parsetree,
|
|||||||
relname);
|
relname);
|
||||||
#ifndef NO_SECURITY
|
#ifndef NO_SECURITY
|
||||||
if (!pg_ownercheck(userName, relname, RELNAME))
|
if (!pg_ownercheck(userName, relname, RELNAME))
|
||||||
elog(WARN, "%s: %s", relationName, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
|
elog(WARN, "%s: %s", relname, aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
|
||||||
#endif
|
#endif
|
||||||
RemoveIndex(relname);
|
RemoveIndex(relname);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user