Automatic deleting views of table in PostgreSql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mateusz1984
    New Member
    • Jul 2008
    • 6

    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
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    to be clear you want to delete views of a table when its (mean table) name changed?

    Comment

    • mateusz1984
      New Member
      • Jul 2008
      • 6

      #3
      Yes, I want to delete views of a table when its name changed

      Comment

      • rski
        Recognized Expert Contributor
        • Dec 2006
        • 700

        #4
        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ć :)

        Comment

        • mateusz1984
          New Member
          • Jul 2008
          • 6

          #5
          Thanks

          I'll try to do it now

          Dzięki:)

          Comment

          • mateusz1984
            New Member
            • Jul 2008
            • 6

            #6
            Hi

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

            Thanks

            Comment

            • mateusz1984
              New Member
              • Jul 2008
              • 6

              #7
              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)

              Comment

              • rski
                Recognized Expert Contributor
                • Dec 2006
                • 700

                #8
                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?

                Comment

                • mateusz1984
                  New Member
                  • Jul 2008
                  • 6

                  #9
                  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

                  Comment

                  Working...