Re: Renaming sequences

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Mike Dewhirst <miked(at)dewhirst(dot)com(dot)au>
Cc: Zahid Rahman <zahidr1000(at)gmail(dot)com>, pgsql-novice(at)lists(dot)postgresql(dot)org
Subject: Re: Renaming sequences
Date: 2019-12-18 11:34:31
Message-ID: 20191218113431.GA11607@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 2019-Dec-18, Mike Dewhirst wrote:

> On 18/12/2019 5:03 pm, Zahid Rahman wrote:
> >
> > If you are referring to a sequence which meets the same definition
> > below. That is to say a persistent number generator.
> >
> > Surely by  changing  the sequence name then any  code using that
> > sequence by name will fail. That's from an application developer's view.
>
> Yes.
>
> I think I'd better ask on the Django users list.
>
> The fact that it is working with mismatched names probably means it would
> stop working if I adjusted them. Django probably reads the migration record
> to establish which sequence to use.

I don't know django, but it's certainly possible that it's obtaining the
sequence name from the Postgres catalogs, not from its own migration
record; there's introspection facilities in Postgres for that. I would
be surprised if it breaks just because you rename a sequence whose name
does not appear directly in its database definition.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Zahid Rahman 2019-12-18 13:03:26 Re: Re[2]: Health warning:
Previous Message Sanjay 2019-12-18 10:41:01 Re[2]: Health warning: