BUG #19455: ALTER TABLE RENAME will rename a sequence
BUG #19455: ALTER TABLE RENAME will rename a sequence
От:
PG Bug reporting form <noreply@postgresql.org>
Дата:
The following bug has been logged on the website:
Bug reference: 19455
Logged by: Bob Sislow
Email address: bsislow@accertify.com
PostgreSQL version: 15.2
Operating system: Red Hat Enterprise Linux release 8.7 (Ootpa)
Description:
Is this expected behavior? ALTER TABLE RENAME will rename a sequence.
postgres=# create sequence test;
CREATE SEQUENCE
postgres=# \ds
List of relations
Schema | Name | Type | Owner
----------+------+----------+----------
dbaadmin | test | sequence | postgres
(1 row)
postgres=# alter table test rename to test2;
ALTER TABLE
postgres=# \ds
List of relations
Schema | Name | Type | Owner
----------+-------+----------+----------
dbaadmin | test2 | sequence | postgres
(1 row)
Re: BUG #19455: ALTER TABLE RENAME will rename a sequence
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
PG Bug reporting form writes: > Is this expected behavior? ALTER TABLE RENAME will rename a sequence. Yes, it is. It'll work on views and (most?) other kinds of relations too. To some extent this is a hangover from before we had the more specialized variants. But it can be handy to not worry too much about just what kind of relation you're renaming, and tightening that up would likely break some applications, so we haven't. regards, tom lane
Re: BUG #19455: ALTER TABLE RENAME will rename a sequence
От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Monday, April 13, 2026, PG Bug reporting form <noreply@postgresql.org> wrote:
The following bug has been logged on the website:
Bug reference: 19455
Logged by: Bob Sislow
Email address: bsislow@accertify.com
PostgreSQL version: 15.2
Operating system: Red Hat Enterprise Linux release 8.7 (Ootpa)
Description:
Is this expected behavior? ALTER TABLE RENAME will rename a sequence.
It’s documented:
Arguably it’s better to use alter sequence so the somewhat buried documentation for this seems ok.
David J.