Try inserting data again to make sure everything’s working properly. Public | Sessions | table | herokupgdbowner Public | SequelizeMeta | table | herokupgdbowner Public | TableNameThree_id_seq | sequence | herokupgdbowner Public | TableNameThree | table | herokupgdbowner Public | TableNameTwo_id_seq | sequence | herokupgdbowner Public | TableNameTwo | table | herokupgdbowner Public | TableName_id_seq | sequence | herokupgdbowner Public | TableName | table | herokupgdbowner You can use the \d command to see a list of all of your tables and sequences to make sure you don’t miss any: DATABASE=> \d You may have more than one table that uses an auto-incremented id, and will need to do the above more than once. Re-check the sequence next value to confirm it worked: DATABASE=> SELECT nextval( '"TableName_id_seq"') Reset the value: DATABASE=> SELECT setval(pg_get_serial_sequence( '"TableName"', 'id'), max(id)) FROM "TableName" It’s then surrounded by single quotes for the nextval() query. The table name always needs to have double quotes around it. Take note of the single and double quotes around the table name. In this case, the next value should be 608! …and compare this to the next value in the sequence: DATABASE=> SELECT nextval( '"TableName_id_seq"') To see if sequencing is actually the problem, you can check the current maximum id: DATABASE=> SELECT MAX(id) FROM "TableName"
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |