Re: [HACKERS] system catalog relation of a table and a

From: Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Rod Taylor <rbt(at)zort(dot)ca>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Re: [HACKERS] system catalog relation of a table and a
Date: 2001-12-16 07:25:00
Message-ID: 1008487500.4895.16.camel@kant.mcmillan.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Brent Verner 2001-12-16 11:30:21 Re: system catalog relation of a table and a serial sequence
Previous Message Philip Warner 2001-12-16 07:12:56 Re: system catalog relation of a table and a serial

Browse pgsql-patches by date

  From Date Subject
Next Message Brent Verner 2001-12-16 11:30:21 Re: system catalog relation of a table and a serial sequence
Previous Message Philip Warner 2001-12-16 07:12:56 Re: system catalog relation of a table and a serial