Reputation: 1684
I would like to change the name of my sequence I use. I tried those two options and failed:
ALTER TABLE PLAYER RENAME id_seq_player TO player_id_seq;
and
ALTER SEQUENCE id_seq_player RENAME TO player_id_seq;
I looked at the official documentation and from there I created those two SQL, but none of them worked. The first solution resulted in a SQL error and the second had a time out.
Here is the SQL error I get:
ERROR: column "id_seq_player" does not exist
********** Error **********
* UPDATE *
Seems like the second SQL statement did the job. Since I have to forward the port, maybe it was an issue with the connection or OpenShift. But now I retried several times to verify and it works.
ALTER SEQUENCE id_seq_player RENAME TO player_id_seq; /* Works */
Upvotes: 35
Views: 27719
Reputation: 2375
Try this:
ALTER TABLE id_seq_player RENAME TO player_id_seq;
Upvotes: 6
Reputation: 1864
ALTER SEQUENCE id_seq_player RENAME TO player_id_seq;
is correct. You might want to add the schema name as well to ensure you are altering the correct one, but this should most likely work.
If it timeouts, you might have another process that is locking your sequence. Is there a way for you to turn off all the other database users, or is it too critical to do so?
Upvotes: 70
Reputation: 48197
Dont know the command line but you can change it on the pgAdmin
I just add 1
to my sequence and change it back.
Upvotes: 0