Re: error: there is no parameter $1

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: error: there is no parameter $1
Дата
Msg-id 1382042757907-5774955.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: error: there is no parameter $1  (Kinnard Hockenhull <kinnard@bitbox.mx>)
Список pgsql-novice
Kinnard Hockenhull wrote
>    var r = [];
>>
>>   for (g in req.body)
>>   {
>>     r[g]=req.body[g];
>>     console.log('r[g] is ' + r[g]);
>>   }
>>
>>   client = pg.connect(connectionString, function(err, client, done){
>>     if(err) console.log(err);
>>     client.query('INSERT INTO causes (cause_name, goal, organization,
>> sponsor, submitter) VALUES ($1,$2,$3,$4,$5)', r, function(err){
>>       console.log('This is r' + r)
>>       if (err) console.log(err);
>>     });
>>   });
>> });
>>
>> Is this a scope issue? I tried passing r into pg.connect, that didn't
>> work.
>>

Apparently not many Node.js users on these lists...

Since you are logging lots of stuff to the console you should provide that
information as well.  The client.query(...) code looks correct syntactically
but if "r" does not have exactly (at least?) 5 values in the array the query
execution will fail.  You have not shown us what is in "r" at the time
client.query(...) is executed.

David J.



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/error-there-is-no-parameter-1-tp5774552p5774955.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


В списке pgsql-novice по дате отправления:

Предыдущее
От: Kinnard Hockenhull
Дата:
Сообщение: Re: error: there is no parameter $1
Следующее
От: Erin Jonaitis
Дата:
Сообщение: Restoring from SQL dump