Skip to content
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

UnableToCalculatePositionException if a function is used inside JOIN condition #358

Merged
merged 1 commit into from
Aug 11, 2022

Conversation

czoIg
Copy link
Contributor

@czoIg czoIg commented Jul 11, 2022

With the following code:

$query = 'SELECT start_date FROM users INNER JOIN vacation ON DATE(start_date) <= DATE(end_date)';
$parser = new \PHPSQLParser\PHPSQLParser($query, true);

an exception is thrown:

# Error        PHPSQLParser\exceptions\UnableToCalculatePositionException
# File      External/greenlion/php-sql-parser/src/PHPSQLParser/positions/PositionCalculator.php
# Line 243
# Trace
# File       Function        Line
# External/greenlion/php-sql-parser/src/PHPSQLParser/positions/PositionCalculator.php   lookForBaseExpression   259
# External/greenlion/php-sql-parser/src/PHPSQLParser/positions/PositionCalculator.php   lookForBaseExpression   259
# External/greenlion/php-sql-parser/src/PHPSQLParser/positions/PositionCalculator.php   lookForBaseExpression   125
# External/greenlion/php-sql-parser/src/PHPSQLParser/PHPSQLParser.php   setPositionsWithinSQL   100
# External/greenlion/php-sql-parser/src/PHPSQLParser/PHPSQLParser.php   parse   75

# [2020-04-01 07:02:15] - Exception     cannot calculate position of vacation ON DATE(start_date) <= DATE(end_date) within )

@greenlion
Copy link
Owner

Thanks!

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.

None yet

2 participants