column-renames-metadata-only
Column Renames (Metadata-Only)
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 18
- Forks
- 6
01 前言 Front Matter
- name
- column-renames-metadata-only
- metadata
- { "original-index": 5, "short-description": "Column Renames (Metadata-Only)" }
- description
- Column Renames (Metadata-Only)
02 资源文件 1
- 参考文档skill.json157 B
03 SKILL.md 正文
Column Renames (Metadata-Only)
What
PostgreSQL's ALTER TABLE RENAME COLUMN is a metadata-only operation. It
changes the column name in the system catalogs (pg_attribute) without touching
the actual table data. It's instant regardless of table size.
Why
This matters because renaming a column on a 100-million-row table takes the same time as renaming one on a 10-row table: effectively zero. No table rewrite, no data movement, no downtime.
How
ALTER TABLE public."Applicant"
RENAME COLUMN "SpeialtyRequirement" TO "SpecialtyRequirement";
What happens internally:
- PostgreSQL acquires an
ACCESS EXCLUSIVElock on the table (very briefly) -- this is the strictest lock mode but the hold time is sub-millisecond since only catalog metadata is updated (PG 16 docs: sql-altertable.html) - Updates
pg_attribute.attnamefor that column's OID - Releases the lock
Total time: typically < 1ms.
What It Does NOT Do
- Does NOT update stored procedures that reference the old column name
- Does NOT update views that reference the old column name
- Does NOT update application code
- Does NOT update indexes (indexes reference column attnum, not name)
- Does NOT change parameter names in function signatures
This is why had to separately update 4 stored procedures -- the column
rename alone would have left them broken with "column does not exist" errors.
When to Use
- Fixing typos in column names
- Standardizing naming conventions
- Any rename where you can also update all dependent objects
Where We Used It
- ****: Renamed 4 misspelled columns in
public."Applicant"SpeialtyRequirement->SpecialtyRequirementAddionalCommentsAuthToWork->AdditionalCommentsAuthToWorkAdditinalCpmmentsUnderAge->AdditionalCommentsUnderAgeVertirnaryTechOrAssistant->the clientTechOrAssistant
Related Skills
- Skill #06 (pg_get_functiondef) -- update procedures after column renames
- Skill #08 (Deep Grep) -- verify all references found
- Skill #14 (Research Checklist) -- find all affected objects before renaming
- Skill #19 (Multi-Object Rename) -- when the rename includes the table itself
Gotchas
- Stored procedures break if they use quoted column names (
"OldName") - Views break if they reference the old column name
- Application code breaks if it uses the old column name in queries
- Always search for ALL dependent objects before renaming
*Category: DDL | Origin: *
04 同仓库更多 Skills
yeet
Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).
wrangler
Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
workspace-skill-discovery
Discover and include ALL skills across the workspace — not just global ones. Use at the start of every session or when the user asks about available skills. Ensures project-level skills (under .claude/skills/ or skills/ in any repo) are never missed.
workers-best-practices
Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
winui-app
Create, build and design WinUI 3 desktop apps with C# and the Windows App SDK following Microsoft's official guidance and CommunityToolkit. Covers XAML, navigation, theming, accessibility and deployment.
windows-brain-script-portability
Scripts in ~/.claude/scripts/ that run on a Windows brain: use the python3.cmd shim and not bare python3, and reconfigure stdout to UTF-8 if you print symbols. Use it when writing a brain script or triaging a Windows-only crash.