BUG #5072: User trying to drop an internally dependent object crashes server

From: "Amit Khandekar" <amit(dot)khandekar(at)enterprisedb(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5072: User trying to drop an internally dependent object crashes server
Date: 2009-09-22 12:16:58
Message-ID: 200909221216.n8MCGw0a010155@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 5072
Logged by: Amit Khandekar
Email address: amit(dot)khandekar(at)enterprisedb(dot)com
PostgreSQL version: 8.5devel
Operating system: All
Description: User trying to drop an internally dependent object
crashes server
Details:

If a DROP command is issued for an object that is actually a part of
internal implementation of another object, then the command crashes the
server.

For e.g. a rule with name "_RETURN" is internally created when a user
creates
a view. This object dependency is stored in pg_depend with deptype
DEPENDENCY_INTERNAL.

postgres=# CREATE VIEW fooview AS SELECT 'foo'::text;
CREATE VIEW
postgres=# DROP RULE "_RETURN" ON fooview;
server closed the connection unexpectedly
This probably means the server terminated abno
before or while processing the request.

The function object_address_present() in src/backend/catalog/dependency.c
assumes that the address list is always a non-NULL argument even though the
number of addresses can be zero. Whereas in the above scenario, the address
list is NULL. A simple address check such as below will fix this issue :

bool
object_address_present(const ObjectAddress *object,
const ObjectAddresses *addrs)
{
+ if (!addrs)
+ return false;
........
........
}

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2009-09-22 13:37:10 Re: BUG #5066: plperl issues with perl_destruct() and END blocks
Previous Message Bhushan Verma 2009-09-22 11:22:18 Re: Databse installation problem