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

Cherry-pick: COPY FORM doesn't throw out ERROR: extra data after last expected column (7X) #793

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hyongtao-db
Copy link
Contributor

@hyongtao-db hyongtao-db commented Dec 17, 2024

Long log:
In pg-12, there is no function InitCopyFromDispatchSplit(),
so attr_count must be > 0. But in GP7, we may get [NULL]in
QE when all fields are processed in the QD. So the condition
checking should change from attr_count > 0 to attr_count >= 0.
But before it, attr_count = list_length(attnumlist);,
we can ensure that attr_count >= 0 consistently,
so delete this bug-related condition attr_count > 0.

Due to code refactoring in gp-14, the related code is moved
from copy.c to copyfrom.c, so modify the related code in
copyfrom.c.

hyongtao-db and others added 3 commits December 17, 2024 23:24
…ected column (7X) (#15612)

This commit can fix bug reported in [issue 15625]
(https://github.com/greenplum-db/gpdb/issues/15625)

**Solution:**
In pg12.12, there is no function `InitCopyFromDispatchSplit()`,
so attr_count must be > 0. In GP7, we may get `[NULL]`
in QE when all fields are processed in the QD.
So the condition checking should change
from `attr_count > 0` to `attr_count >= 0`.
But before it, `attr_count = list_length(attnumlist);`,
we can ensure that `attr_count >= 0` consistently,
so delete this bug-related condition `attr_count > 0`.

Signed-off-by: Yongtao Huang <[email protected]>
Co-authored-by: Xiaoxiao He <[email protected]>
Part of copy.c is split into copyfrom.c and copyto.c in PG-14

Signed-off-by: Yongtao Huang <[email protected]>
Commit 5cae067e41e introduces test file under data dir for copy case. That will generate untracked file after regression tests. Untracked files:
```
  (use "git add <file>..." to include in what will be committed)
        src/test/regress/data/copy_no_cols.data

nothing added to commit but untracked files present (use "git add" to track)
```
Move temp date files to reuslts dir to avoid that.
@avamingli
Copy link
Contributor

Critical fix cherry-pick! Your efforts are greatly appreciated.

@avamingli avamingli added the cherry-pick cherry-pick upstream commts label Dec 17, 2024
@hyongtao-db hyongtao-db changed the title Cherry-pick: fix bug of COPY FORM doesn't throw out ERROR: extra data after last expected column (7X) Cherry-pick: COPY FORM doesn't throw out ERROR: extra data after last expected column (7X) Dec 18, 2024
@yjhjstz yjhjstz requested a review from jiaqizho December 26, 2024 08:51
Copy link
Member

@yjhjstz yjhjstz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick cherry-pick upstream commts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants