ORM doesn't recognize Amazon RDS MariaDB as a MySQL-compatible DB #5860

Closed
opened 2026-01-22 15:20:20 +01:00 by admin · 11 comments
Owner

Originally created by @octaharon on GitHub (Jan 25, 2018).

Originally assigned to: @Ocramius on GitHub.

I have a query with something like this:
AND c.date > DATE_SUB( NOW() ,INTERVAL 24 HOUR)
and it works perfectly on local MariaDB 10.1
but when I switch to my RDS instance instead (without changing any other configuration), the query got invalidated by orm lexer:

Doctrine\ORM\Query\QueryException::syntaxError('line 0, col 209: Error: Expected known function, got \'NOW\'', instance of Doctrine\ORM\Query\QueryException)

I've run the query manually so I'm sure it's not a DB error itself, but with the query parser, and the only idea that comes to my mind is that it somehow prohibits those functions because they're MySQL-specific.

Can I specify a driver manually or somehow else work around this?

Originally created by @octaharon on GitHub (Jan 25, 2018). Originally assigned to: @Ocramius on GitHub. I have a query with something like this: ` AND c.date > DATE_SUB( NOW() ,INTERVAL 24 HOUR)` and it works perfectly on local MariaDB 10.1 but when I switch to my RDS instance instead (without changing any other configuration), the query got invalidated by orm lexer: > Doctrine\\ORM\\Query\\QueryException::syntaxError('line 0, col 209: Error: Expected known function, got \\'NOW\\'', instance of Doctrine\\ORM\\Query\\QueryException) I've run the query manually so I'm sure it's not a DB error itself, but with the query parser, and the only idea that comes to my mind is that it somehow prohibits those functions because they're MySQL-specific. Can I specify a driver manually or somehow else work around this?
admin added the BugWon't FixInvalidMissing TestsDQL labels 2026-01-22 15:20:20 +01:00
admin closed this issue 2026-01-22 15:20:20 +01:00
Author
Owner

@Ocramius commented on GitHub (Jan 25, 2018):

The query parser is not platform-sensitive. Can you reproduce the crash in
isolation (in a test)?

On 25 Jan 2018 17:50, "Alexander Uskov" notifications@github.com wrote:

I have a query with something like this:
AND c.date > DATE_SUB( NOW() ,INTERVAL 24 HOUR)
and it works perfectly on local MariaDB 10.1
but when I switch to my RDS instance instead (without changing any other
configuration), the query got invalidated by orm lexer:

Doctrine\ORM\Query\QueryException::syntaxError('line 0, col 209: Error:
Expected known function, got 'NOW'', instance of Doctrine\ORM\Query
QueryException)

I've run the query manually so I'm sure it's not a DB error itself, but
with the query parser, and the only idea that comes to my mind is that it
somehow prohibits those functions because they're MySQL-specific.

Can I specify a driver manually or somehow else work around this?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7010, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakF2Qd0OCJnLHptAiUc4xFhYWJENKks5tOLC7gaJpZM4RtJv6
.

@Ocramius commented on GitHub (Jan 25, 2018): The query parser is not platform-sensitive. Can you reproduce the crash in isolation (in a test)? On 25 Jan 2018 17:50, "Alexander Uskov" <notifications@github.com> wrote: I have a query with something like this: AND c.date > DATE_SUB( NOW() ,INTERVAL 24 HOUR) and it works perfectly on local MariaDB 10.1 but when I switch to my RDS instance instead (without changing any other configuration), the query got invalidated by orm lexer: Doctrine\ORM\Query\QueryException::syntaxError('line 0, col 209: Error: Expected known function, got \'NOW\'', instance of Doctrine\ORM\Query\ QueryException) I've run the query manually so I'm sure it's not a DB error itself, but with the query parser, and the only idea that comes to my mind is that it somehow prohibits those functions because they're MySQL-specific. Can I specify a driver manually or somehow else work around this? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/doctrine/doctrine2/issues/7010>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAJakF2Qd0OCJnLHptAiUc4xFhYWJENKks5tOLC7gaJpZM4RtJv6> .
Author
Owner

@octaharon commented on GitHub (Jan 25, 2018):

How much of isolation do I need to have? The query is a first-level method of a relevant repository, and according to the stack trace it's being called directly from Symfony controller entrypoint without any prior DDL/DML queries. What I do is just replace "parameters.yml", which literally contains only host/port/user/password, and I don't have any test environment for PHP right now

@octaharon commented on GitHub (Jan 25, 2018): How much of isolation do I need to have? The query is a first-level method of a relevant repository, and according to the stack trace it's being called directly from Symfony controller entrypoint without any prior DDL/DML queries. What I do is just replace "parameters.yml", which literally contains only host/port/user/password, and I don't have any test environment for PHP right now
Author
Owner

@Ocramius commented on GitHub (Jan 26, 2018):

Can you get a full trace of the exception above?

@Ocramius commented on GitHub (Jan 26, 2018): Can you get a full trace of the exception above?
Author
Owner

@octaharon commented on GitHub (Jan 26, 2018):

"trace": [
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 452,
"call": "Doctrine\ORM\Query\QueryException::syntaxError('line 0, col 209: Error: Expected known function, got \'NOW\'', instance of Doctrine\ORM\Query\QueryException)"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 3373,
"call": "Doctrine\ORM\Query\Parser::syntaxError('known function', array(3))"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2831,
"call": "Doctrine\ORM\Query\Parser::FunctionDeclaration()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\AST\Functions\DateAddFunction.php",
"line": 101,
"call": "Doctrine\ORM\Query\Parser::ArithmeticPrimary()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 3464,
"call": "Doctrine\ORM\Query\AST\Functions\DateAddFunction::parse(instance of Doctrine\ORM\Query\Parser)"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 3370,
"call": "Doctrine\ORM\Query\Parser::FunctionsReturningDatetime()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2831,
"call": "Doctrine\ORM\Query\Parser::FunctionDeclaration()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2792,
"call": "Doctrine\ORM\Query\Parser::ArithmeticPrimary()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2760,
"call": "Doctrine\ORM\Query\Parser::ArithmeticFactor()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2734,
"call": "Doctrine\ORM\Query\Parser::ArithmeticTerm()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2721,
"call": "Doctrine\ORM\Query\Parser::SimpleArithmeticExpression()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 3054,
"call": "Doctrine\ORM\Query\Parser::ArithmeticExpression()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2585,
"call": "Doctrine\ORM\Query\Parser::ComparisonExpression()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2468,
"call": "Doctrine\ORM\Query\Parser::SimpleConditionalExpression()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2444,
"call": "Doctrine\ORM\Query\Parser::ConditionalPrimary()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2417,
"call": "Doctrine\ORM\Query\Parser::ConditionalFactor()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2387,
"call": "Doctrine\ORM\Query\Parser::ConditionalTerm()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 1354,
"call": "Doctrine\ORM\Query\Parser::ConditionalExpression()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 876,
"call": "Doctrine\ORM\Query\Parser::WhereClause()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 843,
"call": "Doctrine\ORM\Query\Parser::SelectStatement()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 259,
"call": "Doctrine\ORM\Query\Parser::QueryLanguage()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 355,
"call": "Doctrine\ORM\Query\Parser::getAST()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query.php",
"line": 283,
"call": "Doctrine\ORM\Query\Parser::parse()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query.php",
"line": 295,
"call": "Doctrine\ORM\Query::_parse()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php",
"line": 957,
"call": "Doctrine\ORM\Query::_doExecute()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php",
"line": 912,
"call": "Doctrine\ORM\AbstractQuery::executeIgnoreQueryCache(null, 1)"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php",
"line": 716,
"call": "Doctrine\ORM\AbstractQuery::execute(null, 1)"
},
{
"file": "Z:\src\AppBundle\Controller\Traits\CustomerAccessTrait.php",
"line": 172,
"call": "Doctrine\ORM\AbstractQuery::getResult()"
},
{
"file": "Z:\src\AppBundle\Controller\Traits\CustomerAccessTrait.php",
"line": 223,
"call": "AppBundle\Controller\API\APIController::validateCustomerEnabled(instance of AppBundle\Entity\Customer\Customer, array(2), 7)"
},

And the code is

$operation = $this->entityManager->createQuery(
'SELECT c
FROM AppBundle:Customer\CustomerLog c
WHERE c.operation= :operation
AND c.customerId = :customerId
AND c.date > DATE_SUB( NOW() ,INTERVAL 24 HOUR)
AND c.id <> :skip
ORDER BY c.date DESC'
)
->setParameter('operation', CustomerLog::OPERATION_LOGIN_ATTEMPT)
->setParameter('customerId', $customer->getCustomerId())
->setParameter('skip', $skipOperationId || 0)
->setMaxResults(1)
->getResult();

And my versions are

"doctrine/common": "^2.8",
"doctrine/dbal": "2.6",
"doctrine/doctrine-bundle": "1.8.1",
"doctrine/doctrine-cache-bundle": "^1.2",
"doctrine/doctrine-migrations-bundle": "^1.3",
"doctrine/orm": "2.6",

Settings:

dbal:
driver: pdo_mysql
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
logging: '%kernel.debug%'
profiling: false
server_version: 5.7
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
dql:
numeric_functions:
area: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Area
//here goes all the list of Spatial functions from that module

Also I've tested it against RDS MySQL 5.7.19 instance - works fine. So it's clearly particular MariaDB issue

@octaharon commented on GitHub (Jan 26, 2018): > "trace": [ { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 452, "call": "Doctrine\\ORM\\Query\\QueryException::syntaxError('line 0, col 209: Error: Expected known function, got \\'NOW\\'', instance of Doctrine\\ORM\\Query\\QueryException)" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 3373, "call": "Doctrine\\ORM\\Query\\Parser::syntaxError('known function', array(3))" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 2831, "call": "Doctrine\\ORM\\Query\\Parser::FunctionDeclaration()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\AST\\Functions\\DateAddFunction.php", "line": 101, "call": "Doctrine\\ORM\\Query\\Parser::ArithmeticPrimary()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 3464, "call": "Doctrine\\ORM\\Query\\AST\\Functions\\DateAddFunction::parse(instance of Doctrine\\ORM\\Query\\Parser)" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 3370, "call": "Doctrine\\ORM\\Query\\Parser::FunctionsReturningDatetime()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 2831, "call": "Doctrine\\ORM\\Query\\Parser::FunctionDeclaration()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 2792, "call": "Doctrine\\ORM\\Query\\Parser::ArithmeticPrimary()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 2760, "call": "Doctrine\\ORM\\Query\\Parser::ArithmeticFactor()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 2734, "call": "Doctrine\\ORM\\Query\\Parser::ArithmeticTerm()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 2721, "call": "Doctrine\\ORM\\Query\\Parser::SimpleArithmeticExpression()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 3054, "call": "Doctrine\\ORM\\Query\\Parser::ArithmeticExpression()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 2585, "call": "Doctrine\\ORM\\Query\\Parser::ComparisonExpression()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 2468, "call": "Doctrine\\ORM\\Query\\Parser::SimpleConditionalExpression()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 2444, "call": "Doctrine\\ORM\\Query\\Parser::ConditionalPrimary()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 2417, "call": "Doctrine\\ORM\\Query\\Parser::ConditionalFactor()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 2387, "call": "Doctrine\\ORM\\Query\\Parser::ConditionalTerm()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 1354, "call": "Doctrine\\ORM\\Query\\Parser::ConditionalExpression()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 876, "call": "Doctrine\\ORM\\Query\\Parser::WhereClause()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 843, "call": "Doctrine\\ORM\\Query\\Parser::SelectStatement()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 259, "call": "Doctrine\\ORM\\Query\\Parser::QueryLanguage()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query\\Parser.php", "line": 355, "call": "Doctrine\\ORM\\Query\\Parser::getAST()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query.php", "line": 283, "call": "Doctrine\\ORM\\Query\\Parser::parse()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\Query.php", "line": 295, "call": "Doctrine\\ORM\\Query::_parse()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\AbstractQuery.php", "line": 957, "call": "Doctrine\\ORM\\Query::_doExecute()" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\AbstractQuery.php", "line": 912, "call": "Doctrine\\ORM\\AbstractQuery::executeIgnoreQueryCache(null, 1)" }, { "file": "Z:\\vendor\\doctrine\\orm\\lib\\Doctrine\\ORM\\AbstractQuery.php", "line": 716, "call": "Doctrine\\ORM\\AbstractQuery::execute(null, 1)" }, { "file": "Z:\\src\\AppBundle\\Controller\\Traits\\CustomerAccessTrait.php", "line": 172, "call": "Doctrine\\ORM\\AbstractQuery::getResult()" }, { "file": "Z:\\src\\AppBundle\\Controller\\Traits\\CustomerAccessTrait.php", "line": 223, "call": "AppBundle\\Controller\\API\\APIController::validateCustomerEnabled(instance of AppBundle\\Entity\\Customer\\Customer, array(2), 7)" }, And the code is > $operation = $this->entityManager->createQuery( 'SELECT c FROM AppBundle:Customer\CustomerLog c WHERE c.operation= :operation AND c.customerId = :customerId AND c.date > DATE_SUB( NOW() ,INTERVAL 24 HOUR) AND c.id <> :skip ORDER BY c.date DESC' ) ->setParameter('operation', CustomerLog::OPERATION_LOGIN_ATTEMPT) ->setParameter('customerId', $customer->getCustomerId()) ->setParameter('skip', $skipOperationId || 0) ->setMaxResults(1) ->getResult(); And my versions are > "doctrine/common": "^2.8", "doctrine/dbal": "2.6", "doctrine/doctrine-bundle": "1.8.1", "doctrine/doctrine-cache-bundle": "^1.2", "doctrine/doctrine-migrations-bundle": "^1.3", "doctrine/orm": "2.6", Settings: >dbal: driver: pdo_mysql host: '%database_host%' port: '%database_port%' dbname: '%database_name%' user: '%database_user%' password: '%database_password%' logging: '%kernel.debug%' profiling: false server_version: 5.7 orm: auto_generate_proxy_classes: '%kernel.debug%' naming_strategy: doctrine.orm.naming_strategy.underscore auto_mapping: true dql: numeric_functions: area: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Area //here goes all the list of Spatial functions from that module Also I've tested it against RDS MySQL 5.7.19 instance - works fine. So it's clearly particular MariaDB issue
Author
Owner

@Ocramius commented on GitHub (Jan 26, 2018):

Looks more like a query parsing issue to me. Do you have the full DQL
string?

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On Fri, Jan 26, 2018 at 12:49 PM, Alexander Uskov notifications@github.com
wrote:

"trace": [
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 452,
"call": "Doctrine\ORM\Query\QueryException::syntaxError('line 0, col 209:
Error: Expected known function, got 'NOW'', instance of
Doctrine\ORM\Query\QueryException)"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 3373,
"call": "Doctrine\ORM\Query\Parser::syntaxError('known function',
array(3))"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2831,
"call": "Doctrine\ORM\Query\Parser::FunctionDeclaration()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\AST
Functions\DateAddFunction.php",
"line": 101,
"call": "Doctrine\ORM\Query\Parser::ArithmeticPrimary()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 3464,
"call": "Doctrine\ORM\Query\AST\Functions\DateAddFunction::parse(instance
of Doctrine\ORM\Query\Parser)"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 3370,
"call": "Doctrine\ORM\Query\Parser::FunctionsReturningDatetime()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2831,
"call": "Doctrine\ORM\Query\Parser::FunctionDeclaration()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2792,
"call": "Doctrine\ORM\Query\Parser::ArithmeticPrimary()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2760,
"call": "Doctrine\ORM\Query\Parser::ArithmeticFactor()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2734,
"call": "Doctrine\ORM\Query\Parser::ArithmeticTerm()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2721,
"call": "Doctrine\ORM\Query\Parser::SimpleArithmeticExpression()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 3054,
"call": "Doctrine\ORM\Query\Parser::ArithmeticExpression()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2585,
"call": "Doctrine\ORM\Query\Parser::ComparisonExpression()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2468,
"call": "Doctrine\ORM\Query\Parser::SimpleConditionalExpression()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2444,
"call": "Doctrine\ORM\Query\Parser::ConditionalPrimary()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2417,
"call": "Doctrine\ORM\Query\Parser::ConditionalFactor()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 2387,
"call": "Doctrine\ORM\Query\Parser::ConditionalTerm()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 1354,
"call": "Doctrine\ORM\Query\Parser::ConditionalExpression()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 876,
"call": "Doctrine\ORM\Query\Parser::WhereClause()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 843,
"call": "Doctrine\ORM\Query\Parser::SelectStatement()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 259,
"call": "Doctrine\ORM\Query\Parser::QueryLanguage()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php",
"line": 355,
"call": "Doctrine\ORM\Query\Parser::getAST()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query.php",
"line": 283,
"call": "Doctrine\ORM\Query\Parser::parse()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query.php",
"line": 295,
"call": "Doctrine\ORM\Query::_parse()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php",
"line": 957,
"call": "Doctrine\ORM\Query::_doExecute()"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php",
"line": 912,
"call": "Doctrine\ORM\AbstractQuery::executeIgnoreQueryCache(null, 1)"
},
{
"file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php",
"line": 716,
"call": "Doctrine\ORM\AbstractQuery::execute(null, 1)"
},
{
"file": "Z:\src\AppBundle\Controller\Traits\CustomerAccessTrait.php",
"line": 172,
"call": "Doctrine\ORM\AbstractQuery::getResult()"
},
{
"file": "Z:\src\AppBundle\Controller\Traits\CustomerAccessTrait.php",
"line": 223,
"call": "AppBundle\Controller\API\APIController::validateCustomerEnabled(instance
of AppBundle\Entity\Customer\Customer, array(2), 7)"
},

