*
*
* 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 "parser/dbcommands.h"
#include "access/xact.h"
+#include "access/heapam.h"
#include "catalog/catalog.h"
#include "catalog/pg_type.h"
#include "commands/command.h"
#include "commands/copy.h"
#include "commands/creatinh.h"
+#include "commands/sequence.h"
#include "commands/defrem.h"
#include "commands/purge.h"
#include "commands/rename.h"
DestroyStmt *stmt = (DestroyStmt *)parsetree;
List *arg;
List *args = stmt->relNames;
+ Relation rel;
commandTag = "DROP";
CHECK_IF_ABORTED();
if (IsSystemRelationName(relname))
elog(WARN, "class \"%-.*s\" is a system catalog",
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
if (!pg_ownercheck(userName, relname, RELNAME))
elog(WARN, "you do not own class \"%-.*s\"",
DefineQueryRewrite(stmt);
}
break;
+
+ case T_CreateSeqStmt:
+ commandTag = "CREATE";
+ CHECK_IF_ABORTED();
+
+ DefineSequence((CreateSeqStmt *)parsetree);
+ break;
case T_ExtendStmt:
{
relname);
#ifndef NO_SECURITY
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
RemoveIndex(relname);
break;