Making serial survive pg_dump - Mailing list pgsql-hackers

From Rod Taylor
Subject Making serial survive pg_dump
Date
Msg-id 062a01c212d3$3f21e2e0$fe01a8c0@jester
Whole thread Raw
Responses Re: Making serial survive pg_dump  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Making serial survive pg_dump  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
Currently serial is dumped as a sequence and appropriate default
statement.

With my upcoming dependency patch serials depend on the appropriate
column.  Drop the column (or table) and the sequence goes with it.
The depencency information does not survive the pg_dump / restore
process however as it's recreated as the table and individual
sequence.

I see 2 options for carrying the information.

Store sequence information in the SERIAL creation statement:
CREATE TABLE tab (col1 SERIAL(<start num>, <sequence name>));

Or store the dependency information in the sequence:
CREATE SEQUENCE ... REQUIRES COLUMN <column>;


The former makes a lot more sense, and it's nice that the sequence
information is in one place.
--
Rod



pgsql-hackers by date:

Previous
From: "Jeroen T. Vermeulen"
Date:
Subject: Re: Integrating libpqxx
Next
From: "Marc G. Fournier"
Date:
Subject: Re: Integrating libpqxx