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: EXPORT/IMPORT does not roundtrip arrays properly #33429

Closed
knz opened this issue Jan 2, 2019 · 1 comment · Fixed by #44464
Closed

importccl: EXPORT/IMPORT does not roundtrip arrays properly #33429

knz opened this issue Jan 2, 2019 · 1 comment · Fixed by #44464
Labels
A-disaster-recovery C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.

Comments

@knz
Copy link
Contributor

knz commented Jan 2, 2019

> export into csv 'nodelocal:///foo.csv' from select array['a','b','c'];
  filename | rows | bytes
+----------+------+-------+
  n1.0.csv |    1 |    15
(1 row)


> import table zc(x text[]) csv data ('nodelocal:///foo.csv');
pq: "nodelocal:///foo.csv": row 1: parse "x" as STRING[]: array must be enclosed in { and }:
@knz knz added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption. A-disaster-recovery labels Jan 2, 2019
@knz
Copy link
Contributor Author

knz commented Jan 2, 2019

cc @mjibson

craig bot pushed a commit that referenced this issue Jan 2, 2019
33430: sql: clarify and document formatting flags r=knz a=knz

Informs  #33429.

- `fmtUnicodeStrings` -> `fmtRawStrings` (nothing unicode about them)
- `FmtParseDatums` -> `FmtExport` (to clarify away from FmtParsable)
- separate `FmtExport` and `FmtArrayToString` - these are two
  independent concepts, even if they currently happen to share an
  implementation. Chances are FmtExport will evolve away.

Release note: None

Co-authored-by: Raphael 'kena' Poss <[email protected]>
rohany added a commit to rohany/cockroach that referenced this issue Jan 27, 2020
Part of work for cockroachdb#44322.

Fixes cockroachdb#33429.

Release note (enterprise change): This PR fixes a bug where
export/import could not round trip arrays correctly.
rohany added a commit to rohany/cockroach that referenced this issue Jan 27, 2020
Part of work for cockroachdb#44322.

Fixes cockroachdb#33429.

Release note (enterprise change): This PR fixes a bug where
export/import could not round trip arrays correctly.
craig bot pushed a commit that referenced this issue Feb 5, 2020
44464: sqlbase: add round-trippable export and parsing for arrays and collated strings r=knz a=rohany

Work for #44322.
Fixes #33429.
Fixes #44414.
Closes #44669.

This PR adds support for ARRAY's and collated strings to be dumped with the
`tree.FmtExport` flag, which dumps datums in a string format that can be
round-tripped with `sqlbase.ParseDatumStringAs`.

This PR additionally performs some code cleanup and renaming
around various parsing functions within the `tree` package.
In particular, this PR removes the function `tree.ParseStringAs` which
was confusingly used sometimes instead of `sqlbase.ParseDatumStringAs`
due to it's handling of raw bytes. Instead, we introduce a new function
`sqlbase.ParseDatumStringAsWithRawBytes` to be more explicit about when
to use one parsing function over the other.

Release note (bug fix): This PR fixes bugs around `cockroach dump` and
`IMPORT`/`EXPORT` where columns of arrays or collated strings would
not be able to be roundtripped from cockroach to the dump and back to cockroach.

Co-authored-by: Rohan Yadav <[email protected]>
@craig craig bot closed this as completed in dbfd995 Feb 5, 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. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.
Projects
None yet
1 participant