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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-general by date

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