-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Here's my code:
contacts.publish('contact', function(){ return contacts.select('id', 'firstname', 'lastname') .where('id != ?', 1) .order('firstname DESC') .limit(100); });
The query sent to postgres from my app is:
SELECT id, firstname, lastname FROM contact WHERE id != $1 ORDER BY firstname DESC LIMIT 100;
But postgres says:
ERROR: there is no parameter $1 at character 58
If I recode as follows:
contacts.publish('contact', function(){ return contacts.select('id', 'firstname', 'lastname') .where("id != '1'") .order('firstname DESC') .limit(100); });
I get:
ERROR: syntax error at or near "$1" at character 54 SELECT id, firstname, lastname FROM contact WHERE $0$1id != '1' ORDER BY firstname DESC LIMIT 100;
What's up with the positionals, they are inserted deliberately but postgres doesn't like them. I must be missing something