• Tom Lane's avatar
    Fix COPY FROM for null marker strings that correspond to invalid encoding. · e8476f46
    Tom Lane authored
    The COPY documentation says "COPY FROM matches the input against the null
    string before removing backslashes".  It is therefore reasonable to presume
    that null markers like E'\\0' will work ... and they did, until someone put
    the tests in the wrong order during microoptimization-driven rewrites.
    Since then, we've been failing if the null marker is something that would
    de-escape to an invalidly-encoded string.  Since null markers generally
    need to be something that can't appear in the data, this represents a
    nontrivial loss of functionality; surprising nobody noticed it earlier.
    
    Per report from Jeff Davis.  Backpatch to 8.4 where this got broken.
    e8476f46
copy2.out 7.89 KB