根据2024 sql 生成2024 postgres sql #34
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
修改了适合 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 '城乡分类';