mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Fix crash if a DROP is attempted on an internally-dependent object.
Introduced in 8.4 rewrite of dependency.c. Per bug #5072 from Amit Khandekar.
This commit is contained in:
parent
02faeb4ac8
commit
d5a43ffde0
@ -8,7 +8,7 @@
|
|||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.90 2009/08/07 15:27:56 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.91 2009/09/22 15:46:34 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -559,7 +559,8 @@ findDependentObjects(const ObjectAddress *object,
|
|||||||
{
|
{
|
||||||
char *otherObjDesc;
|
char *otherObjDesc;
|
||||||
|
|
||||||
if (object_address_present(&otherObject, pendingObjects))
|
if (pendingObjects &&
|
||||||
|
object_address_present(&otherObject, pendingObjects))
|
||||||
{
|
{
|
||||||
systable_endscan(scan);
|
systable_endscan(scan);
|
||||||
/* need to release caller's lock; see notes below */
|
/* need to release caller's lock; see notes below */
|
||||||
|
@ -1444,6 +1444,14 @@ insert into rule_and_refint_t3 values (1, 13, 11, 'row8');
|
|||||||
ERROR: insert or update on table "rule_and_refint_t3" violates foreign key constraint "rule_and_refint_t3_id3a_fkey"
|
ERROR: insert or update on table "rule_and_refint_t3" violates foreign key constraint "rule_and_refint_t3_id3a_fkey"
|
||||||
DETAIL: Key (id3a, id3b)=(1, 13) is not present in table "rule_and_refint_t1".
|
DETAIL: Key (id3a, id3b)=(1, 13) is not present in table "rule_and_refint_t1".
|
||||||
--
|
--
|
||||||
|
-- disallow dropping a view's rule (bug #5072)
|
||||||
|
--
|
||||||
|
create view fooview as select 'foo'::text;
|
||||||
|
drop rule "_RETURN" on fooview;
|
||||||
|
ERROR: cannot drop rule _RETURN on view fooview because view fooview requires it
|
||||||
|
HINT: You can drop view fooview instead.
|
||||||
|
drop view fooview;
|
||||||
|
--
|
||||||
-- check for planner problems with complex inherited UPDATES
|
-- check for planner problems with complex inherited UPDATES
|
||||||
--
|
--
|
||||||
create table id (id serial primary key, name text);
|
create table id (id serial primary key, name text);
|
||||||
|
@ -851,6 +851,14 @@ create rule rule_and_refint_t3_ins as on insert to rule_and_refint_t3
|
|||||||
insert into rule_and_refint_t3 values (1, 11, 13, 'row7');
|
insert into rule_and_refint_t3 values (1, 11, 13, 'row7');
|
||||||
insert into rule_and_refint_t3 values (1, 13, 11, 'row8');
|
insert into rule_and_refint_t3 values (1, 13, 11, 'row8');
|
||||||
|
|
||||||
|
--
|
||||||
|
-- disallow dropping a view's rule (bug #5072)
|
||||||
|
--
|
||||||
|
|
||||||
|
create view fooview as select 'foo'::text;
|
||||||
|
drop rule "_RETURN" on fooview;
|
||||||
|
drop view fooview;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- check for planner problems with complex inherited UPDATES
|
-- check for planner problems with complex inherited UPDATES
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user