| From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | pgsql-hackers(at)postgreSQL(dot)org |
| Subject: | Re: DROP OWNED BY doesn't work |
| Date: | 2006-08-20 00:15:33 |
| Message-ID: | 20060820001533.GD10267@alvh.no-ip.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers pgsql-patches |
Tom Lane wrote:
> I think a correct solution probably requires making a list of all
> objects to delete by scanning pg_shdepend and then starting to
> delete 'em, using the list as "oktodelete" context similar to the
> way that dependency.c handles auto/internal objects.
What I'm considering is this: scan pg_shdepend looking for objects to
delete, and save them into a list; but each time we find one, we also
find objects that depend on it. Those dependent objects should be
ignored; but we should also remove from the list of objects to delete,
any dependent object that we added in a previous iteration of the
pg_shdepend scan. A subtlety is that if we see that an object from the
scan is in the ignored list, we need not find dependent objects nor add
it to the to-delete list.
In pseudo-code it would be something like this:
ObjectAddresses objects-to-delete = empty
ObjectAddresses objects-ignored = empty
scan pg_shdepend for objects depending on the user;
for (object) in scan
if (object is not in objects-ignored)
ObjectAddresses dependent-objects = empty
add object to objects-to-delete
dependent-objects = findAutoDeletableObjects(object)
add dependent-objects to objects-ignored
for (object2) in objects-to-delete
if (object2 is in objects-ignored)
remove object2 from objects-to-delete
add object2 fo objects-ignored
for (object) in objects-to-delete
performDeletion(object)
This has a nasty looking O(n^2) behavior, but I don't see anything
better.
Comments?
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2006-08-20 00:37:47 | OTRS |
| Previous Message | Alvaro Herrera | 2006-08-19 22:57:31 | Re: DROP OWNED BY doesn't work |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2006-08-20 01:01:05 | Re: DROP OWNED BY doesn't work |
| Previous Message | Alvaro Herrera | 2006-08-19 22:57:31 | Re: DROP OWNED BY doesn't work |