Commit 9ace0318 authored by Tom Lane's avatar Tom Lane

Some small polishing of Mark Hollomon's cleanup of DROP command: might

as well allow DROP multiple INDEX, RULE, TYPE as well.  Add missing
CommandCounterIncrement to DROP loop, which could cause trouble otherwise
with multiple DROP of items affecting same catalog entries.  Try to
bring a little consistency to various error messages using 'does not exist',
'nonexistent', etc --- I standardized on 'does not exist' since that's
what the vast majority of the existing uses seem to be.
parent ee28d8b3
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_index.sgml,v 1.7 1999/07/22 15:09:10 thomas Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_index.sgml,v 1.8 2000/10/22 23:32:38 tgl Exp $
Postgres documentation Postgres documentation
--> -->
...@@ -15,7 +15,7 @@ Postgres documentation ...@@ -15,7 +15,7 @@ Postgres documentation
DROP INDEX DROP INDEX
</refname> </refname>
<refpurpose> <refpurpose>
Removes an index from a database Removes existing indexes from a database
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
...@@ -23,7 +23,7 @@ Postgres documentation ...@@ -23,7 +23,7 @@ Postgres documentation
<date>1999-07-20</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP INDEX <replaceable class="PARAMETER">index_name</replaceable> DROP INDEX <replaceable class="PARAMETER">index_name</replaceable> [, ...]
</synopsis> </synopsis>
<refsect2 id="R2-SQL-DROPINDEX-1"> <refsect2 id="R2-SQL-DROPINDEX-1">
...@@ -39,7 +39,7 @@ DROP INDEX <replaceable class="PARAMETER">index_name</replaceable> ...@@ -39,7 +39,7 @@ DROP INDEX <replaceable class="PARAMETER">index_name</replaceable>
<term><replaceable class="PARAMETER">index_name</replaceable></term> <term><replaceable class="PARAMETER">index_name</replaceable></term>
<listitem> <listitem>
<para> <para>
The name of the index to remove. The name of an index to remove.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -62,13 +62,13 @@ DROP ...@@ -62,13 +62,13 @@ DROP
</computeroutput></term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
The message returned if the index is successfully dropped. The message returned if the command completes successfully.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>
ERROR: index "<replaceable class="PARAMETER">index_name</replaceable>" nonexistent ERROR: index "<replaceable class="PARAMETER">index_name</replaceable>" does not exist
</computeroutput></term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_rule.sgml,v 1.7 2000/10/05 19:48:18 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_rule.sgml,v 1.8 2000/10/22 23:32:38 tgl Exp $
Postgres documentation Postgres documentation
--> -->
...@@ -15,7 +15,7 @@ Postgres documentation ...@@ -15,7 +15,7 @@ Postgres documentation
DROP RULE DROP RULE
</refname> </refname>
<refpurpose> <refpurpose>
Removes an existing rule from the database Removes existing rules from the database
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
...@@ -23,7 +23,7 @@ Postgres documentation ...@@ -23,7 +23,7 @@ Postgres documentation
<date>1998-09-22</date> <date>1998-09-22</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP RULE <replaceable class="PARAMETER">name</replaceable> DROP RULE <replaceable class="PARAMETER">name</replaceable> [, ...]
</synopsis> </synopsis>
<refsect2 id="R2-SQL-DROPRULE-1"> <refsect2 id="R2-SQL-DROPRULE-1">
...@@ -68,7 +68,7 @@ DROP ...@@ -68,7 +68,7 @@ DROP
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>
ERROR: RewriteGetRuleEventRel: rule "<replaceable class="parameter">name</replaceable>" not found ERROR: Rule or view "<replaceable class="parameter">name</replaceable>" not found
</computeroutput></term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_sequence.sgml,v 1.7 2000/05/18 14:24:33 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_sequence.sgml,v 1.8 2000/10/22 23:32:38 tgl Exp $
Postgres documentation Postgres documentation
--> -->
...@@ -15,7 +15,7 @@ Postgres documentation ...@@ -15,7 +15,7 @@ Postgres documentation
DROP SEQUENCE DROP SEQUENCE
</refname> </refname>
<refpurpose> <refpurpose>
Removes an existing sequence Removes existing sequences from a database
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
...@@ -69,7 +69,7 @@ DROP ...@@ -69,7 +69,7 @@ DROP
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>
NOTICE: Relation "<replaceable class="parameter">name</replaceable>" does not exist. ERROR: sequence "<replaceable class="parameter">name</replaceable>" does not exist
</computeroutput></term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_table.sgml,v 1.8 2000/10/18 16:16:03 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_table.sgml,v 1.9 2000/10/22 23:32:38 tgl Exp $
Postgres documentation Postgres documentation
--> -->
...@@ -68,7 +68,7 @@ DROP ...@@ -68,7 +68,7 @@ DROP
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>
ERROR: table "<replaceable class="parameter">name</replaceable>" is nonexistent ERROR: table "<replaceable class="parameter">name</replaceable>" does not exist
</computeroutput></term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_type.sgml,v 1.7 2000/07/22 04:30:27 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_type.sgml,v 1.8 2000/10/22 23:32:38 tgl Exp $
Postgres documentation Postgres documentation
--> -->
...@@ -15,7 +15,7 @@ Postgres documentation ...@@ -15,7 +15,7 @@ Postgres documentation
DROP TYPE DROP TYPE
</refname> </refname>
<refpurpose> <refpurpose>
Removes a user-defined type from the system catalogs Removes user-defined types from the system catalogs
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
...@@ -23,7 +23,7 @@ Postgres documentation ...@@ -23,7 +23,7 @@ Postgres documentation
<date>1999-07-20</date> <date>1999-07-20</date>
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
DROP TYPE <replaceable class="PARAMETER">typename</replaceable> DROP TYPE <replaceable class="PARAMETER">typename</replaceable> [, ...]
</synopsis> </synopsis>
<refsect2 id="R2-SQL-DROPTYPE-1"> <refsect2 id="R2-SQL-DROPTYPE-1">
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_view.sgml,v 1.7 2000/10/18 16:16:03 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_view.sgml,v 1.8 2000/10/22 23:32:38 tgl Exp $
Postgres documentation Postgres documentation
--> -->
...@@ -15,7 +15,7 @@ Postgres documentation ...@@ -15,7 +15,7 @@ Postgres documentation
DROP VIEW DROP VIEW
</refname> </refname>
<refpurpose> <refpurpose>
Removes an existing view from a database Removes existing views from a database
</refpurpose> </refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
...@@ -70,7 +70,7 @@ DROP ...@@ -70,7 +70,7 @@ DROP
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>
ERROR: view <replaceable class="parameter">name</replaceable> is nonexistent ERROR: view <replaceable class="parameter">name</replaceable> does not exist
</computeroutput></term> </computeroutput></term>
<listitem> <listitem>
<para> <para>
...@@ -104,10 +104,6 @@ ERROR: view <replaceable class="parameter">name</replaceable> is nonexistent ...@@ -104,10 +104,6 @@ ERROR: view <replaceable class="parameter">name</replaceable> is nonexistent
<title> <title>
Notes Notes
</title> </title>
<para>
The <productname>Postgres</productname>
<command>DROP TABLE</command> statement also drops views.
</para>
<para> <para>
Refer to <command>CREATE VIEW</command> Refer to <command>CREATE VIEW</command>
for information on how to create views. for information on how to create views.
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.149 2000/10/16 14:52:02 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.150 2000/10/22 23:32:38 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -1091,7 +1091,7 @@ DeleteRelationTuple(Relation rel) ...@@ -1091,7 +1091,7 @@ DeleteRelationTuple(Relation rel)
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
{ {
heap_close(pg_class_desc, RowExclusiveLock); heap_close(pg_class_desc, RowExclusiveLock);
elog(ERROR, "Relation '%s' does not exist", elog(ERROR, "Relation \"%s\" does not exist",
RelationGetRelationName(rel)); RelationGetRelationName(rel));
} }
...@@ -1342,7 +1342,7 @@ DeleteTypeTuple(Relation rel) ...@@ -1342,7 +1342,7 @@ DeleteTypeTuple(Relation rel)
{ {
heap_endscan(pg_type_scan); heap_endscan(pg_type_scan);
heap_close(pg_type_desc, RowExclusiveLock); heap_close(pg_type_desc, RowExclusiveLock);
elog(ERROR, "DeleteTypeTuple: %s type nonexistent", elog(ERROR, "DeleteTypeTuple: type \"%s\" does not exist",
RelationGetRelationName(rel)); RelationGetRelationName(rel));
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.51 2000/08/21 17:22:35 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.52 2000/10/22 23:32:38 tgl Exp $
* *
* NOTES * NOTES
* these routines moved here from commands/define.c and somewhat cleaned up. * these routines moved here from commands/define.c and somewhat cleaned up.
...@@ -181,7 +181,7 @@ OperatorGet(char *operatorName, ...@@ -181,7 +181,7 @@ OperatorGet(char *operatorName,
leftObjectId = TypeGet(leftTypeName, &leftDefined); leftObjectId = TypeGet(leftTypeName, &leftDefined);
if (!OidIsValid(leftObjectId) || !leftDefined) if (!OidIsValid(leftObjectId) || !leftDefined)
elog(ERROR, "OperatorGet: left type '%s' nonexistent", elog(ERROR, "OperatorGet: left type \"%s\" does not exist",
leftTypeName); leftTypeName);
} }
...@@ -190,7 +190,7 @@ OperatorGet(char *operatorName, ...@@ -190,7 +190,7 @@ OperatorGet(char *operatorName,
rightObjectId = TypeGet(rightTypeName, &rightDefined); rightObjectId = TypeGet(rightTypeName, &rightDefined);
if (!OidIsValid(rightObjectId) || !rightDefined) if (!OidIsValid(rightObjectId) || !rightDefined)
elog(ERROR, "OperatorGet: right type '%s' nonexistent", elog(ERROR, "OperatorGet: right type \"%s\" does not exist",
rightTypeName); rightTypeName);
} }
...@@ -527,7 +527,7 @@ OperatorDef(char *operatorName, ...@@ -527,7 +527,7 @@ OperatorDef(char *operatorName,
leftTypeId = TypeGet(leftTypeName, &leftDefined); leftTypeId = TypeGet(leftTypeName, &leftDefined);
if (!OidIsValid(leftTypeId) || !leftDefined) if (!OidIsValid(leftTypeId) || !leftDefined)
elog(ERROR, "OperatorDef: left type '%s' nonexistent", elog(ERROR, "OperatorDef: left type \"%s\" does not exist",
leftTypeName); leftTypeName);
} }
...@@ -536,7 +536,7 @@ OperatorDef(char *operatorName, ...@@ -536,7 +536,7 @@ OperatorDef(char *operatorName,
rightTypeId = TypeGet(rightTypeName, &rightDefined); rightTypeId = TypeGet(rightTypeName, &rightDefined);
if (!OidIsValid(rightTypeId) || !rightDefined) if (!OidIsValid(rightTypeId) || !rightDefined)
elog(ERROR, "OperatorDef: right type '%s' nonexistent", elog(ERROR, "OperatorDef: right type \"%s\" does not exist",
rightTypeName); rightTypeName);
} }
...@@ -739,7 +739,7 @@ OperatorDef(char *operatorName, ...@@ -739,7 +739,7 @@ OperatorDef(char *operatorName,
otherRightTypeName); otherRightTypeName);
if (!OidIsValid(other_oid)) if (!OidIsValid(other_oid))
elog(ERROR, elog(ERROR,
"OperatorDef: can't create operator shell '%s'", "OperatorDef: can't create operator shell \"%s\"",
name[j]); name[j]);
values[i++] = ObjectIdGetDatum(other_oid); values[i++] = ObjectIdGetDatum(other_oid);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.38 2000/09/06 14:15:16 petere Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.39 2000/10/22 23:32:39 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -610,7 +610,7 @@ RemoveIndex(char *name) ...@@ -610,7 +610,7 @@ RemoveIndex(char *name)
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "index \"%s\" nonexistent", name); elog(ERROR, "index \"%s\" does not exist", name);
if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_INDEX) if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_INDEX)
{ {
...@@ -640,7 +640,7 @@ ReindexIndex(const char *name, bool force /* currently unused */ ) ...@@ -640,7 +640,7 @@ ReindexIndex(const char *name, bool force /* currently unused */ )
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "index \"%s\" nonexistent", name); elog(ERROR, "index \"%s\" does not exist", name);
if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_INDEX) if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_INDEX)
{ {
...@@ -650,7 +650,7 @@ ReindexIndex(const char *name, bool force /* currently unused */ ) ...@@ -650,7 +650,7 @@ ReindexIndex(const char *name, bool force /* currently unused */ )
} }
if (!reindex_index(tuple->t_data->t_oid, force)) if (!reindex_index(tuple->t_data->t_oid, force))
elog(NOTICE, "index '%s' wasn't reindexed", name); elog(NOTICE, "index \"%s\" wasn't reindexed", name);
} }
/* /*
...@@ -671,7 +671,7 @@ ReindexTable(const char *name, bool force) ...@@ -671,7 +671,7 @@ ReindexTable(const char *name, bool force)
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "table \"%s\" nonexistent", name); elog(ERROR, "table \"%s\" does not exist", name);
if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_RELATION) if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_RELATION)
{ {
...@@ -681,7 +681,7 @@ ReindexTable(const char *name, bool force) ...@@ -681,7 +681,7 @@ ReindexTable(const char *name, bool force)
} }
if (!reindex_relation(tuple->t_data->t_oid, force)) if (!reindex_relation(tuple->t_data->t_oid, force))
elog(NOTICE, "table '%s' wasn't reindexed", name); elog(NOTICE, "table \"%s\" wasn't reindexed", name);
} }
/* /*
...@@ -719,7 +719,7 @@ ReindexDatabase(const char *dbname, bool force, bool all) ...@@ -719,7 +719,7 @@ ReindexDatabase(const char *dbname, bool force, bool all)
scan = heap_beginscan(relation, 0, SnapshotNow, 1, &scankey); scan = heap_beginscan(relation, 0, SnapshotNow, 1, &scankey);
dbtuple = heap_getnext(scan, 0); dbtuple = heap_getnext(scan, 0);
if (!HeapTupleIsValid(dbtuple)) if (!HeapTupleIsValid(dbtuple))
elog(ERROR, "Database \"%s\" doesn't exist", dbname); elog(ERROR, "Database \"%s\" does not exist", dbname);
db_id = dbtuple->t_data->t_oid; db_id = dbtuple->t_data->t_oid;
db_owner = ((Form_pg_database) GETSTRUCT(dbtuple))->datdba; db_owner = ((Form_pg_database) GETSTRUCT(dbtuple))->datdba;
heap_endscan(scan); heap_endscan(scan);
...@@ -789,7 +789,7 @@ ReindexDatabase(const char *dbname, bool force, bool all) ...@@ -789,7 +789,7 @@ ReindexDatabase(const char *dbname, bool force, bool all)
{ {
StartTransactionCommand(); StartTransactionCommand();
if (reindex_relation(relids[i], force)) if (reindex_relation(relids[i], force))
elog(NOTICE, "relation %d was reindexed", relids[i]); elog(NOTICE, "relation %u was reindexed", relids[i]);
CommitTransactionCommand(); CommitTransactionCommand();
} }
StartTransactionCommand(); StartTransactionCommand();
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.50 2000/10/20 02:53:10 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.51 2000/10/22 23:32:39 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -137,7 +137,7 @@ renameatt(char *relname, ...@@ -137,7 +137,7 @@ renameatt(char *relname,
PointerGetDatum(oldattname), PointerGetDatum(oldattname),
0, 0); 0, 0);
if (!HeapTupleIsValid(oldatttup)) if (!HeapTupleIsValid(oldatttup))
elog(ERROR, "renameatt: attribute \"%s\" nonexistent", oldattname); elog(ERROR, "renameatt: attribute \"%s\" does not exist", oldattname);
if (((Form_pg_attribute) GETSTRUCT(oldatttup))->attnum < 0) if (((Form_pg_attribute) GETSTRUCT(oldatttup))->attnum < 0)
elog(ERROR, "renameatt: system attribute \"%s\" not renamed", oldattname); elog(ERROR, "renameatt: system attribute \"%s\" not renamed", oldattname);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.196 2000/10/18 16:16:05 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.197 2000/10/22 23:32:48 tgl Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -125,7 +125,7 @@ static void doNegateFloat(Value *v); ...@@ -125,7 +125,7 @@ static void doNegateFloat(Value *v);
DropUserStmt, DropdbStmt, ExplainStmt, ExtendStmt, FetchStmt, DropUserStmt, DropdbStmt, ExplainStmt, ExtendStmt, FetchStmt,
GrantStmt, IndexStmt, InsertStmt, ListenStmt, LoadStmt, LockStmt, GrantStmt, IndexStmt, InsertStmt, ListenStmt, LoadStmt, LockStmt,
NotifyStmt, OptimizableStmt, ProcedureStmt, ReindexStmt, NotifyStmt, OptimizableStmt, ProcedureStmt, ReindexStmt,
RemoveAggrStmt, RemoveFuncStmt, RemoveOperStmt, RemoveStmt, RemoveAggrStmt, RemoveFuncStmt, RemoveOperStmt,
RenameStmt, RevokeStmt, RuleActionStmt, RuleActionStmtOrEmpty, RenameStmt, RevokeStmt, RuleActionStmt, RuleActionStmtOrEmpty,
RuleStmt, SelectStmt, SetSessionStmt, TransactionStmt, TruncateStmt, RuleStmt, SelectStmt, SetSessionStmt, TransactionStmt, TruncateStmt,
UnlistenStmt, UpdateStmt, VacuumStmt, VariableResetStmt, UnlistenStmt, UpdateStmt, VacuumStmt, VariableResetStmt,
...@@ -202,7 +202,7 @@ static void doNegateFloat(Value *v); ...@@ -202,7 +202,7 @@ static void doNegateFloat(Value *v);
opt_with_copy, index_opt_unique, opt_verbose, opt_analyze opt_with_copy, index_opt_unique, opt_verbose, opt_analyze
%type <boolean> opt_cursor %type <boolean> opt_cursor
%type <ival> copy_dirn, def_type, direction, reindex_type, remove_type, %type <ival> copy_dirn, def_type, direction, reindex_type, drop_type,
opt_column, event, comment_type, comment_cl, opt_column, event, comment_type, comment_cl,
comment_ag, comment_fn, comment_op, comment_tg comment_ag, comment_fn, comment_op, comment_tg
...@@ -447,7 +447,6 @@ stmt : AlterSchemaStmt ...@@ -447,7 +447,6 @@ stmt : AlterSchemaStmt
| RemoveAggrStmt | RemoveAggrStmt
| RemoveOperStmt | RemoveOperStmt
| RemoveFuncStmt | RemoveFuncStmt
| RemoveStmt
| RenameStmt | RenameStmt
| RevokeStmt | RevokeStmt
| OptimizableStmt | OptimizableStmt
...@@ -1935,33 +1934,28 @@ def_arg: func_return { $$ = (Node *)$1; } ...@@ -1935,33 +1934,28 @@ def_arg: func_return { $$ = (Node *)$1; }
/***************************************************************************** /*****************************************************************************
* *
* QUERY: * QUERY:
* drop <relname1> [, <relname2> .. <relnameN> ] *
* DROP itemtype itemname [, itemname ...]
* *
*****************************************************************************/ *****************************************************************************/
DropStmt: DROP TABLE relation_name_list DropStmt: DROP drop_type name_list
{
DropStmt *n = makeNode(DropStmt);
n->names = $3;
n->removeType = DROP_TABLE;
$$ = (Node *)n;
}
| DROP SEQUENCE relation_name_list
{
DropStmt *n = makeNode(DropStmt);
n->names = $3;
n->removeType = DROP_SEQUENCE;
$$ = (Node *)n;
}
| DROP VIEW relation_name_list
{ {
DropStmt *n = makeNode(DropStmt); DropStmt *n = makeNode(DropStmt);
n->removeType = $2;
n->names = $3; n->names = $3;
n->removeType = DROP_VIEW;
$$ = (Node *)n; $$ = (Node *)n;
} }
; ;
drop_type: TABLE { $$ = DROP_TABLE; }
| SEQUENCE { $$ = DROP_SEQUENCE; }
| VIEW { $$ = DROP_VIEW; }
| INDEX { $$ = DROP_INDEX; }
| RULE { $$ = DROP_RULE; }
| TYPE_P { $$ = DROP_TYPE_P; }
;
/***************************************************************************** /*****************************************************************************
* *
* QUERY: * QUERY:
...@@ -2550,34 +2544,21 @@ func_return: Typename ...@@ -2550,34 +2544,21 @@ func_return: Typename
* *
* QUERY: * QUERY:
* *
* remove function <funcname> * DROP FUNCTION funcname (arg1, arg2, ...)
* (REMOVE FUNCTION "funcname" (arg1, arg2, ...)) * DROP AGGREGATE aggname aggtype
* remove aggregate <aggname> * DROP OPERATOR opname (leftoperand_typ rightoperand_typ)
* (REMOVE AGGREGATE "aggname" "aggtype")
* remove operator <opname>
* (REMOVE OPERATOR "opname" (leftoperand_typ rightoperand_typ))
* remove type <typename>
* (REMOVE TYPE "typename")
* remove rule <rulename>
* (REMOVE RULE "rulename")
* *
*****************************************************************************/ *****************************************************************************/
RemoveStmt: DROP remove_type name RemoveFuncStmt: DROP FUNCTION func_name func_args
{ {
DropStmt *n = makeNode(DropStmt); RemoveFuncStmt *n = makeNode(RemoveFuncStmt);
n->removeType = $2; n->funcname = $3;
n->names = makeList1(makeString($3)); n->args = $4;
$$ = (Node *)n; $$ = (Node *)n;
} }
; ;
remove_type: TYPE_P { $$ = DROP_TYPE_P; }
| INDEX { $$ = DROP_INDEX; }
| RULE { $$ = DROP_RULE; }
;
RemoveAggrStmt: DROP AGGREGATE name aggr_argtype RemoveAggrStmt: DROP AGGREGATE name aggr_argtype
{ {
RemoveAggrStmt *n = makeNode(RemoveAggrStmt); RemoveAggrStmt *n = makeNode(RemoveAggrStmt);
...@@ -2591,17 +2572,6 @@ aggr_argtype: Typename { $$ = $1; } ...@@ -2591,17 +2572,6 @@ aggr_argtype: Typename { $$ = $1; }
| '*' { $$ = NULL; } | '*' { $$ = NULL; }
; ;
RemoveFuncStmt: DROP FUNCTION func_name func_args
{
RemoveFuncStmt *n = makeNode(RemoveFuncStmt);
n->funcname = $3;
n->args = $4;
$$ = (Node *)n;
}
;
RemoveOperStmt: DROP OPERATOR all_Op '(' oper_argtypes ')' RemoveOperStmt: DROP OPERATOR all_Op '(' oper_argtypes ')'
{ {
RemoveOperStmt *n = makeNode(RemoveOperStmt); RemoveOperStmt *n = makeNode(RemoveOperStmt);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.97 2000/10/18 16:16:06 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.98 2000/10/22 23:32:41 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -47,21 +47,22 @@ ...@@ -47,21 +47,22 @@
/* /*
* * Error-checking support for DROP commands
*/ */
struct kindstrings { struct kindstrings {
char kind; char kind;
char *indef_article;
char *name; char *name;
char *command; char *command;
}; };
static struct kindstrings kindstringarray[] = { static struct kindstrings kindstringarray[] = {
{ RELKIND_RELATION, "table", "TABLE" }, { RELKIND_RELATION, "a", "table", "TABLE" },
{ RELKIND_SEQUENCE, "sequence", "SEQUENCE" }, { RELKIND_SEQUENCE, "a", "sequence", "SEQUENCE" },
{ RELKIND_VIEW, "view", "VIEW" }, { RELKIND_VIEW, "a", "view", "VIEW" },
{ RELKIND_INDEX, "index", "INDEX" }, { RELKIND_INDEX, "an", "index", "INDEX" },
{ '\0', "", "" } { '\0', "a", "???", "???" }
}; };
...@@ -81,36 +82,44 @@ DropErrorMsg(char* relname, char wrongkind, char rightkind) ...@@ -81,36 +82,44 @@ DropErrorMsg(char* relname, char wrongkind, char rightkind)
break; break;
Assert(wentry->kind != '\0'); Assert(wentry->kind != '\0');
elog(ERROR, "%s is not a %s. Use 'DROP %s' to remove a %s", elog(ERROR, "\"%s\" is not %s %s. Use DROP %s to remove %s %s",
relname, rentry->name, wentry->command, wentry->name); relname, rentry->indef_article, rentry->name,
wentry->command, wentry->indef_article, wentry->name);
} }
static void static void
CheckClassKind(char *name, char rightkind) CheckDropPermissions(char *name, char rightkind)
{ {
HeapTuple tuple;
struct kindstrings *rentry; struct kindstrings *rentry;
HeapTuple tuple;
Form_pg_class classform; Form_pg_class classform;
for (rentry = kindstringarray; rentry->kind != '\0'; rentry++)
if (rentry->kind == rightkind)
break;
Assert(rentry->kind != '\0');
tuple = SearchSysCacheTuple(RELNAME, tuple = SearchSysCacheTuple(RELNAME,
PointerGetDatum(name), PointerGetDatum(name),
0, 0, 0); 0, 0, 0);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{ elog(ERROR, "%s \"%s\" does not exist", rentry->name, name);
for (rentry = kindstringarray; rentry->kind != '\0'; rentry++)
if (rentry->kind == rightkind)
break;
Assert(rentry->kind != '\0');
elog(ERROR, "%s \"%s\" is nonexistent", rentry->name, name);
}
classform = (Form_pg_class) GETSTRUCT(tuple); classform = (Form_pg_class) GETSTRUCT(tuple);
if (classform->relkind != rightkind) if (classform->relkind != rightkind)
DropErrorMsg(name, classform->relkind, rightkind); DropErrorMsg(name, classform->relkind, rightkind);
if (!pg_ownercheck(GetUserId(), name, RELNAME))
elog(ERROR, "you do not own %s \"%s\"",
rentry->name, name);
if (!allowSystemTableMods && IsSystemRelationName(name))
elog(ERROR, "%s \"%s\" is a system %s",
rentry->name, name, rentry->name);
} }
/* ---------------- /* ----------------
* general utility function invoker * general utility function invoker
* ---------------- * ----------------
...@@ -204,7 +213,6 @@ ProcessUtility(Node *parsetree, ...@@ -204,7 +213,6 @@ ProcessUtility(Node *parsetree,
/* /*
* Let AlterTableCreateToastTable decide if this * Let AlterTableCreateToastTable decide if this
* one needs a secondary relation too. * one needs a secondary relation too.
*
*/ */
CommandCounterIncrement(); CommandCounterIncrement();
AlterTableCreateToastTable(((CreateStmt *)parsetree)->relname, AlterTableCreateToastTable(((CreateStmt *)parsetree)->relname,
...@@ -217,51 +225,32 @@ ProcessUtility(Node *parsetree, ...@@ -217,51 +225,32 @@ ProcessUtility(Node *parsetree,
List *args = stmt->names; List *args = stmt->names;
List *arg; List *arg;
foreach(arg, args) { set_ps_display(commandTag = "DROP");
foreach(arg, args)
{
relname = strVal(lfirst(arg)); relname = strVal(lfirst(arg));
if (!allowSystemTableMods && IsSystemRelationName(relname))
elog(ERROR, "class \"%s\" is a system catalog",
relname);
set_ps_display(commandTag = "DROP");
switch(stmt->removeType) switch(stmt->removeType)
{ {
case DROP_TABLE: case DROP_TABLE:
CheckClassKind(relname, RELKIND_RELATION); CheckDropPermissions(relname, RELKIND_RELATION);
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "you do not own table \"%s\"",
relname);
RemoveRelation(relname); RemoveRelation(relname);
break; break;
case DROP_SEQUENCE: case DROP_SEQUENCE:
CheckClassKind(relname, RELKIND_SEQUENCE); CheckDropPermissions(relname, RELKIND_SEQUENCE);
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "you do not own sequence \"%s\"",
relname);
RemoveRelation(relname); RemoveRelation(relname);
break; break;
case DROP_VIEW: case DROP_VIEW:
CheckClassKind(relname, RELKIND_VIEW); CheckDropPermissions(relname, RELKIND_VIEW);
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "you do not own view \"%s\"",
relname);
RemoveView(relname); RemoveView(relname);
break; break;
case DROP_INDEX: case DROP_INDEX:
CheckClassKind(relname, RELKIND_INDEX); CheckDropPermissions(relname, RELKIND_INDEX);
if (!pg_ownercheck(GetUserId(), relname, RELNAME))
elog(ERROR, "%s: %s", relname,
aclcheck_error_strings[ACLCHECK_NOT_OWNER]);
RemoveIndex(relname); RemoveIndex(relname);
break; break;
case DROP_RULE: case DROP_RULE:
...@@ -279,11 +268,18 @@ ProcessUtility(Node *parsetree, ...@@ -279,11 +268,18 @@ ProcessUtility(Node *parsetree,
break; break;
case DROP_TYPE_P: case DROP_TYPE_P:
/* RemoveType does its own permissions checks */
RemoveType(relname); RemoveType(relname);
break; break;
} }
}
/*
* Make sure subsequent loop iterations will see results
* of this one; needed if removing multiple rules for
* same table, for example.
*/
CommandCounterIncrement();
}
} }
break; break;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: nodes.h,v 1.78 2000/10/05 19:11:36 tgl Exp $ * $Id: nodes.h,v 1.79 2000/10/22 23:32:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -169,7 +169,7 @@ typedef enum NodeTag ...@@ -169,7 +169,7 @@ typedef enum NodeTag
T_RemoveAggrStmt, T_RemoveAggrStmt,
T_RemoveFuncStmt, T_RemoveFuncStmt,
T_RemoveOperStmt, T_RemoveOperStmt,
T_RemoveStmt, T_RemoveStmt_XXX, /* not used anymore; this tag# is available */
T_RenameStmt, T_RenameStmt,
T_RuleStmt, T_RuleStmt,
T_NotifyStmt, T_NotifyStmt,
......
...@@ -52,7 +52,7 @@ drop table; ...@@ -52,7 +52,7 @@ drop table;
ERROR: parser: parse error at or near ";" ERROR: parser: parse error at or near ";"
-- no such relation -- no such relation
drop table nonesuch; drop table nonesuch;
ERROR: table "nonesuch" is nonexistent ERROR: table "nonesuch" does not exist
-- --
-- RENAME -- RENAME
...@@ -81,7 +81,7 @@ alter table nonesuchrel rename column nonesuchatt to newnonesuchatt; ...@@ -81,7 +81,7 @@ alter table nonesuchrel rename column nonesuchatt to newnonesuchatt;
ERROR: Relation 'nonesuchrel' does not exist ERROR: Relation 'nonesuchrel' does not exist
-- no such attribute -- no such attribute
alter table emp rename column nonesuchatt to newnonesuchatt; alter table emp rename column nonesuchatt to newnonesuchatt;
ERROR: renameatt: attribute "nonesuchatt" nonexistent ERROR: renameatt: attribute "nonesuchatt" does not exist
-- conflict -- conflict
alter table emp rename column salary to manager; alter table emp rename column salary to manager;
ERROR: renameatt: attribute "manager" exists ERROR: renameatt: attribute "manager" exists
...@@ -122,7 +122,7 @@ drop index 314159; ...@@ -122,7 +122,7 @@ drop index 314159;
ERROR: parser: parse error at or near "314159" ERROR: parser: parse error at or near "314159"
-- no such index -- no such index
drop index nonesuch; drop index nonesuch;
ERROR: index "nonesuch" is nonexistent ERROR: index "nonesuch" does not exist
-- --
-- REMOVE AGGREGATE -- REMOVE AGGREGATE
......
...@@ -699,7 +699,7 @@ CREATE TABLE FKTABLE_FAIL2 ( ftest1 int, CONSTRAINT fkfail1 FOREIGN KEY (ftest1) ...@@ -699,7 +699,7 @@ CREATE TABLE FKTABLE_FAIL2 ( ftest1 int, CONSTRAINT fkfail1 FOREIGN KEY (ftest1)
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
ERROR: UNIQUE constraint matching given keys for referenced table "pktable" not found ERROR: UNIQUE constraint matching given keys for referenced table "pktable" not found
DROP TABLE FKTABLE_FAIL1; DROP TABLE FKTABLE_FAIL1;
ERROR: table "fktable_fail1" is nonexistent ERROR: table "fktable_fail1" does not exist
DROP TABLE FKTABLE_FAIL2; DROP TABLE FKTABLE_FAIL2;
ERROR: table "fktable_fail2" is nonexistent ERROR: table "fktable_fail2" does not exist
DROP TABLE PKTABLE; DROP TABLE PKTABLE;
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
-- --
-- prepare the table... -- prepare the table...
DROP TABLE INET_TBL; DROP TABLE INET_TBL;
ERROR: table "inet_tbl" is nonexistent ERROR: table "inet_tbl" does not exist
CREATE TABLE INET_TBL (c cidr, i inet); CREATE TABLE INET_TBL (c cidr, i inet);
INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.226/24'); INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.226/24');
INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/24', '192.168.1.226'); INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/24', '192.168.1.226');
......
...@@ -587,7 +587,7 @@ begin ...@@ -587,7 +587,7 @@ begin
if mytype = ''PS'' then if mytype = ''PS'' then
select into rec * from PSlot where slotname = myname; select into rec * from PSlot where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.backlink != blname then if rec.backlink != blname then
update PSlot set backlink = blname where slotname = myname; update PSlot set backlink = blname where slotname = myname;
...@@ -597,7 +597,7 @@ begin ...@@ -597,7 +597,7 @@ begin
if mytype = ''WS'' then if mytype = ''WS'' then
select into rec * from WSlot where slotname = myname; select into rec * from WSlot where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.backlink != blname then if rec.backlink != blname then
update WSlot set backlink = blname where slotname = myname; update WSlot set backlink = blname where slotname = myname;
...@@ -607,7 +607,7 @@ begin ...@@ -607,7 +607,7 @@ begin
if mytype = ''PL'' then if mytype = ''PL'' then
select into rec * from PLine where slotname = myname; select into rec * from PLine where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.backlink != blname then if rec.backlink != blname then
update PLine set backlink = blname where slotname = myname; update PLine set backlink = blname where slotname = myname;
...@@ -743,7 +743,7 @@ begin ...@@ -743,7 +743,7 @@ begin
if mytype = ''PS'' then if mytype = ''PS'' then
select into rec * from PSlot where slotname = myname; select into rec * from PSlot where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.slotlink != blname then if rec.slotlink != blname then
update PSlot set slotlink = blname where slotname = myname; update PSlot set slotlink = blname where slotname = myname;
...@@ -753,7 +753,7 @@ begin ...@@ -753,7 +753,7 @@ begin
if mytype = ''WS'' then if mytype = ''WS'' then
select into rec * from WSlot where slotname = myname; select into rec * from WSlot where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.slotlink != blname then if rec.slotlink != blname then
update WSlot set slotlink = blname where slotname = myname; update WSlot set slotlink = blname where slotname = myname;
...@@ -763,7 +763,7 @@ begin ...@@ -763,7 +763,7 @@ begin
if mytype = ''IF'' then if mytype = ''IF'' then
select into rec * from IFace where slotname = myname; select into rec * from IFace where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.slotlink != blname then if rec.slotlink != blname then
update IFace set slotlink = blname where slotname = myname; update IFace set slotlink = blname where slotname = myname;
...@@ -773,7 +773,7 @@ begin ...@@ -773,7 +773,7 @@ begin
if mytype = ''HS'' then if mytype = ''HS'' then
select into rec * from HSlot where slotname = myname; select into rec * from HSlot where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.slotlink != blname then if rec.slotlink != blname then
update HSlot set slotlink = blname where slotname = myname; update HSlot set slotlink = blname where slotname = myname;
...@@ -783,7 +783,7 @@ begin ...@@ -783,7 +783,7 @@ begin
if mytype = ''PH'' then if mytype = ''PH'' then
select into rec * from PHone where slotname = myname; select into rec * from PHone where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.slotlink != blname then if rec.slotlink != blname then
update PHone set slotlink = blname where slotname = myname; update PHone set slotlink = blname where slotname = myname;
...@@ -1498,11 +1498,11 @@ select * from PField_v1 where pfname = 'PF0_2' order by slotname; ...@@ -1498,11 +1498,11 @@ select * from PField_v1 where pfname = 'PF0_2' order by slotname;
insert into PField values ('PF1_1', 'should fail due to unique index'); insert into PField values ('PF1_1', 'should fail due to unique index');
ERROR: Cannot insert a duplicate key into unique index pfield_name ERROR: Cannot insert a duplicate key into unique index pfield_name
update PSlot set backlink = 'WS.not.there' where slotname = 'PS.base.a1'; update PSlot set backlink = 'WS.not.there' where slotname = 'PS.base.a1';
ERROR: WS.not.there does not exists ERROR: WS.not.there does not exist
update PSlot set backlink = 'XX.illegal' where slotname = 'PS.base.a1'; update PSlot set backlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal backlink beginning with XX ERROR: illegal backlink beginning with XX
update PSlot set slotlink = 'PS.not.there' where slotname = 'PS.base.a1'; update PSlot set slotlink = 'PS.not.there' where slotname = 'PS.base.a1';
ERROR: PS.not.there does not exists ERROR: PS.not.there does not exist
update PSlot set slotlink = 'XX.illegal' where slotname = 'PS.base.a1'; update PSlot set slotlink = 'XX.illegal' where slotname = 'PS.base.a1';
ERROR: illegal slotlink beginning with XX ERROR: illegal slotlink beginning with XX
insert into HSlot values ('HS', 'base.hub1', 1, ''); insert into HSlot values ('HS', 'base.hub1', 1, '');
......
...@@ -698,7 +698,7 @@ begin ...@@ -698,7 +698,7 @@ begin
if mytype = ''PS'' then if mytype = ''PS'' then
select into rec * from PSlot where slotname = myname; select into rec * from PSlot where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.backlink != blname then if rec.backlink != blname then
update PSlot set backlink = blname where slotname = myname; update PSlot set backlink = blname where slotname = myname;
...@@ -708,7 +708,7 @@ begin ...@@ -708,7 +708,7 @@ begin
if mytype = ''WS'' then if mytype = ''WS'' then
select into rec * from WSlot where slotname = myname; select into rec * from WSlot where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.backlink != blname then if rec.backlink != blname then
update WSlot set backlink = blname where slotname = myname; update WSlot set backlink = blname where slotname = myname;
...@@ -718,7 +718,7 @@ begin ...@@ -718,7 +718,7 @@ begin
if mytype = ''PL'' then if mytype = ''PL'' then
select into rec * from PLine where slotname = myname; select into rec * from PLine where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.backlink != blname then if rec.backlink != blname then
update PLine set backlink = blname where slotname = myname; update PLine set backlink = blname where slotname = myname;
...@@ -866,7 +866,7 @@ begin ...@@ -866,7 +866,7 @@ begin
if mytype = ''PS'' then if mytype = ''PS'' then
select into rec * from PSlot where slotname = myname; select into rec * from PSlot where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.slotlink != blname then if rec.slotlink != blname then
update PSlot set slotlink = blname where slotname = myname; update PSlot set slotlink = blname where slotname = myname;
...@@ -876,7 +876,7 @@ begin ...@@ -876,7 +876,7 @@ begin
if mytype = ''WS'' then if mytype = ''WS'' then
select into rec * from WSlot where slotname = myname; select into rec * from WSlot where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.slotlink != blname then if rec.slotlink != blname then
update WSlot set slotlink = blname where slotname = myname; update WSlot set slotlink = blname where slotname = myname;
...@@ -886,7 +886,7 @@ begin ...@@ -886,7 +886,7 @@ begin
if mytype = ''IF'' then if mytype = ''IF'' then
select into rec * from IFace where slotname = myname; select into rec * from IFace where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.slotlink != blname then if rec.slotlink != blname then
update IFace set slotlink = blname where slotname = myname; update IFace set slotlink = blname where slotname = myname;
...@@ -896,7 +896,7 @@ begin ...@@ -896,7 +896,7 @@ begin
if mytype = ''HS'' then if mytype = ''HS'' then
select into rec * from HSlot where slotname = myname; select into rec * from HSlot where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.slotlink != blname then if rec.slotlink != blname then
update HSlot set slotlink = blname where slotname = myname; update HSlot set slotlink = blname where slotname = myname;
...@@ -906,7 +906,7 @@ begin ...@@ -906,7 +906,7 @@ begin
if mytype = ''PH'' then if mytype = ''PH'' then
select into rec * from PHone where slotname = myname; select into rec * from PHone where slotname = myname;
if not found then if not found then
raise exception ''% does not exists'', myname; raise exception ''% does not exist'', myname;
end if; end if;
if rec.slotlink != blname then if rec.slotlink != blname then
update PHone set slotlink = blname where slotname = myname; update PHone set slotlink = blname where slotname = myname;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment