Skip site navigation (1) Skip section navigation (2)

Re: renaming sequences ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jonathan Vanasco <postgres(at)2xlp(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: renaming sequences ?
Date: 2008-05-27 02:19:19
Message-ID: 19595.1211854759@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-general
Jonathan Vanasco <postgres(at)2xlp(dot)com> writes:
> I keep running into this bug:
> 	http://archives.postgresql.org/pgsql-bugs/2007-09/msg00092.php

> Where "ALTER TABLE/SEQUENCE RENAME TO ____" will rename the sequence,  
> but the 'sequence_name' attribute in 'select * from sequence' and (i  
> believe) the pg catalog info will keep the original name

> this creates an issue with most ORM software under python, perl, php  
> which will pull the old sequence name.

The short answer is that any such software is broken and should be
fixed.  The sequence_name in a sequence is a historical artifact and
can't be relied on, for exactly the reason that it doesn't update
during a rename.  It's more likely that we'd remove the field than
that we'd fix this behavior --- it's not readily fixable because
there's no way to do transactional updates on the fields of a sequence.

			regards, tom lane

In response to

pgsql-general by date

Next:From: markDate: 2008-05-27 02:58:51
Subject: Re: select query takes 13 seconds to run with index
Previous:From: Mark NeelyDate: 2008-05-27 02:18:57
Subject: Open Source CRM - Options?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group