Re: Renaming sequences - Mailing list pgsql-novice

From Alvaro Herrera
Subject Re: Renaming sequences
Date
Msg-id 20191218113431.GA11607@alvherre.pgsql
Whole thread Raw
In response to Re: Renaming sequences  (Mike Dewhirst <miked@dewhirst.com.au>)
List 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



pgsql-novice by date:

Previous
From: Sanjay
Date:
Subject: Re[2]: Health warning:
Next
From: Zahid Rahman
Date:
Subject: Re: Re[2]: Health warning: