Re: [HACKERS] system catalog relation of a table and a - Mailing list pgsql-patches

From Andrew McMillan
Subject Re: [HACKERS] system catalog relation of a table and a
Date
Msg-id 1008487500.4895.16.camel@kant.mcmillan.net.nz
Whole thread Raw
In response to Re: [HACKERS] system catalog relation of a table and a serial sequence  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
On Sun, 2001-12-16 at 17:17, Tom Lane wrote:
> > | > You might further check that the
> > | > apparent sequence name ends with _seq --- if not, it wasn't
> > | > generated by SERIAL.
> > |
> > | Wouldn't you want to include user sequences that are required for
> > | using the table?  If someone has used their own sequence as the
> > | default value for a column it would be nice to have it dumped as well.
>
> > This is my thought as well.  Hopefully Tom will concur.
>
> Well, that's why I said "might".  I'm not sure what the correct behavior
> is here.  If we had an actual SERIAL datatype --- that is, we could
> unambiguously tell that a given column was SERIAL --- then a case could
> be made that "pg_dump -t table" should dump only those sequences
> associated with table's SERIAL columns.
>
> I think it'd be a bit surprising if "pg_dump -t table" would dump
> sequences declared independently of the table.  An example where you'd
> likely not be happy with that is if the same sequence is being used to
> feed multiple tables.
>
> I agree that dumping all such sequences will often be the desired
> behavior, but that doesn't leave me convinced that it's the right
> thing to do.
>
> Any comments out there?

Along with "DROP COLUMN" this is probably one of the biggest "I can't
believe it doesn't" things out there.

I would tend to say that Brent's patch, in dumping all of the sequences
used by a table, is erring on the _correct_ side of caution.

Remember that someone who this is a problem for can easily post-process
the sequence out of the dump with sed or something, but someone for whom
the opposite is true doesn't have anything like as trivial a job to put
it back in there.

Cheers,
                    Andrew.
--
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/        PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201    MOB: +64(21)635-694    OFFICE: +64(4)499-2267


pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Czech NLS
Next
From: Giuseppe Tanzilli - CSF
Date:
Subject: RFC: Locale support for Numeric datatype