How to Change Sequence Name Parameter After Renaming Sequence – PostgreSQL

postgresqlpostgresql-9.6sequence

I have renamed a sequence with the following command:

ALTER SEQUENCE TableIdSeq RENAME TO NewTableIdSeq;

however, when I issue the \d NewTableIdSeq command, I get the following output:

       Sequence "dev.newtableidseq"
    Column     |  Type   |        Value
---------------+---------+---------------------
 sequence_name | name    | tableidseq            <--------------- HASN'T CHANGED!!
 last_value    | bigint  | 3
 start_value   | bigint  | 1
 increment_by  | bigint  | 1
 max_value     | bigint  | 9223372036854775807
 min_value     | bigint  | 1
 cache_value   | bigint  | 1
 log_cnt       | bigint  | 30
 is_cycled     | boolean | f
 is_called     | boolean | t

As you can see, the sequence_name property of the sequence is still set to the old name. How can I change the name here as well?

Best Answer

Don’t worry about it. The sequence name stored inside the sequence is ignored. This field is gone in PostgreSQL 10.