Javascript 错误:整数类型的输入语法无效
我正在使用postgresql数据库。在通过ExpressAPI将数据插入表时,我遇到了这个错误“integer类型的输入语法无效”,但在pgAdmin中成功运行了相同的查询Javascript 错误:整数类型的输入语法无效,javascript,postgresql,express,Javascript,Postgresql,Express,我正在使用postgresql数据库。在通过ExpressAPI将数据插入表时,我遇到了这个错误“integer类型的输入语法无效”,但在pgAdmin中成功运行了相同的查询 const file = require('../../Pool'); const pool = file.pool; const createClass= (req,res)=>{ pool.query("insert into classes(class_name,school_id) va
const file = require('../../Pool');
const pool = file.pool;
const createClass= (req,res)=>{
pool.query("insert into classes(class_name,school_id) values ( 'ICS' , (select id from schools where admin_id = 1))",[className,adminId],
(err,result)=>{
if(err){
console.log('err');
throw err
}
res.status(200).send({"isCreated":true})
}
)
}
module.exports = {
createClass
}
请显示整个错误消息,包括显示引发错误的值的部分。同时,我猜您传递了一个空字符串,例如
select''::integer;错误:整数类型的输入语法无效:“第1行:选择“”::整数代码>感谢您的回复。问题在于我的路由模式。请显示整个错误消息,包括显示引发错误的值的部分。同时,我猜您传递了一个空字符串,例如select''::integer;错误:整数类型的输入语法无效:“第1行:选择“”::整数代码>感谢您的回复。问题在于我的路由模式。