Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 73677dd

Browse files
committed
The following patch was sent to the patches list:
This patch forces the use of 'DROP VIEW' to destroy views. It also changes the syntax of DROP VIEW to DROP VIEW v1, v2, ... to match the syntax of DROP TABLE. Some error messages were changed so this patch also includes changes to the appropriate expected/*.out files. Doc changes for 'DROP TABLE" and 'DROP VIEW' are included. -- Mark Hollomon
1 parent 60dcf13 commit 73677dd

File tree

11 files changed

+183
-153
lines changed

11 files changed

+183
-153
lines changed

doc/src/sgml/ref/drop_table.sgml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_table.sgml,v 1.7 2000/07/21 04:37:10 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_table.sgml,v 1.8 2000/10/18 16:16:03 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -39,7 +39,7 @@ DROP TABLE <replaceable class="PARAMETER">name</replaceable> [, ...]
3939
<term><replaceable class="PARAMETER">name</replaceable></term>
4040
<listitem>
4141
<para>
42-
The name of an existing table or view to drop.
42+
The name of an existing table to drop.
4343
</para>
4444
</listitem>
4545
</varlistentry>
@@ -68,11 +68,11 @@ DROP
6868
</varlistentry>
6969
<varlistentry>
7070
<term><computeroutput>
71-
ERROR Relation "<replaceable class="parameter">name</replaceable>" Does Not Exist!
71+
ERROR: table "<replaceable class="parameter">name</replaceable>" is nonexistent
7272
</computeroutput></term>
7373
<listitem>
7474
<para>
75-
If the specified table or view does not exist in the database.
75+
If the specified table does not exist in the database.
7676
</para>
7777
</listitem>
7878
</varlistentry>
@@ -89,8 +89,8 @@ ERROR Relation "<replaceable class="parameter">name</replaceable>" Does Not Exis
8989
Description
9090
</title>
9191
<para>
92-
<command>DROP TABLE</command> removes tables and views from the database.
93-
Only its owner may destroy a table or view. A table
92+
<command>DROP TABLE</command> removes tables from the database.
93+
Only its owner may destroy a table. A table
9494
may be emptied of rows, but not destroyed, by using <command>DELETE</command>.
9595
</para>
9696
<para>

doc/src/sgml/ref/drop_view.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_view.sgml,v 1.6 1999/07/22 15:09:11 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_view.sgml,v 1.7 2000/10/18 16:16:03 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -23,7 +23,7 @@ Postgres documentation
2323
<date>1999-07-20</date>
2424
</refsynopsisdivinfo>
2525
<synopsis>
26-
DROP VIEW <replaceable class="PARAMETER">name</replaceable>
26+
DROP VIEW <replaceable class="PARAMETER">name</replaceable> [, ...]
2727
</synopsis>
2828

2929
<refsect2 id="R2-SQL-DROPVIEW-1">
@@ -70,7 +70,7 @@ DROP
7070
</varlistentry>
7171
<varlistentry>
7272
<term><computeroutput>
73-
ERROR: RewriteGetRuleEventRel: rule "_RET<replaceable class="PARAMETER">name</replaceable>" not found
73+
ERROR: view <replaceable class="parameter">name</replaceable> is nonexistent
7474
</computeroutput></term>
7575
<listitem>
7676
<para>

src/backend/nodes/copyfuncs.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Portions Copyright (c) 1994, Regents of the University of California
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.125 2000/10/07 00:58:16 tgl Exp $
18+
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.126 2000/10/18 16:16:04 momjian Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -1949,8 +1949,8 @@ _copyDropStmt(DropStmt *from)
19491949
{
19501950
DropStmt *newnode = makeNode(DropStmt);
19511951

1952-
Node_Copy(from, newnode, relNames);
1953-
newnode->sequence = from->sequence;
1952+
Node_Copy(from, newnode, names);
1953+
newnode->removeType = from->removeType;
19541954

19551955
return newnode;
19561956
}
@@ -2071,17 +2071,6 @@ _copyRemoveOperStmt(RemoveOperStmt *from)
20712071
return newnode;
20722072
}
20732073

2074-
static RemoveStmt *
2075-
_copyRemoveStmt(RemoveStmt *from)
2076-
{
2077-
RemoveStmt *newnode = makeNode(RemoveStmt);
2078-
2079-
newnode->removeType = from->removeType;
2080-
newnode->name = pstrdup(from->name);
2081-
2082-
return newnode;
2083-
}
2084-
20852074
static RenameStmt *
20862075
_copyRenameStmt(RenameStmt *from)
20872076
{
@@ -2782,9 +2771,6 @@ copyObject(void *from)
27822771
case T_RemoveOperStmt:
27832772
retval = _copyRemoveOperStmt(from);
27842773
break;
2785-
case T_RemoveStmt:
2786-
retval = _copyRemoveStmt(from);
2787-
break;
27882774
case T_RenameStmt:
27892775
retval = _copyRenameStmt(from);
27902776
break;

src/backend/nodes/equalfuncs.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Portions Copyright (c) 1994, Regents of the University of California
2121
*
2222
* IDENTIFICATION
23-
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.76 2000/10/07 00:58:16 tgl Exp $
23+
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.77 2000/10/18 16:16:04 momjian Exp $
2424
*
2525
*-------------------------------------------------------------------------
2626
*/
@@ -850,9 +850,9 @@ _equalDefineStmt(DefineStmt *a, DefineStmt *b)
850850
static bool
851851
_equalDropStmt(DropStmt *a, DropStmt *b)
852852
{
853-
if (!equal(a->relNames, b->relNames))
853+
if (!equal(a->names, b->names))
854854
return false;
855-
if (a->sequence != b->sequence)
855+
if (a->removeType != b->removeType)
856856
return false;
857857

858858
return true;
@@ -989,16 +989,6 @@ _equalRemoveOperStmt(RemoveOperStmt *a, RemoveOperStmt *b)
989989
return true;
990990
}
991991

992-
static bool
993-
_equalRemoveStmt(RemoveStmt *a, RemoveStmt *b)
994-
{
995-
if (a->removeType != b->removeType)
996-
return false;
997-
if (!equalstr(a->name, b->name))
998-
return false;
999-
1000-
return true;
1001-
}
1002992

1003993
static bool
1004994
_equalRenameStmt(RenameStmt *a, RenameStmt *b)
@@ -1959,9 +1949,6 @@ equal(void *a, void *b)
19591949
case T_RemoveOperStmt:
19601950
retval = _equalRemoveOperStmt(a, b);
19611951
break;
1962-
case T_RemoveStmt:
1963-
retval = _equalRemoveStmt(a, b);
1964-
break;
19651952
case T_RenameStmt:
19661953
retval = _equalRenameStmt(a, b);
19671954
break;

src/backend/parser/gram.y

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.195 2000/10/07 00:58:17 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.196 2000/10/18 16:16:05 momjian Exp $
1515
*
1616
* HISTORY
1717
* AUTHOR DATE MAJOR EVENT
@@ -1942,15 +1942,22 @@ def_arg: func_return { $$ = (Node *)$1; }
19421942
DropStmt: DROP TABLE relation_name_list
19431943
{
19441944
DropStmt *n = makeNode(DropStmt);
1945-
n->relNames = $3;
1946-
n->sequence = FALSE;
1945+
n->names = $3;
1946+
n->removeType = DROP_TABLE;
19471947
$$ = (Node *)n;
19481948
}
19491949
| DROP SEQUENCE relation_name_list
19501950
{
19511951
DropStmt *n = makeNode(DropStmt);
1952-
n->relNames = $3;
1953-
n->sequence = TRUE;
1952+
n->names = $3;
1953+
n->removeType = DROP_SEQUENCE;
1954+
$$ = (Node *)n;
1955+
}
1956+
| DROP VIEW relation_name_list
1957+
{
1958+
DropStmt *n = makeNode(DropStmt);
1959+
n->names = $3;
1960+
n->removeType = DROP_VIEW;
19541961
$$ = (Node *)n;
19551962
}
19561963
;
@@ -2558,17 +2565,16 @@ func_return: Typename
25582565

25592566
RemoveStmt: DROP remove_type name
25602567
{
2561-
RemoveStmt *n = makeNode(RemoveStmt);
2568+
DropStmt *n = makeNode(DropStmt);
25622569
n->removeType = $2;
2563-
n->name = $3;
2570+
n->names = makeList1(makeString($3));
25642571
$$ = (Node *)n;
25652572
}
25662573
;
25672574

2568-
remove_type: TYPE_P { $$ = TYPE_P; }
2569-
| INDEX { $$ = INDEX; }
2570-
| RULE { $$ = RULE; }
2571-
| VIEW { $$ = VIEW; }
2575+
remove_type: TYPE_P { $$ = DROP_TYPE_P; }
2576+
| INDEX { $$ = DROP_INDEX; }
2577+
| RULE { $$ = DROP_RULE; }
25722578
;
25732579

25742580

0 commit comments

Comments
 (0)