Fix array quote escaping

Porting correct escaping of single quotes in arrays from AR (see https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb#L36)

Failure of modified test before patch:

    Error: test_strings_with_quotes(PostgreSQLArrayTypeTest)
      ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: org.postgresql.util.PSQLException: ERROR: syntax error at or near "s"
        Position: 99: INSERT INTO "pg_arrays" ("tags") VALUES ('{"this has","some \"s that need to be escaped\"","some 's that need to be escaped too"}') RETURNING "id"