I'm working in Rails, ActiveRecord, and Postgresql, and am attempting to sanitize a SQL statement that executes a stored procedure:
query =<<-SQL
SELECT *
FROM #{stored_procedure_name}
(
#{param_1},
#{param_2}
)
SQL
The above statement works when executed. From what I understand, the stored procedure should be sanitized at the database layer because of parametrization (due to the way I defined the function). However, how can I sanitize the query
above? I tried ActiveRecord's sanitize
methods to no avail by using something like
statement =<<-SQL
SELECT * FROM ? (?, ?)
SQL
and then passing the parameters in, but this didn't work - and seems silly.