Hi, i’m trying to change the starting ticket number to a higher number.
I have a RT 4.4.3 brand new installation on a Centos 7 using the Centos installation guide from the wiki.
I’m issuing these commands:
sudo -u postgres psql - to enter the posgres shell and enter the password to authenticate
I’m not a postgres user, but do you not have to select the RT4 database before running the select? Otherwise you’ll be trying to do it in whatever default database postgres has that doesn’t have RT’s ticket_id_seq.
Thanks. The database turned out to be rt4. I got in to the database with \c rt4 command. Then I listed tables in the database with \dt command. The tickets table was in the list. Then I listed all columns of the tickets table with \d tickets command. It showed me the id record which is the ticket number:
I think you misread the result of your queries. The first column is “id”, not " tickets_id_seq". Instead, “tickets_id_seq” is a sequence, that in database jargon is something that establishes which number to assign next.
So if you want to try to set a higher starting number, you should write:
SELECT setval(‘id’, 20800);
Note however that the DBMS may not allow you to do it. I am a database administrator but I have very little experience with postgres unfortunately, so I’m unable to offer you a better solution.
Could you show me step by step exactly what commands you enter to get to the database level and to get to issue this command. Maybe I’m missing something.
psql postgres
psql (10.5)
Type "help" for help.
postgres=# \c rt44
You are now connected to database "rt44" as user "craigkaiser".
rt44=# SELECT setval('tickets_id_seq', 20800);
setval
--------
20800
(1 row)
rt44=#
I want to try what you did here with the psql postgres command but I can’t authenticate. I enter the postgres password I created during the installation and I still get this:
psql: FATAL: password authentication failed for user “root”
But when I issue this command - sudo -u postgres psql
I can authenticate into the postgres with the password I created during installation.
[root@server ~]# su - postgres
Last login: Tue Nov 6 03:07:40 UTC 2018 on pts/0
Last failed login: Thu Nov 8 04:34:44 UTC 2018 from www.now-gmbh.de on ssh:notty
There were 30 failed login attempts since the last successful login.
-bash-4.2$
-bash-4.2$ psql
Password:
psql (9.2.24)
Type “help” for help.
postgres=# \c rt4
You are now connected to database “rt4” as user “postgres”.
rt4=# SELECT setval(‘tickets_id_seq’, 20800);
setval
20800
(1 row)
It worked that way.
Thank you guys for all your help. I really appreciate it and hope this can be useful for someone else.
Sorry if I posted misleading information. Looking at the error message (" ERROR: column “‘tickets_id_seq’” does not exist") I thought that that command had to be run against the column, not the sequence itself.
Thank you for sharing your solution to the problem!