-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
ValidationException occurs when accessing the column with table's alias #1502
Copy link
Copy link
Closed
Description
Describe the bug
When accessing the column with table's alias, ValidationException occurs because of the wrong validation order.
To Reproduce
Steps to reproduce the behavior:
- SQL
var errors = parserUtils.validate(
"select b.id, name ,(select name from Blog where name = 'sadf') as name2 \n" +
", category, owner, b.update_time \n" +
"from Blog as b \n" +
"left join Content\n" +
"ON b.id = Content.blog_id \n" +
"where name = 'sadf' order by Content.title desc"
,capa
);
- Parsing this SQL using JSqlParser with this statements
Validation validation = new Validation(Arrays.asList(capability()), stmt);
List<ValidationError> errors = validation.validate();
return errors;
- Produce wrong results after validation().
capability=meta data
errors=[ValidationException: b.id does not exist., UnexpectedValidationException: name: cannot validate column-name. detail: fully qualified name must not be null, UnexpectedValidationException: name: cannot validate column-name. detail: fully qualified name must not be null, ValidationException: b.update_time does not exist.]
]]
Expected behavior
b.id, b.update_time must exist. and It should not throw ValidationException.
System
- Database you are using: mysql 8
- Java Version: jdk 13
- JSqlParser version: v4.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels