I am evaluating 3 different Frameworks for the large company I work for, and because of it's speed, I was especially interested in Phalcon. However, I am having a problem with Postgresql materialized views. It seems that Phalcon is using ‘informationschema’ to query for tables. This does not include materialized views. I found a fix for CakePHP which had the same problem. Here is my notes and modified code from there. (you have to join and query pgclass as well):
/ @originalcode //$sql = "SELECT tablename as name FROM INFORMATIONSCHEMA.tables WHERE tableschema = ?"; //$result = $this->_execute($sql, array($schema));
/* Query rewrite to add support to PostgreSQL materialized views. */ $sql = "SELECT tablename as name FROM INFORMATIONSCHEMA.tables WHERE tableschema = ?"; $sql .= " UNION SELECT tablename as name FROM INFORMATIONSCHEMA.views WHERE tableschema = ?"; $sql .= "UNION SELECT oid::regclass::text FROM pg_class WHERE relkind = 'm' or relkind = 'v";
$result = $this->_execute($sql, array($schema));
Is this something that can be overwritten via a config change? If so, what method, etc is this possible through?
currently, from what I can tell, phalcon uses this query to determine if a 'table' exists: SELECT CASE WHEN COUNT(*) > 0 THEN 1 ELSE 0 END FROM informationschema.tables WHERE tableschema = 'schemaname' AND tablename='table_name' I work for a rather large company and speed is important, which Phalcon seems to have. I would love a solution to this problem. :)