lib/pg special cases queries starting with "copy" (case-insensitive) to a code path for bulk imports from passed in data. That's nice and all, but unfortunately it has a false positive.
RedShift (pg-compatible, mostly) has a special statement "copy" that is used to bulk import data from S3 and stuff (http://docs.aws.amazon.com/redshift/latest/dg/r_COPY.html)
Unfortunately such copy statements will end up in the wrong code path in lib/pg:
|
if len(q) >= 4 && strings.EqualFold(q[:4], "COPY") { |
I think you could either use invalid syntax such as "copy" to do this, or use a magic inline comment in the query, e.g. "/ bulk */copy".
My work around until this is fixed upstream is prefixing RedShift copy queries with a space...