BUG #2781: database dump/restore problems - Mailing list pgsql-bugs

From Greg Peters
Subject BUG #2781: database dump/restore problems
Date
Msg-id 200611261138.kAQBcuEJ021648@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #2781: database dump/restore problems
List pgsql-bugs
The following bug has been logged online:

Bug reference:      2781
Logged by:          Greg Peters
Email address:      gregpeters79@gmail.com
PostgreSQL version: 8.1/8.2beta3
Operating system:   WInXP
Description:        database dump/restore problems
Details:

Hello,

I recently performed a database dump with 8.2b3 for a complete database. An
example of the SQL output for a single table is below:

CREATE TABLE admin_field_list (
    "key" bigint NOT NULL,
    field character varying(25) NOT NULL,
    added_by character varying(25) NOT NULL,
    add_date timestamp without time zone DEFAULT now() NOT NULL,
    mod_date timestamp without time zone,
    modified_by character varying(25)
);


ALTER TABLE public.admin_field_list OWNER TO root;

--
-- TOC entry 1351 (class 1259 OID 16425)
-- Dependencies: 1352 4
-- Name: admin_field_list_key_seq; Type: SEQUENCE; Schema: public; Owner:
root
--

CREATE SEQUENCE admin_field_list_key_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;

As you can see, the primary key is exported as a bigint, with a separate
section for the sequence. This differs to the way 8.1 dumps the same table
below:

CREATE TABLE admin_field_list (
    "key" bigserial NOT NULL,
    field character varying(25) NOT NULL,
    added_by character varying(25) NOT NULL,
    add_date timestamp without time zone DEFAULT now() NOT NULL,
    mod_date timestamp without time zone,
    modified_by character varying(25)
);

I then tried to restore the DB dumped by 8.2b3 into 8.1, with no success. It
didn't like the sequence part. This probably isn't so much a bug, but more a
backwards compatibility issue. Also, it seems strange to make the newer
database dumps more verbose and complicated. Surely the simple "bigserial"
datatype is a better method, and easier to implement then the sequence
statements?

Regards,

Greg.

pgsql-bugs by date:

Previous
From: "Michael Simms"
Date:
Subject: BUG #2784: Performance serious degrades over a period of a month
Next
From: "Patrick Hayes"
Date:
Subject: BUG #2785: Exception Issue