Skip to content

sql/schemachanger: check nil table name for comment on column#83812

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
chengxiong-ruan:check-table-name-for-comment-on-column
Jul 7, 2022
Merged

sql/schemachanger: check nil table name for comment on column#83812
craig[bot] merged 1 commit intocockroachdb:masterfrom
chengxiong-ruan:check-table-name-for-comment-on-column

Conversation

@chengxiong-ruan
Copy link
Copy Markdown
Contributor

addressing this build error
throw pg error instead of panic on nil pointer.

Release note: None.

@chengxiong-ruan chengxiong-ruan requested a review from a team July 5, 2022 14:42
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @chengxiong-ruan)


pkg/sql/schemachanger/scbuild/internal/scbuildstmt/comment_on.go line 108 at r1 (raw file):

func CommentOnColumn(b BuildCtx, n *tree.CommentOnColumn) {
	if n.ColumnItem.TableName == nil {
		panic(pgerror.New(pgcode.InvalidParameterValue, "table name must be provided"))

Postgres throws pgcode.Syntax with the message: ERROR: 42601: column name must be qualified. Can we use that?

@chengxiong-ruan chengxiong-ruan force-pushed the check-table-name-for-comment-on-column branch from 2b0d555 to 7e9be0e Compare July 5, 2022 17:11
@chengxiong-ruan chengxiong-ruan requested a review from a team July 5, 2022 17:11
throw pg error instead of panic on nil pointer.

Release note: None.
@chengxiong-ruan chengxiong-ruan force-pushed the check-table-name-for-comment-on-column branch from 7e9be0e to df380db Compare July 5, 2022 17:15
@chengxiong-ruan
Copy link
Copy Markdown
Contributor Author

pkg/sql/schemachanger/scbuild/internal/scbuildstmt/comment_on.go line 108 at r1 (raw file):

Previously, ajwerner wrote…

Postgres throws pgcode.Syntax with the message: ERROR: 42601: column name must be qualified. Can we use that?

Done. Thanks for catching that.
I didn't throw error from the parser since it'd be more verbose with something like syntax error at blahblah, and there're existing cases where we throw syntax error out side of parser.

Copy link
Copy Markdown
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r3, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @chengxiong-ruan)

@chengxiong-ruan
Copy link
Copy Markdown
Contributor Author

TFTR! bors r+

@chengxiong-ruan
Copy link
Copy Markdown
Contributor Author

bots...
bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 7, 2022

Build failed (retrying...):

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jul 7, 2022

Build succeeded:

@craig craig bot merged commit 1abab4c into cockroachdb:master Jul 7, 2022
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.

3 participants