Skip to content
New issue

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

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

Already on GitHub? # to your account

Use 'SHOW CREATE ALL TABLES' instead of cockroach dump #44

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

Conversation

adammohammed
Copy link

In CRDB v21.2 and newer cockroach dump is removed and the docs say to use SHOW CREATE ALL TABLES. This isn't quite a drop in replacement since it dumps some other non-sql information out.

This PR builds off of #41 and filters out the non-sql bits so that the generated tests still work.

Should fix #43 - but not sure if this is backwards compatible with previous CRDB releases.

@adammohammed adammohammed changed the title Support for v21.2 and newer Use 'SHOW CREATE ALL TABLES' instead of cockroach dump Jun 7, 2022
@adammohammed adammohammed force-pushed the support-for-v21.2-and-newer branch from c0ab29f to 9a38a11 Compare June 7, 2022 16:50
@glerchundi
Copy link
Owner

glerchundi commented Jun 11, 2022

LGTM, please rebase on top of master as it already includes the fix proposed in #41.

Thanks for the contribution, once rebased I will review ASAP.

@adammohammed adammohammed force-pushed the support-for-v21.2-and-newer branch from 9a38a11 to 2791dc9 Compare June 13, 2022 14:21
@adammohammed
Copy link
Author

@glerchundi Do you have time to take another pass at this?

all = bytes.Replace(all, []byte("create_statement"), []byte{}, -1)
all = bytes.Replace(all, []byte("\"CREATE"), []byte("CREATE"), -1)
all = bytes.Replace(all, []byte(";\""), []byte(";"), -1)
f.buf = bytes.NewBuffer(all)
Copy link

Choose a reason for hiding this comment

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

I had issues with DOUBLE DOUBLE QUOTES.
To fix, I had to replace "" with ", like this:

    all = bytes.Replace(all, []byte("\"\""), []byte("\""), -1)

In CRDB v21.2 and newer `cockroach dump` is removed and the docs say
to use `SHOW CREATE ALL TABLES`. This isn't quite a drop in
replacement since it dumps some other non-sql information out.

Signed-off-by: Adam Mohammed <admohammed@equinix.com>
Signed-off-by: Adam Mohammed <admohammed@equinix.com>
Signed-off-by: Adam Mohammed <admohammed@equinix.com>
@adammohammed adammohammed force-pushed the support-for-v21.2-and-newer branch from 2791dc9 to dffb9a3 Compare February 21, 2023 15:54
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cockroach CLI dropped support for dump used in tests
3 participants