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

importccl: IMPORT PGDUMP could fail when the targeted columns are ordered differently than when they are created #51159

Closed
Anzoteh96 opened this issue Jul 8, 2020 · 0 comments · Fixed by #51065
Assignees
Labels
A-disaster-recovery C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Comments

@Anzoteh96
Copy link

Anzoteh96 commented Jul 8, 2020

When running an IMPORT from a PGDUMP file, it seems like it expects the ordering of the targeted columns to match the declaration of the columns. In particular, it also requires all columns to be targeted.

To illustrate this, let's consider the following pgdump file called myfile:

A,1
B,2

Take an example of the following command:

CREATE TABLE t (a INT, b STRING)
IMPORT INTO t (b, a) PGDUMP DATA ("myfile")

It gives an error row 1: cannot parse "A" as int when we expect it to return the table

a   b
---+---
1 | A
2 | B

Take another example independent of the example above, but still using "myfile":

CREATE TABLE t (a STRING, b INT, c INT)
IMPORT INTO t (a, b) PGDUMP DATA ("myfile")

This gives error expected 3 values, got 2 ["A", "1"], when we expect the following:

a   b   c
---+---+---
A | 1 | NULL
B | 2 | NULL

This will therefore cause problems when we perform import on a table from PGDUMP file when there's non-targeted columns with default expressions.

@Anzoteh96 Anzoteh96 added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. A-disaster-recovery labels Jul 8, 2020
@Anzoteh96 Anzoteh96 self-assigned this Jul 8, 2020
@craig craig bot closed this as completed in ba2deac Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-disaster-recovery C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant