Project

General

Profile

« Previous | Next » 

Revision 13517

schemas/util.sql: recreate(): perform the correct DROP VIEW in the function itself so that the caller does not have to worry about forming it properly

View differences:

trunk/schemas/util.sql
3052 3052
	restore_views_info util.restore_views_info;
3053 3053
BEGIN
3054 3054
	restore_views_info = util.save_drop_views(users);
3055
	
3056
	-- trigger the dependent_objects_still_exist exception
3057
	PERFORM util.eval(util.mk_drop_from_create(cmd));
3058
		-- *not* CASCADE; it must trigger an exception
3059
	
3055 3060
	PERFORM util.eval(cmd);
3061
	
3056 3062
	PERFORM util.restore_views(restore_views_info);
3057 3063
EXCEPTION
3058 3064
WHEN dependent_objects_still_exist THEN
......
3074 3080
--
3075 3081

  
3076 3082
COMMENT ON FUNCTION recreate(cmd text, users text[]) IS '
3083
the appropriate drop statement will be added automatically.
3084

  
3077 3085
usage:
3078 3086
SELECT util.recreate($$
3079
-- trigger the dependent_objects_still_exist exception
3080
DROP VIEW schemas.main_view; -- *not* CASCADE; it must trigger an exception
3081

  
3082 3087
CREATE VIEW schemas.main_view AS _;
3083 3088

  
3084 3089
-- manually restore views that need to be updated for the changes

Also available in: Unified diff