0

我正在使用 nodejs 0.10.12 和最新版本的 node-postgres 模块。我尝试使用准备好的语句,我有类似的东西

var query = client.query(  {text:"insert into controller(c_name) values($1)", values:[ja]});
//ja is a var that contains user input came from the client side

query.on("error", function (error) {
console.log(error)});

query.on("end", function (result) {
console.log(result), client.end()});

我得到以下信息

{[error: permission denied for relation controller]
length: 116,
name: 'error',
severity: 'ERROR',
code: '42501',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
file: '.\\src\\backend\\catalog\\aclchk.c',
line: '3166',
routine: 'aclcheck_error'}
undefined

我承认我是 node 和那个模块的新手,所以我不知道如何解决这个问题。有什么建议/提示吗?

非常感谢

4

1 回答 1

1

传入的字符串是否大于c_name长度?

长度:116,

其次,您会看到code: '42501',这应该是错误代码,您应该在node-postgres项目文档或资源中搜索。

于 2013-07-27T14:43:54.027 回答