In PostgreSQL, is it possible to parameterize the table name used in a query?
Think of parameters as a replacement for scalar values only. Use one parameter in the place where you could use one string literal or numeric literal.
You cannot use parameters for other parts of an SQL query:
IN (...)
predicate. Each value in the list would need an individual parameter. All those parts of the SQL query must be fixed by the time the query is parsed during prepare()
. If a client library supports "parameters" for identifiers, it's really doing string-interpolation into the SQL query before the query is parsed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.