Connecting Tech Pros Worldwide
Login or Sign up Help | Site Map
[ http://bytes.com/adLoader.php?parent=database

Automatic deleting views of table in PostgreSql

Question posted by: mateusz1984 (Newbie) on July 14th, 2008 11:16 AM
Hi

I have a problem with deleting all views od tables in PostgreSql.

I have the table with name "tab1" and it has a view with name "view1". Do you know how to dynamic delete all views when the name of the table "tab1" will be changed?

Sorry for my english

Thanks
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
rski's Avatar
rski
Moderator
238 Posts
July 14th, 2008
12:09 PM
#2

Re: Automatic deleting views of table in PostgreSql
to be clear you want to delete views of a table when its (mean table) name changed?

Reply
mateusz1984's Avatar
mateusz1984
Newbie
6 Posts
July 14th, 2008
12:16 PM
#3

Re: Automatic deleting views of table in PostgreSql
Yes, I want to delete views of a table when its name changed

Reply
rski's Avatar
rski
Moderator
238 Posts
July 14th, 2008
05:21 PM
#4

Re: Automatic deleting views of table in PostgreSql
I didn't try it but there may be some solutions
1) with postgresql root privileges you can create trigger on pg_class wich will delete all views for a table which is altered (if i found comp with root accout on postgres i'll try do that and write it down here)
2) do alter on table and views removing via a some function, you should write.

Powinno zadziałać :)

Reply
mateusz1984's Avatar
mateusz1984
Newbie
6 Posts
July 15th, 2008
06:33 AM
#5

Re: Automatic deleting views of table in PostgreSql
Thanks

I'll try to do it now

Dzięki:)

Reply
mateusz1984's Avatar
mateusz1984
Newbie
6 Posts
July 24th, 2008
07:16 AM
#6

Re: Automatic deleting views of table in PostgreSql
Hi

Unfortunately I haven't done this problem yet :( I really need help

Thanks

Reply
mateusz1984's Avatar
mateusz1984
Newbie
6 Posts
July 25th, 2008
11:42 AM
#7

Re: Automatic deleting views of table in PostgreSql
Hi

I want to write some function in plpgsql which will be located into trigger later, this function must delete views of a table when its name was changed to another one (all views must be deleted)

Reply
rski's Avatar
rski
Moderator
238 Posts
July 25th, 2008
02:18 PM
#8

Re: Automatic deleting views of table in PostgreSql
Quote:
Originally Posted by mateusz1984
Hi

I want to write some function in plpgsql which will be located into trigger later, this function must delete views of a table when its name was changed to another one (all views must be deleted)

What about views which are defined on more than one table?

Reply
mateusz1984's Avatar
mateusz1984
Newbie
6 Posts
August 3rd, 2008
05:40 PM
#9

Re: Automatic deleting views of table in PostgreSql
Quote:
Originally Posted by rski
What about views which are defined on more than one table?


All views created on many tables must be deleted when tables are altered

Reply
Reply
Not the answer you were looking for? Post your question . . .
183,820 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
Top PostgreSQL Forum Contributors
[ http://bytes.com/adLoader.php?parent=database


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser