Skip to content

Instantly share code, notes, and snippets.

@fmcgeough
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save fmcgeough/cbb777816d951bf46b45 to your computer and use it in GitHub Desktop.

Select an option

Save fmcgeough/cbb777816d951bf46b45 to your computer and use it in GitHub Desktop.
sql = 'select * from account_status where account_status_id in ($1)'
params = [1, 2]
# obviously wrong. 2 params instead of 1
db.exec_params(sql, params)
# PG::IndeterminateDatatype: ERROR: could not determine data type of parameter $2
params = [[1,2]]
db.exec_params(sql, params)
# PG::InvalidTextRepresentation: ERROR: invalid input syntax for integer: "[1, 2]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment