dockyard/postgres_ext — pull request #32 by skandragon (2012-10-30 16:13:00+00:00)
Title: String encoding fix, part 2

PostgreSQL requires a very special string encoding in the literal array syntax. This patch fixes that in the "update" case, but does not fix the problem with array_overlap() generating bad SQL.

I've run out of time today to work on this, but I've given Dan access to my fork, so if he can figure out why this:

u = User.where(arel[:nick_names].array_overlap(["s'o{m}e"]))

generates this SQL:

: SELECT "users".* FROM "users" WHERE ("users"."nick_names" && '{"s""o{m}e"}') LIMIT 1

(and ideally why I need to gsub '\\' to '\\\\\\\\' -- yes, that's eight slashes -- I'd be thrilled)