Re: [PATCHES] Proposed patch for sequence-renaming problems

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [PATCHES] Proposed patch for sequence-renaming problems
Date: 2005-09-28 16:10:20
Message-ID: 200509281610.j8SGAKd09861@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Just to follow up, I agree we can't totally replace all instances of
> > nextval() with regclass because regclass requires a constant string, but
> > I would like to have the regclass behavior with simple syntax and
> > require people who want "late binding" of the sequence name to use some
> > extra syntax, like ::text or something.
>
> That would require a considerably more invasive change, AFAICS: remove
> the text-input version of nextval() and introduce an implicit coercion
> from text to regclass to avoid breaking existing dumps. I'd prefer not
> to mess with that during beta, because there'd be nontrivial risk of
> breaking existing behaviors. Because the proposed patch just adds on
> new functions and doesn't change the behavior of existing DEFAULT
> clauses, I don't think it can break anything.
>
> However, we could certainly add the NEXT VALUE FOR syntax if that will
> satisfy your concern about syntax.

I am personally fine with use ::regclass internally, especially for
SERIAL. It is documenting its use (and recommending it) that has me
concerned. We are placing additional burdens on users --- burdens that
will not exist in 8.2 when we have more time to fix it right.

Is it worth telling users to use ::regclass in their code for 8.1 just
to fix this, and then telling them in 8.2 it is not necessary to use
this?

> > The other question is whether we should be playing with this at all
> > during beta. Should we just disable ALTER SCHEMA RENAME and return to
> > this during 8.2? I am worried these side missions will delay our final
> > release of 8.1.
>
> I'm prepared to argue that this is a bug fix, not only for ALTER SCHEMA
> RENAME but for some very long-standing problems with renaming of
> sequences. As I said before, you are seriously mistaken to consider
> that disabling ALTER SCHEMA RENAME would eliminate the problem.

If it was that bad, we should have fixed it during development, not
during beta. The only reason it is getting attention now is because it
is triggered more by a new feature we are adding, a feature we can
easily remove.

I know we both don't want to open up the entire TODO list for fixing
during beta, especially fixing that isn't 100% complete and who's
user-visible behavior will change in the next major release.

Now, if we use ::regclass internally for just SERIAL, and don't document
its use for sequences (or at last minimize its visibility), or we add
NEXT VALUE FOR support and tell everyone to use that, that is fine with
me because it is probably the best way for users to use this in
defaults for all future releases.

Am I correct that NEXT VALUE FOR is behavior which will be
feature-complete and will be the recommended way to use sequences in
defaults in all future releases?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-09-28 16:11:14 Re: unchecked malloc
Previous Message Tom Lane 2005-09-28 16:04:36 Re: Proposed patch for sequence-renaming problems

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-09-28 16:13:38 Re: Proposed patch for sequence-renaming problems
Previous Message Tom Lane 2005-09-28 16:04:36 Re: Proposed patch for sequence-renaming problems