Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have following node.js + express code which is inserting data into postgres.

app.post('/register', function(request, response) {
    pg.connect(connString, function(err, client, done) {
        if(err) response.send("Could not connect to DB: " + err);
        client.query('INSER INTO clients (client_id, params) VALUES ($1, $2)',
            [request.query.client_id, request.query.params], 
            function(err, result) {
                done();
                if(err) return response.send(err);
                response.send('OK');
        });
    });
});

The table structure is:

CREATE TABLE clients
(
client_id character varying NOT NULL,
params character varying[] NOT NULL,
id integer NOT NULL DEFAULT nextval('clients_id_seq1'::regclass),
CONSTRAINT clients_pkey PRIMARY KEY (id)
)

If I do a plain SELECT it works well. However on INSERT I get this HTTP 200 response:

{
 "name": "error",
 "length": 86,
 "severity": "ERROR",
 "code": "42601",
 "position": "1",
 "file": "scan.l",
 "line": "1044",
 "routine": "scanner_yyerror"
}

This error does not say too much for me.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You have INSER rather than INSERT in your query.

share|improve this answer
1  
This is in line with 42601 SYNTAX ERROR syntax_error. –  Farce Dec 18 '13 at 23:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.