And the code is

$operation = $this->entityManager->createQuery(
'SELECT c
FROM AppBundle:Customer\CustomerLog c
WHERE c.operation= :operation
AND c.customerId = :customerId
AND c.date > DATE_SUB( NOW() ,INTERVAL 24 HOUR)
AND c.id <> :skip
ORDER BY c.date DESC'
)
->setParameter('operation', CustomerLog::OPERATION_LOGIN_ATTEMPT)
->setParameter('customerId', $customer->getCustomerId())
->setParameter('skip', $skipOperationId || 0)
->setMaxResults(1)
->getResult();

And my versions are

"doctrine/common": "^2.8",
"doctrine/dbal": "2.6",
"doctrine/doctrine-bundle": "1.8.1",
"doctrine/doctrine-cache-bundle": "^1.2",
"doctrine/doctrine-migrations-bundle": "^1.3",
"doctrine/orm": "2.6",

Settings:

dbal:
driver: pdo_mysql
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
logging: '%kernel.debug%'
profiling: false
server_version: 5.7
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
dql:
numeric_functions:
area: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Area
//here goes all the list of Spatial functions from that module

Also I've tested it against RDS MySQL 5.7.19 instance - works fine. So
it's clearly particular MariaDB issue


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7010#issuecomment-360765462,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakFAqHXo4SIzL493vnLBCShDOZNomks5tObvagaJpZM4RtJv6
.

