Thread: Sequence Not created with pg_dump

Sequence Not created with pg_dump

From
sweta@opspl.com
Date:
Hello all,

When I create a db dump using --

pg_dump -s dbname > mydump.sql

 Sequences present are not being added to the mydump.sql file....

PS Cannot paste the contents of the file . Its too large :P

Regards
Sweta






Re: Sequence Not created with pg_dump

From
Tom Lane
Date:
sweta@opspl.com writes:
> When I create a db dump using --

> pg_dump -s dbname > mydump.sql

>  Sequences present are not being added to the mydump.sql file....

Seems unlikely (IOW, if so, you've found a bug no one else has ever
seen).  Maybe they are being created implicitly by SERIAL column
declarations?

            regards, tom lane

Re: Sequence Not created with pg_dump

From
John R Pierce
Date:
sweta@opspl.com wrote:
> Hello all,
>
> When I create a db dump using --
>
> pg_dump -s dbname > mydump.sql
>
>  Sequences present are not being added to the mydump.sql file....
>

you'll need to be a -little- more specific... sure seems to me like its
working on this centos5 linux + pg 8.3.7 system


[postgres@somehost ~]$ createdb junk
[postgres@somehost ~]$ psql junk
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.
...
junk=# create table junk (id serial, dat text);
NOTICE:  CREATE TABLE will create implicit sequence "junk_id_seq" for
serial column "junk.id"
CREATE TABLE
junk=# \q

[postgres@somehost ~]$ pg_dump -s junk
--
-- PostgreSQL database dump
--

SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: junk; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
--

CREATE TABLE junk (
    id integer NOT NULL,
    dat text
);


ALTER TABLE public.junk OWNER TO postgres;

--
-- Name: junk_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.junk_id_seq OWNER TO postgres;

--
-- Name: junk_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner:
postgres
--

ALTER SEQUENCE junk_id_seq OWNED BY junk.id;


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE junk ALTER COLUMN id SET DEFAULT
nextval('junk_id_seq'::regclass);


--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


--
-- PostgreSQL database dump complete
--

[postgres@somehost ~]$

Re: Sequence Not created with pg_dump

From
sweta@opspl.com
Date:

>
> Seems unlikely (IOW, if so, you've found a bug no one else has ever
> seen).  Maybe they are being created implicitly by SERIAL column
> declarations?
>

  Yeah....  they are created by the Serial column .

Regards
Sweta


Re: Sequence Not created with pg_dump

From
Alvaro Herrera
Date:
sweta@opspl.com wrote:
>
>
> >
> > Seems unlikely (IOW, if so, you've found a bug no one else has ever
> > seen).  Maybe they are being created implicitly by SERIAL column
> > declarations?
> >
>
>   Yeah....  they are created by the Serial column .

He means: are they output as SERIAL columns in the dump too?

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support