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
Add support for COMMENT ON COLUMN statement #2516
Conversation
Syntax looks good. It's consistent with COMMENT ON TABLE and the eventual direction we're going with this. See (#200 (comment) for previous discussions) |
@Test | ||
public void testCommentColumn() | ||
{ | ||
assertStatement("COMMENT ON COLUMN a.b IS 'test'", new Comment(Comment.Type.COLUMN, QualifiedName.of("a", "b"), Optional.of("test"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests for other forms of column names: E.g., catalog.schema.table.column
, schema.table.column
, column
, etc.
@@ -58,6 +61,23 @@ public String getName() | |||
|
|||
metadata.setTableComment(session, tableHandle.get(), statement.getComment()); | |||
} | |||
else if (statement.getType() == Comment.Type.COLUMN) { | |||
QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getName().getPrefix().get()); | |||
Optional<TableHandle> tableHandle = metadata.getTableHandle(session, tableName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to check if the name has a single part. E.g., if the user enters COMMENT ON foo IS ...
9e06768
to
2a96c46
Compare
Updated. |
Fixes #2242