I use Sequelize.js and follow this post to update primary key value.
I run:
await sequelize.query(`SELECT SETVAL('${idSeqence}', max(id)) FROM "${tableName}";`)
but error message says:
error: relation "my_bottemplates_id_seq" does not exist
sql: `SELECT SETVAL('my_botTemplates_id_seq', max(id)) FROM "myBotTemplates";
Then I follow this post to try to replace double quotes
First try:
await sequelize.query(`SELECT SETVAL(trim(both '"' from '"${idSeqence}"'), max(id)) FROM "${tableName}";`)
but I got the same error message again:
error: relation "my_bottemplates_id_seq" does not exist
sql: `SELECT SETVAL(trim(both '"' from '"my_botTemplates_id_seq"'), max(id)) FROM "myBotTemplates";`
Second try:
await sequelize.query(`SELECT SETVAL(replace('${idSeqence}', ", '), max(id)) FROM "${tableName}";`)
This error message says:
error: syntax error at or near "myBotTemplates"
sql: `SELECT SETVAL(replace('my_botTemplates_id_seq', ", '), max(id)) FROM "myBotTemplates";`
Is there any method to run the SETVAL to update primary key value successfully?