Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old July 14th, 2008, 12:16 PM
Newbie
 
Join Date: Jul 2008
Posts: 6
Default Automatic deleting views of table in PostgreSql

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
Reply
  #2  
Old July 14th, 2008, 01:09 PM
Moderator
 
Join Date: Dec 2006
Posts: 250
Default

to be clear you want to delete views of a table when its (mean table) name changed?
Reply
  #3  
Old July 14th, 2008, 01:16 PM
Newbie
 
Join Date: Jul 2008
Posts: 6
Default

Yes, I want to delete views of a table when its name changed
Reply
  #4  
Old July 14th, 2008, 06:21 PM
Moderator
 
Join Date: Dec 2006
Posts: 250
Default

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
  #5  
Old July 15th, 2008, 07:33 AM
Newbie
 
Join Date: Jul 2008
Posts: 6
Default

Thanks

I'll try to do it now

Dzięki:)
Reply
  #6  
Old July 24th, 2008, 08:16 AM
Newbie
 
Join Date: Jul 2008
Posts: 6
Default

Hi

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

Thanks
Reply
  #7  
Old July 25th, 2008, 12:42 PM
Newbie
 
Join Date: Jul 2008
Posts: 6
Default

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
  #8  
Old July 25th, 2008, 03:18 PM
Moderator
 
Join Date: Dec 2006
Posts: 250
Default

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
  #9  
Old August 3rd, 2008, 06:40 PM
Newbie
 
Join Date: Jul 2008
Posts: 6
Default

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

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles