Skip to content

cli,sql: add another crutch to the handling of column types in dump#28949

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
knz:20180822-c8-unbreak-dump
Aug 23, 2018
Merged

cli,sql: add another crutch to the handling of column types in dump#28949
craig[bot] merged 1 commit intocockroachdb:masterfrom
knz:20180822-c8-unbreak-dump

Conversation

@knz
Copy link
Copy Markdown
Contributor

@knz knz commented Aug 22, 2018

All commits but the last part of #28945 and priors.
PR forked from #28690.

There are major problems in cockroach dump described separately in
#28948. Part of this is cockroach dump trying to reverse-engineer a datum
type from the announced column type in information_schema.columns,
by parsing the type name. Prior to this patch, this parsing was
incomplete (it went out of sync with the SQL parser over time,
naturally as it was bound to do).

This entire approach is flawed, but this is no time to redesign
cockroach dump. Instead, this patch re-syncs the dump-specific type
parser with the general SQL parser. It also ensures this parser is
still able to parse pre-2.1 type name aliases.

Release note (bug fix): cockroach dump is now again better able to
operate across multiple CockroachDB versions.

@knz knz requested a review from a team as a code owner August 22, 2018 10:15
@knz knz requested review from a team August 22, 2018 10:15
@knz knz requested a review from a team as a code owner August 22, 2018 10:15
@knz knz requested review from a team August 22, 2018 10:15
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@knz knz force-pushed the 20180822-c8-unbreak-dump branch 2 times, most recently from 494737e to 0d3bec1 Compare August 22, 2018 10:25
@knz knz force-pushed the 20180822-c8-unbreak-dump branch from 0d3bec1 to e4f172f Compare August 22, 2018 15:39
pkg/cli/dump.go Outdated
strings.HasPrefix(md.columnTypes[cols[si]], "TEXT") ||
strings.HasPrefix(md.columnTypes[cols[si]], "CHAR") ||
strings.HasPrefix(md.columnTypes[cols[si]], "VARCHAR") ||
strings.HasPrefix(md.columnTypes[cols[si]], `"char"`) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs to be upper and lower cased?

Copy link
Copy Markdown
Member

@BramGruneir BramGruneir left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r1, 1 of 1 files at r2, 18 of 18 files at r3, 2 of 2 files at r4, 7 of 7 files at r5, 3 of 3 files at r6.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained


pkg/cli/dump.go, line 700 at r6 (raw file):

}

// parseArrayElementTypeString returns a column type given a string

Moving this from tree/parse_array to here seems wrong.

It really should interface with the parser. Can that be done easily?

@knz knz force-pushed the 20180822-c8-unbreak-dump branch from e4f172f to 771adc6 Compare August 23, 2018 10:10
There are major problems in `cockroach dump` described separately in
cockroachdb#28948.

Part of this is `cockroach dump` trying to reverse-engineering a datum
type from the announced column type in `information_schema.columns`,
by parsing the type name. Prior to this patch, this parsing was
incomplete (it went out of sync with the SQL parser over time,
naturally as it was bound to do).

This entire approach is flawed, but this is no time to redesign
`cockroach dump`. Instead, this patch re-syncs the dump-specific type
parser with the general SQL parser.

Release note (bug fix): `cockroach dump` is now again better able to
operate across multiple CockroachDB versions.
@knz knz force-pushed the 20180822-c8-unbreak-dump branch from 771adc6 to 2363d44 Compare August 23, 2018 10:10
Copy link
Copy Markdown
Contributor Author

@knz knz left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained


pkg/cli/dump.go, line 642 at r6 (raw file):

Previously, mjibson (Matt Jibson) wrote…

This needs to be upper and lower cased?

Bram just made this question obsolete :)


pkg/cli/dump.go, line 700 at r6 (raw file):

Previously, BramGruneir (Bram Gruneir) wrote…

Moving this from tree/parse_array to here seems wrong.

It really should interface with the parser. Can that be done easily?

You just had to ask! 💖

@knz knz dismissed BramGruneir’s stale review August 23, 2018 10:12

it now uses the parser!

@knz
Copy link
Copy Markdown
Contributor Author

knz commented Aug 23, 2018

Bram thanks again for being critical and making me think this through. Your review made this PR distinctly better.

bors r+

craig bot pushed a commit that referenced this pull request Aug 23, 2018
28949:  cli,sql: add another crutch to the handling of column types in `dump` r=knz a=knz

All commits but the last part of #28945 and priors.
PR forked from #28690.

There are major problems in `cockroach dump` described separately in
#28948. Part of this is `cockroach dump` trying to reverse-engineer a datum
type from the announced column type in `information_schema.columns`,
by parsing the type name. Prior to this patch, this parsing was
incomplete (it went out of sync with the SQL parser over time,
naturally as it was bound to do).

This entire approach is flawed, but this is no time to redesign
`cockroach dump`. Instead, this patch re-syncs the dump-specific type
parser with the general SQL parser. It also ensures this parser is
still able to parse pre-2.1 type name aliases.

Release note (bug fix): `cockroach dump` is now again better able to
operate across multiple CockroachDB versions.

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 23, 2018

Build succeeded

@craig craig bot merged commit 2363d44 into cockroachdb:master Aug 23, 2018
@knz knz deleted the 20180822-c8-unbreak-dump branch August 23, 2018 10:31
craig bot pushed a commit that referenced this pull request Aug 23, 2018
28950: sql: desugar TEXT to STRING r=knz a=knz

First commits from #28949 and priors.
Forked off from #28690.

The distinction between "TEXT" and "STRING" inside CockroachDB is
inconsequential. Remove it. The data type is already properly reported
in pg_catalog and information_schema as "text".

Release note: None

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
craig bot pushed a commit that referenced this pull request Aug 23, 2018
29006: backport-2.1: fix the handling of SQL types r=knz a=knz

Backport 1/1 commits from #28937.
Backport 1/1 commits from #28942.
Backport 17/17 commits from #28943.
Backport 1/1 commits from #28944.
Backport 1/1 commits from #28945.
Backport 1/1 commits from #28949.
Backport 2/2 commits from #28950.
Backport 1/1 commits from #28951 (#28959).
Backport 1/1 commits from #28952 (#28959).
Backport 1/1 commits from #28955 (#28959).
Backport 1/1 commits from #28959.
Backport 1/1 commits from #28959.
Backport 1/1 commits from #28690.

cc @cockroachdb/release 

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
craig bot pushed a commit that referenced this pull request Aug 24, 2018
29006: backport-2.1: fix the handling of SQL types r=knz a=knz

Backport 1/1 commits from #28937.
Backport 1/1 commits from #28942.
Backport 17/17 commits from #28943.
Backport 1/1 commits from #28944.
Backport 1/1 commits from #28945.
Backport 1/1 commits from #28949.
Backport 2/2 commits from #28950.
Backport 1/1 commits from #28951 (#28959).
Backport 1/1 commits from #28952 (#28959).
Backport 1/1 commits from #28955 (#28959).
Backport 1/1 commits from #28959.
Backport 1/1 commits from #28959.
Backport 1/1 commits from #28690.

cc @cockroachdb/release 

Co-authored-by: Raphael 'kena' Poss <knz@cockroachlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants