dwyl / hapi-postgres-connection

:zap: Creates a PostgreSQL Connection (Pool) available anywhere in your Hapi App
GNU General Public License v2.0
40 stars 13 forks source link

Prepared Statement In ORDER BY Clause Doesn't Work #25

Closed Kuchiriel closed 7 years ago

Kuchiriel commented 7 years ago

Hello fellow coders (:

Sorry if I am submitting it to the wrong repository, since this project uses node-postgres.

This is my query

 request.pg.client.query({
    text: `select  
    email,
    name,
    role,   
    place  
    from users
    order by $1 desc`,
    values: [request.query.sort]
  }, (err, result) => {

request.query.sort defaults to 'name', but doesn't work.

image

Is this an issue or am I doing something wrong?

Thanks in advance!

Kuchiriel commented 7 years ago

Solved https://github.com/brianc/node-postgres/issues/1284