Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add support for column aliases and comments in CREATE VIEW statements#27672

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
hqbhoho wants to merge1 commit intotrinodb:master
base:master
Choose a base branch
Loading
fromhqbhoho:feat/support_create_view_with_comment

Conversation

@hqbhoho
Copy link
Contributor

@hqbhohohqbhoho commentedDec 17, 2025
edited
Loading

Description

Add support for the following syntax:

| CREATE (OR REPLACE)? VIEW qualifiedName        columnComments?        (COMMENT string)?        (SECURITY (DEFINER | INVOKER))?        (WITH properties)? AS rootQuery                                #createView        columnComments    : '(' columnComment (',' columnComment)* ')'    ;columnComment    : qualifiedName (COMMENT string)?    ;

So we can create view with column alias and comment as follow:

CREATEVIEWtest (id COMMENT'id', name COMMENT'name')ASSELECT123 ,'456';CREATEVIEWtest (id COMMENT'id', name COMMENT'name')ASSELECT123as id ,'456'as id;

AndSHOW CREATE VIEW will expose these column alias and comment. The behavior of the existingCREATE VIEW syntax remains unchanged which will not expose them.

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(X) Release notes are required, with the following suggested text:

##General* Add support for column aliases and comments in`CREATE VIEW` statements. ({issue}`issuenumber`)

@hqbhohohqbhoho marked this pull request as draftDecember 17, 2025 10:24
@hqbhohohqbhohoforce-pushed thefeat/support_create_view_with_comment branch frome6014af tof036403CompareDecember 17, 2025 10:51
@hqbhohohqbhoho marked this pull request as ready for reviewDecember 17, 2025 10:52
@ebyhr
Copy link
Member

The logic around duplicate column names handling looks wrong. The below CRATE VIEW should fail:

CREATEVIEWduplicate_columns (regionkey, regionkey2)ASSELECT regionkey, regionkeyFROM region;TABLE duplicate_columns;line1:1: View'memory.default.duplicate_columns' is staleorin invalid state: column [regionkey] of typebigint projectedfrom query view at position1 has a different namefrom column [regionkey2] of typebigint storedin view definition

@hqbhohohqbhoho marked this pull request as draftDecember 18, 2025 03:11
@hqbhoho
Copy link
ContributorAuthor

hqbhoho commentedDec 18, 2025
edited
Loading

@ebyhr Thanks for your feedback
The same SQL query that fails with aDuplicate column name error in Hive but executes successfully in StarRocks.
Currently, there is indeed an issue: if the aliased column name does not match the name defined in the query, it will cause an execution error when query this view.
What I'd like to confirm is, if we support aliased columns in views, can we then allow duplicate column names in a query?

@hqbhohohqbhohoforce-pushed thefeat/support_create_view_with_comment branch fromf036403 to73010dcCompareDecember 18, 2025 13:18
@github-actionsgithub-actionsbot added icebergIceberg connector hiveHive connector blackholeBlackhole connector fakerFaker connector memoryMemory connector labelsDec 18, 2025
@hqbhohohqbhohoforce-pushed thefeat/support_create_view_with_comment branch from73010dc to4185527CompareDecember 18, 2025 14:06
@hqbhohohqbhoho marked this pull request as ready for reviewDecember 18, 2025 15:42
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@martintmartintAwaiting requested review from martint

@ebyhrebyhrAwaiting requested review from ebyhr

@Praveen2112Praveen2112Awaiting requested review from Praveen2112

@kasiafikasiafiAwaiting requested review from kasiafi

Assignees

No one assigned

Labels

blackholeBlackhole connectorcla-signedfakerFaker connectorhiveHive connectoricebergIceberg connectormemoryMemory connectorsyntax-needs-review

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@hqbhoho@ebyhr@raunaqmorarka

[8]ページ先頭

©2009-2025 Movatter.jp