Monday, June 18, 2012

Dropping table that has many objects dependent on it

Dropping table automatically,
the program throws error:

Exception in thread "Thread-3" java.lang.NullPointerException
Changed the drop table query statement in Java from
stmt.execute(droptable);
          to
stmt.executeUpdate(droptable);

Still it displayed the same error.

While executing the query on pgadmin, it displayed the error:

ERROR: cannot drop table h*** because other objects depend on it
HINT: Use DROP ... CASCADE to drop the dependent objects too.

Too many triggers and views are dependent on the table

Changed the Drop table statement from

DROP TABLE TABLENAME
to
DROP TABLE TABLENAME CASCADE

Program works fine.

No comments:

Post a Comment

Thanks for visiting my Blog....Ur comments n suggestions are most valuable for me...Thanks