Re: WIP -- renaming implicit sequences

From: Thomas Munro <munro(at)ip9(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP -- renaming implicit sequences
Date: 2012-01-12 21:18:52
Message-ID: CADLWmXWLnzSc2xAdNLDjq7nBDMfVtH+GAjehw21WT1YmRhQ66w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12 January 2012 00:58, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Thomas Munro <munro(at)ip9(dot)org> writes:
>> Here is an unfinished patch to implement something which appears on
>> the TODO list under ALTER: automatic renaming of sequences created
>> with serial when the table and column names change.  I've often wanted
>> this feature and it seemed like a good starter project.
>
> Hmm ... this seems a bit inconsistent with the fact that we got rid of
> automatic renaming of indexes a year or three back.  Won't renaming of
> serials have all the same problems that caused us to give up on renaming
> indexes?

Ah. I assume this is it:

http://archives.postgresql.org/pgsql-committers/2009-12/msg00209.php

I used ChooseRelationName to generate a new unique name during
transformation. Presumably the implicit ALTER SEQUENCE will fail at
execution if someone manages to nab the name after
ChooseRelationName's get_relname_relid check.

So with the patch, ALTER TABLE RENAME with serial columns has the same
concurrency caveat as CREATE TABLE with serial columns, which I hoped
was reasonable or at least symmetrical.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-01-12 21:50:58 rewriteheap.c bug: toast rows don't get XIDs matching their parents
Previous Message Robert Haas 2012-01-12 21:00:02 Re: measuring spinning