Postgresql – SequelizeDatabaseError While Upserting, Wrong Table Being Referenced

postgresqlupsert

I'm selecting from a table, and the query runs fine. It even shows up on the client side without a hitch.

`
SELECT * FROM public."roleAllocation"
`

However, when I run an upsert function from a query that pulls data from other tables in the db, it throws a Sequelize error.

 SequelizeDatabaseError: relation "roleAllocations" does not exist

I've tried to find any spelling errors, no luck. From what I've found online it's said to be a trigger in the database that might be changing the name of the table. There seems to be no triggers in the database.

PostgreSQL@9.5.13

Best Answer

So from further searching I was able to solve this issue by adding a...

freezeTableName: true

value to the model file for the table.