我想 pg_dump 我的数据库并且有一些序列在转储文件中生成而一些没有的问题。
使用表 infrastruktur_pictures 它与表 hoehenprofile 一起使用它不起作用。以下是 pgadmin3 中有关表的信息:
hoehenprofile
CREATE SEQUENCE "hoehenprofile_HID_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 14289
CACHE 1;
ALTER TABLE "hoehenprofile_HID_seq";
CREATE TABLE hoehenprofile
(
"HID" serial NOT NULL,
hoehenprofil character varying(255),
CONSTRAINT "HID" PRIMARY KEY ("HID")
)
WITH (
OIDS=FALSE
);
ALTER TABLE hoehenprofile ADD COLUMN "HID" integer;
ALTER TABLE hoehenprofile ALTER COLUMN "HID" SET NOT NULL;
ALTER TABLE hoehenprofile ALTER COLUMN "HID" SET DEFAULT nextval('"hoehenprofile_HID_seq"'::regclass);
基础设施_图片
CREATE SEQUENCE "infrastruktur_pictures_IPID_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
ALTER TABLE "infrastruktur_pictures_IPID_seq";
CREATE TABLE infrastruktur_pictures
(
"IPID" serial NOT NULL,
picture character varying(255) NOT NULL,
picture_text text,
fotograf text,
CONSTRAINT prim PRIMARY KEY ("IPID")
)
WITH (
OIDS=FALSE
);
ALTER TABLE infrastruktur_pictures ADD COLUMN "IPID" integer;
ALTER TABLE infrastruktur_pictures ALTER COLUMN "IPID" SET NOT NULL;
ALTER TABLE infrastruktur_pictures ALTER COLUMN "IPID" SET DEFAULT nextval('"infrastruktur_pictures_IPID_seq"'::regclass);
在转储文件中,生成的 hoehenprofile 代码如下所示(未生成序列):
--
-- TOC entry 145 (class 1259 OID 67719)
-- Name: hoehenprofile; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE hoehenprofile (
"HID" integer DEFAULT nextval('"hoehenprofile_HID_seq"'::regclass) NOT NULL,
hoehenprofil character varying(255)
);
infrastruktur_pictures 的代码如下所示:
-
-- TOC entry 152 (class 1259 OID 67750)
-- Name: infrastruktur_pictures; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE infrastruktur_pictures (
"IPID" integer NOT NULL,
picture character varying(255) NOT NULL,
picture_text text,
fotograf text
);
--
-- TOC entry 4230 (class 0 OID 0)
-- Dependencies: 152
-- Name: TABLE infrastruktur_pictures; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON TABLE infrastruktur_pictures IS 'Bilder im Infrastruktur Bereich des Backends';
--
-- TOC entry 153 (class 1259 OID 67756)
-- Name: infrastruktur_pictures_IPID_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE "infrastruktur_pictures_IPID_seq"
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- TOC entry 4231 (class 0 OID 0)
-- Dependencies: 153
-- Name: infrastruktur_pictures_IPID_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE "infrastruktur_pictures_IPID_seq" OWNED BY infrastruktur_pictures."IPID";
我可以在 pgadmin3 中看到这两个表之间的唯一区别。当我在对象浏览器中单击特定的 cloumn(HID, IPID) 并查看其右侧的属性选项卡时,我可以看到在 HID 列中未设置序列属性。