Skip to content

lib/pg assumes that all queries that start with "copy" (case-insensitive) are special bulk import queries #530

@flgr

Description

@flgr

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:

pq/conn.go

Line 768 in ae8357d

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions