首页 > 解决方案 > Sequelize.query not woking:错误:关系不存在

问题描述

我想从我的数据库中的表中执行选择查询。我很确定我的连接是正确的,因为我可以查询 showAllSchema()。

这是我的代码:

const sequelize = new Sequelize(database address,
 {
  logging: false,
  pool: {
  max: 3,
  },
});
  sequelize.query('Select * from "order"',{ type: sequelize.QueryTypes.SELECT 
  }).then((tableObj) => {
console.log('// Tables in database','==========================');
console.log(tableObj);
})
 .catch((err) => {
console.log('showAllSchemas ERROR',err);
 })

但是错误说:原始:错误:关系“订单”不存在

请帮我。先感谢您。

标签: postgresqlsequelize.js

解决方案


推荐阅读