This commit is contained in:
vipg
2025-11-18 11:53:08 +08:00
parent 74e87033ed
commit 53e55c1123
3 changed files with 23 additions and 5 deletions

View File

@@ -69,6 +69,12 @@ BEGIN
WHERE table_name = 'country_info_view'
) INTO view_exists;
-- 若视图存在,先删除(避免字段名冲突)
IF view_exists THEN
DROP VIEW country_info_view;
RAISE NOTICE '已删除旧视图 country_info_view';
END IF;
-- 创建或更新视图
CREATE OR REPLACE VIEW country_info_view AS
SELECT
@@ -87,7 +93,7 @@ BEGIN
-- 根据视图是否已存在输出不同提示
IF view_exists THEN
RAISE NOTICE '视图 country_info_view 已更新';
RAISE NOTICE '视图 country_info_view 已更新(删除旧视图后重建)';
ELSE
RAISE NOTICE '视图 country_info_view 已创建';
END IF;