fix: correct information schema views metadata - #27716
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Request changes: one blocking correctness gap remains in the VIEW_DEFINITION extractor.
[P1] Handle every line-comment form accepted by the MatrixOne lexer when locating the structural AS.
The new separator patterns in pkg/util/sysview/predefined.go only recognize -- ..., but the MySQL scanner also accepts # ... and // ... as line comments (pkg/sql/parsers/dialect/mysql/scanner.go, scanCommentTypeLine). GetRootSql preserves these comments. For example, this is valid MatrixOne SQL:
create view hash_comment_v # migration comment
as select 1;The persisted statement reaches the new regexp unchanged, the prefix regexp cannot cross # migration comment, informationSchemaViewDefinitionPrefixLengthSQL becomes 0, and information_schema.VIEWS.VIEW_DEFINITION still exposes the full CREATE VIEW ... text instead of select 1. That is the same failure class as the previously fixed -- case, so the linked issue is not closed for all valid parser inputs.
Please make extraction comment-aware for all lexer-supported line comments (or avoid raw-SQL regexp extraction), and add parser/BVT counterexamples for at least # and //. The existing -- fix and the IS_UPDATABLE correction otherwise look consistent.
What type of PR is this?
Which issue(s) this PR fixes:
issue #27655
What this PR does / why we need it:
fix: correct information schema views metadata