Re: BUG #3619: Renaming sequence does not update its 'sequence_name' field - Mailing list pgsql-bugs

From Heikki Linnakangas
Subject Re: BUG #3619: Renaming sequence does not update its 'sequence_name' field
Date
Msg-id 4703D0A5.4080203@enterprisedb.com
Whole thread Raw
In response to Re: BUG #3619: Renaming sequence does not update its 'sequence_name' field  (Guillaume 'ioguix' de Rorthais <ioguix@free.fr>)
Responses Re: BUG #3619: Renaming sequence does not update its 'sequence_name' field
List pgsql-bugs
Guillaume 'ioguix' de Rorthais wrote:
> Heikki Linnakangas a écrit :
>> Tom Lane wrote:
>>> Alvaro Herrera <alvherre@commandprompt.com> writes:
>>>> I am amused by the fact that we store the sequence name in the sequence
>>>> itself though.
>>> Yeah, it's a bit pointless.  One possible response to this gripe would
>>> be to take the name out of the sequence itself.  However, that would
>>> likely break client-side code for no very good reason.
> Actually, there's at least one reason : client side code using this value is buggy when a sequence is renamed.
> That's exactly how I found this issue: when coding "alter sequence" stuff in ppa which was using it...
> Presently, I will not use this value anymore, but I think other dev / projects which are using it should be inform
about
> this issue.
> However, I don't know if breaking client side code is the solution neither.

Well, the way it is now is just broken, so IMO we have to either fix it
or remove it altogether.

Since having sequence_name in there doesn't let you do anything you
can't do without it, and there's no easy way to fix it, I'd say let's
just remove it in 8.3 and do nothing in backbranches.

>> Would it be possible to create a SELECT rule on the sequence that
>> returns the sequence name from the catalog instead?
>>
> Well it looks a pretty good idea to me, but I'm not really aware about internal constraints to judge :S

I looked at it briefly. Unfortunately you can't just use CREATE RULE to
create one, that throws an error. I believe we could change the code to
allow it, and create such a rule automatically in DefineSequence, but
frankly it doesn't seem worth the trouble to me. Doesn't seem like a
candidate for backporting anyway.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: BUG #3648: Server crashes when trying to create a table
Next
From: Tom Lane
Date:
Subject: Re: BUG #3619: Renaming sequence does not update its 'sequence_name' field