Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4.1.0 call powa_delete_and_purge_server function fails with powa_extensions ..is still referenced from table #120

Closed
banlex73 opened this issue Dec 14, 2020 · 6 comments
Assignees
Labels

Comments

@banlex73
Copy link

Hello
When trying
select powa_delete_and_purge_server (9)
getting error:
powa_extensions" Detail: Key (id)=(9) is still referenced from table "powa_extensions". Where: SQL statement "DELETE FROM public.powa_servers WHERE id = _srvid" PL/pgSQL function powa_delete_and_purge_server(integer) line 9 at SQL statement

But was able to fix it running:
ALTER TABLE public.powa_extensions drop constraint IF EXISTS powa_extensions_srvid_fkey; ALTER TABLE public.powa_extensions ADD CONSTRAINT powa_extensions_srvid_fkey FOREIGN KEY (srvid) REFERENCES powa_servers(id) on DELETE CASCADE;

@rjuju rjuju self-assigned this Dec 14, 2020
@rjuju
Copy link
Member

rjuju commented Dec 14, 2020

What is the content of powa_delete_and_purge_server ?

@banlex73
Copy link
Author

banlex73 commented Dec 14, 2020 via email

@rjuju
Copy link
Member

rjuju commented Dec 14, 2020

I see, thanks. Would you like me to push a function to remove all data from a specific server in pg_track_settings so you don't have to maintain it yourself? I'm also wondering if we should add a trigger on DELETE on powa_server, to automatically delete data from pg_track_settings if installed. The idea is that you shouldn't need a specific function to clean up a server, just remove the row. It'll still cause problems if you add additional extensions, but that can also be fixed if needed.

And indeed I forgot the ON UPDATE / ON DELETE cascade clause, ouch. I'll push a fix shortly.

@rjuju rjuju added the bug label Dec 14, 2020
@banlex73
Copy link
Author

banlex73 commented Dec 14, 2020 via email

@rjuju
Copy link
Member

rjuju commented Dec 14, 2020

PS: I am actively testing 4.1.0 going to deploy it on TST on Monday and
later on PRD too

Thanks a lot!

Also, I just pushed powa-team/powa-archivist@59bcbc6 which should fix the issue once version 4.1.2 is released.

@banlex73
Copy link
Author

banlex73 commented Dec 14, 2020 via email

@rjuju rjuju closed this as completed Jan 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants