Using PostgreSQL's parameterized query form, this works: R> dbSendQuery(CONN, "SELECT * FROM foo WHERE val = $1 OR val = $2", list("bar", "baz"))
... and becomes: SELECT * FROM foo WHERE val = 'bar' OR val = 'baz'; I cannot figure out, however, if something like this is possible with RPostgreSQL: R> dbSendQuery(CONN, "SELECT * FROM foo WHERE val IN ($1)", list(c("bar", "baz"))) ... which becomes: SELECT * FROM foo WHERE val IN ('bar', 'baz'); (To be clear, the dbSendQuery attempt above does _not_ work.) Anyone know if this is doable with RPostgreSQL? I can construct the statement with sprintf/paste, but I'd prefer to use properly-parameterized queries if possible (relying on PostgreSQL to do the type conversions safely). I've also, BTW, tried using DBI's basic ANSI functionality, like so: R> sqlInterpolate(ANSI(), "SELECT * FROM foo WHERE name IN (?names)", names = c("foo", "bar")) ... but this also doesn't work :-/ -Murat ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.