Closed AcerLaurinum closed 4 years ago
Thanks for the compliment! I can not reproduce this error i.e. can not get missing value error for that query and parameters. Can you provide more details / stack to see what is happening?
My bad, that example does work fine. Here is corrected version that I just tested and can reproduce the error with.
pg.query(named('SELECT :userid::integer as "User:Id"')({userid: 5}), (err, result) => {...})
The error I get is,
Error: Missing value for statement.
Id not provided for statement:
SELECT :userid::integer as "User:Id"
at errorMissingValue (/project/node_modules/yesql/yesql.js:79:9)
at part.replace (/project/node_modules/yesql/yesql.js:46:22)
at String.replace (<anonymous>)
at query.split.map.part (/project/node_modules/yesql/yesql.js:36:23)
at Array.map (<anonymous>)
at /project/node_modules/yesql/yesql.js:32:8
at query (/project/query.js:51:20)
at process._tickCallback (internal/process/next_tick.js:178:7)
Thanks for the update. There was a bug concerning double quotes with a colon. This is now fixed in latest version (4.1.3). Thanks again for finding this!
Thanks for making such an awesome library! I'm using yesql 4.2.1 and am trying to run a query with a colon in a "Select As" but get a missing value error. For example,
pg.query(named('SELECT :usercount AS "Number of users: ";')({usercount: 5}), (err, result) => {...})
Not sure if this is a bug or I need to be escaping the colon somehow. Thank you!