Re: determine sequence name for a serial

From: "Ed L(dot)" <pgsql(at)bluepolka(dot)net>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: Robby Russell <robby(at)planetargon(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: determine sequence name for a serial
Date: 2004-10-28 23:50:35
Message-ID: 200410281750.36003.pgsql@bluepolka.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday October 28 2004 5:31, Michael Fuhr wrote:
> On Thu, Oct 28, 2004 at 04:51:05PM -0600, Ed L. wrote:
> > But I didn't understand why you care to get rid of the explicit
> > reference to the sequence object in your code in the first place. In
> > PostgreSQL, at least for the past 5 years if not longer, if you create
> > a SERIAL column for (schemaname, tablename, columnname), then your
> > sequence will *always* be "schemaname.tablename_columnname_seq".
>
> Only for certain values of "always." Tables and columns can be renamed,
> so the sequence name might no longer be "tablename_columnname_seq",
> but rather "oldtablename_oldcolumnname_seq".

Your point is well taken, I see the gotcha there, and thus the value of a
function.

Ed

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2004-10-28 23:55:51 Re: determine sequence name for a serial
Previous Message Michael Fuhr 2004-10-28 23:31:35 Re: determine sequence name for a serial