We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am using node-postgress version 0.6.2 When I am running the following query
await pool.query( 'SELECT id, email from user where name = $1', ['jone'], );
I am getting this error
Error [ERR_UNHANDLED_ERROR]: Unhandled error. (Message { name: 'error', message: 'there is no parameter $1', severity: 'ERROR', code: '42P02', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: '/home/ec2-user/padb/src/pg/src/backend/parser/parse_expr.c', line: '477', routine: 'transformExpr' })
However, If I run the same query with this format it works as expected
await pool.query( SELECT id, email from user where name = '${username}' );
SELECT id, email from user where name = '${username}'
NodeJs version is v14.17.3
The text was updated successfully, but these errors were encountered:
This repository does not support Parameterized query.
You can use the best library(9.9k star +): https://github.com/brianc/node-postgres
docs: https://node-postgres.com/
const { Client } = require('pg') const client = new Client() await client.connect() const res = await client.query('SELECT $1::text as message', ['Hello world!']) console.log(res.rows[0].message) // Hello world! await client.end()
Sorry, something went wrong.
No branches or pull requests
I am using node-postgress version 0.6.2
When I am running the following query
await pool.query(
'SELECT id, email from user where name = $1',
['jone'],
);
I am getting this error
Error [ERR_UNHANDLED_ERROR]: Unhandled error. (Message {
name: 'error',
message: 'there is no parameter $1',
severity: 'ERROR',
code: '42P02',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: '/home/ec2-user/padb/src/pg/src/backend/parser/parse_expr.c',
line: '477',
routine: 'transformExpr'
})
However, If I run the same query with this format it works as expected
await pool.query(
SELECT id, email from user where name = '${username}'
);
NodeJs version is v14.17.3
The text was updated successfully, but these errors were encountered: