Re: Sequence Not created with pg_dump

From: John R Pierce <pierce(at)hogranch(dot)com>
To: sweta(at)opspl(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sequence Not created with pg_dump
Date: 2009-08-06 05:11:34
Message-ID: 4A7A6606.9030604@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

sweta(at)opspl(dot)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(at)somehost ~]$ createdb junk
[postgres(at)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(at)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(at)somehost ~]$

In response to

Browse pgsql-general by date

  From Date Subject
Next Message sweta 2009-08-06 05:54:23 Re: Sequence Not created with pg_dump
Previous Message Tom Lane 2009-08-06 05:04:19 Re: Sequence Not created with pg_dump