Home > Mobile >  postgress-node error: bind message supplies 1 parameters, but prepared statement "" requir
postgress-node error: bind message supplies 1 parameters, but prepared statement "" requir

Time:05-12

I'm doing a simple request to a database and trying to retrieve all the table data. However, i get this error: error: bind message supplies 1 parameters, but prepared statement "" requires 0

const { Client } = require('pg');

const client = new Client({
    //connection details
});

const query = async() => {
    await client.connect();
    const result = await client.query("SELECT * FROM asites", [1]);
    console.log(result.rows);
    client.end();
}

query();

Any help is greatly appreciated.

CodePudding user response:

After SELECT why do you have that part: ", [1]"? This is probablty the error as you don't provide a bind in the statement.

  • Related