I am using pg-promise
to execute select query with like clause in PostgreSQL. Unfortunately the query is failing with error code as 08P01
and error message
bind message supplies 1 parameters, but prepared statement "" requires 0
The query is as follows
select user_name, user_id from users where user_name like '$1#%'
I am using Parameterized query as
var userQuery:pgp.ParameterizedQuery = new pgp.ParameterizedQuery("<above_query>", [userName]);
The API used for executing query is
each(query:TQuery, values:any, cb:(row:any, index:number, data:Array<any>)=>void, thisArg?:any):XPromise<Array<any>>;
I looked at the pg-promise examples but it ain't using LIKE clause with Parameterized Query.
Environment Details are
pg-promise: 4.3.2
PostgreSQL: 9.6
Node: 5.7.1
UPDATE: 1
I am able to run the query using query
API (plain text sql) but not with each
. Can anyone please explain why the LIKE clause is failing with each
while using Parameterized
API.