Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

postgress-node error: bind message supplies 1 parameters, but prepared statement "" requires 0

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading