0

I'm using nodejs 0.10.12 and the latest version of node-postgres module. I try to use prepared statements, I have something like

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()});

And I get the following

{[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

I admit I am a newcomer to node and that module, so I have no idea how to fix this. Any suggestions/hints?

Thank you very much

1 Answer 1

1

Is incoming string bigger than c_name length?

length: 116,

Secondly you see code: '42501', that should be error code, that you should search for in node-postgres project documentation or sources.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.