Skip to content

Conversation

@sdhou
Copy link

@sdhou sdhou commented Apr 16, 2025

修改了适合 postgres 的建表语句

DROP TABLE IF EXISTS area_code_2024;
CREATE TABLE area_code_2024 (
code BIGINT NOT NULL,
name VARCHAR(128) NOT NULL DEFAULT '',
level SMALLINT NOT NULL CHECK (level BETWEEN 1 AND 5),
pcode BIGINT,
category INTEGER,
PRIMARY KEY (code)
) WITH (fillfactor = 90);

-- 创建索引
CREATE INDEX area_code_2024_name_idx ON area_code_2024 (name);
CREATE INDEX area_code_2024_level_idx ON area_code_2024 (level);
CREATE INDEX area_code_2024_pcode_idx ON area_code_2024 (pcode);

-- 添加列注释
COMMENT ON COLUMN area_code_2024.code IS '区划代码';
COMMENT ON COLUMN area_code_2024.name IS '名称';
COMMENT ON COLUMN area_code_2024.level IS '级别1-5,省市县镇村';
COMMENT ON COLUMN area_code_2024.pcode IS '父级区划代码';
COMMENT ON COLUMN area_code_2024.category IS '城乡分类';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant