Fix PostgreSQL requiring an explicit cast when using int or double precision arrays

Values should be casted to the correct database type before sending them to the DB, without the cast, PostgreSQL will ask for explicit cast, because a str is used instead of an int or float.

The patch handles int, text and double precision arrays, some tests were added.