pgsql:equery error with parse $n。Error:42601。 #29

zhangwz opened this Issue Apr 26, 2013 · 1 comment

2 participants


pgsql:equery(C,"select * from $1",["a_new_table_name"]).
<<"syntax error at or near \"$1\"">>,

but this is ok.

pgsql:equery(C,"select * from a_new_table_name;",[]).

wg commented Apr 26, 2013

Hello, I don't believe PostgreSQL supports passing table names as parameters to a parameterized query. PostgreSQL is pretty strict about where parameters are allowed, so for these sort of queries you'll need to do your own formatting and proper escaping.

@wg wg closed this Apr 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment