PHQL wrong conversion of CAST AND CONVERT method (maybe more ?)

Hello again people !

Since 1.3.0 this PHQL query that used to work properly, doesn't now :

$di = new \Phalcon\DI\FactoryDefault();

class X extends \Phalcon\DI\Injectable
{
    public function x()
    {
        $manager = $this->getDI()->getModelsManager();
        $manager->executeQuery("SELECT id FROM Article WHERE CAST(date AS date)='2014-02-01'");
    }
}

$x = new X;
$x->setDI($di);
$x->x();

This produces this PDO query :

SELECT "article"."id" FROM "public"."article" WHERE CAST("article"."date" AS ) = '2014-02-01'

I tested with another SQL function as CONVERT and it produces exactly the same issue.

Thanks a lot !

Can you try that query with another column that is not named "date" or "datetime"? I believe those are reserved sql words.



2.1k

Hi,

thanks for the answer, actually the column name is called "date" just for the example, I could have called it "mydate", the issue is not here !