@Ocramius commented on GitHub (Jan 26, 2018): Looks more like a query parsing issue to me. Do you have the full DQL string? Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On Fri, Jan 26, 2018 at 12:49 PM, Alexander Uskov <notifications@github.com> wrote: > "trace": [ > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 452, > "call": "Doctrine\ORM\Query\QueryException::syntaxError('line 0, col 209: > Error: Expected known function, got \'NOW\'', instance of > Doctrine\ORM\Query\QueryException)" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 3373, > "call": "Doctrine\ORM\Query\Parser::syntaxError('known function', > array(3))" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 2831, > "call": "Doctrine\ORM\Query\Parser::FunctionDeclaration()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\AST\ > Functions\DateAddFunction.php", > "line": 101, > "call": "Doctrine\ORM\Query\Parser::ArithmeticPrimary()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 3464, > "call": "Doctrine\ORM\Query\AST\Functions\DateAddFunction::parse(instance > of Doctrine\ORM\Query\Parser)" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 3370, > "call": "Doctrine\ORM\Query\Parser::FunctionsReturningDatetime()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 2831, > "call": "Doctrine\ORM\Query\Parser::FunctionDeclaration()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 2792, > "call": "Doctrine\ORM\Query\Parser::ArithmeticPrimary()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 2760, > "call": "Doctrine\ORM\Query\Parser::ArithmeticFactor()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 2734, > "call": "Doctrine\ORM\Query\Parser::ArithmeticTerm()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 2721, > "call": "Doctrine\ORM\Query\Parser::SimpleArithmeticExpression()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 3054, > "call": "Doctrine\ORM\Query\Parser::ArithmeticExpression()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 2585, > "call": "Doctrine\ORM\Query\Parser::ComparisonExpression()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 2468, > "call": "Doctrine\ORM\Query\Parser::SimpleConditionalExpression()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 2444, > "call": "Doctrine\ORM\Query\Parser::ConditionalPrimary()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 2417, > "call": "Doctrine\ORM\Query\Parser::ConditionalFactor()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 2387, > "call": "Doctrine\ORM\Query\Parser::ConditionalTerm()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 1354, > "call": "Doctrine\ORM\Query\Parser::ConditionalExpression()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 876, > "call": "Doctrine\ORM\Query\Parser::WhereClause()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 843, > "call": "Doctrine\ORM\Query\Parser::SelectStatement()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 259, > "call": "Doctrine\ORM\Query\Parser::QueryLanguage()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query\Parser.php", > "line": 355, > "call": "Doctrine\ORM\Query\Parser::getAST()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query.php", > "line": 283, > "call": "Doctrine\ORM\Query\Parser::parse()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\Query.php", > "line": 295, > "call": "Doctrine\ORM\Query::_parse()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php", > "line": 957, > "call": "Doctrine\ORM\Query::_doExecute()" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php", > "line": 912, > "call": "Doctrine\ORM\AbstractQuery::executeIgnoreQueryCache(null, 1)" > }, > { > "file": "Z:\vendor\doctrine\orm\lib\Doctrine\ORM\AbstractQuery.php", > "line": 716, > "call": "Doctrine\ORM\AbstractQuery::execute(null, 1)" > }, > { > "file": "Z:\src\AppBundle\Controller\Traits\CustomerAccessTrait.php", > "line": 172, > "call": "Doctrine\ORM\AbstractQuery::getResult()" > }, > { > "file": "Z:\src\AppBundle\Controller\Traits\CustomerAccessTrait.php", > "line": 223, > "call": "AppBundle\Controller\API\APIController::validateCustomerEnabled(instance > of AppBundle\Entity\Customer\Customer, array(2), 7)" > }, > > And the code is > > $operation = $this->entityManager->createQuery( > 'SELECT c > FROM AppBundle:Customer\CustomerLog c > WHERE c.operation= :operation > AND c.customerId = :customerId > AND c.date > DATE_SUB( NOW() ,INTERVAL 24 HOUR) > AND c.id <> :skip > ORDER BY c.date DESC' > ) > ->setParameter('operation', CustomerLog::OPERATION_LOGIN_ATTEMPT) > ->setParameter('customerId', $customer->getCustomerId()) > ->setParameter('skip', $skipOperationId || 0) > ->setMaxResults(1) > ->getResult(); > > And my versions are > > "doctrine/common": "^2.8", > "doctrine/dbal": "2.6", > "doctrine/doctrine-bundle": "1.8.1", > "doctrine/doctrine-cache-bundle": "^1.2", > "doctrine/doctrine-migrations-bundle": "^1.3", > "doctrine/orm": "2.6", > > Settings: > > dbal: > driver: pdo_mysql > host: '%database_host%' > port: '%database_port%' > dbname: '%database_name%' > user: '%database_user%' > password: '%database_password%' > logging: '%kernel.debug%' > profiling: false > server_version: 5.7 > orm: > auto_generate_proxy_classes: '%kernel.debug%' > naming_strategy: doctrine.orm.naming_strategy.underscore > auto_mapping: true > dql: > numeric_functions: > area: CrEOF\Spatial\ORM\Query\AST\Functions\MySql\Area > //here goes all the list of Spatial functions from that module > > Also I've tested it against RDS MySQL 5.7.19 instance - works fine. So > it's clearly particular MariaDB issue > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/doctrine2/issues/7010#issuecomment-360765462>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAJakFAqHXo4SIzL493vnLBCShDOZNomks5tObvagaJpZM4RtJv6> > . >
Author
Owner

@octaharon commented on GitHub (Jan 26, 2018):

I've pasted my code in the previous reply, not sure what you mean by "full DQL string"

@octaharon commented on GitHub (Jan 26, 2018): I've pasted my code in the previous reply, not sure what you mean by "full DQL string"
Author
Owner

@Majkl578 commented on GitHub (Jan 27, 2018):

Error: Expected known function, got 'NOW'

NOW() is not a valid DQL function so it's correct that the parser does not recognize it. DQL only provides CURRENT_DATE/CURRENT_TIME/CURRENT_TIMESTAMP, see https://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#id3.

@Majkl578 commented on GitHub (Jan 27, 2018): > Error: Expected known function, got 'NOW' `NOW()` is not a valid DQL function so it's correct that the parser does not recognize it. DQL only provides `CURRENT_DATE`/`CURRENT_TIME`/`CURRENT_TIMESTAMP`, see https://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#id3.
Author
Owner

@octaharon commented on GitHub (Jan 27, 2018):

Seems reasonable, but then how it works on MySQL instance?

@octaharon commented on GitHub (Jan 27, 2018): Seems reasonable, but then how it works on MySQL instance?
Author
Owner

@Ocramius commented on GitHub (Jan 28, 2018):

What could be is that one of the dependencies you use is detecting the
platform and manual registering custom DQL queries. Try dumping
EntityManager#getConfiguration() on both systems.

On 27 Jan 2018 18:59, "Alexander Uskov" notifications@github.com wrote:

Seems reasonable, but then how it works on MySQL instance?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/7010#issuecomment-361002286,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakMdnVwd5sPSpn4CJtIace6_dic1Xks5tO2PpgaJpZM4RtJv6
.

@Ocramius commented on GitHub (Jan 28, 2018): What could be is that one of the dependencies you use is detecting the platform and manual registering custom DQL queries. Try dumping `EntityManager#getConfiguration()` on both systems. On 27 Jan 2018 18:59, "Alexander Uskov" <notifications@github.com> wrote: > Seems reasonable, but then how it works on MySQL instance? > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/doctrine2/issues/7010#issuecomment-361002286>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAJakMdnVwd5sPSpn4CJtIace6_dic1Xks5tO2PpgaJpZM4RtJv6> > . >
Author
Owner

@kojidev commented on GitHub (Mar 11, 2019):

@Ocramius What about issues like that, it sits here for a year now, author apparently forgot about it.
You wrote that it is likely a third party library. Does the issue like that stays here until someone try to reproduce it (which is unlikely to be the same what OP experienced)?

P.S. Is invalid label for issues that are unlikely a doctrine's problem?

@kojidev commented on GitHub (Mar 11, 2019): @Ocramius What about issues like that, it sits here for a year now, author apparently forgot about it. You wrote that it is likely a third party library. Does the issue like that stays here until someone try to reproduce it (which is unlikely to be the same what OP experienced)? P.S. Is `invalid` label for issues that are unlikely a doctrine's problem?
Author
Owner

@Ocramius commented on GitHub (Mar 11, 2019):

@kojiDev if the problem is real and persistent, they stay open. In this case, I'd close it as per @Majkl578's review above.

@Ocramius commented on GitHub (Mar 11, 2019): @kojiDev if the problem is real and persistent, they stay open. In this case, I'd close it as per @Majkl578's review above.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5860