Skip to content

Instantly share code, notes, and snippets.

@ststeiger
Created August 13, 2015 14:52
Show Gist options
  • Select an option

  • Save ststeiger/c3285bffb2097ab0623a to your computer and use it in GitHub Desktop.

Select an option

Save ststeiger/c3285bffb2097ab0623a to your computer and use it in GitHub Desktop.
Arrays as Parameters in pgSQL
SELECT * FROM some_table WHERE id_column = ANY(@id_list)
-- where @id_list is bound to an int[] parameter by way of
SELECT * FROM some_table WHERE id_column = ANY(@id_list);
-- Code:
command.Parameters.Add("@id_list", NpgsqlDbType.Array | NpgsqlDbType.Integer).Value = my_id_list;
where command is a NpgsqlCommand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment