pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_dump and sequences
4+ messages / 2 participants
[nested] [flat]

* pg_dump and sequences
@ 2002-07-23 08:27 Achilleus Mantzios <achill@matrix.gatewaynet.com>
  2002-07-23 08:33 ` Re: pg_dump and sequences Achilleus Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Achilleus Mantzios @ 2002-07-23 08:27 UTC (permalink / raw)
  To: pgsql-sql

Hi, i am using postgreSQL 7.2.1 on a redhat 7.2 (kernel 
2.4.9-31,glibc-2.2.4-24).

It seems that pg_dump -t "tablename" dumps correctly the sequence of a 
table's column,when the column is named after "id".

For example,

dynacom=# CREATE TABLE foo2 (fid serial NOT NULL UNIQUE PRIMARY KEY,id 
serial);

[postgres@pc216 ~]% pg_dump -t foo2 > foo2DUMP.sql 

[postgres@pc216 ~]% cat foo2DUMP.sql
--
-- Selected TOC Entries:
--
\connect - postgres
 
--
-- TOC Entry ID 2 (OID 2009757)
--
-- Name: foo2_id_seq Type: SEQUENCE Owner: postgres
--
 
CREATE SEQUENCE "foo2_id_seq" start 1 increment 1 maxvalue 
9223372036854775807 minvalue 1 cache 1;
 
--
-- TOC Entry ID 4 (OID 2009759)
--
-- Name: foo2 Type: TABLE Owner: postgres
--
 
CREATE TABLE "foo2" (
        "fid" integer DEFAULT nextval('"foo2_fid_seq"'::text) NOT NULL,
        "id" integer DEFAULT nextval('"foo2_id_seq"'::text) NOT NULL,
        Constraint "foo2_pkey" Primary Key ("fid")
);
 
--
-- Data for TOC Entry ID 6 (OID 2009759)
--
-- Name: foo2 Type: TABLE DATA Owner: postgres
--
 
 
COPY "foo2" FROM stdin;
\.
--
-- TOC Entry ID 5 (OID 2009762)
--
-- Name: "foo2_id_key" Type: INDEX Owner: postgres
--
 
CREATE UNIQUE INDEX foo2_id_key ON foo2 USING btree (id);
 
--
-- TOC Entry ID 3 (OID 2009757)
--
-- Name: foo2_id_seq Type: SEQUENCE SET Owner: postgres
--
 
SELECT setval ('"foo2_id_seq"', 1, false);
-- 

Any ideas??

Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel:    +30-10-8981112
fax:    +30-10-8981877
email:  achill@matrix.gatewaynet.com
        mantzios@softlab.ece.ntua.gr




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_dump and sequences
  2002-07-23 08:27 pg_dump and sequences Achilleus Mantzios <achill@matrix.gatewaynet.com>
@ 2002-07-23 08:33 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
  2002-07-24 07:24   ` Re: pg_dump and sequences Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Achilleus Mantzios @ 2002-07-23 08:33 UTC (permalink / raw)
  To: pgsql-sql

On Tue, 23 Jul 2002, Achilleus Mantzios wrote:

Just a correction

> Hi, i am using postgreSQL 7.2.1 on a redhat 7.2 (kernel 
> 2.4.9-31,glibc-2.2.4-24).
> 
> It seems that pg_dump -t "tablename" dumps correctly the sequence of a 
> table's column,when the column is named after "id".
> 
                 ^^^^

I meant "when ONLY" the column is named after "id",
whereas it does not dump the sequence when the column is
named after something different than "id".

-- 
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel:    +30-10-8981112
fax:    +30-10-8981877
email:  achill@matrix.gatewaynet.com
        mantzios@softlab.ece.ntua.gr




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_dump and sequences
  2002-07-23 08:27 pg_dump and sequences Achilleus Mantzios <achill@matrix.gatewaynet.com>
  2002-07-23 08:33 ` Re: pg_dump and sequences Achilleus Mantzios <achill@matrix.gatewaynet.com>
@ 2002-07-24 07:24   ` Tom Lane <tgl@sss.pgh.pa.us>
  2002-07-24 10:56     ` Re: pg_dump and sequences Achilleus Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2002-07-24 07:24 UTC (permalink / raw)
  To: Achilleus Mantzios <achill@matrix.gatewaynet.com>; +Cc: pgsql-sql

Achilleus Mantzios <achill@matrix.gatewaynet.com> writes:
>> It seems that pg_dump -t "tablename" dumps correctly the sequence of a 
>> table's column,when the column is named after "id".

> I meant "when ONLY" the column is named after "id",

Yeah, you're right.  I'm hoping to see a better answer in 7.3, but
right now it's a horrible kluge ...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pg_dump and sequences
  2002-07-23 08:27 pg_dump and sequences Achilleus Mantzios <achill@matrix.gatewaynet.com>
  2002-07-23 08:33 ` Re: pg_dump and sequences Achilleus Mantzios <achill@matrix.gatewaynet.com>
  2002-07-24 07:24   ` Re: pg_dump and sequences Tom Lane <tgl@sss.pgh.pa.us>
@ 2002-07-24 10:56     ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Achilleus Mantzios @ 2002-07-24 10:56 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql

On Wed, 24 Jul 2002, Tom Lane wrote:

> Achilleus Mantzios <achill@matrix.gatewaynet.com> writes:
> >> It seems that pg_dump -t "tablename" dumps correctly the sequence of a 
> >> table's column,when the column is named after "id".
> 
> > I meant "when ONLY" the column is named after "id",
> 
> Yeah, you're right.  I'm hoping to see a better answer in 7.3, but
> right now it's a horrible kluge ...

No harm done!

> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 

-- 
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel:    +30-10-8981112
fax:    +30-10-8981877
email:  achill@matrix.gatewaynet.com
        mantzios@softlab.ece.ntua.gr




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-07-24 10:56 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-07-23 08:27 pg_dump and sequences Achilleus Mantzios <achill@matrix.gatewaynet.com>
2002-07-23 08:33 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2002-07-24 07:24   ` Tom Lane <tgl@sss.pgh.pa.us>
2002-07-24 10:56     ` Achilleus Mantzios <achill@matrix.gatewaynet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox