Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read until EOF in COPY fetcher #4977

Merged
merged 1 commit into from Dec 5, 2022

Commits on Dec 5, 2022

  1. Read until EOF in COPY fetcher

    Ensure the COPY fetcher implementation reads data until EOF with
    `PQgetCopyData()`. Also ensure the malloc'ed copy data is freed with
    `PQfreemem()` if an error is thrown in the processing loop.
    
    Previously, the COPY fetcher didn't read until EOF, and instead
    assumed EOF when the COPY file trailer is received. Since EOF wasn't
    reached, it required terminating the COPY with an extra call to the
    (deprecated) `PQendcopy()` function.
    
    Still, there are cases when a COPY needs to be prematurely terminated,
    for example, when querying with a LIMIT clause. Therefore, distinguish
    between "normal" end (when receiving EOF) and forceful end (cancel the
    ongoing query).
    erimatnor committed Dec 5, 2022
    Copy the full SHA
    e55041e View commit details
    Browse the repository at this point in the history