fix: 002b 改用 date_part 修复表达式索引语法,002c 补救专用

This commit is contained in:
simonkoson
2026-05-15 13:37:38 +08:00
parent 3102fbec6c
commit 9439c72d30
2 changed files with 28 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
-- ============================================================
-- 002c_recreate_index_only.sql
-- 002b 跑半截翻车后补救:只执行 CREATE INDEX,不要再 DROP CONSTRAINT
-- 执行方式: psql -U postgres -d milsci_dev -f sql/002c_recreate_index_only.sql
-- 前置条件:先设 $env:PGCLIENTENCODING="UTF8"
-- ============================================================
CREATE UNIQUE INDEX idx_episodes_year_number
ON episodes (date_part('year', air_date), episode_number)
WHERE original_episode_id IS NULL;